@vgroup/dialbox 0.2.29 → 0.2.30
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 +7 -7
- package/esm2020/lib/service/extension.service.mjs +16 -40
- package/fesm2015/vgroup-dialbox.mjs +20 -44
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +20 -44
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/lib/service/extension.service.d.ts +1 -14
- package/package.json +1 -1
|
@@ -562,45 +562,21 @@ class ExtensionService {
|
|
|
562
562
|
// })
|
|
563
563
|
// );
|
|
564
564
|
// }
|
|
565
|
-
/**
|
|
566
|
-
* Initiates a normal & a conference call in parallel.
|
|
567
|
-
* The method performs three steps:
|
|
568
|
-
* 1. Load black-listed countries & current IP info in parallel.
|
|
569
|
-
* 2. Abort early if the caller is from a blocked country.
|
|
570
|
-
* 3. Fire both call-initiation APIs together and return both responses.
|
|
571
|
-
*
|
|
572
|
-
* It guarantees that:
|
|
573
|
-
* • Both HTTP requests are always attempted.
|
|
574
|
-
* • Failure of one request does not cancel the other – the error is
|
|
575
|
-
* returned alongside the success response so that the component can
|
|
576
|
-
* decide what to do.
|
|
577
|
-
*/
|
|
578
565
|
initiateCall(payload) {
|
|
579
|
-
return
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
});
|
|
594
|
-
const body = { ...payload, proxy: ipInfo.proxy.toString() };
|
|
595
|
-
const options = { headers };
|
|
596
|
-
const api1$ = this.http
|
|
597
|
-
.post(`${environment.apiUrl}/utilities/ext/ur/initiate/call`, body, options)
|
|
598
|
-
.pipe(catchError(error => of({ error })));
|
|
599
|
-
const api2$ = this.http
|
|
600
|
-
.post(`${environment.apiUrl}/ur/initiate/conference/call`, body, options)
|
|
601
|
-
.pipe(catchError(error => of({ error })));
|
|
602
|
-
// Execute both requests and return their individual outcomes.
|
|
603
|
-
return forkJoin([api1$, api2$]);
|
|
566
|
+
return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
|
|
567
|
+
return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
|
|
568
|
+
const params = {
|
|
569
|
+
'Content-Type': 'application/json',
|
|
570
|
+
'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
|
|
571
|
+
'ip-address': ipAddressInfo.ip,
|
|
572
|
+
'ip-country': ipAddressInfo.address.country,
|
|
573
|
+
};
|
|
574
|
+
payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
|
|
575
|
+
const httpOptions = { headers: new HttpHeaders(params) };
|
|
576
|
+
const api1$ = this.http.post(`${environment.apiUrl}/utilities/ext/ur/initiate/call`, payload, httpOptions);
|
|
577
|
+
const api2$ = this.http.post(`${environment.apiUrl}/utilities/ext/ur/initiate/conference/call`, payload, httpOptions);
|
|
578
|
+
return forkJoin([api1$, api2$]).pipe(catchError(error => throwError(() => error)));
|
|
579
|
+
}), catchError(error => throwError(() => error)));
|
|
604
580
|
}));
|
|
605
581
|
}
|
|
606
582
|
getConferenceCallToken(payload) {
|
|
@@ -2120,8 +2096,8 @@ class CallProgressComponent {
|
|
|
2120
2096
|
scope: 'local',
|
|
2121
2097
|
fromNumber: callData.from
|
|
2122
2098
|
};
|
|
2123
|
-
const
|
|
2124
|
-
if (response
|
|
2099
|
+
const response = await this.initiateCall(payload);
|
|
2100
|
+
if (response.status == 200) {
|
|
2125
2101
|
const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
|
|
2126
2102
|
this.getUserInformation(callAuthId);
|
|
2127
2103
|
this.recordCall = recordCall; // Store the recordCall value
|
|
@@ -2130,7 +2106,7 @@ class CallProgressComponent {
|
|
|
2130
2106
|
// Poll the status for 30-45 seconds
|
|
2131
2107
|
this.pollCallStatus(callAuthId);
|
|
2132
2108
|
}
|
|
2133
|
-
else if (response
|
|
2109
|
+
else if (response.status == 201) {
|
|
2134
2110
|
swal("Error", response.message.join("<br/>"), "error");
|
|
2135
2111
|
console.log('test2');
|
|
2136
2112
|
this.endCall();
|
|
@@ -2369,8 +2345,8 @@ class CallProgressComponent {
|
|
|
2369
2345
|
scope: 'local',
|
|
2370
2346
|
fromNumber: this.callData.from
|
|
2371
2347
|
};
|
|
2372
|
-
const
|
|
2373
|
-
if (response
|
|
2348
|
+
const response = await this.initiateCall(payload);
|
|
2349
|
+
if (response.status == 200) {
|
|
2374
2350
|
const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
|
|
2375
2351
|
this.getUserInformation(callAuthId);
|
|
2376
2352
|
this.recordCall = recordCall;
|
|
@@ -2416,7 +2392,7 @@ class CallProgressComponent {
|
|
|
2416
2392
|
console.log('New call initiated to:', phoneNumber);
|
|
2417
2393
|
this.cdr.detectChanges();
|
|
2418
2394
|
}
|
|
2419
|
-
else if (response
|
|
2395
|
+
else if (response.status == 201) {
|
|
2420
2396
|
swal("Error", response.message.join("<br/>"), "error");
|
|
2421
2397
|
// Restore held call if new call fails
|
|
2422
2398
|
if (this.heldCall) {
|