@vgroup/dialbox 0.7.82 → 0.7.84

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.
@@ -1597,6 +1597,11 @@ class TwilioService {
1597
1597
  this.refreshDeviceToken();
1598
1598
  });
1599
1599
  device.on('incoming', (call) => {
1600
+ const incomingCallSid = call?.parameters?.['CallSid'];
1601
+ if (incomingCallSid && this.incomingCallsMap.has(incomingCallSid)) {
1602
+ console.log('primary device: duplicate incoming for already-tracked call, ignoring', incomingCallSid);
1603
+ return;
1604
+ }
1600
1605
  console.log('Twilio Device incoming call event:', call);
1601
1606
  const notification = this.buildIncomingNotification(call);
1602
1607
  this.incomingCallNotification.next(notification);
@@ -1912,8 +1917,15 @@ class TwilioService {
1912
1917
  if (spare._ownsAcceptedCall || spare._pendingIncomingCall) {
1913
1918
  return;
1914
1919
  }
1915
- spare._pendingIncomingCall = call;
1916
1920
  const callSid = call?.parameters?.['CallSid'];
1921
+ // Same shared-identity fan-out guard as the primary device's 'incoming' handler:
1922
+ // if another Device already claimed this CallSid, this is a duplicate leg of
1923
+ // the same call, not a genuinely new concurrent call — ignore it.
1924
+ if (callSid && this.incomingCallsMap.has(callSid)) {
1925
+ console.log('spare device: duplicate incoming for already-tracked call, ignoring', callSid);
1926
+ return;
1927
+ }
1928
+ spare._pendingIncomingCall = call;
1917
1929
  // Transition this spare from "free" → "pending": remove it as the active
1918
1930
  // spareDevice and track it by CallSid so onConcurrentCallAccepted can find it.
1919
1931
  if (this.spareDevice === spare) {
@@ -2481,7 +2493,7 @@ class CallProgressComponent {
2481
2493
  this.conferenceCallNullCount = 0;
2482
2494
  }
2483
2495
  else {
2484
- if (this.conferenceCallNullCount > 5) {
2496
+ if (this.conferenceCallNullCount > 5 && !this.twilioService.acceptedCallList?.length) {
2485
2497
  console.log('Call end in 299');
2486
2498
  this.isRinging = false;
2487
2499
  this.isConcurrentIncoming = false;
@@ -2670,7 +2682,7 @@ class CallProgressComponent {
2670
2682
  this.conferenceCallNullCount = 0;
2671
2683
  }
2672
2684
  else if (!this.newIncomingCallsList?.length) {
2673
- if (this.conferenceCallNullCount > 5) {
2685
+ if (this.conferenceCallNullCount > 5 && !this.twilioService.acceptedCallList?.length) {
2674
2686
  console.log('411');
2675
2687
  this.isRinging = false;
2676
2688
  this.isConcurrentIncoming = false;
@@ -4912,7 +4924,7 @@ class DialboxComponent {
4912
4924
  }
4913
4925
  if (!this.incomingCallsList?.length) {
4914
4926
  setTimeout(() => {
4915
- if (!this.incomingCallsList?.length) {
4927
+ if (!this.incomingCallsList?.length && !this.twilioService.acceptedCallList?.length) {
4916
4928
  this.isCallInProgress = false;
4917
4929
  this.twilioService.device?.disconnectAll();
4918
4930
  }