@vgroup/dialbox 0.1.47 → 0.1.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/dialbox.component.mjs +4 -2
- package/esm2020/lib/service/extension.service.mjs +12 -7
- package/esm2020/lib/service/twilio.service.mjs +4 -3
- package/fesm2015/vgroup-dialbox.mjs +17 -9
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +17 -9
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/service/extension.service.d.ts +1 -1
- package/lib/service/twilio.service.d.ts +2 -1
- package/package.json +1 -1
|
@@ -579,13 +579,14 @@ class ExtensionService {
|
|
|
579
579
|
// })
|
|
580
580
|
// );
|
|
581
581
|
// }
|
|
582
|
-
getIncomingCallToken() {
|
|
583
|
-
const
|
|
582
|
+
getIncomingCallToken(deviceId) {
|
|
583
|
+
const headers = {
|
|
584
584
|
'Content-Type': 'application/json',
|
|
585
585
|
'Auth-Key': "Bearer " + localStorage.getItem('ext_token')
|
|
586
586
|
};
|
|
587
|
-
const httpOptions = { headers: new HttpHeaders(params) };
|
|
588
|
-
|
|
587
|
+
// const httpOptions = { headers: new HttpHeaders(params) };
|
|
588
|
+
const params = new HttpParams().set('deviceId', deviceId);
|
|
589
|
+
return this.http.get(environment.apiUrl + '/utilities/twilio/incomingcall/token/web', { headers, params });
|
|
589
590
|
}
|
|
590
591
|
getOutgoingCallToken(payload) {
|
|
591
592
|
const params = {
|
|
@@ -1166,8 +1167,12 @@ class ExtensionService {
|
|
|
1166
1167
|
'recordId': recordId,
|
|
1167
1168
|
'callStatus': callStatus,
|
|
1168
1169
|
};
|
|
1169
|
-
const
|
|
1170
|
-
|
|
1170
|
+
const headers = new HttpHeaders({
|
|
1171
|
+
'Content-Type': 'application/json',
|
|
1172
|
+
'Authorization': `Bearer ${localStorage.getItem('ext_token') || ''}`
|
|
1173
|
+
});
|
|
1174
|
+
const params = new HttpParams().set('deviceId', deviceId);
|
|
1175
|
+
return this.http.post(environment.apiUrl + '/utilities/twilio/incoming/call/ip', IpObj, { headers, params }).pipe(catchError(postError => {
|
|
1171
1176
|
// console.log('Error during HTTP POST request:', postError);
|
|
1172
1177
|
return throwError(postError);
|
|
1173
1178
|
}));
|
|
@@ -1395,7 +1400,7 @@ class TwilioService {
|
|
|
1395
1400
|
if (this.tokenInitialized) {
|
|
1396
1401
|
return this.tokenInitialization$ || of(null);
|
|
1397
1402
|
}
|
|
1398
|
-
this.tokenInitialization$ = this.extensionService.getIncomingCallToken().pipe(tap((data) => {
|
|
1403
|
+
this.tokenInitialization$ = this.extensionService.getIncomingCallToken(this.deviceId).pipe(tap((data) => {
|
|
1399
1404
|
this.incomingCallToken = data.token;
|
|
1400
1405
|
localStorage.setItem('in-token', data.token);
|
|
1401
1406
|
this.tokenInitialized = true;
|
|
@@ -1408,7 +1413,8 @@ class TwilioService {
|
|
|
1408
1413
|
);
|
|
1409
1414
|
return this.tokenInitialization$;
|
|
1410
1415
|
}
|
|
1411
|
-
initializeTwilioDevice() {
|
|
1416
|
+
initializeTwilioDevice(deviceId) {
|
|
1417
|
+
this.deviceId = deviceId;
|
|
1412
1418
|
if (this.tokenInitialized && this.incomingCallToken) {
|
|
1413
1419
|
this.initializeDevice();
|
|
1414
1420
|
}
|
|
@@ -2266,7 +2272,7 @@ class DialboxComponent {
|
|
|
2266
2272
|
}
|
|
2267
2273
|
this.isInitialized = true;
|
|
2268
2274
|
// Initialize Twilio service
|
|
2269
|
-
this.twilioService.initializeTwilioDevice();
|
|
2275
|
+
this.twilioService.initializeTwilioDevice(this.deviceId);
|
|
2270
2276
|
}
|
|
2271
2277
|
}
|
|
2272
2278
|
// ngOnChange() {
|
|
@@ -2511,6 +2517,8 @@ class DialboxComponent {
|
|
|
2511
2517
|
this.registerDragElement();
|
|
2512
2518
|
}
|
|
2513
2519
|
ngOnChanges(changes) {
|
|
2520
|
+
if (changes['deviceId'] && this.deviceId) {
|
|
2521
|
+
}
|
|
2514
2522
|
if (changes['isDialpadHidden'] && !this.isDialpadHidden) {
|
|
2515
2523
|
this.getContactList();
|
|
2516
2524
|
this.getUserCallSetting();
|