@vgroup/dialbox 0.2.30 → 0.2.32

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.
@@ -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, forkJoin, of, interval, Subscription } from 'rxjs';
5
+ import { throwError, BehaviorSubject, 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';
@@ -67,7 +67,7 @@ const environment = {
67
67
  production: false,
68
68
  secureCookies: true,
69
69
  feUrl: 'https://dev.vgroupinc.com:91/',
70
- apiUrl: 'https://apis.vgroupinc.com/test_softphone',
70
+ apiUrl: 'https://dev-api-t10.vgroupinc.com/dev_softphone_p91',
71
71
  captchaKey: "6LfpOmEaAAAAAGsI6JXlMzOl3b7rW4YmYXFDjldD",
72
72
  stripePublishableKey: "pk_test_51K6aTuBiNVV2TMlQfmBWY8jziwiDo0IZ3TrqWPqth1m32cpMAAg5Qpi2AlSMDEAX6hCZRBXoTzBB1uQQLc8B4tco00q2SgG6zO",
73
73
  sessionTimeout: 15,
@@ -573,19 +573,63 @@ class ExtensionService {
573
573
  };
574
574
  payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
575
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)));
576
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(catchError(error => {
577
+ return throwError(error);
578
+ }));
579
+ }), catchError(error => {
580
+ // Catch error from getIpAddressInfo
581
+ return throwError(error);
582
+ }));
580
583
  }));
581
584
  }
585
+ // initiateCall(payload: any): Observable<any> {
586
+ // return this.fetchBlockedCountries().pipe(
587
+ // switchMap(blockedCountries => {
588
+ // return this.ipAddressService.getIpAddressInfo().pipe(
589
+ // switchMap(ipAddressInfo => {
590
+ // const params = {
591
+ // 'Content-Type': 'application/json',
592
+ // 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
593
+ // 'ip-address': ipAddressInfo.ip,
594
+ // 'ip-country': ipAddressInfo.address.country,
595
+ // };
596
+ // payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
597
+ // const httpOptions = { headers: new HttpHeaders(params) };
598
+ // const api1$ = this.http.post(
599
+ // `${environment.apiUrl}/utilities/ext/ur/initiate/call`,
600
+ // payload,
601
+ // httpOptions
602
+ // );
603
+ // const api2$ = this.http.post(
604
+ // `${environment.apiUrl}/utilities/ext/ur/initiate/conference/call`,
605
+ // payload,
606
+ // httpOptions
607
+ // );
608
+ // return forkJoin([api1$, api2$]).pipe(
609
+ // catchError(error => throwError(() => error))
610
+ // );
611
+ // }),
612
+ // catchError(error => throwError(() => error))
613
+ // );
614
+ // })
615
+ // );
616
+ // }
617
+ // getConferenceCallToken(payload: any) {
618
+ // const params = {
619
+ // "conferenceId": payload.conferenceId,
620
+ // "userId": payload.userId
621
+ // }
622
+ // const httpOptions = { headers: new HttpHeaders(params) };
623
+ // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/generate/conference/token', params, httpOptions);
624
+ // }
582
625
  getConferenceCallToken(payload) {
583
626
  const params = {
584
- "conferenceId": payload.conferenceId,
585
- "userId": payload.userId
627
+ 'Content-Type': 'application/json',
628
+ 'Auth-Key': "Bearer " + localStorage.getItem('ext_token'),
629
+ 'c2c-request': window.location.hostname
586
630
  };
587
631
  const httpOptions = { headers: new HttpHeaders(params) };
588
- return this.http.post(environment.apiUrl + '/ur/generate/conference/token', params, httpOptions);
632
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/generate/token', payload, httpOptions);
589
633
  }
590
634
  addFirstParticipant(payload) {
591
635
  const params = {
@@ -2101,7 +2145,7 @@ class CallProgressComponent {
2101
2145
  const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2102
2146
  this.getUserInformation(callAuthId);
2103
2147
  this.recordCall = recordCall; // Store the recordCall value
2104
- const tokenData = await this.getOutgoingCallToken(callAuthId);
2148
+ const tokenData = await this.getConferenceCallToken(callAuthId);
2105
2149
  await this.connectToDevice(tokenData.token, callData);
2106
2150
  // Poll the status for 30-45 seconds
2107
2151
  this.pollCallStatus(callAuthId);
@@ -2128,8 +2172,8 @@ class CallProgressComponent {
2128
2172
  recordCall: response.callauth.recordCall
2129
2173
  };
2130
2174
  }
2131
- async getOutgoingCallToken(callAuthId) {
2132
- return await this.extensionService.getOutgoingCallToken({ authId: callAuthId }).toPromise();
2175
+ async getConferenceCallToken(callAuthId) {
2176
+ return await this.extensionService.getConferenceCallToken({ authId: callAuthId }).toPromise();
2133
2177
  }
2134
2178
  async connectToDevice(token, callData) {
2135
2179
  const options = {
@@ -2350,7 +2394,7 @@ class CallProgressComponent {
2350
2394
  const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2351
2395
  this.getUserInformation(callAuthId);
2352
2396
  this.recordCall = recordCall;
2353
- const tokenData = await this.getOutgoingCallToken(callAuthId);
2397
+ const tokenData = await this.getConferenceCallToken(callAuthId);
2354
2398
  // Connect to new call
2355
2399
  const options = {
2356
2400
  codecPreferences: ['opus', 'pcmu'],