@vgroup/dialbox 0.7.92 → 0.7.94

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",
66
- production: false,
65
+ abb: "p",
66
+ production: true,
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://app-phone.contexttocall.com/',
69
+ apiUrl: 'https://phone-api.contexttocall.com/softphone/',
70
+ websocketUrl: 'wss://phone-api.contexttocall.com/softphone/',
71
71
  captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
72
- stripePublishableKey: "pk_test_51NbMVaA3guus6fhlTuCV5ycFTIJmwgN38dDUf9pNPfM319x5CkLbV6EbTQaZiNOrRsfR16RWLE8hQmR0eZFTBqTy00Wlsug4qS",
72
+ stripePublishableKey: "pk_live_51OV9NYDjRTFWP7oMLrrgaWxCUp4nzeuwdDCCPjvwH7z6oDYUTierhavGMxBa411U0O27Yn24te7Hb43WFDwg2U7N00qbQUzTi6",
73
73
  sessionTimeout: 15,
74
74
  deviceType: "web",
75
- appVersion: "2.3",
76
- channelId: '61481b12e138eb7dc3007579',
75
+ appVersion: "3.2",
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: '67783949be93ab03faf8eea6',
79
+ c2c_point_url: 'https://bit.ly/3blWnPv',
80
+ c2c_call_label_id: 'Bn78kjz6sSottXSHgqMt',
81
+ c2c_email_label_id: 'UkNer4LgzXCfFlh8u909',
82
82
  radarAPIKey: 'prj_live_sk_569b6f639edde6120a26f703511c61aaecd3f7ef',
83
83
  firebase: {
84
84
  apiKey: "AIzaSyCA8LSPrqlDq_thk26LhBQexAQeY6pkU5Y",
@@ -90,10 +90,7 @@ const environment = {
90
90
  measurementId: "G-NGXTSV9SH3",
91
91
  vapidKey: "BD6EgcQgbZTjOQfleG3YlEc0_SajB03prqTdDy-qGJkxTxezbq-A_qtuXE1l3yT47o8hnTAbTKBcH15D2AJB2To"
92
92
  },
93
- perspectiveApiKey: 'AIzaSyClf32lvLH4QOy-vOnzLzwSNntKIgapH8s',
94
- keycloakURL: 'https://test-keycloak.vgroupinc.com/',
95
- keycloakRealm: 'vgroup-test',
96
- keycloakClientId: 'c2c-softphone-app'
93
+ perspectiveApiKey: 'AIzaSyClf32lvLH4QOy-vOnzLzwSNntKIgapH8s'
97
94
  };
98
95
 
