@vgroup/dialbox 0.8.6 → 0.8.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,23 +62,23 @@ const keypad = [
62
62
  ];
63
63
 
64
64
  const environment = {
65
- abb: "t",
65
+ abb: "u",
66
66
  production: false,
67
67
  secureCookies: true,
68
- feUrl: 'https://test.vgroupinc.com:91/',
69
- apiUrl: 'https://apis.vgroupinc.com/test_softphone',
70
- websocketUrl: 'wss://apis.vgroupinc.com/test_softphone/',
68
+ feUrl: 'https://c2c-uat.contexttocall.com:85/',
69
+ apiUrl: 'https://c2c-uatapi-t10.contexttocall.com/uat_softphone',
70
+ websocketUrl: 'wss://c2c-uatapi-t10.contexttocall.com/uat_softphone/',
71
71
  captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
72
- stripePublishableKey: "pk_test_51NbMVaA3guus6fhlTuCV5ycFTIJmwgN38dDUf9pNPfM319x5CkLbV6EbTQaZiNOrRsfR16RWLE8hQmR0eZFTBqTy00Wlsug4qS",
72
+ stripePublishableKey: "pk_live_51NbMVaA3guus6fhl85gdcvAWHzfHba5LdGlsnV7DxBT9spHghn4IHT9rDCjSRgFh2ijTiZn9qeazdciY1PbreOuB00t1GdQAZJ",
73
73
  sessionTimeout: 15,
74
74
  deviceType: "web",
75
- appVersion: "2.3",
76
- channelId: '61481b12e138eb7dc3007579',
75
+ appVersion: "2.9",
76
+ channelId: '6511738039ee10367cbde2e9',
77
77
  c2c_support_point_id: '60424735f74ac306c1bfa900',
78
- c2c_support_channel_id: '677f6726be93ab507fbbfdf0',
79
- c2c_point_url: 'https://app.contexttocall.com/assets/cdn/c2c.js',
80
- c2c_call_label_id: '6NU5fKE2mGTyXDC3yhmK',
81
- c2c_email_label_id: 'YPMamj8RvsGORVvqXWyc',
78
+ c2c_support_channel_id: '677f68fcbe93ab507fbbfe0b',
79
+ c2c_point_url: 'https://bit.ly/3blWnPv',
80
+ c2c_call_label_id: '5M4taT8xzAg9pPIUADOW',
81
+ c2c_email_label_id: 'MUUC4NV5bLqHixXyhmok',
82
82
  radarAPIKey: 'prj_live_sk_569b6f639edde6120a26f703511c61aaecd3f7ef',
83
83
  firebase: {
84
84
  apiKey: "AIzaSyCA8LSPrqlDq_thk26LhBQexAQeY6pkU5Y",
@@ -2293,6 +2293,7 @@ class CallProgressComponent {
2293
2293
  this.isParticipantPanelLoading = false;
2294
2294
  this.pendingNewCallHeldParticipant = null;
2295
2295
  this.isCallCancelled = false;
2296
+ this.isNewCallLoader = false;
2296
2297
  this.isMinimised = false;
2297
2298
  this.showDisconnectModal = false;
2298
2299
  this.call = this.twilioService.call;
@@ -2338,6 +2339,7 @@ class CallProgressComponent {
2338
2339
  name: changes['callData'].currentValue?.name || changes['callData'].currentValue?.fromName || changes['callData'].currentValue?.toName || '',
2339
2340
  time: this.timer,
2340
2341
  };
2342
+ this.isNewCallLoader = true;
2341
2343
  this.onAddNewCall(changes['callData'].currentValue);
2342
2344
  }
2343
2345
  }
@@ -2704,6 +2706,7 @@ class CallProgressComponent {
2704
2706
  this.isRinging = false;
2705
2707
  this.isConcurrentIncoming = false;
2706
2708
  if (this.call) {
2709
+ console.log('call disconnect 566');
2707
2710
  this.call.disconnect();
2708
2711
  }
2709
2712
  this.currentCallList = [];
@@ -2734,6 +2737,7 @@ class CallProgressComponent {
2734
2737
  this.deviceNumberList = this.callerIdList.map((res) => res.number);
2735
2738
  let data = this.newIncomingCallsList.find((item) => item?.conferenceId == this.callAction?.conferenceId)?.participants.find((resData) => resData?.host);
2736
2739
  if (data?.isLeft || !data) {
2740
+ this.isNewCallLoader = true;
2737
2741
  this.rejoinHost(this.callAction);
2738
2742
  }
2739
2743
  }
@@ -2803,9 +2807,11 @@ class CallProgressComponent {
2803
2807
  clientSid: this.call?.parameters?.['CallSid'],
2804
2808
  recordId: rejoinParticipentInfo?.id
2805
2809
  });
2810
+ this.isNewCallLoader = false;
2806
2811
  this.conferenceCallIDForParticipantList = rejoinParticipentInfo?.conferenceId;
2807
2812
  }
