@vgroup/dialbox 0.7.91 → 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.
@@ -63,23 +63,23 @@ const keypad = [
63
63
  ];
64
64
 
65
65
  const environment = {
66
- abb: "t",
66
+ abb: "u",
67
67
  production: false,
68
68
  secureCookies: true,
69
- feUrl: 'https://test.vgroupinc.com:91/',
70
- apiUrl: 'https://apis.vgroupinc.com/test_softphone',
71
- websocketUrl: 'wss://apis.vgroupinc.com/test_softphone/',
69
+ feUrl: 'https://c2c-uat.contexttocall.com:85/',
70
+ apiUrl: 'https://c2c-uatapi-t10.contexttocall.com/uat_softphone',
71
+ websocketUrl: 'wss://c2c-uatapi-t10.contexttocall.com/uat_softphone/',
72
72
  captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
73
- stripePublishableKey: "pk_test_51NbMVaA3guus6fhlTuCV5ycFTIJmwgN38dDUf9pNPfM319x5CkLbV6EbTQaZiNOrRsfR16RWLE8hQmR0eZFTBqTy00Wlsug4qS",
73
+ stripePublishableKey: "pk_live_51NbMVaA3guus6fhl85gdcvAWHzfHba5LdGlsnV7DxBT9spHghn4IHT9rDCjSRgFh2ijTiZn9qeazdciY1PbreOuB00t1GdQAZJ",
74
74
  sessionTimeout: 15,
75
75
  deviceType: "web",
76
- appVersion: "2.3",
77
- channelId: '61481b12e138eb7dc3007579',
76
+ appVersion: "2.9",
77
+ channelId: '6511738039ee10367cbde2e9',
78
78
  c2c_support_point_id: '60424735f74ac306c1bfa900',
79
- c2c_support_channel_id: '677f6726be93ab507fbbfdf0',
80
- c2c_point_url: 'https://app.contexttocall.com/assets/cdn/c2c.js',
81
- c2c_call_label_id: '6NU5fKE2mGTyXDC3yhmK',
82
- c2c_email_label_id: 'YPMamj8RvsGORVvqXWyc',
79
+ c2c_support_channel_id: '677f68fcbe93ab507fbbfe0b',
80
+ c2c_point_url: 'https://bit.ly/3blWnPv',
81
+ c2c_call_label_id: '5M4taT8xzAg9pPIUADOW',
82
+ c2c_email_label_id: 'MUUC4NV5bLqHixXyhmok',
83
83
  radarAPIKey: 'prj_live_sk_569b6f639edde6120a26f703511c61aaecd3f7ef',
84
84
  firebase: {
85
85
  apiKey: "AIzaSyCA8LSPrqlDq_thk26LhBQexAQeY6pkU5Y",
@@ -1656,6 +1656,11 @@ class TwilioService {
1656
1656
  };
1657
1657
  this.currentDeviceErrorHandler = onDeviceError;
1658
1658
  device.on('error', onDeviceError);
1659
+ device.on('disconnect', () => {
1660
+ console.log('Twilio Device disconnected');
1661
+ this.isShowIncomingCall = false;
1662
+ this.scheduleDeviceRecovery();
1663
+ });
1659
1664
  const onDeviceUnregistered = () => {
1660
1665
  // Stale event from a device we've already intentionally replaced — ignore.
1661
1666
  if (this.device !== device)
@@ -2350,7 +2355,6 @@ class CallProgressComponent {
2350
2355
  if (!((_p = this.deviceNumberList) === null || _p === void 0 ? void 0 : _p.length)) {
2351
2356
  this.deviceNumberList = this.callerIdList.map((res) => res.number);
2352
2357
  }
2353
- console.log('newIncomingCallsList', this.newIncomingCallsList);
2354
2358
  this.newIncomingCallsList.forEach((callInfo, i) => {
2355
2359
  var _a, _b, _c;
2356
2360
  this.conferenceId = i == 0 ? this.newIncomingCallsList[i].conferenceId : this.conferenceId;
@@ -2415,7 +2419,6 @@ class CallProgressComponent {
2415
2419
  this.startTimer((_p = this.currentCall) === null || _p === void 0 ? void 0 : _p.joinedAt);
2416
2420
  }
2417
2421
  else if (index != -1 && !(res === null || res === void 0 ? void 0 : res.isLeft)) {
2418
- //console.log(res);
2419
2422
  const participantId = res.id;
2420
2423
  // Check if a mute update is pending for this participant
2421
2424
  const isMutePending = this.pendingMuteParticipants.has(participantId);
@@ -2589,7 +2592,7 @@ class CallProgressComponent {
2589
2592
  if (!((_9 = this.currentConferenceCall) === null || _9 === void 0 ? void 0 : _9.conferenceId) && ((_10 = this.currentCall) === null || _10 === void 0 ? void 0 : _10.conferenceId)) {
2590
2593
  this.timer = this.getTimeDifference((_11 = this.currentCall) === null || _11 === void 0 ? void 0 : _11.joinedAt);
2591
2594
  }
2592
- if ((_12 = this.selectedUserInfo) === null || _12 === void 0 ? void 0 : _12.participantId) {
2595
+ if ((_12 = this.selectedUserInfo) === null || _12 === void 0 ? void 0 : _12.id) {
2593
2596
  let selectedUser = this.currentCallList.find((item) => { var _a; return (item === null || item === void 0 ? void 0 : item.id) == ((_a = this.selectedUserInfo) === null || _a === void 0 ? void 0 : _a.id); });
2594
2597
  if (selectedUser && ((selectedUser === null || selectedUser === void 0 ? void 0 : selectedUser.conferenceId) == ((_13 = this.currentConferenceCall) === null || _13 === void 0 ? void 0 : _13.conferenceId) || this.isClickExpand)) {
2595
2598
  selectedUser.IsUserInfoShow = true;
@@ -2940,7 +2943,7 @@ class CallProgressComponent {
2940
2943
  setTimeout(() => __awaiter(this, void 0, void 0, function* () {
2941
2944
  var _c, _d, _e, _f, _g;
2942
2945
  try {
2943
- let addClientParticipantRes = this.addClientParticipant({
2946
+ let addClientParticipantRes = yield this.addClientParticipant({
2944
2947
  from: callData === null || callData === void 0 ? void 0 : callData.from,
2945
2948
  route: "OUTGOING",
2946
2949
  participantNumber: callData === null || callData === void 0 ? void 0 : callData.phone,
@@ -2951,9 +2954,9 @@ class CallProgressComponent {
2951
2954
  deviceId: this.deviceId,
2952
2955
  clientSid: (_d = this.call) === null || _d === void 0 ? void 0 : _d.parameters['CallSid']
2953
2956
  });
2954
- // if(addClientParticipantRes?.status != 200) {
2955
- // swal("Error", addClientParticipantRes?.message.join("<br/>"), "error");
2956
- // }
2957
+ if ((addClientParticipantRes === null || addClientParticipantRes === void 0 ? void 0 : addClientParticipantRes.status) != 200) {
2958
+ swal("Error", addClientParticipantRes === null || addClientParticipantRes === void 0 ? void 0 : addClientParticipantRes.message, "error");
2959
+ }
2957
2960
  this.addRes = yield this.addParticipantToCall({
2958
2961
  from: callData === null || callData === void 0 ? void 0 : callData.from,
2959
2962
  route: "OUTGOING",
@@ -2991,14 +2994,34 @@ class CallProgressComponent {
2991
2994
  this.unholdPendingConference();
2992
2995
  }
2993
2996
  else {
2997
+ console.log(896);
2998
+ this.endCallEvent.emit();
2994
2999
  this.endCall(); // regular call failure – disconnect everything
2995
3000
  }
2996
3001
  }
2997
3002
  }
2998
3003
  catch (error) {
2999
3004
  this.showRingAnimation = false;
3000
- this.handleError(error);
3001
- this.endCall();
3005
+ // Whatever failed above (backend call, Twilio connect, etc.), the "Connecting..."
3006
+ // loader must always come down — previously this was left to endCall()/the socket
3007
+ // feed, and if either of those didn't run (or threw), the loader stayed on screen
3008
+ // forever with no way back to the dialpad.
3009
+ this.extensionService.isLoadershow.next(false);
3010
+ this.isLoadershown.emit(false);
3011
+ if (isNewConference) {
3012
+ this.unholdPendingConference();
3013
+ }
3014
+ else {
3015
+ console.log(896);
3016
+ this.endCallEvent.emit();
3017
+ try {
3018
+ this.endCall(); // regular call failure – disconnect everything
3019
+ }
3020
+ catch (cleanupError) {
3021
+ console.error('Error during call failure cleanup:', cleanupError);
3022
+ }
3023
+ }
3024
+ this.handleError('Call not initiating due to a technical issue. Please try again.');
3002
3025
  return false;
3003
3026
  }
3004
3027
  });
@@ -3100,15 +3123,25 @@ class CallProgressComponent {
3100
3123
  });
3101
3124
  }
3102
3125
  onEndCall(c, isAllCallEnd, isContect) {
3103
- var _a;
3126
+ var _a, _b;
3104
3127
  return __awaiter(this, void 0, void 0, function* () {
3105
- let participantId = isAllCallEnd ? 'all' : c.participantId || (c === null || c === void 0 ? void 0 : c.id);
3128
+ let participantId = isAllCallEnd ? 'all' : (c === null || c === void 0 ? void 0 : c.participantId) || (c === null || c === void 0 ? void 0 : c.id);
3106
3129
  const currentConferenceCallInfo = this.getCurrentCallInfo();
3107
- const participantList = this.newIncomingCallsList.find((callInfo) => (callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId) == (c === null || c === void 0 ? void 0 : c.conferenceId)).participants.filter((resData) => !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
3130
+ // A call that failed/aborted before the backend ever created a conference for it
3131
+ // (e.g. initiateCall()/connectToDevice() threw) has no `c` and no matching entry
3132
+ // here — there is nothing to remove server-side, so just fall through to the
3133
+ // local cleanup below instead of throwing on `undefined.participants`.
3134
+ if (!(c === null || c === void 0 ? void 0 : c.conferenceId) && !isAllCallEnd) {
3135
+ this.conferenceCallIDForParticipantList = currentConferenceCallInfo === null || currentConferenceCallInfo === void 0 ? void 0 : currentConferenceCallInfo.conferenceId;
3136
+ this.incomeingCallSocketService.pause();
3137
+ this.cdr.detectChanges();
3138
+ return false;
3139
+ }
3140
+ const participantList = ((_a = this.newIncomingCallsList.find((callInfo) => (callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId) == (c === null || c === void 0 ? void 0 : c.conferenceId))) === null || _a === void 0 ? void 0 : _a.participants.filter((resData) => !(resData === null || resData === void 0 ? void 0 : resData.isLeft))) || [];
3108
3141
  if ((participantList === null || participantList === void 0 ? void 0 : participantList.length) <= 2 && !isContect) {
3109
3142
  participantId = 'all';
3110
3143
  }
3111
- if (((_a = this.newIncomingCallsList) === null || _a === void 0 ? void 0 : _a.length) == 2) {
3144
+ if (((_b = this.newIncomingCallsList) === null || _b === void 0 ? void 0 : _b.length) == 2) {
3112
3145
  this.pendingAutoUnhold = true;
3113
3146
  }
3114
3147
  let conferenceId = c.conferenceId || (currentConferenceCallInfo === null || currentConferenceCallInfo === void 0 ? void 0 : currentConferenceCallInfo.conferenceId);
@@ -3417,7 +3450,7 @@ class CallProgressComponent {
3417
3450
  if (!this.C2ConfoList[userInfo === null || userInfo === void 0 ? void 0 : userInfo.participantId] && !this.C2ConfoList[userInfo === null || userInfo === void 0 ? void 0 : userInfo.businessParticipantId]) {
3418
3451
  this.extensionService.getUserInformation(participantID).subscribe({
3419
3452
  next: (resInfo) => {
3420
- let index = this.currentCallList.findIndex((item) => (item === null || item === void 0 ? void 0 : item.participantId) == (userInfo === null || userInfo === void 0 ? void 0 : userInfo.id));
3453
+ let index = this.currentCallList.findIndex((item) => (item === null || item === void 0 ? void 0 : item.participantId) == participantID);
3421
3454
  this.currentCallList[index] = this.mapUserInfo(this.currentCallList[index], resInfo === null || resInfo === void 0 ? void 0 : resInfo.c2cInformation);
3422
3455
  this.selectedUserInfo = this.currentCallList[index];
3423
3456
  this.C2ConfoList[participantID] = this.currentCallList[index];
@@ -3612,7 +3645,7 @@ class CallProgressComponent {
3612
3645
  else if (((_d = (_c = (_b = this.missCallInfo) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.recordId) == (data === null || data === void 0 ? void 0 : data.id) && !((_e = callToAccept.parameters) === null || _e === void 0 ? void 0 : _e.CallSid)) {
3613
3646
  clearInterval(intervalId);
3614
3647
  const sid = (_f = callToAccept.parameters) === null || _f === void 0 ? void 0 : _f.CallSid;
3615
- this.isConnectingIncomingCallId = '';
3648
+ this.twilioService.isConnectingIncomingCallId.next('');
3616
3649
  this.isConnectingIncomingCallId = '';
3617
3650
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3618
3651
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => { var _a; return ((_a = c.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) !== sid; });
@@ -3757,7 +3790,7 @@ class CallProgressComponent {
3757
3790
  catch (error) {
3758
3791
  console.error('Error adding participant:', error);
3759
3792
  this.showRingAnimation = false;
3760
- this.handleError(error);
3793
+ this.handleError('Failed to add participant. Please try again.');
3761
3794
  }
3762
3795
  });
3763
3796
  }
@@ -4114,9 +4147,7 @@ class CallProgressComponent {
4114
4147
  console.log(ev);
4115
4148
  try {
4116
4149
  let selfCall = (_a = this.newIncomingCallsList.find((res) => { var _a; return (res === null || res === void 0 ? void 0 : res.conferenceId) == ((_a = this.currentCall) === null || _a === void 0 ? void 0 : _a.conferenceId); })) === null || _a === void 0 ? void 0 : _a.participants.find((resData) => ((this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.from) && (resData === null || resData === void 0 ? void 0 : resData.client)) || (this.deviceNumberList.includes(resData === null || resData === void 0 ? void 0 : resData.to) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'incoming-call' && (resData === null || resData === void 0 ? void 0 : resData.host))) && !(resData === null || resData === void 0 ? void 0 : resData.isLeft));
4117
- console.log(selfCall);
4118
4150
  let device = this.twilioService.getIncomingCallById((selfCall === null || selfCall === void 0 ? void 0 : selfCall.callSid) || (selfCall === null || selfCall === void 0 ? void 0 : selfCall.clientSid));
4119
- console.log(device);
4120
4151
  if (device && (device === null || device === void 0 ? void 0 : device._status) == 'open') {
4121
4152
  device.sendDigits(String(ev.key));
4122
4153
  }
@@ -4906,7 +4937,7 @@ class DialboxComponent {
4906
4937
  this.incomeingCallSocketService.connect(this.deviceId);
4907
4938
  try {
4908
4939
  this.incomeingCallSocketService.listen().subscribe((incomingCallData) => __awaiter(this, void 0, void 0, function* () {
4909
- var _a, _b, _c, _d, _e, _f;
4940
+ var _a, _b, _c, _d, _e;
4910
4941
  this.twilioService.conferenceCallInfo = incomingCallData;
4911
4942
  this.conferenceCallList.emit(incomingCallData);
4912
4943
  this.token = localStorage.getItem('ext_token') || '';
@@ -4949,7 +4980,7 @@ class DialboxComponent {
4949
4980
  });
4950
4981
  // Remove active-call entries whose conferenceId is no longer in the socket
4951
4982
  // but keep incoming-call notifications (they are managed by notificationCallList expiry)
4952
- this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.direction === 'incoming-call');
4983
+ this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.callDirection === 'incoming-call');
4953
4984
  // Remove expired notification entries
4954
4985
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
4955
4986
  // Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
@@ -4987,7 +5018,7 @@ class DialboxComponent {
4987
5018
  this.cdk.detectChanges();
4988
5019
  }
4989
5020
  else {
4990
- const hasPendingNotifications = this.incomingCallsList.some((res) => (res === null || res === void 0 ? void 0 : res._isNotification) || (res === null || res === void 0 ? void 0 : res.direction) === 'incoming-call');
5021
+ const hasPendingNotifications = this.incomingCallsList.some((res) => (res === null || res === void 0 ? void 0 : res._isNotification) || (res === null || res === void 0 ? void 0 : res.callDirection) === 'incoming-call');
4991
5022
  const hasAcceptedCalls = ((_c = this.twilioService.acceptedCallList) === null || _c === void 0 ? void 0 : _c.length) > 0;
4992
5023
  if ((hasAcceptedCalls || hasPendingNotifications) && ((_d = this.incomingCallsList) === null || _d === void 0 ? void 0 : _d.length)) {
4993
5024
  this.isCallInProgress = true;
@@ -5006,13 +5037,13 @@ class DialboxComponent {
5006
5037
  }, 2000);
5007
5038
  }
5008
5039
  }
5009
- if (!((_e = this.incomingCallsList) === null || _e === void 0 ? void 0 : _e.length) && !((_f = this.twilioService.acceptedCallList) === null || _f === void 0 ? void 0 : _f.length)) {
5040
+ if (!((_e = this.incomingCallsList) === null || _e === void 0 ? void 0 : _e.length)) {
5010
5041
  setTimeout(() => {
5011
- var _a, _b, _c, _d;
5012
- if (!((_a = this.incomingCallsList) === null || _a === void 0 ? void 0 : _a.length) && !((_b = this.twilioService.acceptedCallList) === null || _b === void 0 ? void 0 : _b.length)) {
5042
+ var _a, _b, _c;
5043
+ if (!((_a = this.incomingCallsList) === null || _a === void 0 ? void 0 : _a.length)) {
5013
5044
  this.isCallInProgress = false;
5014
- (_c = this.twilioService.device) === null || _c === void 0 ? void 0 : _c.disconnectAll();
5015
- (_d = this.twilioService.spareDevice) === null || _d === void 0 ? void 0 : _d.disconnectAll();
5045
+ (_b = this.twilioService.device) === null || _b === void 0 ? void 0 : _b.disconnectAll();
5046
+ (_c = this.twilioService.spareDevice) === null || _c === void 0 ? void 0 : _c.disconnectAll();
5016
5047
  }
5017
5048
  }, 2000);
5018
5049
  }
@@ -5032,12 +5063,12 @@ class DialboxComponent {
5032
5063
  if (acceptedParticipantId != null) {
5033
5064
  this.notificationCallList = this.notificationCallList.filter((call) => (call === null || call === void 0 ? void 0 : call.participantId) != acceptedParticipantId);
5034
5065
  this.incomingCallsList = this.incomingCallsList.filter((call) => !(((call === null || call === void 0 ? void 0 : call.participantId) == acceptedParticipantId || (call === null || call === void 0 ? void 0 : call.id) == acceptedParticipantId) &&
5035
- (call === null || call === void 0 ? void 0 : call.direction) == 'incoming-call'));
5066
+ (call === null || call === void 0 ? void 0 : call.callDirection) == 'incoming-call'));
5036
5067
  }
5037
5068
  else {
5038
5069
  // Legacy fallback: remove by conferenceId.
5039
5070
  this.notificationCallList = this.notificationCallList.filter((call) => (call === null || call === void 0 ? void 0 : call.conferenceId) != acceptedConferenceId);
5040
- this.incomingCallsList = this.incomingCallsList.filter((call) => (call === null || call === void 0 ? void 0 : call.conferenceId) != acceptedConferenceId || (call === null || call === void 0 ? void 0 : call.direction) != 'incoming-call');
5071
+ this.incomingCallsList = this.incomingCallsList.filter((call) => (call === null || call === void 0 ? void 0 : call.conferenceId) != acceptedConferenceId || (call === null || call === void 0 ? void 0 : call.callDirection) != 'incoming-call');
5041
5072
  }
5042
5073
  });
5043
5074
  this.getUserCallSetting();
@@ -5179,7 +5210,7 @@ class DialboxComponent {
5179
5210
  this.registerDragElement();
5180
5211
  }
5181
5212
  ngOnChanges(changes) {
5182
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
5213
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
5183
5214
  if (((_a = changes['incomingCallnotification']) === null || _a === void 0 ? void 0 : _a.currentValue) && this.incomingCallnotification && ((_c = (_b = this.incomingCallnotification) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.content) != "Voicemail") {
5184
5215
  // Capture snapshot immediately so async callbacks always use this call's data,
5185
5216
  // not whatever this.incomingCallnotification points to when they eventually run.
@@ -5209,18 +5240,18 @@ class DialboxComponent {
5209
5240
  else if (((_j = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _j === void 0 ? void 0 : _j.content) == "Missed Call" || ((_l = (_k = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _k === void 0 ? void 0 : _k.data) === null || _l === void 0 ? void 0 : _l.status) == "rejected" || ((_o = (_m = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _m === void 0 ? void 0 : _m.data) === null || _o === void 0 ? void 0 : _o.status) == "accepted") {
5210
5241
  this.notificationCallList = this.notificationCallList.filter((call) => { var _a, _b, _c, _d; return (call === null || call === void 0 ? void 0 : call.participantId) != ((_b = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.recordId) && (call === null || call === void 0 ? void 0 : call.participantId) != ((_d = (_c = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.participantId); });
5211
5242
  this.missCallInfo = snapshot;
5212
- let incomingCallIndex = this.incomingCallsList.findIndex((call) => { var _a, _b, _c, _d; return ((call === null || call === void 0 ? void 0 : call.participantId) == ((_b = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.recordId) || call.participantId == ((_d = (_c = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.participantId)) && (call === null || call === void 0 ? void 0 : call.direction) == 'incoming-call'; });
5243
+ let incomingCallIndex = this.incomingCallsList.findIndex((call) => { var _a, _b, _c, _d; return ((call === null || call === void 0 ? void 0 : call.participantId) == ((_b = (_a = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.recordId) || call.participantId == ((_d = (_c = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.participantId)) && (call === null || call === void 0 ? void 0 : call.callDirection) == 'incoming-call'; });
5213
5244
  if (incomingCallIndex > -1) {
5214
5245
  console.log('incomingCallIndex', incomingCallIndex, snapshot);
5215
5246
  this.incomingCallsList.splice(incomingCallIndex, 1);
5216
5247
  this.incomeingCallSocketService.pause();
5217
5248
  this.cdk.detectChanges();
5218
- if (!((_p = this.incomingCallsList) === null || _p === void 0 ? void 0 : _p.length)) {
5219
- console.log('407');
5220
- this.isCallInProgress = false;
5221
- }
5249
+ // if (!this.incomingCallsList?.length) {
5250
+ // console.log('407');
5251
+ // this.isCallInProgress = false;
5252
+ // }
5222
5253
  }
5223
- if (this.connectingIncomingCallId == ((_r = (_q = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _q === void 0 ? void 0 : _q.data) === null || _r === void 0 ? void 0 : _r.recordId) || this.connectingIncomingCallId == ((_t = (_s = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _s === void 0 ? void 0 : _s.data) === null || _t === void 0 ? void 0 : _t.participantId) && ((_v = (_u = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _u === void 0 ? void 0 : _u.data) === null || _v === void 0 ? void 0 : _v.status) != "accepted") {
5254
+ if (this.connectingIncomingCallId == ((_q = (_p = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _p === void 0 ? void 0 : _p.data) === null || _q === void 0 ? void 0 : _q.recordId) || this.connectingIncomingCallId == ((_s = (_r = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.participantId) && ((_u = (_t = snapshot === null || snapshot === void 0 ? void 0 : snapshot.data) === null || _t === void 0 ? void 0 : _t.data) === null || _u === void 0 ? void 0 : _u.status) != "accepted") {
5224
5255
  // swal("Error", 'Internal Server Error', "error");
5225
5256
  this.twilioService.isConnectingIncomingCallId.next('');
5226
5257
  }
@@ -5237,11 +5268,11 @@ class DialboxComponent {
5237
5268
  }
5238
5269
  console.log('notificationCallList', this.notificationCallList);
5239
5270
  let parentCall = [];
5240
- if ((_w = this.notificationCallList) === null || _w === void 0 ? void 0 : _w.length) {
5271
+ if ((_v = this.notificationCallList) === null || _v === void 0 ? void 0 : _v.length) {
5241
5272
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= (new Date().getTime()));
5242
5273
  this.notificationCallList.forEach((call) => {
5243
5274
  this.incomingCallsList.forEach((item) => {
5244
- let info = item.participants.find((resInfo) => (resInfo === null || resInfo === void 0 ? void 0 : resInfo.id) === (call === null || call === void 0 ? void 0 : call.participantId) && (call === null || call === void 0 ? void 0 : call.direction) !== 'incoming');
5275
+ let info = item.participants.find((resInfo) => (resInfo === null || resInfo === void 0 ? void 0 : resInfo.id) === (call === null || call === void 0 ? void 0 : call.participantId) && (call === null || call === void 0 ? void 0 : call.callDirection) !== 'incoming');
5245
5276
  if (info) {
5246
5277
  parentCall.push(info.id);
5247
5278
  }
@@ -5264,17 +5295,17 @@ class DialboxComponent {
5264
5295
  this.twilioService.deviceId = changes['deviceId'].currentValue;
5265
5296
  this.extService.getIpInfo();
5266
5297
  }
5267
- if (((_x = changes['updatedTwilioToken']) === null || _x === void 0 ? void 0 : _x.currentValue) && this.updatedTwilioToken) {
5298
+ if (((_w = changes['updatedTwilioToken']) === null || _w === void 0 ? void 0 : _w.currentValue) && this.updatedTwilioToken) {
5268
5299
  if (this.twilioService.incomingCallToken != this.updatedTwilioToken) {
5269
5300
  this.twilioService.incomingCallToken = this.updatedTwilioToken;
5270
5301
  this.twilioService.tokenInitialized = true;
5271
- this.twilioService.initializeTwilioDevice(this.deviceId || localStorage.getItem('deviceId'));
5302
+ this.twilioService.initializeTwilioDevice(localStorage.getItem('deviceId'));
5272
5303
  }
5273
5304
  }
5274
- if (((_y = changes['userId']) === null || _y === void 0 ? void 0 : _y.currentValue) && this.userId) {
5305
+ if (((_x = changes['userId']) === null || _x === void 0 ? void 0 : _x.currentValue) && this.userId) {
5275
5306
  this.extensionService.userId = this.userId;
5276
5307
  }
5277
- if (((_z = changes['contactInfo']) === null || _z === void 0 ? void 0 : _z.currentValue) && this.contactInfo) {
5308
+ if (((_y = changes['contactInfo']) === null || _y === void 0 ? void 0 : _y.currentValue) && this.contactInfo) {
5278
5309
  let contact = this.contactInfo;
5279
5310
  this.isValidationMessageShow = true;
5280
5311
  if (contact.number && !this.incomingCallsList.length) {
@@ -5365,13 +5396,13 @@ class DialboxComponent {
5365
5396
  });
5366
5397
  }
5367
5398
  }
5368
- if ((_0 = changes['callAction']) === null || _0 === void 0 ? void 0 : _0.currentValue) {
5369
- if (((_1 = this.callAction) === null || _1 === void 0 ? void 0 : _1.type) == 'reJoin') {
5399
+ if ((_z = changes['callAction']) === null || _z === void 0 ? void 0 : _z.currentValue) {
5400
+ if (((_0 = this.callAction) === null || _0 === void 0 ? void 0 : _0.type) == 'reJoin') {
5370
5401
  this.extService.getIpInfo();
5371
5402
  this.isCallInProgress = true;
5372
5403
  }
5373
- else if ((_2 = this.callAction) === null || _2 === void 0 ? void 0 : _2.conferenceId) {
5374
- this.extensionService.getRemoveParticipants('all', (_3 = this.callAction) === null || _3 === void 0 ? void 0 : _3.conferenceId).subscribe((res) => { });
5404
+ else if ((_1 = this.callAction) === null || _1 === void 0 ? void 0 : _1.conferenceId) {
5405
+ this.extensionService.getRemoveParticipants('all', (_2 = this.callAction) === null || _2 === void 0 ? void 0 : _2.conferenceId).subscribe((res) => { });
5375
5406
  }
5376
5407
  }
5377
5408
  }
@@ -5435,7 +5466,7 @@ class DialboxComponent {
5435
5466
  // so a notification can coexist with an active conference that shares its conferenceId.
5436
5467
  _isNotification: true,
5437
5468
  participantId: notification === null || notification === void 0 ? void 0 : notification.participantId,
5438
- direction: "incoming-call",
5469
+ callDirection: "incoming-call",
5439
5470
  participants: [
5440
5471
  {
5441
5472
  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,
@@ -6013,6 +6044,7 @@ class DialboxComponent {
6013
6044
  this.incomingCallsList = [];
6014
6045
  // Clean up Twilio device when component is destroyed
6015
6046
  if (this.twilioService['device']) {
6047
+ console.log('Destroying Twilio device...');
6016
6048
  this.twilioService['device'].disconnectAll();
6017
6049
  this.twilioService['device'].destroy();
6018
6050
  }