99
96
  class IpAddressService {
@@ -2347,7 +2344,6 @@ class CallProgressComponent {
2347
2344
  if (!this.deviceNumberList?.length) {
2348
2345
  this.deviceNumberList = this.callerIdList.map((res) => res.number);
2349
2346
  }
2350
- console.log('newIncomingCallsList', this.newIncomingCallsList);
2351
2347
  this.newIncomingCallsList.forEach((callInfo, i) => {
2352
2348
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
2353
2349
  let ourNumberInfo = this.newIncomingCallsList[i]?.participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.direction == 'outgoing-call' && resData?.client) || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call' && (!resData?.businessNumber || (resData?.businessNumber && callInfo?.participants?.length == 1)))) && !resData?.isLeft);
@@ -2429,7 +2425,6 @@ class CallProgressComponent {
2429
2425
  this.startTimer(this.currentCall?.joinedAt);
2430
2426
  }
2431
2427
  else if (index != -1 && !res?.isLeft) {
2432
- //console.log(res);
2433
2428
  const participantId = res.id;
2434
2429
  // Check if a mute update is pending for this participant
2435
2430
  const isMutePending = this.pendingMuteParticipants.has(participantId);
@@ -2982,7 +2977,7 @@ class CallProgressComponent {
2982
2977
  await this.pollCallStatus(callAuthId);
2983
2978
  setTimeout(async () => {
2984
2979
  try {
2985
- let addClientParticipantRes = this.addClientParticipant({
2980
+ let addClientParticipantRes = await this.addClientParticipant({
2986
2981
  from: callData?.from,
2987
2982
  route: "OUTGOING",
2988
2983
  participantNumber: callData?.phone,
@@ -2993,9 +2988,9 @@ class CallProgressComponent {
2993
2988
  deviceId: this.deviceId,
2994
2989
  clientSid: this.call?.parameters['CallSid']
2995
2990
  });
2996
- // if(addClientParticipantRes?.status != 200) {
2997
- // swal("Error", addClientParticipantRes?.message.join("<br/>"), "error");
2998
- // }
2991
+ if (addClientParticipantRes?.status != 200) {
2992
+ swal("Error", addClientParticipantRes?.message, "error");
2993
+ }
2999
2994
  this.addRes = await this.addParticipantToCall({
3000
2995
  from: callData?.from,
3001
2996
  route: "OUTGOING",
@@ -3033,14 +3028,34 @@ class CallProgressComponent {
3033
3028
  this.unholdPendingConference();
3034
3029
  }
3035
3030
  else {
3031
+ console.log(896);
3032
+ this.endCallEvent.emit();
3036
3033
  this.endCall(); // regular call failure – disconnect everything
3037
3034
  }
3038
3035
  }
3039
3036
  }
3040
3037
  catch (error) {
3041
3038
  this.showRingAnimation = false;
3042
- this.handleError(error);
3043
- this.endCall();
3039
+ // Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
3040
+ // loader must always come down — previously this was left to endCall()/the socket
3041
+ // feed, and if either of those didn't run (or threw), the loader stayed on screen
3042
+ // forever with no way back to the dialpad.
3043
+ this.extensionService.isLoadershow.next(false);
3044
+ this.isLoadershown.emit(false);
3045
+ if (isNewConference) {
3046
+ this.unholdPendingConference();
3047
+ }
3048
+ else {
3049
+ console.log(896);
3050
+ this.endCallEvent.emit();
3051
+ try {
3052
+ this.endCall(); // regular call failure – disconnect everything
3053
+ }
3054
+ catch (cleanupError) {
3055
+ console.error('Error during call failure cleanup:', cleanupError);
3056
+ }
3057
+ }
3058
+ this.handleError('Call not initiating due to a technical issue. Please try again.');
3044
3059
  return false;
3045
3060
  }
3046
3061
  }
@@ -3135,9 +3150,19 @@ class CallProgressComponent {
3135
3150
  // await this.getAllParticipants(c?.conferenceId);
3136
3151
  }
3137
3152
  async onEndCall(c, isAllCallEnd, isContect) {
3138
- let participantId = isAllCallEnd ? 'all' : c.participantId || c?.id;
3153
+ let participantId = isAllCallEnd ? 'all' : c?.participantId || c?.id;
3139
3154
  const currentConferenceCallInfo = this.getCurrentCallInfo();
3140
- const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId).participants.filter((resData) => !resData?.isLeft);
3155
+ // A call that failed/aborted before the backend ever created a conference for it
3156
+ // (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
3157
+ // here — there is nothing to remove server-side, so just fall through to the
3158
+ // local cleanup below instead of throwing on `undefined.participants`.
3159
+ if (!c?.conferenceId && !isAllCallEnd) {
3160
+ this.conferenceCallIDForParticipantList = currentConferenceCallInfo?.conferenceId;
3161
+ this.incomeingCallSocketService.pause();
3162
+ this.cdr.detectChanges();
3163
+ return false;
3164
+ }
3165
+ const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId)?.participants.filter((resData) => !resData?.isLeft) || [];
3141
3166
  if (participantList?.length <= 2 && !isContect) {
3142
3167
  participantId = 'all';
3143
3168
  }
@@ -3606,7 +3631,7 @@ class CallProgressComponent {
3606
3631
  else if (this.missCallInfo?.data?.data?.recordId == data?.id && !callToAccept.parameters?.CallSid) {
3607
3632
  clearInterval(intervalId);
3608
3633
  const sid = callToAccept.parameters?.CallSid;
3609
- this.isConnectingIncomingCallId = '';
3634
+ this.twilioService.isConnectingIncomingCallId.next('');
3610
3635
  this.isConnectingIncomingCallId = '';
3611
3636
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3612
3637
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== sid);
@@ -3747,7 +3772,7 @@ class CallProgressComponent {
3747
3772
  catch (error) {
3748
3773
  console.error('Error adding participant:', error);
3749
3774
  this.showRingAnimation = false;
3750
- this.handleError(error);
3775
+ this.handleError('Failed to add participant. Please try again.');
3751
3776
  }
3752
3777
  }
3753
3778
  async CallToUnsavedNumber(number, isNewConference, options, participantInfo) {
@@ -4089,9 +4114,7 @@ class CallProgressComponent {
4089
4114
  console.log(ev);
4090
4115
  try {
4091
4116
  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);
4092
- console.log(selfCall);
4093
4117
  let device = this.twilioService.getIncomingCallById(selfCall?.callSid || selfCall?.clientSid);
4094
- console.log(device);
4095
4118
  if (device && device?._status == 'open') {
4096
4119
  device.sendDigits(String(ev.key));
4097
4120
  }
@@ -4879,7 +4902,6 @@ class DialboxComponent {
4879
4902
  incomingCallData = incomingCallData?.length > 0
4880
4903
  ? incomingCallData.filter((item) => item.participants?.length > 0)
4881
4904
  : [];
4882
- console.log('244', incomingCallData);
4883
4905
  // All conferenceIds received from socket this tick
4884
4906
  const socketConferenceIds = incomingCallData.map((c) => c.conferenceId);
4885
4907
  incomingCallData.forEach((callInfo) => {
@@ -4907,14 +4929,11 @@ class DialboxComponent {
4907
4929
  }
4908
4930
  }
4909
4931
  });
4910
- console.log('incomingCallsList 275', this.incomingCallsList);
4911
4932
  // Remove active-call entries whose conferenceId is no longer in the socket
4912
4933
  // but keep incoming-call notifications (they are managed by notificationCallList expiry)
4913
- this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.direction === 'incoming-call');
4914
- console.log('incomingCallsList 281', this.incomingCallsList);
4934
+ this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.callDirection === 'incoming-call');
4915
4935
  // Remove expired notification entries
4916
4936
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
4917
- console.log('notificationCallList 286', this.notificationCallList, this.incomingCallsList);
4918
4937
  // Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
4919
4938
  // notification is identified by its OWN participantId — never by conferenceId —
4920
4939
  // because it can legitimately share the conferenceId of a conference we are already
@@ -4923,10 +4942,8 @@ class DialboxComponent {
4923
4942
  const existingNotificationParticipantIds = new Set(this.incomingCallsList
4924
4943
  .filter((r) => r?._isNotification)
4925
4944
  .map((r) => r?.participantId));
4926
- console.log('existingNotificationParticipantIds 296', existingNotificationParticipantIds);
4927
4945
  const notificationsToAdd = this.notificationCallList.filter((n) => !existingNotificationParticipantIds.has(n?.participantId));
4928
4946
  this.incomingCallsList = [...this.incomingCallsList, ...notificationsToAdd];
4929
- console.log('incomingCallsList 305', this.incomingCallsList, notificationsToAdd);
4930
4947
  // Final deduplication. Active conference entries are keyed by conferenceId (socket data
4931
4948
  // wins — last write wins). Pending incoming-call notifications are keyed in a SEPARATE
4932
4949
  // namespace by participantId, so a notification and an active conference that share the
@@ -4938,13 +4955,11 @@ class DialboxComponent {
4938
4955
  : `conf:${item?.conferenceId}`;
4939
4956
  seen.set(key, item);
4940
4957
  }
4941
- console.log('incomingCallsList 320', this.incomingCallsList, Array.from(seen.values()));
4942
4958
  let finalList = Array.from(seen.values());
4943
4959
  // Remove any notification entry if an active conference with the same conferenceId already exists
4944
4960
  // added for 7472 bug
4945
4961
  const activeConferenceIds = new Set(finalList.filter((item) => !item._isNotification).map((item) => item.conferenceId));
4946
4962
  finalList = finalList.filter((item) => !(item._isNotification && activeConferenceIds.has(item.conferenceId)));
4947
- console.log('incomingCallsList 33=0', this.incomingCallsList, finalList);
4948
4963
  this.incomingCallsList = finalList;
4949
4964
  if (this.incomingCallsList?.length && incomingCallData?.length) {
4950
4965
  this.isCallInProgress = true;
@@ -4954,7 +4969,7 @@ class DialboxComponent {
4954
4969
  this.cdk.detectChanges();
4955
4970
  }
4956
4971
  else {
4957
- const hasPendingNotifications = this.incomingCallsList.some((res) => res?._isNotification || res?.direction === 'incoming-call');
4972
+ const hasPendingNotifications = this.incomingCallsList.some((res) => res?._isNotification || res?.callDirection === 'incoming-call');
4958
4973
  const hasAcceptedCalls = this.twilioService.acceptedCallList?.length > 0;
4959
4974
  if ((hasAcceptedCalls || hasPendingNotifications) && this.incomingCallsList?.length) {
4960
4975
  this.isCallInProgress = true;
@@ -4997,12 +5012,12 @@ class DialboxComponent {
4997
5012
  if (acceptedParticipantId != null) {
4998
5013
  this.notificationCallList = this.notificationCallList.filter((call) => call?.participantId != acceptedParticipantId);
4999
5014
  this.incomingCallsList = this.incomingCallsList.filter((call) => !((call?.participantId == acceptedParticipantId || call?.id == acceptedParticipantId) &&
5000
- call?.direction == 'incoming-call'));
5015
+ call?.callDirection == 'incoming-call'));
5001
5016
  }
5002
5017
  else {
5003
5018
  // Legacy fallback: remove by conferenceId.
5004
5019
  this.notificationCallList = this.notificationCallList.filter((call) => call?.conferenceId != acceptedConferenceId);
5005
- this.incomingCallsList = this.incomingCallsList.filter((call) => call?.conferenceId != acceptedConferenceId || call?.direction != 'incoming-call');
5020
+ this.incomingCallsList = this.incomingCallsList.filter((call) => call?.conferenceId != acceptedConferenceId || call?.callDirection != 'incoming-call');
5006
5021
  }
5007
5022
  });
5008
5023
  this.getUserCallSetting();
@@ -5173,7 +5188,7 @@ class DialboxComponent {
5173
5188
  else if (snapshot?.data?.content == "Missed Call" || snapshot?.data?.data?.status == "rejected" || snapshot?.data?.data?.status == "accepted") {
5174
5189
  this.notificationCallList = this.notificationCallList.filter((call) => call?.participantId != snapshot?.data?.data?.recordId && call?.participantId != snapshot?.data?.data?.participantId);
5175
5190
  this.missCallInfo = snapshot;
5176
- let incomingCallIndex = this.incomingCallsList.findIndex((call) => (call?.participantId == snapshot?.data?.data?.recordId || call.participantId == snapshot?.data?.data?.participantId) && call?.direction == 'incoming-call');
5191
+ let incomingCallIndex = this.incomingCallsList.findIndex((call) => (call?.participantId == snapshot?.data?.data?.recordId || call.participantId == snapshot?.data?.data?.participantId) && call?.callDirection == 'incoming-call');
5177
5192
  if (incomingCallIndex > -1) {
5178
5193
  console.log('incomingCallIndex', incomingCallIndex, snapshot);
5179
5194
  this.incomingCallsList.splice(incomingCallIndex, 1);
@@ -5205,7 +5220,7 @@ class DialboxComponent {
5205
5220
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= (new Date().getTime()));
5206
5221
  this.notificationCallList.forEach((call) => {
5207
5222
  this.incomingCallsList.forEach((item) => {
5208
- let info = item.participants.find((resInfo) => resInfo?.id === call?.participantId && call?.direction !== 'incoming');
5223
+ let info = item.participants.find((resInfo) => resInfo?.id === call?.participantId && call?.callDirection !== 'incoming');
5209
5224
  if (info) {
5210
5225
  parentCall.push(info.id);
5211
5226
  }
@@ -5232,7 +5247,7 @@ class DialboxComponent {
5232
5247
  if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
5233
5248
  this.twilioService.incomingCallToken = this.updatedTwilioToken;
5234
5249
  this.twilioService.tokenInitialized = true;
5235
- this.twilioService.initializeTwilioDevice(this.deviceId || localStorage.getItem('deviceId'));
5250
+ this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
5236
5251
  }
5237
5252
  }
5238
5253
  if (changes['userId']?.currentValue && this.userId) {
@@ -5398,7 +5413,7 @@ class DialboxComponent {
5398
5413
  // so a notification can coexist with an active conference that shares its conferenceId.
5399
5414
  _isNotification: true,
5400
5415
  participantId: notification?.participantId,
5401
- direction: "incoming-call",
5416
+ callDirection: "incoming-call",
5402
5417
  participants: [
5403
5418
  {
5404
5419
  direction: "incoming-call", businessNumber: notification.c2cBusiness, img: notification.fromImage || notification.image || 'assets/images/user.jpg', isIncomingCall: true, isHold: false, isConference: false, isAcceptCall: false, dial: true, phone: notification.fromNumber, to: notification.toNumber,
@@ -5968,6 +5983,7 @@ class DialboxComponent {
5968
5983
  this.incomingCallsList = [];
5969
5984
  // Clean up Twilio device when component is destroyed
5970
5985
  if (this.twilioService['device']) {
5986
+ console.log('Destroying Twilio device...');
5971
5987
  this.twilioService['device'].disconnectAll();
5972
5988
  this.twilioService['device'].destroy();
5973
5989
  }