@vgroup/dialbox 0.7.83 → 0.7.85

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.
@@ -1594,6 +1594,11 @@ class TwilioService {
1594
1594
  this.refreshDeviceToken();
1595
1595
  });
1596
1596
  device.on('incoming', (call) => {
1597
+ const incomingCallSid = call?.parameters?.['CallSid'];
1598
+ if (incomingCallSid && this.incomingCallsMap.has(incomingCallSid)) {
1599
+ console.log('primary device: duplicate incoming for already-tracked call, ignoring', incomingCallSid);
1600
+ return;
1601
+ }
1597
1602
  console.log('Twilio Device incoming call event:', call);
1598
1603
  const notification = this.buildIncomingNotification(call);
1599
1604
  this.incomingCallNotification.next(notification);
@@ -1909,8 +1914,15 @@ class TwilioService {
1909
1914
  if (spare._ownsAcceptedCall || spare._pendingIncomingCall) {
1910
1915
  return;
1911
1916
  }
1912
- spare._pendingIncomingCall = call;
1913
1917
  const callSid = call?.parameters?.['CallSid'];
1918
+ // Same shared-identity fan-out guard as the primary device's 'incoming' handler:
1919
+ // if another Device already claimed this CallSid, this is a duplicate leg of
1920
+ // the same call, not a genuinely new concurrent call — ignore it.
1921
+ if (callSid && this.incomingCallsMap.has(callSid)) {
1922
+ console.log('spare device: duplicate incoming for already-tracked call, ignoring', callSid);
1923
+ return;
1924
+ }
1925
+ spare._pendingIncomingCall = call;
1914
1926
  // Transition this spare from "free" → "pending": remove it as the active
1915
1927
  // spareDevice and track it by CallSid so onConcurrentCallAccepted can find it.
1916
1928
  if (this.spareDevice === spare) {
@@ -2478,7 +2490,7 @@ class CallProgressComponent {
2478
2490
  this.conferenceCallNullCount = 0;
2479
2491
  }
2480
2492
  else {
2481
- if (this.conferenceCallNullCount > 5) {
2493
+ if (this.conferenceCallNullCount > 5 && !this.twilioService.acceptedCallList?.length) {
2482
2494
  console.log('Call end in 299');
2483
2495
  this.isRinging = false;
2484
2496
  this.isConcurrentIncoming = false;
@@ -2667,7 +2679,7 @@ class CallProgressComponent {
2667
2679
  this.conferenceCallNullCount = 0;
2668
2680
  }
2669
2681
  else if (!this.newIncomingCallsList?.length) {
2670
- if (this.conferenceCallNullCount > 5) {
2682
+ if (this.conferenceCallNullCount > 5 && !this.twilioService.acceptedCallList?.length) {
2671
2683
  console.log('411');
2672
2684
  this.isRinging = false;
2673
2685
  this.isConcurrentIncoming = false;
@@ -4909,7 +4921,7 @@ class DialboxComponent {
4909
4921
  }
4910
4922
  if (!this.incomingCallsList?.length) {
4911
4923
  setTimeout(() => {
4912
- if (!this.incomingCallsList?.length) {
4924
+ if (!this.incomingCallsList?.length && !this.twilioService.acceptedCallList?.length) {
4913
4925
  this.isCallInProgress = false;
4914
4926
  this.twilioService.device?.disconnectAll();
4915
4927
  }