@vgroup/dialbox 0.7.92 → 0.7.93

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",
@@ -2347,7 +2347,6 @@ class CallProgressComponent {
2347
2347
  if (!this.deviceNumberList?.length) {
2348
2348
  this.deviceNumberList = this.callerIdList.map((res) => res.number);
2349
2349
  }
2350
- console.log('newIncomingCallsList', this.newIncomingCallsList);
2351
2350
  this.newIncomingCallsList.forEach((callInfo, i) => {
2352
2351
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
2353
2352
  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 +2428,6 @@ class CallProgressComponent {
2429
2428
  this.startTimer(this.currentCall?.joinedAt);
2430
2429
  }
2431
2430
  else if (index != -1 && !res?.isLeft) {
2432
- //console.log(res);
2433
2431
  const participantId = res.id;
2434
2432
  // Check if a mute update is pending for this participant
2435
2433
  const isMutePending = this.pendingMuteParticipants.has(participantId);
@@ -2982,7 +2980,7 @@ class CallProgressComponent {
2982
2980
  await this.pollCallStatus(callAuthId);
2983
2981
  setTimeout(async () => {
2984
2982
  try {
2985
- let addClientParticipantRes = this.addClientParticipant({
2983
+ let addClientParticipantRes = await this.addClientParticipant({
2986
2984
  from: callData?.from,
2987
2985
  route: "OUTGOING",
2988
2986
  participantNumber: callData?.phone,
@@ -2993,9 +2991,9 @@ class CallProgressComponent {
2993
2991
  deviceId: this.deviceId,
2994
2992
  clientSid: this.call?.parameters['CallSid']
2995
2993
  });
2996
- // if(addClientParticipantRes?.status != 200) {
2997
- // swal("Error", addClientParticipantRes?.message.join("<br/>"), "error");
2998
- // }
2994
+ if (addClientParticipantRes?.status != 200) {
2995
+ swal("Error", addClientParticipantRes?.message, "error");
2996
+ }
2999
2997
  this.addRes = await this.addParticipantToCall({
3000
2998
  from: callData?.from,
3001
2999
  route: "OUTGOING",
@@ -3033,14 +3031,34 @@ class CallProgressComponent {
3033
3031
  this.unholdPendingConference();
3034
3032
  }
3035
3033
  else {
3034
+ console.log(896);
3035
+ this.endCallEvent.emit();
3036
3036
  this.endCall(); // regular call failure – disconnect everything
3037
3037
  }
3038
3038
  }
3039
3039
  }
3040
3040
  catch (error) {
3041
3041
  this.showRingAnimation = false;
3042
- this.handleError(error);
3043
- this.endCall();
3042
+ // Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
3043
+ // loader must always come down — previously this was left to endCall()/the socket
3044
+ // feed, and if either of those didn't run (or threw), the loader stayed on screen
3045
+ // forever with no way back to the dialpad.
3046
+ this.extensionService.isLoadershow.next(false);
3047
+ this.isLoadershown.emit(false);
3048
+ if (isNewConference) {
3049
+ this.unholdPendingConference();
3050
+ }
3051
+ else {
3052
+ console.log(896);
3053
+ this.endCallEvent.emit();
3054
+ try {
3055
+ this.endCall(); // regular call failure – disconnect everything
3056
+ }
3057
+ catch (cleanupError) {
3058
+ console.error('Error during call failure cleanup:', cleanupError);
3059
+ }
3060
+ }
3061
+ this.handleError('Call not initiating due to a technical issue. Please try again.');
3044
3062
  return false;
3045
3063
  }
3046
3064
  }
@@ -3135,9 +3153,19 @@ class CallProgressComponent {
3135
3153
  // await this.getAllParticipants(c?.conferenceId);
3136
3154
  }
3137
3155
  async onEndCall(c, isAllCallEnd, isContect) {
3138
- let participantId = isAllCallEnd ? 'all' : c.participantId || c?.id;
3156
+ let participantId = isAllCallEnd ? 'all' : c?.participantId || c?.id;
3139
3157
  const currentConferenceCallInfo = this.getCurrentCallInfo();
3140
- const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId).participants.filter((resData) => !resData?.isLeft);
3158
+ // A call that failed/aborted before the backend ever created a conference for it
3159
+ // (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
3160
+ // here — there is nothing to remove server-side, so just fall through to the
3161
+ // local cleanup below instead of throwing on `undefined.participants`.
3162
+ if (!c?.conferenceId && !isAllCallEnd) {
3163
+ this.conferenceCallIDForParticipantList = currentConferenceCallInfo?.conferenceId;
3164
+ this.incomeingCallSocketService.pause();
3165
+ this.cdr.detectChanges();
3166
+ return false;
3167
+ }
3168
+ const participantList = this.newIncomingCallsList.find((callInfo) => callInfo?.conferenceId == c?.conferenceId)?.participants.filter((resData) => !resData?.isLeft) || [];
3141
3169
  if (participantList?.length <= 2 && !isContect) {
3142
3170
  participantId = 'all';
3143
3171
  }
@@ -3606,7 +3634,7 @@ class CallProgressComponent {
3606
3634
  else if (this.missCallInfo?.data?.data?.recordId == data?.id && !callToAccept.parameters?.CallSid) {
3607
3635
  clearInterval(intervalId);
3608
3636
  const sid = callToAccept.parameters?.CallSid;
3609
- this.isConnectingIncomingCallId = '';
3637
+ this.twilioService.isConnectingIncomingCallId.next('');
3610
3638
  this.isConnectingIncomingCallId = '';
3611
3639
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3612
3640
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== sid);
@@ -3747,7 +3775,7 @@ class CallProgressComponent {
3747
3775
  catch (error) {
3748
3776
  console.error('Error adding participant:', error);
3749
3777
  this.showRingAnimation = false;
3750
- this.handleError(error);
3778
+ this.handleError('Failed to add participant. Please try again.');
3751
3779
  }
3752
3780
  }
3753
3781
  async CallToUnsavedNumber(number, isNewConference, options, participantInfo) {
@@ -4089,9 +4117,7 @@ class CallProgressComponent {
4089
4117
  console.log(ev);
4090
4118
  try {
4091
4119
  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
4120
  let device = this.twilioService.getIncomingCallById(selfCall?.callSid || selfCall?.clientSid);
4094
- console.log(device);
4095
4121
  if (device && device?._status == 'open') {
4096
4122
  device.sendDigits(String(ev.key));
4097
4123
  }
@@ -4879,7 +4905,6 @@ class DialboxComponent {
4879
4905
  incomingCallData = incomingCallData?.length > 0
4880
4906
  ? incomingCallData.filter((item) => item.participants?.length > 0)
4881
4907
  : [];
4882
- console.log('244', incomingCallData);
4883
4908
  // All conferenceIds received from socket this tick
4884
4909
  const socketConferenceIds = incomingCallData.map((c) => c.conferenceId);
4885
4910
  incomingCallData.forEach((callInfo) => {
@@ -4907,14 +4932,11 @@ class DialboxComponent {
4907
4932
  }
4908
4933
  }
4909
4934
  });
4910
- console.log('incomingCallsList 275', this.incomingCallsList);
4911
4935
  // Remove active-call entries whose conferenceId is no longer in the socket
4912
4936
  // 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);
4937
+ this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.callDirection === 'incoming-call');
4915
4938
  // Remove expired notification entries
4916
4939
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
4917
- console.log('notificationCallList 286', this.notificationCallList, this.incomingCallsList);
4918
4940
  // Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
4919
4941
  // notification is identified by its OWN participantId — never by conferenceId —
4920
4942
  // because it can legitimately share the conferenceId of a conference we are already
@@ -4923,10 +4945,8 @@ class DialboxComponent {
4923
4945
  const existingNotificationParticipantIds = new Set(this.incomingCallsList
4924
4946
  .filter((r) => r?._isNotification)
4925
4947
  .map((r) => r?.participantId));
4926
- console.log('existingNotificationParticipantIds 296', existingNotificationParticipantIds);
4927
4948
  const notificationsToAdd = this.notificationCallList.filter((n) => !existingNotificationParticipantIds.has(n?.participantId));
4928
4949
  this.incomingCallsList = [...this.incomingCallsList, ...notificationsToAdd];
4929
- console.log('incomingCallsList 305', this.incomingCallsList, notificationsToAdd);
4930
4950
  // Final deduplication. Active conference entries are keyed by conferenceId (socket data
4931
4951
  // wins — last write wins). Pending incoming-call notifications are keyed in a SEPARATE
4932
4952
  // namespace by participantId, so a notification and an active conference that share the
@@ -4938,13 +4958,11 @@ class DialboxComponent {
4938
4958
  : `conf:${item?.conferenceId}`;
4939
4959
  seen.set(key, item);
4940
4960
  }
4941
- console.log('incomingCallsList 320', this.incomingCallsList, Array.from(seen.values()));
4942
4961
  let finalList = Array.from(seen.values());
4943
4962
  // Remove any notification entry if an active conference with the same conferenceId already exists
4944
4963
  // added for 7472 bug
4945
4964
  const activeConferenceIds = new Set(finalList.filter((item) => !item._isNotification).map((item) => item.conferenceId));
4946
4965
  finalList = finalList.filter((item) => !(item._isNotification && activeConferenceIds.has(item.conferenceId)));
4947
- console.log('incomingCallsList 33=0', this.incomingCallsList, finalList);
4948
4966
  this.incomingCallsList = finalList;
4949
4967
  if (this.incomingCallsList?.length && incomingCallData?.length) {
4950
4968
  this.isCallInProgress = true;
@@ -4954,7 +4972,7 @@ class DialboxComponent {
4954
4972
  this.cdk.detectChanges();
4955
4973
  }
4956
4974
  else {
4957
- const hasPendingNotifications = this.incomingCallsList.some((res) => res?._isNotification || res?.direction === 'incoming-call');
4975
+ const hasPendingNotifications = this.incomingCallsList.some((res) => res?._isNotification || res?.callDirection === 'incoming-call');
4958
4976
  const hasAcceptedCalls = this.twilioService.acceptedCallList?.length > 0;
4959
4977
  if ((hasAcceptedCalls || hasPendingNotifications) && this.incomingCallsList?.length) {
4960
4978
  this.isCallInProgress = true;
@@ -4997,12 +5015,12 @@ class DialboxComponent {
4997
5015
  if (acceptedParticipantId != null) {
4998
5016
  this.notificationCallList = this.notificationCallList.filter((call) => call?.participantId != acceptedParticipantId);
4999
5017
  this.incomingCallsList = this.incomingCallsList.filter((call) => !((call?.participantId == acceptedParticipantId || call?.id == acceptedParticipantId) &&
5000
- call?.direction == 'incoming-call'));
5018
+ call?.callDirection == 'incoming-call'));
5001
5019
  }
5002
5020
  else {
5003
5021
  // Legacy fallback: remove by conferenceId.
5004
5022
  this.notificationCallList = this.notificationCallList.filter((call) => call?.conferenceId != acceptedConferenceId);
5005
- this.incomingCallsList = this.incomingCallsList.filter((call) => call?.conferenceId != acceptedConferenceId || call?.direction != 'incoming-call');
5023
+ this.incomingCallsList = this.incomingCallsList.filter((call) => call?.conferenceId != acceptedConferenceId || call?.callDirection != 'incoming-call');
5006
5024
  }
5007
5025
  });
5008
5026
  this.getUserCallSetting();
@@ -5173,7 +5191,7 @@ class DialboxComponent {
5173
5191
  else if (snapshot?.data?.content == "Missed Call" || snapshot?.data?.data?.status == "rejected" || snapshot?.data?.data?.status == "accepted") {
5174
5192
  this.notificationCallList = this.notificationCallList.filter((call) => call?.participantId != snapshot?.data?.data?.recordId && call?.participantId != snapshot?.data?.data?.participantId);
5175
5193
  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');
5194
+ let incomingCallIndex = this.incomingCallsList.findIndex((call) => (call?.participantId == snapshot?.data?.data?.recordId || call.participantId == snapshot?.data?.data?.participantId) && call?.callDirection == 'incoming-call');
5177
5195
  if (incomingCallIndex > -1) {
5178
5196
  console.log('incomingCallIndex', incomingCallIndex, snapshot);
5179
5197
  this.incomingCallsList.splice(incomingCallIndex, 1);
@@ -5205,7 +5223,7 @@ class DialboxComponent {
5205
5223
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= (new Date().getTime()));
5206
5224
  this.notificationCallList.forEach((call) => {
5207
5225
  this.incomingCallsList.forEach((item) => {
5208
- let info = item.participants.find((resInfo) => resInfo?.id === call?.participantId && call?.direction !== 'incoming');
5226
+ let info = item.participants.find((resInfo) => resInfo?.id === call?.participantId && call?.callDirection !== 'incoming');
5209
5227
  if (info) {
5210
5228
  parentCall.push(info.id);
5211
5229
  }
@@ -5232,7 +5250,7 @@ class DialboxComponent {
5232
5250
  if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
5233
5251
  this.twilioService.incomingCallToken = this.updatedTwilioToken;
5234
5252
  this.twilioService.tokenInitialized = true;
5235
- this.twilioService.initializeTwilioDevice(this.deviceId || localStorage.getItem('deviceId'));
5253
+ this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
5236
5254
  }
5237
5255
  }
5238
5256
  if (changes['userId']?.currentValue && this.userId) {
@@ -5398,7 +5416,7 @@ class DialboxComponent {
5398
5416
  // so a notification can coexist with an active conference that shares its conferenceId.
5399
5417
  _isNotification: true,
5400
5418
  participantId: notification?.participantId,
5401
- direction: "incoming-call",
5419
+ callDirection: "incoming-call",
5402
5420
  participants: [
5403
5421
  {
5404
5422
  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 +5986,7 @@ class DialboxComponent {
5968
5986
  this.incomingCallsList = [];
5969
5987
  // Clean up Twilio device when component is destroyed
5970
5988
  if (this.twilioService['device']) {
5989
+ console.log('Destroying Twilio device...');
5971
5990
  this.twilioService['device'].disconnectAll();
5972
5991
  this.twilioService['device'].destroy();
5973
5992
  }