@vgroup/dialbox 0.0.48 → 0.0.49
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 +2 -1
- package/esm2020/lib/service/twilio.service.mjs +19 -47
- package/fesm2015/vgroup-dialbox.mjs +19 -46
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +19 -46
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1318,54 +1318,26 @@ class TwilioService {
|
|
|
1318
1318
|
this.initializeTwilioDevice();
|
|
1319
1319
|
}
|
|
1320
1320
|
initializeTwilioDevice() {
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
if (!this.token) {
|
|
1324
|
-
console.error('No token available for Twilio initialization');
|
|
1325
|
-
return;
|
|
1326
|
-
}
|
|
1327
|
-
this.extensionService.getIncomingCallToken().subscribe({
|
|
1328
|
-
next: (data) => {
|
|
1329
|
-
console.log('Received Twilio token');
|
|
1330
|
-
if (!data || !data.token) {
|
|
1331
|
-
console.error('Invalid token received from server');
|
|
1332
|
-
return;
|
|
1333
|
-
}
|
|
1321
|
+
if (this.token) {
|
|
1322
|
+
this.extensionService.getIncomingCallToken().subscribe((data) => {
|
|
1334
1323
|
this.incomingCallToken = data.token;
|
|
1335
1324
|
localStorage.setItem('in-token', data.token);
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
this.
|
|
1344
|
-
this.
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
});
|
|
1353
|
-
this.device.on('error', (error) => {
|
|
1354
|
-
console.error('Twilio Device Error:', error);
|
|
1355
|
-
// Attempt to reinitialize after delay
|
|
1356
|
-
setTimeout(() => this.initializeTwilioDevice(), 5000);
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
catch (error) {
|
|
1360
|
-
console.error('Error initializing Twilio Device:', error);
|
|
1361
|
-
}
|
|
1362
|
-
},
|
|
1363
|
-
error: (error) => {
|
|
1364
|
-
console.error('Error getting Twilio token:', error);
|
|
1365
|
-
// Retry after delay
|
|
1366
|
-
setTimeout(() => this.initializeTwilioDevice(), 5000);
|
|
1367
|
-
}
|
|
1368
|
-
});
|
|
1325
|
+
this.device = new Device(this.incomingCallToken, {
|
|
1326
|
+
allowIncomingWhileBusy: true,
|
|
1327
|
+
// Add any other necessary options
|
|
1328
|
+
});
|
|
1329
|
+
this.device.register();
|
|
1330
|
+
this.device.on('incoming', (call) => {
|
|
1331
|
+
this.currentCall.next(call);
|
|
1332
|
+
this.callType.next('INCOMING');
|
|
1333
|
+
this.currentCallState.next('incoming');
|
|
1334
|
+
});
|
|
1335
|
+
this.device.on('error', (error) => {
|
|
1336
|
+
console.error('Twilio Device Error:', error);
|
|
1337
|
+
// Add error handling and reconnection logic
|
|
1338
|
+
});
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1369
1341
|
}
|
|
1370
1342
|
// onIncomingCall(){
|
|
1371
1343
|
// this.device.on('incoming', (call:any) => {
|
|
@@ -1573,6 +1545,7 @@ class IncomingCallComponent {
|
|
|
1573
1545
|
if (call) {
|
|
1574
1546
|
this.twilioCallData = call;
|
|
1575
1547
|
this.twilioAuthId = call.customParameters.get('twilioAuthId');
|
|
1548
|
+
this.newIncomingCallsList.push(call);
|
|
1576
1549
|
if (!call.parameters) {
|
|
1577
1550
|
call.parameters = {};
|
|
1578
1551
|
}
|