2808
2813
  catch (error) {
2814
+ this.isNewCallLoader = false;
2809
2815
  console.error('Error in addClientParticipant:', error);
2810
2816
  }
2811
2817
  };
@@ -3002,15 +3008,16 @@ class CallProgressComponent {
3002
3008
  }
3003
3009
  this.conferenceId = response?.callauth?.id;
3004
3010
  this.isCallCancelled = false;
3005
- if (response.status == 200) {
3011
+ if (response?.status == 200) {
3006
3012
  this.pendingNewCallHeldParticipant = null;
3007
3013
  const { id: callAuthId, recordCall, tokenData } = await this.getCallAuthId(response);
3008
3014
  this.recordCall = recordCall; // Store the recordCall value
3009
3015
  await this.connectToDevice(callAuthId, callData, tokenData);
3010
3016
  await this.pollCallStatus(callAuthId);
3017
+ console.log('Call initiated successfully:', response);
3011
3018
  setTimeout(async () => {
3012
3019
  try {
3013
- let addClientParticipantRes = this.addClientParticipant({
3020
+ let addClientParticipantRes = await this.addClientParticipant({
3014
3021
  from: callData?.from,
3015
3022
  route: "OUTGOING",
3016
3023
  participantNumber: callData?.phone,
@@ -3021,9 +3028,9 @@ class CallProgressComponent {
3021
3028
  deviceId: this.deviceId,
3022
3029
  clientSid: this.call?.parameters['CallSid']
3023
3030
  });
3024
- // if(addClientParticipantRes?.status != 200) {
3025
- // swal("Error", addClientParticipantRes?.message.join("<br/>"), "error");
3026
- // }
3031
+ if (addClientParticipantRes?.status != 200) {
3032
+ swal("Error", addClientParticipantRes?.message, "error");
3033
+ }
3027
3034
  this.addRes = await this.addParticipantToCall({
3028
3035
  from: callData?.from,
3029
3036
  route: "OUTGOING",
@@ -3034,6 +3041,7 @@ class CallProgressComponent {
3034
3041
  countrycode: '',
3035
3042
  deviceId: this.deviceId,
3036
3043
  });
3044
+ this.isNewCallLoader = false;
3037
3045
  if (isNewConference) {
3038
3046
  this.conferenceCallIDForParticipantList = response?.callauth?.id;
3039
3047
  }
@@ -3042,6 +3050,7 @@ class CallProgressComponent {
3042
3050
  this.extensionService.isLoadershow.next(false);
3043
3051
  this.isLoadershown.emit(false);
3044
3052
  }
3053
+ this.showRingAnimation = false;
3045
3054
  // this.conferenceCallIDForParticipantList = response?.callauth?.id;
3046
3055
  // await this.getAllParticipants(response?.callauth?.id);
3047
3056
  }
@@ -3061,14 +3070,34 @@ class CallProgressComponent {
3061
3070
  this.unholdPendingConference();
3062
3071
  }
3063
3072
  else {
3073
+ console.log(896);
3074
+ this.endCallEvent.emit();
3064
3075
  this.endCall(); // regular call failure – disconnect everything
3065
3076
  }
3066
3077
  }
3067
3078
  }
3068
3079
  catch (error) {
3069
3080
  this.showRingAnimation = false;
3070
- this.handleError(error);
3071
- this.endCall();
3081
+ // Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
3082
+ // loader must always come down — previously this was left to endCall()/the socket
3083
+ // feed, and if either of those didn't run (or threw), the loader stayed on screen
3084
+ // forever with no way back to the dialpad.
3085
+ this.extensionService.isLoadershow.next(false);
3086
+ this.isLoadershown.emit(false);
3087
+ if (isNewConference) {
3088
+ this.unholdPendingConference();
3089
+ }
3090
+ else {
3091
+ console.log(896);
3092
+ this.endCallEvent.emit();
3093
+ try {
3094
+ this.endCall(); // regular call failure – disconnect everything
3095
+ }
3096
+ catch (cleanupError) {
3097
+ console.error('Error during call failure cleanup:', cleanupError);
3098
+ }
3099
+ }
3100
+ this.handleError('Call not initiating due to a technical issue. Please try again.');
3072
3101
  return false;
3073
3102
  }
3074
3103
  }
@@ -3165,7 +3194,17 @@ class CallProgressComponent {
3165
3194
  async onEndCall(c, isAllCallEnd, isContect, isSetTimer) {
3166
3195
  let participantId = isAllCallEnd ? 'all' : c.participantId || c?.id;
3167
3196
  const currentConferenceCallInfo = this.getCurrentCallInfo();
3168
- const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId).participants.filter((resData) => !resData?.isLeft);
3197
+ // A call that failed/aborted before the backend ever created a conference for it
3198
+ // (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
3199
+ // here — there is nothing to remove server-side, so just fall through to the
3200
+ // local cleanup below instead of throwing on `undefined.participants`.
3201
+ if (!c?.conferenceId && !isAllCallEnd) {
3202
+ this.conferenceCallIDForParticipantList = currentConferenceCallInfo?.conferenceId;
3203
+ this.incomeingCallSocketService.pause();
3204
+ this.cdr.detectChanges();
3205
+ return false;
3206
+ }
3207
+ const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId)?.participants.filter((resData) => !resData?.isLeft) || [];
3169
3208
  if (participantList?.length <= 2 && !isContect) {
3170
3209
  participantId = 'all';
3171
3210
  }
@@ -3639,7 +3678,7 @@ class CallProgressComponent {
3639
3678
  else if (this.missCallInfo?.data?.data?.recordId == data?.id && !callToAccept.parameters?.CallSid) {
3640
3679
  clearInterval(intervalId);
3641
3680
  const sid = callToAccept.parameters?.CallSid;
3642
- this.isConnectingIncomingCallId = '';
3681
+ this.twilioService.isConnectingIncomingCallId.next('');
3643
3682
  this.isConnectingIncomingCallId = '';
3644
3683
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3645
3684
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== sid);
@@ -3780,7 +3819,7 @@ class CallProgressComponent {
3780
3819
  catch (error) {
3781
3820
  console.error('Error adding participant:', error);
3782
3821
  this.showRingAnimation = false;
3783
- this.handleError(error);
3822
+ this.handleError('Failed to add participant. Please try again.');
3784
3823
  }
3785
3824
  }
3786
3825
  async CallToUnsavedNumber(number, isNewConference, options, participantInfo) {
@@ -4122,9 +4161,7 @@ class CallProgressComponent {
4122
4161
  console.log(ev);
4123
4162
  try {
4124
4163
  let selfCall = this.newIncomingCallsList.find((res) => res?.conferenceId == this.currentCall?.conferenceId)?.participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.client) || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call' && resData?.host)) && !resData?.isLeft);
4125
- console.log(selfCall);
4126
4164
  let device = this.twilioService.getIncomingCallById(selfCall?.callSid || selfCall?.clientSid);
4127
- console.log(device);
4128
4165
  if (device && device?._status == 'open') {
4129
4166
  device.sendDigits(String(ev.key));
4130
4167
  }
@@ -4586,13 +4623,14 @@ class CallProgressComponent {
4586
4623
  }
4587
4624
  ngOnDestroy() {
4588
4625
  this.callData.dial = false;
4589
- setTimeout(() => {
4590
- if (!this.newIncomingCallsList?.length) {
4591
- this.twilioService.device?.disconnectAll();
4592
- this.call.disconnect();
4593
- this.device?.destroy();
4594
- }
4595
- }, 1500);
4626
+ // setTimeout(() => {
4627
+ if (!this.newIncomingCallsList?.length && !this.isNewCallLoader) {
4628
+ console.log('Destroying device and disconnecting all calls 2572');
4629
+ this.twilioService.device?.disconnectAll();
4630
+ this.call.disconnect();
4631
+ this.device?.destroy();
4632
+ }
4633
+ // }, 1500);
4596
4634
  if (this.timerSubscription) {
4597
4635
  this.timerSubscription.unsubscribe();
4598
4636
  }
@@ -4998,6 +5036,7 @@ class DialboxComponent {
4998
5036
  this.incomingCallsList = [];
4999
5037
  this.isCallInProgress = false;
5000
5038
  setTimeout(() => {
5039
+ console.log('344');
5001
5040
  if (!this.twilioService.acceptedCallList?.length) {
5002
5041
  this.twilioService.device?.disconnectAll();
5003
5042
  this.twilioService.spareDevice?.disconnectAll();
@@ -5007,14 +5046,14 @@ class DialboxComponent {
5007
5046
  }
5008
5047
  }
5009
5048
  if (!this.incomingCallsList?.length) {
5010
- setTimeout(() => {
5011
- if (!this.incomingCallsList?.length) {
5012
- this.isCallInProgress = false;
5013
- this.twilioService.device?.disconnectAll();
5014
- this.twilioService.spareDevice?.disconnectAll();
5015
- this.twilioService.acceptedCallList = [];
5016
- }
5017
- }, 2000);
5049
+ // setTimeout(() => {
5050
+ // if(!this.incomingCallsList?.length) {
5051
+ // this.isCallInProgress = false;
5052
+ // this.twilioService.device?.disconnectAll();
5053
+ // this.twilioService.spareDevice?.disconnectAll();
5054
+ // this.twilioService.acceptedCallList = [];
5055
+ // }
5056
+ // }, 5000);
5018
5057
  }
5019
5058
  });
5020
5059
  this.token = localStorage.getItem('ext_token') || '';
@@ -5267,7 +5306,7 @@ class DialboxComponent {
5267
5306
  if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
5268
5307
  this.twilioService.incomingCallToken = this.updatedTwilioToken;
5269
5308
  this.twilioService.tokenInitialized = true;
5270
- this.twilioService.initializeTwilioDevice(this.deviceId || localStorage.getItem('deviceId'));
5309
+ this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
5271
5310
  }
5272
5311
  }
5273
5312
  if (changes['userId']?.currentValue && this.userId) {
@@ -6003,6 +6042,7 @@ class DialboxComponent {
6003
6042
  this.incomingCallsList = [];
6004
6043
  // Clean up Twilio device when component is destroyed
6005
6044
  if (this.twilioService['device']) {
6045
+ console.log('1402');
6006
6046
  this.twilioService['device'].disconnectAll();
6007
6047
  this.twilioService['device'].destroy();
6008
6048
  }