@vgroup/dialbox 0.7.96 → 0.7.97

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.
@@ -2464,6 +2464,10 @@ class CallProgressComponent {
2464
2464
  this.showContactsPanel = false;
2465
2465
  // No call in progress: reset the incoming-mute switch back to default (off).
2466
2466
  this.twilioService.setIncomingMuted(false);
2467
+ // Call has fully ended: close the minimized bar too, otherwise its
2468
+ // mic/end-call buttons keep showing for a call that no longer exists.
2469
+ this.isMinimised = false;
2470
+ this.minimiseEvent.emit(false);
2467
2471
  // this.isUnholdConferenceCall = false;
2468
2472
  this.currentCallList = [];
2469
2473
  this.currentCall = {};
@@ -2660,6 +2664,10 @@ class CallProgressComponent {
2660
2664
  this.isConferenceCallHold = false;
2661
2665
  // No call in progress: reset the incoming-mute switch back to default (off).
2662
2666
  this.twilioService.setIncomingMuted(false);
2667
+ // Call has fully ended: close the minimized bar too, otherwise its
2668
+ // mic/end-call buttons keep showing for a call that no longer exists.
2669
+ this.isMinimised = false;
2670
+ this.minimiseEvent.emit(false);
2663
2671
  this.stopTimer();
2664
2672
  this.cdr.detectChanges();
2665
2673
  }
@@ -2701,13 +2709,13 @@ class CallProgressComponent {
2701
2709
  && (resData === null || resData === void 0 ? void 0 : resData.client) && (resData === null || resData === void 0 ? void 0 : resData.direction) == 'outgoing-call') || (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.businessNumber) && (resData === null || resData === void 0 ? void 0 : resData.host)) && (resData === null || resData === void 0 ? void 0 : resData.isLeft)));
2702
2710
  this.showRingAnimation = true;
2703
2711
  // 1️⃣ Get new token for same conference
2704
- const tokenData = (rejoinParticipentInfo === null || rejoinParticipentInfo === void 0 ? void 0 : rejoinParticipentInfo.hostToken) || (yield this.getOutgoingCallToken(callInfo === null || callInfo === void 0 ? void 0 : callInfo.conferenceId));
2712
+ const tokenData = rejoinParticipentInfo === null || rejoinParticipentInfo === void 0 ? void 0 : rejoinParticipentInfo.hostToken;
2705
2713
  // 2️⃣ Reconnect device
2706
2714
  const options = {
2707
2715
  codecPreferences: ['opus', 'pcmu'],
2708
2716
  closeProtection: true,
2709
2717
  };
