@vgroup/dialbox 0.1.34 → 0.1.36

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.
@@ -1609,22 +1609,28 @@ class IncomingCallComponent {
1609
1609
  }
1610
1610
  }
1611
1611
  acceptCallFromList(data) {
1612
- data.accept();
1613
- // data.parameters['isCallConnected'] = true;
1614
- const isFirstCall = this.newIncomingCallsList.find((item) => item.isFirstCall);
1615
- if (isFirstCall && isFirstCall.isCallConnected) {
1616
- isFirstCall.disconnect();
1612
+ if (!data) {
1613
+ return;
1614
+ }
1615
+ // Disconnect any other connected call before accepting this one
1616
+ if (this.newIncomingCallsList && this.newIncomingCallsList.length) {
1617
+ const otherConnected = this.newIncomingCallsList.find((item) => item.isCallConnected && item !== data);
1618
+ if (otherConnected) {
1619
+ try {
1620
+ otherConnected.disconnect();
1621
+ }
1622
+ catch { }
1623
+ otherConnected.isCallConnected = false;
1624
+ otherConnected.isFirstCall = false;
1625
+ }
1617
1626
  }
1627
+ // Accept this call and mark as the active one
1628
+ data.accept();
1618
1629
  data.isCallConnected = true;
1630
+ data.isFirstCall = true;
1619
1631
  this.sendIPforIncomingCall(data.customParameters.get('twilioAuthId'), 'answered').then(() => {
1620
- if (this.shouldRecordCall) { // default recording
1621
- this.extensionService.setCallSid(this.CallSid, this.recordCall);
1622
- this.closeIncomingCallWrapper(1);
1623
- }
1624
- else { // manual recording
1625
- this.extensionService.setCallSid(this.CallSid, this.recordCall);
1626
- this.closeIncomingCallWrapper(1);
1627
- }
1632
+ this.extensionService.setCallSid(this.CallSid, this.recordCall);
1633
+ this.closeIncomingCallWrapper(1);
1628
1634
  });
1629
1635
  }
1630
1636
  rejectCallFromList(data) {
@@ -2441,12 +2447,12 @@ class DialboxComponent {
2441
2447
  // }
2442
2448
  if (incomingCallData) {
2443
2449
  if (this.isCallInProgress) {
2444
- incomingCallData['isFirstCall'] = true;
2445
2450
  this.newIncomingCalls.push(incomingCallData);
2446
2451
  console.log('325', incomingCallData);
2447
2452
  this.getUserInformation(incomingCallData);
2448
2453
  }
2449
2454
  else {
2455
+ incomingCallData['isFirstCall'] = true;
2450
2456
  this.isCallInProgress = true;
2451
2457
  this.isDialpadHidden = false;
2452
2458
  this.callData.phone = incomingCallData.parameters['From'];