@vgroup/dialbox 0.7.89 → 0.7.90

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: "u",
65
+ abb: "t",
66
66
  production: false,
67
67
  secureCookies: true,
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/',
68
+ feUrl: 'https://test.vgroupinc.com:91/',
69
+ apiUrl: 'https://apis.vgroupinc.com/test_softphone',
70
+ websocketUrl: 'wss://apis.vgroupinc.com/test_softphone/',
71
71
  captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
72
- stripePublishableKey: "pk_live_51NbMVaA3guus6fhl85gdcvAWHzfHba5LdGlsnV7DxBT9spHghn4IHT9rDCjSRgFh2ijTiZn9qeazdciY1PbreOuB00t1GdQAZJ",
72
+ stripePublishableKey: "pk_test_51NbMVaA3guus6fhlTuCV5ycFTIJmwgN38dDUf9pNPfM319x5CkLbV6EbTQaZiNOrRsfR16RWLE8hQmR0eZFTBqTy00Wlsug4qS",
73
73
  sessionTimeout: 15,
74
74
  deviceType: "web",
75
- appVersion: "2.9",
76
- channelId: '6511738039ee10367cbde2e9',
75
+ appVersion: "2.3",
76
+ channelId: '61481b12e138eb7dc3007579',
77
77
  c2c_support_point_id: '60424735f74ac306c1bfa900',
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',
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',
82
82
  radarAPIKey: 'prj_live_sk_569b6f639edde6120a26f703511c61aaecd3f7ef',
