@vgroup/dialbox 0.1.98 → 0.1.99
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 +4 -46
- package/esm2020/lib/service/extension.service.mjs +44 -8
- package/fesm2015/vgroup-dialbox.mjs +46 -48
- package/fesm2015/vgroup-dialbox.mjs.map +1 -1
- package/fesm2020/vgroup-dialbox.mjs +46 -53
- package/fesm2020/vgroup-dialbox.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Injectable, EventEmitter, Component, Input, Output, ViewChild, Inject, NgModule } from '@angular/core';
|
|
3
3
|
import swal from 'sweetalert2';
|
|
4
4
|
import { AsYouType } from 'libphonenumber-js';
|
|
5
|
-
import { throwError, BehaviorSubject, of, interval, Subscription } from 'rxjs';
|
|
5
|
+
import { throwError, BehaviorSubject, forkJoin, of, interval, Subscription } from 'rxjs';
|
|
6
6
|
import * as i1 from '@angular/common/http';
|
|
7
7
|
import { HttpHeaders, HttpParams, HttpClientModule } from '@angular/common/http';
|
|
8
8
|
import { catchError, switchMap, map, tap, shareReplay } from 'rxjs/operators';
|
|
@@ -535,6 +535,38 @@ class ExtensionService {
|
|
|
535
535
|
const httpOptions = { headers: new HttpHeaders(params) };
|
|
536
536
|
return this.http.put(environment.apiUrl + '/utilities/softphone/update/callerid/label', dtModel, httpOptions);
|
|
537
537
|
}
|
|
538
|
+
// initiateCall(payload: any): Observable<any> {
|
|
539
|
+
// return this.fetchBlockedCountries().pipe(
|
|
540
|
+
// switchMap(blockedCountries => {
|
|
541
|
+
// return this.ipAddressService.getIpAddressInfo().pipe(
|
|
542
|
+
// switchMap(ipAddressInfo => {
|
|
543
|
+
// const params = {
|
|
544
|
+
// 'Content-Type': 'application/json',
|
|
545
|
+
// 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
|
|
546
|
+
// 'ip-address': ipAddressInfo.ip,
|
|
547
|
+
// 'ip-country': ipAddressInfo.address.country,
|
|
548
|
+
// };
|
|
549
|
+
// payload = {...payload, proxy:ipAddressInfo.proxy.toString()}
|
|
550
|
+
// const httpOptions = { headers: new HttpHeaders(params) };
|
|
551
|
+
// return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(
|
|
552
|
+
// catchError(error => {
|
|
553
|
+
// return throwError(error);
|
|
554
|
+
// }),
|
|
555
|
+
// );
|
|
556
|
+
// return this.http.post<[]>(environment.apiUrl + '/ur/initiate/conference/call', payload, httpOptions).pipe(
|
|
557
|
+
// catchError(error => {
|
|
558
|
+
// return throwError(error);
|
|
559
|
+
// }),
|
|
560
|
+
// );
|
|
561
|
+
// }),
|
|
562
|
+
// catchError(error => {
|
|
563
|
+
// // Catch error from getIpAddressInfo
|
|
564
|
+
// return throwError(error);
|
|
565
|
+
// })
|
|
566
|
+
// );
|
|
567
|
+
// })
|
|
568
|
+
// );
|
|
569
|
+
// }
|
|
538
570
|
initiateCall(payload) {
|
|
539
571
|
return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
|
|
540
572
|
return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
|
|
@@ -544,15 +576,18 @@ class ExtensionService {
|
|
|
544
576
|
'ip-address': ipAddressInfo.ip,
|
|
545
577
|
'ip-country': ipAddressInfo.address.country,
|
|
546
578
|
};
|
|
579
|
+
const params1 = {
|
|
580
|
+
"from": payload.from,
|
|
581
|
+
"to": payload.to,
|
|
582
|
+
"userId": payload.userId
|
|
583
|
+
};
|
|
547
584
|
payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
|
|
548
585
|
const httpOptions = { headers: new HttpHeaders(params) };
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
return throwError(error);
|
|
555
|
-
}));
|
|
586
|
+
const api1$ = this.http.post(`${environment.apiUrl}/utilities/ext/ur/initiate/call`, payload, httpOptions);
|
|
587
|
+
const api2$ = this.http.post(`${environment.apiUrl}/ur/initiate/conference/call`, params1, httpOptions);
|
|
588
|
+
// Run both requests in parallel
|
|
589
|
+
return forkJoin([api1$, api2$]).pipe(catchError(error => throwError(() => error)));
|
|
590
|
+
}), catchError(error => throwError(() => error)));
|
|
556
591
|
}));
|
|
557
592
|
}
|
|
558
593
|
fetchBlockedCountries() {
|
|
@@ -2138,10 +2173,6 @@ class CallProgressComponent {
|
|
|
2138
2173
|
name: callerName,
|
|
2139
2174
|
img: callerImg
|
|
2140
2175
|
};
|
|
2141
|
-
// Ensure UI flags are properly set
|
|
2142
|
-
this.isConcurrentIncoming = false;
|
|
2143
|
-
this.incomingCallDiv = false;
|
|
2144
|
-
this.showRingAnimation = false;
|
|
2145
2176
|
// Restart timer for the resumed call
|
|
2146
2177
|
this.startTimer();
|
|
2147
2178
|
this.disbaleEndCallBtn = false;
|
|
@@ -2296,7 +2327,6 @@ class CallProgressComponent {
|
|
|
2296
2327
|
this.incomingCallDiv = false;
|
|
2297
2328
|
const incomingDetail = this.extensionService.getCallSid();
|
|
2298
2329
|
this.incomingRecordCall = incomingDetail.recordCall;
|
|
2299
|
-
// Start recording if the call is answered and recording is enabled
|
|
2300
2330
|
if (this.incomingRecordCall) {
|
|
2301
2331
|
this.startRecording();
|
|
2302
2332
|
}
|
|
@@ -2307,49 +2337,12 @@ class CallProgressComponent {
|
|
|
2307
2337
|
}
|
|
2308
2338
|
else {
|
|
2309
2339
|
// incoming call rejected or auto-cancelled
|
|
2310
|
-
console.log('Incoming call rejected/cancelled');
|
|
2311
|
-
console.log('Current call status:', this.call?.status());
|
|
2312
|
-
console.log('Held call status:', this.heldCall?.status());
|
|
2313
2340
|
this.isConcurrentIncoming = false;
|
|
2314
2341
|
this.incomingCallDiv = false;
|
|
2315
|
-
//
|
|
2316
|
-
if (this.
|
|
2317
|
-
console.log('Restoring held call to active');
|
|
2318
|
-
// Make held call the active call
|
|
2319
|
-
this.call = this.heldCall;
|
|
2320
|
-
this.heldCall = undefined;
|
|
2321
|
-
this.isCallOnHold = false;
|
|
2322
|
-
// Unmute the resumed call
|
|
2323
|
-
this.call.mute(false);
|
|
2324
|
-
this.isMute = false;
|
|
2325
|
-
// Update UI with the resumed call info
|
|
2326
|
-
const fromNumber = this.call.parameters['From'];
|
|
2327
|
-
const callerName = this.call.customParameters?.get('name') || '-';
|
|
2328
|
-
const callerImg = this.call.customParameters?.get('image') || 'assets/images/user.jpg';
|
|
2329
|
-
this.callData = {
|
|
2330
|
-
...this.callData,
|
|
2331
|
-
phone: fromNumber,
|
|
2332
|
-
displayNum: fromNumber,
|
|
2333
|
-
name: callerName,
|
|
2334
|
-
img: callerImg
|
|
2335
|
-
};
|
|
2336
|
-
this.disbaleEndCallBtn = false;
|
|
2337
|
-
this.showRingAnimation = false;
|
|
2338
|
-
console.log('Held call restored successfully');
|
|
2339
|
-
}
|
|
2340
|
-
// Check if there's an active call (for cases where incoming was rejected before being answered)
|
|
2341
|
-
else if (this.call && this.call.status() === 'open') {
|
|
2342
|
-
console.log('Active call exists, keeping UI visible');
|
|
2343
|
-
// Just ensure UI flags are correct to show the active call
|
|
2344
|
-
this.disbaleEndCallBtn = false;
|
|
2345
|
-
this.showRingAnimation = false;
|
|
2346
|
-
}
|
|
2347
|
-
// No active or held call - completely end
|
|
2348
|
-
else {
|
|
2349
|
-
console.log('No active or held call, ending completely');
|
|
2342
|
+
// If there is NO active call, then propagate end. Otherwise keep ongoing UI.
|
|
2343
|
+
if (!this.call || this.call.status() !== 'open') {
|
|
2350
2344
|
this.endCallEvent.emit();
|
|
2351
2345
|
}
|
|
2352
|
-
this.cdr.detectChanges();
|
|
2353
2346
|
}
|
|
2354
2347
|
}
|
|
2355
2348
|
clearInputs() {
|
|
@@ -2410,7 +2403,7 @@ class CallProgressComponent {
|
|
|
2410
2403
|
this.extensionService.pauseOrResumeRecording(sid, 'pause').subscribe(response => {
|
|
2411
2404
|
this.stopRecordingTimer();
|
|
2412
2405
|
this.isPaused = true;
|
|
2413
|
-
}, error => {
|
|
2406
|
+
}, (error) => {
|
|
2414
2407
|
console.error('Error pausing recording:', error);
|
|
2415
2408
|
// Consider updating the UI to show the error state
|
|
2416
2409
|
});
|