@vgroup/dialbox 0.2.49 → 0.2.51

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 { authId } = await this.getConferenceCallToken(response);
2120
- this.getUserInformation(authId);
2121
- // this.recordCall = recordCall; // Store the recordCall value
2122
- const tokenData = await this.getOutgoingCallToken(authId);
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);
2123
2123
  await this.connectToDevice(tokenData.token, callData);
2124
2124
  // Poll the status for 30-45 seconds
2125
- this.pollCallStatus(authId);
2125
+ this.pollCallStatus(callAuthId);
2126
2126
  }
2127
2127
  else if (response.status == 201) {
2128
2128
  swal("Error", response.message.join("<br/>"), "error");
@@ -2140,19 +2140,14 @@ class CallProgressComponent {
2140
2140
  async initiateCall(payload) {
2141
2141
  return await this.extensionService.initiateCall(payload).toPromise();
2142
2142
  }
2143
- // private async getCallAuthId(response: any) {
2144
- // return {
2145
- // id: response.callauth.id,
2146
- // recordCall: response.callauth.recordCall
2147
- // };
2148
- // }
2149
- getConferenceCallToken(response) {
2143
+ async getCallAuthId(response) {
2150
2144
  return {
2151
- authId: response.callauth.id,
2145
+ id: response.callauth.id,
2146
+ recordCall: response.callauth.recordCall
2152
2147
  };
2153
2148
  }
2154
2149
  async getOutgoingCallToken(callAuthId) {
2155
- return await this.extensionService.getOutgoingCallToken({ authId: callAuthId }).toPromise();
2150
+ return await this.extensionService.getConferenceCallToken({ authId: callAuthId }).toPromise();
2156
2151
  }
2157
2152
  async connectToDevice(token, callData) {
2158
2153
  const options = {
@@ -2372,10 +2367,10 @@ class CallProgressComponent {
2372
2367
  };
2373
2368
  const response = await this.initiateCall(payload);
2374
2369
  if (response.status == 200) {
2375
- const { authId } = await this.getConferenceCallToken(response);
2376
- this.getUserInformation(authId);
2377
- // this.recordCall = recordCall;
2378
- const tokenData = await this.getOutgoingCallToken(authId);
2370
+ const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2371
+ this.getUserInformation(callAuthId);
2372
+ this.recordCall = recordCall;
2373
+ const tokenData = await this.getOutgoingCallToken(callAuthId);
2379
2374
  // Connect to new call
2380
2375
  const options = {
2381
2376
  codecPreferences: ['opus', 'pcmu'],
@@ -2413,7 +2408,7 @@ class CallProgressComponent {
2413
2408
  // Setup event listeners for new call
2414
2409
  this.setupEventListeners();
2415
2410
  // Poll call status
2416
- this.pollCallStatus(authId);
2411
+ this.pollCallStatus(callAuthId);
2417
2412
  console.log('New call initiated to:', phoneNumber);
2418
2413
  this.cdr.detectChanges();
2419
2414
  }