83
83
  firebase: {
84
84
  apiKey: "AIzaSyCA8LSPrqlDq_thk26LhBQexAQeY6pkU5Y",
@@ -1650,6 +1650,11 @@ class TwilioService {
1650
1650
  };
1651
1651
  this.currentDeviceErrorHandler = onDeviceError;
1652
1652
  device.on('error', onDeviceError);
1653
+ device.on('disconnect', () => {
1654
+ console.log('Twilio Device disconnected');
1655
+ this.isShowIncomingCall = false;
1656
+ this.scheduleDeviceRecovery();
1657
+ });
1653
1658
  const onDeviceUnregistered = () => {
1654
1659
  // Stale event from a device we've already intentionally replaced — ignore.
1655
1660
  if (this.device !== device)
@@ -2631,7 +2636,7 @@ class CallProgressComponent {
2631
2636
  if (!this.currentConferenceCall?.conferenceId && this.currentCall?.conferenceId) {
2632
2637
  this.timer = this.getTimeDifference(this.currentCall?.joinedAt);
2633
2638
  }
2634
- if (this.selectedUserInfo?.participantId) {
2639
+ if (this.selectedUserInfo?.id) {
2635
2640
  let selectedUser = this.currentCallList.find((item) => item?.id == this.selectedUserInfo?.id);
2636
2641
  if (selectedUser && (selectedUser?.conferenceId == this.currentConferenceCall?.conferenceId || this.isClickExpand)) {
2637
2642
  selectedUser.IsUserInfoShow = true;
@@ -2973,7 +2978,7 @@ class CallProgressComponent {
2973
2978
  await this.pollCallStatus(callAuthId);
2974
2979
  setTimeout(async () => {
2975
2980
  try {
2976
- let addClientParticipantRes = await this.addClientParticipant({
2981
+ let addClientParticipantRes = this.addClientParticipant({
2977
2982
  from: callData?.from,
2978
2983
  route: "OUTGOING",
2979
2984
  participantNumber: callData?.phone,
@@ -2984,9 +2989,9 @@ class CallProgressComponent {
2984
2989
  deviceId: this.deviceId,
2985
2990
  clientSid: this.call?.parameters['CallSid']
2986
2991
  });
2987
- if (addClientParticipantRes?.status != 200) {
2988
- swal("Error", addClientParticipantRes?.message, "error");
2989
- }
2992
+ // if(addClientParticipantRes?.status != 200) {
2993
+ // swal("Error", addClientParticipantRes?.message.join("<br/>"), "error");
2994
+ // }
2990
2995
  this.addRes = await this.addParticipantToCall({
2991
2996
  from: callData?.from,
2992
2997
  route: "OUTGOING",
@@ -3024,34 +3029,14 @@ class CallProgressComponent {
3024
3029
  this.unholdPendingConference();
3025
3030
  }
3026
3031
  else {
3027
- console.log(896);
3028
- this.endCallEvent.emit();
3029
3032
  this.endCall(); // regular call failure – disconnect everything
3030
3033
  }
3031
3034
  }
3032
3035
  }
3033
3036
  catch (error) {
3034
3037
  this.showRingAnimation = false;
3035
- // Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
3036
- // loader must always come down — previously this was left to endCall()/the socket
3037
- // feed, and if either of those didn't run (or threw), the loader stayed on screen
3038
- // forever with no way back to the dialpad.
3039
- this.extensionService.isLoadershow.next(false);
3040
- this.isLoadershown.emit(false);
3041
- if (isNewConference) {
3042
- this.unholdPendingConference();
3043
- }
3044
- else {
3045
- console.log(896);
3046
- this.endCallEvent.emit();
3047
- try {
3048
- this.endCall(); // regular call failure – disconnect everything
3049
- }
3050
- catch (cleanupError) {
3051
- console.error('Error during call failure cleanup:', cleanupError);
3052
- }
3053
- }
3054
- this.handleError('Call not initiating due to a technical issue. Please try again.');
3038
+ this.handleError(error);
3039
+ this.endCall();
3055
3040
  return false;
3056
3041
  }
3057
3042
  }
@@ -3146,19 +3131,9 @@ class CallProgressComponent {
3146
3131
  // await this.getAllParticipants(c?.conferenceId);
3147
3132
  }
3148
3133
  async onEndCall(c, isAllCallEnd, isContect) {
3149
- let participantId = isAllCallEnd ? 'all' : c?.participantId || c?.id;
3134
+ let participantId = isAllCallEnd ? 'all' : c.participantId || c?.id;
3150
3135
  const currentConferenceCallInfo = this.getCurrentCallInfo();
3151
- // A call that failed/aborted before the backend ever created a conference for it
3152
- // (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
3153
- // here — there is nothing to remove server-side, so just fall through to the
3154
- // local cleanup below instead of throwing on `undefined.participants`.
3155
- if (!c?.conferenceId && !isAllCallEnd) {
3156
- this.conferenceCallIDForParticipantList = currentConferenceCallInfo?.conferenceId;
3157
- this.incomeingCallSocketService.pause();
3158
- this.cdr.detectChanges();
3159
- return false;
3160
- }
3161
- const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId)?.participants.filter((resData) => !resData?.isLeft) || [];
3136
+ const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId).participants.filter((resData) => !resData?.isLeft);
3162
3137
  if (participantList?.length <= 2 && !isContect) {
3163
3138
  participantId = 'all';
3164
3139
  }
@@ -3444,7 +3419,7 @@ class CallProgressComponent {
3444
3419
  if (!this.C2ConfoList[userInfo?.participantId] && !this.C2ConfoList[userInfo?.businessParticipantId]) {
3445
3420
  this.extensionService.getUserInformation(participantID).subscribe({
3446
3421
  next: (resInfo) => {
3447
- let index = this.currentCallList.findIndex((item) => item?.participantId == userInfo?.id);
3422
+ let index = this.currentCallList.findIndex((item) => item?.participantId == participantID);
3448
3423
  this.currentCallList[index] = this.mapUserInfo(this.currentCallList[index], resInfo?.c2cInformation);
3449
3424
  this.selectedUserInfo = this.currentCallList[index];
3450
3425
  this.C2ConfoList[participantID] = this.currentCallList[index];
@@ -3627,7 +3602,7 @@ class CallProgressComponent {
3627
3602
  else if (this.missCallInfo?.data?.data?.recordId == data?.id && !callToAccept.parameters?.CallSid) {
3628
3603
  clearInterval(intervalId);
3629
3604
  const sid = callToAccept.parameters?.CallSid;
3630
- this.twilioService.isConnectingIncomingCallId.next('');
3605
+ this.isConnectingIncomingCallId = '';
3631
3606
  this.isConnectingIncomingCallId = '';
3632
3607
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3633
3608
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== sid);
@@ -3768,7 +3743,7 @@ class CallProgressComponent {
3768
3743
  catch (error) {
3769
3744
  console.error('Error adding participant:', error);
3770
3745
  this.showRingAnimation = false;
3771
- this.handleError('Failed to add participant. Please try again.');
3746
+ this.handleError(error);
3772
3747
  }
3773
3748
  }
3774
3749
  async CallToUnsavedNumber(number, isNewConference, options, participantInfo) {
@@ -4079,7 +4054,9 @@ class CallProgressComponent {
4079
4054
  console.log(ev);
4080
4055
  try {
4081
4056
  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);
4057
+ console.log(selfCall);
4082
4058
  let device = this.twilioService.getIncomingCallById(selfCall?.callSid || selfCall?.clientSid);
4059
+ console.log(device);
4083
4060
  if (device && device?._status == 'open') {
4084
4061
  device.sendDigits(String(ev.key));
4085
4062
  }
@@ -4862,6 +4839,7 @@ class DialboxComponent {
4862
4839
  incomingCallData = incomingCallData?.length > 0
4863
4840
  ? incomingCallData.filter((item) => item.participants?.length > 0)
4864
4841
  : [];
4842
+ console.log('244', incomingCallData);
4865
4843
  // All conferenceIds received from socket this tick
4866
4844
  const socketConferenceIds = incomingCallData.map((c) => c.conferenceId);
4867
4845
  incomingCallData.forEach((callInfo) => {
@@ -4889,11 +4867,14 @@ class DialboxComponent {
4889
4867
  }
4890
4868
  }
4891
4869
  });
4870
+ console.log('incomingCallsList 275', this.incomingCallsList);
4892
4871
  // Remove active-call entries whose conferenceId is no longer in the socket
4893
4872
  // but keep incoming-call notifications (they are managed by notificationCallList expiry)
4894
4873
  this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.direction === 'incoming-call');
4874
+ console.log('incomingCallsList 281', this.incomingCallsList);
4895
4875
  // Remove expired notification entries
4896
4876
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
4877
+ console.log('notificationCallList 286', this.notificationCallList, this.incomingCallsList);
4897
4878
  // Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
4898
4879
  // notification is identified by its OWN participantId — never by conferenceId —
4899
4880
  // because it can legitimately share the conferenceId of a conference we are already
@@ -4902,8 +4883,10 @@ class DialboxComponent {
4902
4883
  const existingNotificationParticipantIds = new Set(this.incomingCallsList
4903
4884
  .filter((r) => r?._isNotification)
4904
4885
  .map((r) => r?.participantId));
4886
+ console.log('existingNotificationParticipantIds 296', existingNotificationParticipantIds);
4905
4887
  const notificationsToAdd = this.notificationCallList.filter((n) => !existingNotificationParticipantIds.has(n?.participantId));
4906
4888
  this.incomingCallsList = [...this.incomingCallsList, ...notificationsToAdd];
4889
+ console.log('incomingCallsList 305', this.incomingCallsList, notificationsToAdd);
4907
4890
  // Final deduplication. Active conference entries are keyed by conferenceId (socket data
4908
4891
  // wins — last write wins). Pending incoming-call notifications are keyed in a SEPARATE
4909
4892
  // namespace by participantId, so a notification and an active conference that share the
@@ -4915,11 +4898,13 @@ class DialboxComponent {
4915
4898
  : `conf:${item?.conferenceId}`;
4916
4899
  seen.set(key, item);
4917
4900
  }
4901
+ console.log('incomingCallsList 320', this.incomingCallsList, Array.from(seen.values()));
4918
4902
  let finalList = Array.from(seen.values());
4919
4903
  // Remove any notification entry if an active conference with the same conferenceId already exists
4920
4904
  // added for 7472 bug
4921
4905
  const activeConferenceIds = new Set(finalList.filter((item) => !item._isNotification).map((item) => item.conferenceId));
4922
4906
  finalList = finalList.filter((item) => !(item._isNotification && activeConferenceIds.has(item.conferenceId)));
4907
+ console.log('incomingCallsList 33=0', this.incomingCallsList, finalList);
4923
4908
  this.incomingCallsList = finalList;
4924
4909
  if (this.incomingCallsList?.length && incomingCallData?.length) {
4925
4910
  this.isCallInProgress = true;
@@ -4947,9 +4932,9 @@ class DialboxComponent {
4947
4932
  }, 2000);
4948
4933
  }
4949
4934
  }
4950
- if (!this.incomingCallsList?.length && !this.twilioService.acceptedCallList?.length) {
4935
+ if (!this.incomingCallsList?.length) {
4951
4936
  setTimeout(() => {
4952
- if (!this.incomingCallsList?.length && !this.twilioService.acceptedCallList?.length) {
4937
+ if (!this.incomingCallsList?.length) {
4953
4938
  this.isCallInProgress = false;
4954
4939
  this.twilioService.device?.disconnectAll();
4955
4940
  this.twilioService.spareDevice?.disconnectAll();
@@ -5207,7 +5192,7 @@ class DialboxComponent {
5207
5192
  if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
5208
5193
  this.twilioService.incomingCallToken = this.updatedTwilioToken;
5209
5194
  this.twilioService.tokenInitialized = true;
5210
- this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
5195
+ this.twilioService.initializeTwilioDevice(this.deviceId || localStorage.getItem('deviceId'));
5211
5196
  }
5212
5197
  }
5213
5198
  if (changes['userId']?.currentValue && this.userId) {
@@ -5914,7 +5899,6 @@ class DialboxComponent {
5914
5899
  this.incomingCallsList = [];
5915
5900
  // Clean up Twilio device when component is destroyed
5916
5901
  if (this.twilioService['device']) {
5917
- console.log('Destroying Twilio device...');
5918
5902
  this.twilioService['device'].disconnectAll();
5919
5903
  this.twilioService['device'].destroy();
5920
5904
  }