@vgroup/dialbox 0.1.26 → 0.1.27
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 +9 -25
- package/esm2020/lib/service/twilio.service.mjs +8 -1
- package/fesm2015/vgroup-dialbox.mjs +15 -24
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +15 -24
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/components/call-progress/incoming-call/incoming-call.component.d.ts +0 -1
- package/lib/service/twilio.service.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1372,6 +1372,8 @@ class TwilioService {
|
|
|
1372
1372
|
this.notificationSerivce = notificationSerivce;
|
|
1373
1373
|
this.openInProgressDialpad = new BehaviorSubject(false);
|
|
1374
1374
|
this.currentCall = new BehaviorSubject(null);
|
|
1375
|
+
this.incomingCalls = new BehaviorSubject([]);
|
|
1376
|
+
this.incomingCalls$ = this.incomingCalls.asObservable();
|
|
1375
1377
|
this.currentCallState = new BehaviorSubject('none'); //in-progress, out-progress, none
|
|
1376
1378
|
this.callType = new BehaviorSubject('NIL');
|
|
1377
1379
|
this.isIncomingCallPicked = new BehaviorSubject(false); // for both incoming and outgoing
|
|
@@ -1456,12 +1458,17 @@ class TwilioService {
|
|
|
1456
1458
|
if (callSid && !this.processedCallSids.has(callSid)) {
|
|
1457
1459
|
this.processedCallSids.add(callSid);
|
|
1458
1460
|
console.log('New incoming call:', callSid);
|
|
1461
|
+
const currentCalls = this.incomingCalls.getValue();
|
|
1462
|
+
this.incomingCalls.next([...currentCalls, call]);
|
|
1463
|
+
// The original currentCall can still represent the most recent call for single-call contexts
|
|
1459
1464
|
this.currentCall.next(call);
|
|
1460
1465
|
this.callType.next('INCOMING');
|
|
1461
1466
|
this.currentCallState.next('incoming');
|
|
1462
1467
|
this.notificationSerivce.showNotification(call);
|
|
1463
1468
|
const callEndHandler = () => {
|
|
1464
1469
|
this.processedCallSids.delete(callSid);
|
|
1470
|
+
const currentCalls = this.incomingCalls.getValue().filter(c => c.parameters['CallSid'] !== callSid);
|
|
1471
|
+
this.incomingCalls.next(currentCalls);
|
|
1465
1472
|
call.off('disconnect', callEndHandler);
|
|
1466
1473
|
call.off('cancel', callEndHandler);
|
|
1467
1474
|
};
|
|
@@ -1603,9 +1610,14 @@ class IncomingCallComponent {
|
|
|
1603
1610
|
}
|
|
1604
1611
|
ngOnInit() {
|
|
1605
1612
|
try {
|
|
1606
|
-
this.twilioService.
|
|
1607
|
-
|
|
1608
|
-
|
|
1613
|
+
this.twilioService.incomingCalls$.subscribe(calls => {
|
|
1614
|
+
this.newIncomingCallsList = calls;
|
|
1615
|
+
this.incomingCallsNewList.emit(this.newIncomingCallsList);
|
|
1616
|
+
if (calls.length > 0 && !this.twilioCallData) {
|
|
1617
|
+
const firstCall = calls[0];
|
|
1618
|
+
this.twilioCallData = firstCall;
|
|
1619
|
+
this.twilioAuthId = firstCall.customParameters.get('twilioAuthId');
|
|
1620
|
+
this.sendIPforIncomingCall(this.twilioAuthId, '');
|
|
1609
1621
|
}
|
|
1610
1622
|
});
|
|
1611
1623
|
}
|
|
@@ -1613,27 +1625,6 @@ class IncomingCallComponent {
|
|
|
1613
1625
|
console.log(e);
|
|
1614
1626
|
}
|
|
1615
1627
|
}
|
|
1616
|
-
addCallToList(call) {
|
|
1617
|
-
if (!this.newIncomingCallsList) {
|
|
1618
|
-
this.newIncomingCallsList = [];
|
|
1619
|
-
}
|
|
1620
|
-
const callSid = call.parameters['CallSid'];
|
|
1621
|
-
const existingCall = this.newIncomingCallsList.find((c) => c.parameters['CallSid'] === callSid);
|
|
1622
|
-
if (!existingCall) {
|
|
1623
|
-
this.newIncomingCallsList.push(call);
|
|
1624
|
-
this.incomingCallsNewList.emit([...this.newIncomingCallsList]);
|
|
1625
|
-
if (!this.twilioCallData) {
|
|
1626
|
-
this.twilioCallData = call;
|
|
1627
|
-
this.twilioAuthId = call.customParameters.get('twilioAuthId');
|
|
1628
|
-
this.sendIPforIncomingCall(this.twilioAuthId, '');
|
|
1629
|
-
}
|
|
1630
|
-
call.on('cancel', () => this.removeCallFromList(callSid));
|
|
1631
|
-
call.on('disconnect', () => this.removeCallFromList(callSid));
|
|
1632
|
-
}
|
|
1633
|
-
else {
|
|
1634
|
-
console.log('Call already in list, not adding again.');
|
|
1635
|
-
}
|
|
1636
|
-
}
|
|
1637
1628
|
acceptCallFromList(data) {
|
|
1638
1629
|
data.accept();
|
|
1639
1630
|
// data.parameters['isCallConnected'] = true;
|