@vgroup/dialbox 0.0.47 → 0.0.48
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/dialbox.component.mjs +3 -3
- package/esm2020/lib/service/twilio.service.mjs +47 -19
- package/fesm2015/vgroup-dialbox.mjs +48 -20
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +48 -20
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1318,26 +1318,54 @@ class TwilioService {
|
|
|
1318
1318
|
this.initializeTwilioDevice();
|
|
1319
1319
|
}
|
|
1320
1320
|
initializeTwilioDevice() {
|
|
1321
|
-
|
|
1322
|
-
|
|
1321
|
+
console.log('Initializing Twilio Device...');
|
|
1322
|
+
console.log('Token exists:', !!this.token);
|
|
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
|
+
}
|
|
1323
1334
|
this.incomingCallToken = data.token;
|
|
1324
1335
|
localStorage.setItem('in-token', data.token);
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
this.
|
|
1333
|
-
this.
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1336
|
+
try {
|
|
1337
|
+
console.log('Creating Twilio Device instance with token:', data.token.substring(0, 10) + '...');
|
|
1338
|
+
this.device = new Device(data.token, {
|
|
1339
|
+
allowIncomingWhileBusy: true,
|
|
1340
|
+
closeProtection: true
|
|
1341
|
+
});
|
|
1342
|
+
console.log('Registering device...');
|
|
1343
|
+
this.device.register();
|
|
1344
|
+
this.device.on('registered', () => {
|
|
1345
|
+
console.log('Twilio Device registered successfully');
|
|
1346
|
+
});
|
|
1347
|
+
this.device.on('incoming', (call) => {
|
|
1348
|
+
console.log('Incoming call received');
|
|
1349
|
+
this.currentCall.next(call);
|
|
1350
|
+
this.callType.next('INCOMING');
|
|
1351
|
+
this.currentCallState.next('incoming');
|
|
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
|
+
});
|
|
1341
1369
|
}
|
|
1342
1370
|
// onIncomingCall(){
|
|
1343
1371
|
// this.device.on('incoming', (call:any) => {
|
|
@@ -2199,7 +2227,7 @@ class DialboxComponent {
|
|
|
2199
2227
|
this.selectedCallerId = { number: contact.from };
|
|
2200
2228
|
this.isSmartDialCall = true;
|
|
2201
2229
|
setTimeout(() => {
|
|
2202
|
-
this.isDialpadHidden =
|
|
2230
|
+
this.isDialpadHidden = false;
|
|
2203
2231
|
}, 2000);
|
|
2204
2232
|
this.callData.phone = contact.number;
|
|
2205
2233
|
this.callData.name = contact.name;
|
|
@@ -2213,7 +2241,7 @@ class DialboxComponent {
|
|
|
2213
2241
|
else {
|
|
2214
2242
|
this.getUserCallSetting();
|
|
2215
2243
|
setTimeout(() => {
|
|
2216
|
-
this.isDialpadHidden =
|
|
2244
|
+
this.isDialpadHidden = false;
|
|
2217
2245
|
}, 1000);
|
|
2218
2246
|
this.getUserInformation(contact);
|
|
2219
2247
|
// this.incomingCallsList.push(contact)
|