@vgroup/dialbox 0.7.96 → 0.7.98

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.
@@ -2511,6 +2511,10 @@ class CallProgressComponent {
2511
2511
  this.showContactsPanel = false;
2512
2512
  // No call in progress: reset the incoming-mute switch back to default (off).
2513
2513
  this.twilioService.setIncomingMuted(false);
2514
+ // Call has fully ended: close the minimized bar too, otherwise its
2515
+ // mic/end-call buttons keep showing for a call that no longer exists.
2516
+ this.isMinimised = false;
2517
+ this.minimiseEvent.emit(false);
2514
2518
  // this.isUnholdConferenceCall = false;
2515
2519
  this.currentCallList = [];
2516
2520
  this.currentCall = {};
@@ -2708,6 +2712,10 @@ class CallProgressComponent {
2708
2712
  this.isConferenceCallHold = false;
2709
2713
  // No call in progress: reset the incoming-mute switch back to default (off).
2710
2714
  this.twilioService.setIncomingMuted(false);
2715
+ // Call has fully ended: close the minimized bar too, otherwise its
2716
+ // mic/end-call buttons keep showing for a call that no longer exists.
2717
+ this.isMinimised = false;
2718
+ this.minimiseEvent.emit(false);
2711
2719
  this.stopTimer();
2712
2720
  this.cdr.detectChanges();
2713
2721
  }
@@ -2747,13 +2755,13 @@ class CallProgressComponent {
2747
2755
  && resData?.client && resData?.direction == 'outgoing-call') || (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call' && !resData?.businessNumber && resData?.host) && resData?.isLeft));
2748
2756
  this.showRingAnimation = true;
2749
2757
  // 1️⃣ Get new token for same conference
2750
- const tokenData = rejoinParticipentInfo?.hostToken || await this.getOutgoingCallToken(callInfo?.conferenceId);
2758
+ const tokenData = rejoinParticipentInfo?.hostToken;
2751
2759
  // 2️⃣ Reconnect device
2752
2760
  const options = {
2753
2761
  codecPreferences: ['opus', 'pcmu'],
2754
2762
  closeProtection: true,
2755
2763
  };
2756
- this.device = new Device(tokenData.token.value, options);
2764
+ this.device = new Device(tokenData, options);
2757
2765
  this.call = await this.device.connect({
2758
2766
  params: {
2759
2767
  From: rejoinParticipentInfo.from,
@@ -3533,6 +3541,20 @@ class CallProgressComponent {
3533
3541
  callToAccept.on('reject', () => {
3534
3542
  handleTwilioConnectFailure('Call could not be connected.');
3535
3543
  });
3544
+ // Registered immediately (not after the accept() -> setIncomingCallStatus BE
3545
+ // round-trip below) so a far-end hangup landing in that window can't race past
3546
+ // this listener. If it did, acceptedCallList would stay non-empty forever, which
3547
+ // permanently blocks teardownSpareDevicesIfIdle(), the idle device.disconnectAll()
3548
+ // reset in dialbox.component.ts, and twilioService's self-recovery guards.
3549
+ const acceptedSid = callToAccept.parameters?.CallSid;
3550
+ callToAccept.on('disconnect', () => {
3551
+ if (acceptedSid) {
3552
+ this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== acceptedSid);
3553
+ this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== acceptedSid);
3554
+ this.twilioService.releaseConcurrentCallDevice(acceptedSid);
3555
+ }
3556
+ this.twilioService.teardownSpareDevicesIfIdle();
3557
+ });
3536
3558
  callToAccept.on('accept', () => {
3537
3559
  console.log('call accepted sucessfully !!!!!!!');
3538
3560
  if (isTwilioConnectSettled)
@@ -3565,15 +3587,6 @@ class CallProgressComponent {
3565
3587
  this.twilioService.isConnectingIncomingCallId.next('');
3566
3588
  this.incomeingCallSocketService.pause();
3567
3589
  this.twilioService.onConcurrentCallAccepted(callToAccept);
3568
- const acceptedSid = callToAccept.parameters?.CallSid;
3569
- callToAccept.on('disconnect', () => {
3570
- if (acceptedSid) {
3571
- this.acceptedCallList = this.acceptedCallList.filter(c => c.callSid !== acceptedSid);
3572
- this.twilioService.acceptedCallList = this.twilioService.acceptedCallList.filter((c) => c.parameters?.CallSid !== acceptedSid);
3573
- this.twilioService.releaseConcurrentCallDevice(acceptedSid);
3574
- }
3575
- this.twilioService.teardownSpareDevicesIfIdle();
3576
- });
3577
3590
  this.cdr.detectChanges();
3578
3591
  }
3579
3592
  else {
@@ -4875,13 +4888,13 @@ class DialboxComponent {
4875
4888
  }
4876
4889
  // Filter out conferences with no participants
4877
4890
  incomingCallData = incomingCallData?.length > 0
4878
- ? incomingCallData.filter((item) => item.participants?.length > 0 && item.callSource == 'Dialpad')
4891
+ ? incomingCallData.filter((item) => item.participants?.length > 0)
4879
4892
  : [];
4880
4893
  // All conferenceIds received from socket this tick
4881
4894
  const socketConferenceIds = incomingCallData.map((c) => c.conferenceId);
4882
4895
  incomingCallData.forEach((callInfo) => {
4883
4896
  // Check if WE are an active participant in this conference
4884
- const ourNumber = callInfo?.participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.direction == 'outgoing-call' && resData?.client) ||
4897
+ const ourNumber = callInfo?.participants.find((resData) => ((this.deviceNumberList.includes(resData?.from) && resData?.direction == 'outgoing-call' && resData?.client && (resData?.host && callInfo.callSource == 'Dialpad' || !resData?.host)) ||
4885
4898
  (this.deviceNumberList.includes(resData?.to) && resData?.direction == 'incoming-call' && resData?.client)) && !resData?.isLeft);
4886
4899
  // Match the ACTIVE conference entry only — never a pending incoming-call
4887
4900
  // notification, which can share this conferenceId but must not be overwritten