@vgroup/dialbox 0.1.22 → 0.1.24
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/call-progress.component.mjs +4 -1
- package/esm2020/lib/components/call-progress/incoming-call/incoming-call.component.mjs +38 -69
- package/fesm2015/vgroup-dialbox.mjs +40 -70
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +40 -68
- 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
|
@@ -1573,42 +1573,32 @@ class IncomingCallComponent {
|
|
|
1573
1573
|
this.selectedIncomingCallInfo = new EventEmitter();
|
|
1574
1574
|
}
|
|
1575
1575
|
ngOnInit() {
|
|
1576
|
-
// this.twilioService.currentCall.subscribe((call: any) => {
|
|
1577
|
-
// if (call) {
|
|
1578
|
-
// this.twilioCallData = call;
|
|
1579
|
-
// this.notificationSerivce.showNotification(call);
|
|
1580
|
-
// // Handle the call UI
|
|
1581
|
-
// }
|
|
1582
|
-
// });
|
|
1583
1576
|
try {
|
|
1584
1577
|
this.twilioService.currentCall.subscribe(call => {
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
if (!callSid)
|
|
1589
|
-
return;
|
|
1590
|
-
// Check if this call already exists in the list
|
|
1591
|
-
const callExists = (_b = this.newIncomingCallsList) === null || _b === void 0 ? void 0 : _b.some((item) => { var _a; return ((_a = item.parameters) === null || _a === void 0 ? void 0 : _a['CallSid']) === callSid; });
|
|
1592
|
-
if (callExists) {
|
|
1593
|
-
console.log('Call already exists in the list:', callSid);
|
|
1594
|
-
return;
|
|
1578
|
+
if (call && call.parameters['CallSid']) {
|
|
1579
|
+
if (!this.newIncomingCallsList) {
|
|
1580
|
+
this.newIncomingCallsList = [];
|
|
1595
1581
|
}
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
if (!
|
|
1599
|
-
call
|
|
1582
|
+
const callSid = call.parameters['CallSid'];
|
|
1583
|
+
const existingCall = this.newIncomingCallsList.find((c) => c.parameters['CallSid'] === callSid);
|
|
1584
|
+
if (!existingCall) {
|
|
1585
|
+
this.newIncomingCallsList.push(call);
|
|
1586
|
+
this.incomingCallsNewList.emit(this.newIncomingCallsList);
|
|
1587
|
+
if (!this.twilioCallData) {
|
|
1588
|
+
this.twilioCallData = call;
|
|
1589
|
+
this.twilioAuthId = call.customParameters.get('twilioAuthId');
|
|
1590
|
+
if (!call.parameters) {
|
|
1591
|
+
call.parameters = {};
|
|
1592
|
+
}
|
|
1593
|
+
this.sendIPforIncomingCall(this.twilioAuthId, '');
|
|
1594
|
+
}
|
|
1595
|
+
call.on('cancel', () => {
|
|
1596
|
+
this.removeCallFromList(callSid);
|
|
1597
|
+
});
|
|
1598
|
+
call.on('disconnect', () => {
|
|
1599
|
+
this.removeCallFromList(callSid);
|
|
1600
|
+
});
|
|
1600
1601
|
}
|
|
1601
|
-
// Add call to the list
|
|
1602
|
-
this.newIncomingCallsList = [...(this.newIncomingCallsList || []), call];
|
|
1603
|
-
this.incomingCallsNewList.emit(this.newIncomingCallsList);
|
|
1604
|
-
this.sendIPforIncomingCall(this.twilioAuthId, '');
|
|
1605
|
-
// Set up event handlers for the call
|
|
1606
|
-
call.on('cancel', () => {
|
|
1607
|
-
this.handleCallEnd(call, callSid);
|
|
1608
|
-
});
|
|
1609
|
-
call.on('disconnect', () => {
|
|
1610
|
-
this.handleCallEnd(call, callSid);
|
|
1611
|
-
});
|
|
1612
1602
|
}
|
|
1613
1603
|
});
|
|
1614
1604
|
}
|
|
@@ -1631,53 +1621,30 @@ class IncomingCallComponent {
|
|
|
1631
1621
|
}
|
|
1632
1622
|
});
|
|
1633
1623
|
}
|
|
1634
|
-
|
|
1635
|
-
handleCallEnd(call, callSid) {
|
|
1636
|
-
if (!callSid)
|
|
1637
|
-
return;
|
|
1638
|
-
// Remove call from the list
|
|
1624
|
+
removeCallFromList(callSid) {
|
|
1639
1625
|
if (this.newIncomingCallsList) {
|
|
1640
|
-
this.newIncomingCallsList = this.newIncomingCallsList.filter((
|
|
1641
|
-
this.incomingCallsNewList.emit(
|
|
1642
|
-
// Close UI if no more calls
|
|
1626
|
+
this.newIncomingCallsList = this.newIncomingCallsList.filter((c) => c.parameters['CallSid'] !== callSid);
|
|
1627
|
+
this.incomingCallsNewList.emit(this.newIncomingCallsList);
|
|
1643
1628
|
if (this.newIncomingCallsList.length === 0) {
|
|
1644
|
-
this.closeIncomingCallDiv.emit({ show: 0, call });
|
|
1629
|
+
this.closeIncomingCallDiv.emit({ show: 0, call: null });
|
|
1645
1630
|
}
|
|
1646
1631
|
}
|
|
1647
1632
|
}
|
|
1648
1633
|
rejectCallFromList(data) {
|
|
1649
|
-
var _a;
|
|
1650
1634
|
if (!data)
|
|
1651
1635
|
return;
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
data.reject();
|
|
1659
|
-
}
|
|
1660
|
-
else if (typeof data.disconnect === 'function') {
|
|
1661
|
-
data.disconnect();
|
|
1662
|
-
}
|
|
1663
|
-
// Update call status
|
|
1664
|
-
if (data.parameters) {
|
|
1665
|
-
data.parameters['isCallConnected'] = false;
|
|
1666
|
-
}
|
|
1667
|
-
// Update call status on the server
|
|
1668
|
-
if (data.customParameters) {
|
|
1669
|
-
const twilioAuthId = data.customParameters.get('twilioAuthId');
|
|
1670
|
-
if (twilioAuthId) {
|
|
1671
|
-
this.sendIPforIncomingCall(twilioAuthId, 'completed');
|
|
1672
|
-
}
|
|
1673
|
-
}
|
|
1674
|
-
// Remove call from the list
|
|
1675
|
-
this.handleCallEnd(data, callSid);
|
|
1636
|
+
if (data.reject)
|
|
1637
|
+
data.reject();
|
|
1638
|
+
if (data.disconnect)
|
|
1639
|
+
data.disconnect();
|
|
1640
|
+
if (data.parameters) {
|
|
1641
|
+
data.parameters['isCallConnected'] = false; // Should be false when rejecting
|
|
1676
1642
|
}
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1643
|
+
if (data.customParameters) {
|
|
1644
|
+
this.sendIPforIncomingCall(data.customParameters.get('twilioAuthId'), 'answered');
|
|
1645
|
+
}
|
|
1646
|
+
if (this.newIncomingCallsList && data && data.parameters && data.parameters.CallSid) {
|
|
1647
|
+
this.removeCallFromList(data.parameters.CallSid);
|
|
1681
1648
|
}
|
|
1682
1649
|
}
|
|
1683
1650
|
closeIncomingCallWrapper(val) {
|
|
@@ -2187,6 +2154,9 @@ class CallProgressComponent {
|
|
|
2187
2154
|
incomingCallsNewList(data) {
|
|
2188
2155
|
this.newIncomingCallsList = data;
|
|
2189
2156
|
this.incomingCallsNewInfo.emit(this.newIncomingCallsList);
|
|
2157
|
+
if (!data || data.length === 0) {
|
|
2158
|
+
this.incomingCallDiv = false;
|
|
2159
|
+
}
|
|
2190
2160
|
}
|
|
2191
2161
|
selectedIncomingCallInfo(data) {
|
|
2192
2162
|
this.selectedIncomingCall = data;
|