@vgroup/dialbox 0.2.48 → 0.2.50

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.
@@ -539,26 +539,6 @@ class ExtensionService {
539
539
  const httpOptions = { headers: new HttpHeaders(params) };
540
540
  return this.http.put(environment.apiUrl + '/utilities/softphone/update/callerid/label', dtModel, httpOptions);
541
541
  }
542
- initiateCall(payload) {
543
- return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
544
- return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
545
- const params = {
546
- 'Content-Type': 'application/json',
547
- 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
548
- 'ip-address': ipAddressInfo.ip,
549
- 'ip-country': ipAddressInfo.address.country,
550
- };
551
- payload = Object.assign(Object.assign({}, payload), { proxy: ipAddressInfo.proxy.toString() });
552
- const httpOptions = { headers: new HttpHeaders(params) };
553
- return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(catchError(error => {
554
- return throwError(error);
555
- }));
556
- }), catchError(error => {
557
- // Catch error from getIpAddressInfo
558
- return throwError(error);
559
- }));
560
- }));
561
- }
562
542
  // initiateCall(payload: any): Observable<any> {
563
543
  // return this.fetchBlockedCountries().pipe(
564
544
  // switchMap(blockedCountries => {
@@ -572,7 +552,7 @@ class ExtensionService {
572
552
  // };
573
553
  // payload = {...payload, proxy:ipAddressInfo.proxy.toString()}
574
554
  // const httpOptions = { headers: new HttpHeaders(params) };
575
- // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(
555
+ // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(
576
556
  // catchError(error => {
577
557
  // return throwError(error);
578
558
  // }),
@@ -586,6 +566,26 @@ class ExtensionService {
586
566
  // })
587
567
  // );
588
568
  // }
569
+ initiateCall(payload) {
570
+ return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
571
+ return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
572
+ const params = {
573
+ 'Content-Type': 'application/json',
574
+ 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
575
+ 'ip-address': ipAddressInfo.ip,
576
+ 'ip-country': ipAddressInfo.address.country,
577
+ };
578
+ payload = Object.assign(Object.assign({}, payload), { proxy: ipAddressInfo.proxy.toString() });
579
+ const httpOptions = { headers: new HttpHeaders(params) };
580
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(catchError(error => {
581
+ return throwError(error);
582
+ }));
583
+ }), catchError(error => {
584
+ // Catch error from getIpAddressInfo
585
+ return throwError(error);
586
+ }));
587
+ }));
588
+ }
589
589
  getConferenceCallToken(payload) {
590
590
  const params = {
591
591
  "conferenceId": payload.conferenceId,
@@ -2120,13 +2120,13 @@ class CallProgressComponent {
2120
2120
  };
2121
2121
  const response = yield this.initiateCall(payload);
2122
2122
  if (response.status == 200) {
2123
- const { id: callAuthId, recordCall } = yield this.getCallAuthId(response);
2124
- this.getUserInformation(callAuthId);
2125
- this.recordCall = recordCall; // Store the recordCall value
2126
- const tokenData = yield this.getOutgoingCallToken(callAuthId);
2123
+ const { authId } = yield this.getConferenceCallToken(response);
2124
+ this.getUserInformation(authId);
2125
+ // this.recordCall = recordCall; // Store the recordCall value
2126
+ const tokenData = yield this.getOutgoingCallToken(authId);
2127
2127
  yield this.connectToDevice(tokenData.token, callData);
2128
2128
  // Poll the status for 30-45 seconds
2129
- this.pollCallStatus(callAuthId);
2129
+ this.pollCallStatus(authId);
2130
2130
  }
2131
2131
  else if (response.status == 201) {
2132
2132
  swal("Error", response.message.join("<br/>"), "error");
@@ -2147,13 +2147,16 @@ class CallProgressComponent {
2147
2147
  return yield this.extensionService.initiateCall(payload).toPromise();
2148
2148
  });
2149
2149
  }
2150
- getCallAuthId(response) {
2151
- return __awaiter(this, void 0, void 0, function* () {
2152
- return {
2153
- id: response.callauth.id,
2154
- recordCall: response.callauth.recordCall
2155
- };
2156
- });
2150
+ // private async getCallAuthId(response: any) {
2151
+ // return {
2152
+ // id: response.callauth.id,
2153
+ // recordCall: response.callauth.recordCall
2154
+ // };
2155
+ // }
2156
+ getConferenceCallToken(response) {
2157
+ return {
2158
+ authId: response.callauth.id,
2159
+ };
2157
2160
  }
2158
2161
  getOutgoingCallToken(callAuthId) {
2159
2162
  return __awaiter(this, void 0, void 0, function* () {
@@ -2385,10 +2388,10 @@ class CallProgressComponent {
2385
2388
  };
2386
2389
  const response = yield this.initiateCall(payload);
2387
2390
  if (response.status == 200) {
2388
- const { id: callAuthId, recordCall } = yield this.getCallAuthId(response);
2389
- this.getUserInformation(callAuthId);
2390
- this.recordCall = recordCall;
2391
- const tokenData = yield this.getOutgoingCallToken(callAuthId);
2391
+ const { authId } = yield this.getConferenceCallToken(response);
2392
+ this.getUserInformation(authId);
2393
+ // this.recordCall = recordCall;
2394
+ const tokenData = yield this.getOutgoingCallToken(authId);
2392
2395
  // Connect to new call
2393
2396
  const options = {
2394
2397
  codecPreferences: ['opus', 'pcmu'],
@@ -2426,7 +2429,7 @@ class CallProgressComponent {
2426
2429
  // Setup event listeners for new call
2427
2430
  this.setupEventListeners();
2428
2431
  // Poll call status
2429
- this.pollCallStatus(callAuthId);
2432
+ this.pollCallStatus(authId);
2430
2433
  console.log('New call initiated to:', phoneNumber);
2431
2434
  this.cdr.detectChanges();
2432
2435
  }