@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.
@@ -538,26 +538,6 @@ class ExtensionService {
538
538
  const httpOptions = { headers: new HttpHeaders(params) };
539
539
  return this.http.put(environment.apiUrl + '/utilities/softphone/update/callerid/label', dtModel, httpOptions);
540
540
  }
541
- initiateCall(payload) {
542
- return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
543
- return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
544
- const params = {
545
- 'Content-Type': 'application/json',
546
- 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
547
- 'ip-address': ipAddressInfo.ip,
548
- 'ip-country': ipAddressInfo.address.country,
549
- };
550
- payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
551
- const httpOptions = { headers: new HttpHeaders(params) };
552
- return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(catchError(error => {
553
- return throwError(error);
554
- }));
555
- }), catchError(error => {
556
- // Catch error from getIpAddressInfo
557
- return throwError(error);
558
- }));
559
- }));
560
- }
561
541
  // initiateCall(payload: any): Observable<any> {
562
542
  // return this.fetchBlockedCountries().pipe(
563
543
  // switchMap(blockedCountries => {
@@ -571,7 +551,7 @@ class ExtensionService {
571
551
  // };
572
552
  // payload = {...payload, proxy:ipAddressInfo.proxy.toString()}
573
553
  // const httpOptions = { headers: new HttpHeaders(params) };
574
- // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(
554
+ // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(
575
555
  // catchError(error => {
576
556
  // return throwError(error);
577
557
  // }),
@@ -585,6 +565,26 @@ class ExtensionService {
585
565
  // })
586
566
  // );
587
567
  // }
568
+ initiateCall(payload) {
569
+ return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
570
+ return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
571
+ const params = {
572
+ 'Content-Type': 'application/json',
573
+ 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
574
+ 'ip-address': ipAddressInfo.ip,
575
+ 'ip-country': ipAddressInfo.address.country,
576
+ };
577
+ payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
578
+ const httpOptions = { headers: new HttpHeaders(params) };
579
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(catchError(error => {
580
+ return throwError(error);
581
+ }));
582
+ }), catchError(error => {
583
+ // Catch error from getIpAddressInfo
584
+ return throwError(error);
585
+ }));
586
+ }));
587
+ }
588
588
  getConferenceCallToken(payload) {
589
589
  const params = {
590
590
  "conferenceId": payload.conferenceId,
@@ -2116,13 +2116,13 @@ class CallProgressComponent {
2116
2116
  };
2117
2117
  const response = await this.initiateCall(payload);
2118
2118
  if (response.status == 200) {
2119
- const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2120
- this.getUserInformation(callAuthId);
2121
- this.recordCall = recordCall; // Store the recordCall value
2122
- const tokenData = await this.getOutgoingCallToken(callAuthId);
2119
+ const { authId } = await this.getConferenceCallToken(response);
2120
+ this.getUserInformation(authId);
2121
+ // this.recordCall = recordCall; // Store the recordCall value
2122
+ const tokenData = await this.getOutgoingCallToken(authId);
2123
2123
  await this.connectToDevice(tokenData.token, callData);
2124
2124
  // Poll the status for 30-45 seconds
2125
- this.pollCallStatus(callAuthId);
2125
+ this.pollCallStatus(authId);
2126
2126
  }
2127
2127
  else if (response.status == 201) {
2128
2128
  swal("Error", response.message.join("<br/>"), "error");
@@ -2140,10 +2140,15 @@ class CallProgressComponent {
2140
2140
  async initiateCall(payload) {
2141
2141
  return await this.extensionService.initiateCall(payload).toPromise();
2142
2142
  }
2143
- async getCallAuthId(response) {
2143
+ // private async getCallAuthId(response: any) {
2144
+ // return {
2145
+ // id: response.callauth.id,
2146
+ // recordCall: response.callauth.recordCall
2147
+ // };
2148
+ // }
2149
+ getConferenceCallToken(response) {
2144
2150
  return {
2145
- id: response.callauth.id,
2146
- recordCall: response.callauth.recordCall
2151
+ authId: response.callauth.id,
2147
2152
  };
2148
2153
  }
2149
2154
  async getOutgoingCallToken(callAuthId) {
@@ -2367,10 +2372,10 @@ class CallProgressComponent {
2367
2372
  };
2368
2373
  const response = await this.initiateCall(payload);
2369
2374
  if (response.status == 200) {
2370
- const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2371
- this.getUserInformation(callAuthId);
2372
- this.recordCall = recordCall;
2373
- const tokenData = await this.getOutgoingCallToken(callAuthId);
2375
+ const { authId } = await this.getConferenceCallToken(response);
2376
+ this.getUserInformation(authId);
2377
+ // this.recordCall = recordCall;
2378
+ const tokenData = await this.getOutgoingCallToken(authId);
2374
2379
  // Connect to new call
2375
2380
  const options = {
2376
2381
  codecPreferences: ['opus', 'pcmu'],
@@ -2408,7 +2413,7 @@ class CallProgressComponent {
2408
2413
  // Setup event listeners for new call
2409
2414
  this.setupEventListeners();
2410
2415
  // Poll call status
2411
- this.pollCallStatus(callAuthId);
2416
+ this.pollCallStatus(authId);
2412
2417
  console.log('New call initiated to:', phoneNumber);
2413
2418
  this.cdr.detectChanges();
2414
2419
  }