2710
- this.device = new Device(tokenData.token.value, options);
2718
+ this.device = new Device(tokenData, options);
2711
2719
  this.call = yield this.device.connect({
2712
2720
  params: {
2713
2721
  From: rejoinParticipentInfo.from,
@@ -3490,7 +3498,7 @@ class CallProgressComponent {
3490
3498
  this.isIncomingCallBtnDisable = true;
3491
3499
  this.cdr.detectChanges();
3492
3500
  let intervalId = setInterval(() => {
3493
- var _a, _b, _c, _d, _e, _f;
3501
+ var _a, _b, _c, _d, _e, _f, _g;
3494
3502
  const callToAccept = this.twilioService.getIncomingCallById(data === null || data === void 0 ? void 0 : data.clientSid);
3495
3503
  if ((_a = callToAccept === null || callToAccept === void 0 ? void 0 : callToAccept.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) {
3496
3504
  clearInterval(intervalId);
@@ -3542,6 +3550,20 @@ class CallProgressComponent {
3542
3550
  callToAccept.on('reject', () => {
3543
3551
  handleTwilioConnectFailure('Call could not be connected.');
3544
3552
  });
3553
+ // Registered immediately (not after the accept() -> setIncomingCallStatus BE
3554
+ // round-trip below) so a far-end hangup landing in that window can't race past
3555
+ // this listener. If it did, acceptedCallList would stay non-empty forever, which
3556
+ // permanently blocks teardownSpareDevicesIfIdle(), the idle device.disconnectAll()
3557
+ // reset in dialbox.component.ts, and twilioService's self-recovery guards.
3558
+ const acceptedSid = (_b = callToAccept.parameters) === null || _b === void 0 ? void 0 : _b.CallSid;
3559
+ callToAccept.on('disconnect', () => {
3560
+ if (acceptedSid) {
3561
+ this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== acceptedSid);
3562
+ this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => { var _a; return ((_a = c.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) !== acceptedSid; });
3563
+ this.twilioService.releaseConcurrentCallDevice(acceptedSid);
3564
+ }
3565
+ this.twilioService.teardownSpareDevicesIfIdle();
3566
+ });
3545
3567
  callToAccept.on('accept', () => {
3546
3568
  var _a;
3547
3569
  console.log('call accepted sucessfully !!!!!!!');
@@ -3564,7 +3586,7 @@ class CallProgressComponent {
3564
3586
  conferenceId: (data === null || data === void 0 ? void 0 : data.conferenceId) || 'no'
3565
3587
  };
3566
3588
  this.extensionService.setIncomingCallStatus(payload).subscribe((res) => __awaiter(this, void 0, void 0, function* () {
3567
- var _b, _c, _d, _e, _f;
3589
+ var _b, _c, _d, _e;
3568
3590
  if (res.status == 200) {
3569
3591
  this.isConnectingIncomingCallId = '';
3570
3592
  this.conferenceCallIDForParticipantList = data === null || data === void 0 ? void 0 : data.conferenceId;
@@ -3576,19 +3598,10 @@ class CallProgressComponent {
3576
3598
  this.twilioService.isConnectingIncomingCallId.next('');
3577
3599
  this.incomeingCallSocketService.pause();
3578
3600
  this.twilioService.onConcurrentCallAccepted(callToAccept);
3579
- const acceptedSid = (_c = callToAccept.parameters) === null || _c === void 0 ? void 0 : _c.CallSid;
3580
- callToAccept.on('disconnect', () => {
3581
- if (acceptedSid) {
3582
- this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== acceptedSid);
3583
- this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => { var _a; return ((_a = c.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) !== acceptedSid; });
3584
- this.twilioService.releaseConcurrentCallDevice(acceptedSid);
3585
- }
3586
- this.twilioService.teardownSpareDevicesIfIdle();
3587
- });
3588
3601
  this.cdr.detectChanges();
3589
3602
  }
3590
3603
  else {
3591
- const sid = (_d = callToAccept.parameters) === null || _d === void 0 ? void 0 : _d.CallSid;
3604
+ const sid = (_c = callToAccept.parameters) === null || _c === void 0 ? void 0 : _c.CallSid;
3592
3605
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);
3593
3606
  this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => { var _a; return ((_a = c.parameters) === null || _a === void 0 ? void 0 : _a.CallSid) !== sid; });
3594
3607
  this.twilioService.isConnectingIncomingCallId.next('');
@@ -3602,7 +3615,7 @@ class CallProgressComponent {
3602
3615
  this.incomeingCallSocketService.pause();
3603
3616
  this.endCallEvent.emit(data);
3604
3617
  this.cdr.detectChanges();
3605
- swal("Error", ((_f = (_e = res === null || res === void 0 ? void 0 : res.message) === null || _e === void 0 ? void 0 : _e.join) === null || _f === void 0 ? void 0 : _f.call(_e, "<br/>")) || 'Internal Server Error', "error");
3618
+ swal("Error", ((_e = (_d = res === null || res === void 0 ? void 0 : res.message) === null || _d === void 0 ? void 0 : _d.join) === null || _e === void 0 ? void 0 : _e.call(_d, "<br/>")) || 'Internal Server Error', "error");
3606
3619
  }
3607
3620
  setTimeout(() => {
3608
3621
  this.isUnholdConferenceCall = false;
@@ -3612,9 +3625,9 @@ class CallProgressComponent {
3612
3625
  callToAccept.accept();
3613
3626
  this.cdr.detectChanges();
3614
3627
  }
3615
- 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)) {
3628
+ else if (((_e = (_d = (_c = this.missCallInfo) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.data) === null || _e === void 0 ? void 0 : _e.recordId) == (data === null || data === void 0 ? void 0 : data.id) && !((_f = callToAccept.parameters) === null || _f === void 0 ? void 0 : _f.CallSid)) {
3616
3629
  clearInterval(intervalId);
3617
- const sid = (_f = callToAccept.parameters) === null || _f === void 0 ? void 0 : _f.CallSid;
3630
+ const sid = (_g = callToAccept.parameters) === null || _g === void 0 ? void 0 : _g.CallSid;
3618
3631
  this.isConnectingIncomingCallId = '';
3619
3632
  this.isConnectingIncomingCallId = '';
3620
3633
  this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== sid);