@vgroup/dialbox 0.1.18 → 0.1.20
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.
- package/esm2020/lib/components/call-progress/incoming-call/incoming-call.component.mjs +38 -16
- package/esm2020/lib/service/twilio.service.mjs +2 -1
- package/fesm2015/vgroup-dialbox.mjs +43 -17
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +39 -16
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/components/call-progress/incoming-call/incoming-call.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1430,6 +1430,7 @@ class TwilioService {
|
|
|
1430
1430
|
console.log("device created");
|
|
1431
1431
|
this.device.register();
|
|
1432
1432
|
this.device.on('incoming', (call) => {
|
|
1433
|
+
console.log("incoming call", call);
|
|
1433
1434
|
this.currentCall.next(call);
|
|
1434
1435
|
this.callType.next('INCOMING');
|
|
1435
1436
|
this.currentCallState.next('incoming');
|
|
@@ -1621,25 +1622,47 @@ class IncomingCallComponent {
|
|
|
1621
1622
|
}
|
|
1622
1623
|
});
|
|
1623
1624
|
}
|
|
1624
|
-
rejectCallFromList(data) {
|
|
1625
|
+
async rejectCallFromList(data) {
|
|
1625
1626
|
if (!data)
|
|
1626
1627
|
return;
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
if
|
|
1641
|
-
|
|
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]);
|
|
1642
1664
|
}
|
|
1665
|
+
this.closeIncomingCallDiv.emit({ show: 0, call: data });
|
|
1643
1666
|
}
|
|
1644
1667
|
}
|
|
1645
1668
|
closeIncomingCallWrapper(val) {
|