@vgroup/dialbox 0.7.91 → 0.7.92

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.
@@ -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)
@@ -2635,7 +2640,7 @@ class CallProgressComponent {
2635
2640
  if (!this.currentConferenceCall?.conferenceId && this.currentCall?.conferenceId) {
2636
2641
  this.timer = this.getTimeDifference(this.currentCall?.joinedAt);
2637
2642
  }
2638
- if (this.selectedUserInfo?.participantId) {
2643
+ if (this.selectedUserInfo?.id) {
2639
2644
  let selectedUser = this.currentCallList.find((item) => item?.id == this.selectedUserInfo?.id);
2640
2645
  if (selectedUser && (selectedUser?.conferenceId == this.currentConferenceCall?.conferenceId || this.isClickExpand)) {
2641
2646
  selectedUser.IsUserInfoShow = true;
@@ -3418,7 +3423,7 @@ class CallProgressComponent {
3418
3423
  if (!this.C2ConfoList[userInfo?.participantId] && !this.C2ConfoList[userInfo?.businessParticipantId]) {
3419
3424
  this.extensionService.getUserInformation(participantID).subscribe({
3420
3425
  next: (resInfo) => {
3421
- let index = this.currentCallList.findIndex((item) => item?.participantId == userInfo?.id);
3426
+ let index = this.currentCallList.findIndex((item) => item?.participantId == participantID);
3422
3427
  this.currentCallList[index] = this.mapUserInfo(this.currentCallList[index], resInfo?.c2cInformation);
3423
3428
  this.selectedUserInfo = this.currentCallList[index];
3424
3429
  this.C2ConfoList[participantID] = this.currentCallList[index];
@@ -4874,6 +4879,7 @@ class DialboxComponent {
4874
4879
  incomingCallData = incomingCallData?.length > 0
4875
4880
  ? incomingCallData.filter((item) => item.participants?.length > 0)
4876
4881
  : [];
4882
+ console.log('244', incomingCallData);
4877
4883
  // All conferenceIds received from socket this tick
4878
4884
  const socketConferenceIds = incomingCallData.map((c) => c.conferenceId);
4879
4885
  incomingCallData.forEach((callInfo) => {
@@ -4901,11 +4907,14 @@ class DialboxComponent {
4901
4907
  }
4902
4908
  }
4903
4909
  });
4910
+ console.log('incomingCallsList 275', this.incomingCallsList);
4904
4911
  // Remove active-call entries whose conferenceId is no longer in the socket
4905
4912
  // but keep incoming-call notifications (they are managed by notificationCallList expiry)
4906
4913
  this.incomingCallsList = this.incomingCallsList.filter((res) => socketConferenceIds.includes(res.conferenceId) || res.direction === 'incoming-call');
4914
+ console.log('incomingCallsList 281', this.incomingCallsList);
4907
4915
  // Remove expired notification entries
4908
4916
  this.notificationCallList = this.notificationCallList.filter((res) => res.endTime >= new Date().getTime());
4917
+ console.log('notificationCallList 286', this.notificationCallList, this.incomingCallsList);
4909
4918
  // Merge notificationCallList ONCE (not inside forEach). A pending incoming-call
4910
4919
  // notification is identified by its OWN participantId — never by conferenceId —
4911
4920
  // because it can legitimately share the conferenceId of a conference we are already
@@ -4914,8 +4923,10 @@ class DialboxComponent {
4914
4923
  const existingNotificationParticipantIds = new Set(this.incomingCallsList
4915
4924
  .filter((r) => r?._isNotification)
4916
4925
  .map((r) => r?.participantId));
4926
+ console.log('existingNotificationParticipantIds 296', existingNotificationParticipantIds);
4917
4927
  const notificationsToAdd = this.notificationCallList.filter((n) => !existingNotificationParticipantIds.has(n?.participantId));
4918
4928
  this.incomingCallsList = [...this.incomingCallsList, ...notificationsToAdd];
4929
+ console.log('incomingCallsList 305', this.incomingCallsList, notificationsToAdd);
4919
4930
  // Final deduplication. Active conference entries are keyed by conferenceId (socket data
4920
4931
  // wins — last write wins). Pending incoming-call notifications are keyed in a SEPARATE
4921
4932
  // namespace by participantId, so a notification and an active conference that share the
@@ -4927,11 +4938,13 @@ class DialboxComponent {
4927
4938
  : `conf:${item?.conferenceId}`;
4928
4939
  seen.set(key, item);
4929
4940
  }
4941
+ console.log('incomingCallsList 320', this.incomingCallsList, Array.from(seen.values()));
4930
4942
  let finalList = Array.from(seen.values());
4931
4943
  // Remove any notification entry if an active conference with the same conferenceId already exists
4932
4944
  // added for 7472 bug
4933
4945
  const activeConferenceIds = new Set(finalList.filter((item) => !item._isNotification).map((item) => item.conferenceId));
4934
4946
  finalList = finalList.filter((item) => !(item._isNotification && activeConferenceIds.has(item.conferenceId)));
4947
+ console.log('incomingCallsList 33=0', this.incomingCallsList, finalList);
4935
4948
  this.incomingCallsList = finalList;
4936
4949
  if (this.incomingCallsList?.length && incomingCallData?.length) {
4937
4950
  this.isCallInProgress = true;
@@ -4959,9 +4972,9 @@ class DialboxComponent {
4959
4972
  }, 2000);
4960
4973
  }
4961
4974
  }
4962
- if (!this.incomingCallsList?.length && !this.twilioService.acceptedCallList?.length) {
4975
+ if (!this.incomingCallsList?.length) {
4963
4976
  setTimeout(() => {
4964
- if (!this.incomingCallsList?.length && !this.twilioService.acceptedCallList?.length) {
4977
+ if (!this.incomingCallsList?.length) {
4965
4978
  this.isCallInProgress = false;
4966
4979
  this.twilioService.device?.disconnectAll();
4967
4980
  this.twilioService.spareDevice?.disconnectAll();
@@ -5166,10 +5179,10 @@ class DialboxComponent {
5166
5179
  this.incomingCallsList.splice(incomingCallIndex, 1);
5167
5180
  this.incomeingCallSocketService.pause();
5168
5181
  this.cdk.detectChanges();
5169
- if (!this.incomingCallsList?.length) {
5170
- console.log('407');
5171
- this.isCallInProgress = false;
5172
- }
5182
+ // if (!this.incomingCallsList?.length) {
5183
+ // console.log('407');
5184
+ // this.isCallInProgress = false;
5185
+ // }
5173
5186
  }
5174
5187
  if (this.connectingIncomingCallId == snapshot?.data?.data?.recordId || this.connectingIncomingCallId == snapshot?.data?.data?.participantId && snapshot?.data?.data?.status != "accepted") {
5175
5188
  // swal("Error", 'Internal Server Error', "error");