@vgroup/dialbox 0.1.20 → 0.1.21

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.
@@ -1622,47 +1622,25 @@ class IncomingCallComponent {
1622
1622
  }
1623
1623
  });
1624
1624
  }
1625
- async rejectCallFromList(data) {
1625
+ rejectCallFromList(data) {
1626
1626
  if (!data)
1627
1627
  return;
1628
- try {
1629
- // First try to reject the call if it's incoming
1630
- if (typeof data.reject === 'function') {
1631
- data.reject();
1632
- }
1633
- // If reject doesn't work (e.g., for connected calls), try disconnect
1634
- else if (typeof data.disconnect === 'function') {
1635
- data.disconnect();
1636
- }
1637
- // Update call parameters
1638
- if (data.parameters) {
1639
- data.parameters['isCallConnected'] = false;
1640
- }
1641
- // Send call status update if we have auth ID
1642
- if (data.customParameters) {
1643
- const twilioAuthId = data.customParameters.get('twilioAuthId');
1644
- if (twilioAuthId) {
1645
- await this.sendIPforIncomingCall(twilioAuthId, 'completed');
1646
- }
1647
- }
1648
- // Remove call from the list
1649
- if (this.newIncomingCallsList && data.parameters?.CallSid) {
1650
- this.newIncomingCallsList = this.newIncomingCallsList.filter((item) => item.parameters?.CallSid !== data.parameters.CallSid);
1651
- this.incomingCallsNewList.emit([...this.newIncomingCallsList]);
1652
- // Close the UI if no more calls
1653
- if (this.newIncomingCallsList.length === 0) {
1654
- this.closeIncomingCallDiv.emit({ show: 0, call: data });
1655
- }
1656
- }
1657
- }
1658
- catch (error) {
1659
- console.error('Error rejecting call:', error);
1660
- // Even if there's an error, try to clean up the UI
1661
- if (this.newIncomingCallsList && data.parameters?.CallSid) {
1662
- this.newIncomingCallsList = this.newIncomingCallsList.filter((item) => item.parameters?.CallSid !== data.parameters.CallSid);
1663
- this.incomingCallsNewList.emit([...this.newIncomingCallsList]);
1628
+ if (data.reject)
1629
+ data.reject();
1630
+ if (data.disconnect)
1631
+ data.disconnect();
1632
+ if (data.parameters) {
1633
+ data.parameters['isCallConnected'] = false; // Should be false when rejecting
1634
+ }
1635
+ if (data.customParameters) {
1636
+ this.sendIPforIncomingCall(data.customParameters.get('twilioAuthId'), 'answered');
1637
+ }
1638
+ if (this.newIncomingCallsList && data && data.parameters && data.parameters.CallSid) {
1639
+ this.newIncomingCallsList = this.newIncomingCallsList.filter((item) => item.parameters && item.parameters.CallSid !== data.parameters.CallSid);
1640
+ this.incomingCallsNewList.emit(this.newIncomingCallsList);
1641
+ if (this.newIncomingCallsList.length == 0) {
1642
+ this.closeIncomingCallDiv.emit({ show: 0, call: data });
1664
1643
  }
1665
- this.closeIncomingCallDiv.emit({ show: 0, call: data });
1666
1644
  }
1667
1645
  }
1668
1646
  closeIncomingCallWrapper(val) {