@vgroup/dialbox 0.2.35 → 0.2.36

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,33 +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: any): Observable<any> {
542
- // return this.fetchBlockedCountries().pipe(
543
- // switchMap(blockedCountries => {
544
- // return this.ipAddressService.getIpAddressInfo().pipe(
545
- // switchMap(ipAddressInfo => {
546
- // const params = {
547
- // 'Content-Type': 'application/json',
548
- // 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
549
- // 'ip-address': ipAddressInfo.ip,
550
- // 'ip-country': ipAddressInfo.address.country,
551
- // };
552
- // payload = {...payload, proxy:ipAddressInfo.proxy.toString()}
553
- // const httpOptions = { headers: new HttpHeaders(params) };
554
- // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(
555
- // catchError(error => {
556
- // return throwError(error);
557
- // }),
558
- // );
559
- // }),
560
- // catchError(error => {
561
- // // Catch error from getIpAddressInfo
562
- // return throwError(error);
563
- // })
564
- // );
565
- // })
566
- // );
567
- // }
568
541
  initiateCall(payload) {
569
542
  return this.fetchBlockedCountries().pipe(switchMap(blockedCountries => {
570
543
  return this.ipAddressService.getIpAddressInfo().pipe(switchMap(ipAddressInfo => {
@@ -576,7 +549,7 @@ class ExtensionService {
576
549
  };
577
550
  payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
578
551
  const httpOptions = { headers: new HttpHeaders(params) };
579
- return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(catchError(error => {
552
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/initiate/call', payload, httpOptions).pipe(catchError(error => {
580
553
  return throwError(error);
581
554
  }));
582
555
  }), catchError(error => {
@@ -590,51 +563,46 @@ class ExtensionService {
590
563
  // switchMap(blockedCountries => {
591
564
  // return this.ipAddressService.getIpAddressInfo().pipe(
592
565
  // switchMap(ipAddressInfo => {
593
- // const params = {
594
- // 'Content-Type': 'application/json',
595
- // 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
596
- // 'ip-address': ipAddressInfo.ip,
597
- // 'ip-country': ipAddressInfo.address.country,
598
- // };
599
- // payload = { ...payload, proxy: ipAddressInfo.proxy.toString() };
600
- // const httpOptions = { headers: new HttpHeaders(params) };
601
- // const api1$ = this.http.post(
602
- // `${environment.apiUrl}/utilities/ext/ur/initiate/call`,
603
- // payload,
604
- // httpOptions
605
- // );
606
- // const api2$ = this.http.post(
607
- // `${environment.apiUrl}/utilities/ext/ur/initiate/conference/call`,
608
- // payload,
609
- // httpOptions
610
- // );
611
- // return forkJoin([api1$, api2$]).pipe(
612
- // catchError(error => throwError(() => error))
613
- // );
566
+ // const params = {
567
+ // 'Content-Type': 'application/json',
568
+ // 'Auth-Key': 'Bearer ' + localStorage.getItem('ext_token'),
569
+ // 'ip-address': ipAddressInfo.ip,
570
+ // 'ip-country': ipAddressInfo.address.country,
571
+ // };
572
+ // payload = {...payload, proxy:ipAddressInfo.proxy.toString()}
573
+ // const httpOptions = { headers: new HttpHeaders(params) };
574
+ // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/initiate/conference/call', payload, httpOptions).pipe(
575
+ // catchError(error => {
576
+ // return throwError(error);
577
+ // }),
578
+ // );
614
579
  // }),
615
- // catchError(error => throwError(() => error))
580
+ // catchError(error => {
581
+ // // Catch error from getIpAddressInfo
582
+ // return throwError(error);
583
+ // })
616
584
  // );
617
585
  // })
618
586
  // );
619
587
  // }
620
- // getConferenceCallToken(payload: any) {
621
- // const params = {
622
- // "conferenceId": payload.conferenceId,
623
- // "userId": payload.userId
624
- // }
625
- // const httpOptions = { headers: new HttpHeaders(params) };
626
- // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/generate/conference/token', params, httpOptions);
627
- // }
628
588
  getConferenceCallToken(payload) {
629
- console.log(payload, 'payload');
630
589
  const params = {
631
- 'Content-Type': 'application/json',
632
- 'Auth-Key': "Bearer " + localStorage.getItem('ext_token'),
633
- 'c2c-request': window.location.hostname
590
+ "conferenceId": payload.conferenceId,
591
+ "userId": payload.userId
634
592
  };
635
593
  const httpOptions = { headers: new HttpHeaders(params) };
636
- return this.http.post(environment.apiUrl + '/utilities/ext/ur/generate/token', payload, httpOptions);
594
+ return this.http.post(environment.apiUrl + '/utilities/ext/ur/generate/conference/token', params, httpOptions);
637
595
  }
596
+ // getConferenceCallToken(payload: any) {
597
+ // console.log(payload, 'payload');
598
+ // const params = {
599
+ // 'Content-Type': 'application/json',
600
+ // 'Auth-Key': "Bearer " + localStorage.getItem('ext_token'),
601
+ // 'c2c-request': window.location.hostname
602
+ // }
603
+ // const httpOptions = { headers: new HttpHeaders(params) };
604
+ // return this.http.post<[]>(environment.apiUrl + '/utilities/ext/ur/generate/token', payload, httpOptions);
605
+ // }
638
606
  addFirstParticipant(payload) {
639
607
  const params = {
640
608
  "conferenceId": payload.conferenceId,
@@ -2151,7 +2119,7 @@ class CallProgressComponent {
2151
2119
  const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2152
2120
  this.getUserInformation(callAuthId);
2153
2121
  this.recordCall = recordCall; // Store the recordCall value
2154
- const tokenData = await this.getConferenceCallToken(response.conferenceId);
2122
+ const tokenData = await this.getOutgoingCallToken(callAuthId);
2155
2123
  await this.connectToDevice(tokenData.token, callData);
2156
2124
  // Poll the status for 30-45 seconds
2157
2125
  this.pollCallStatus(callAuthId);
@@ -2178,9 +2146,8 @@ class CallProgressComponent {
2178
2146
  recordCall: response.callauth.recordCall
2179
2147
  };
2180
2148
  }
2181
- async getConferenceCallToken(conferenceId) {
2182
- console.log(conferenceId, 'conferenceId');
2183
- return await this.extensionService.getConferenceCallToken({ conferenceId: conferenceId }).toPromise();
2149
+ async getOutgoingCallToken(callAuthId) {
2150
+ return await this.extensionService.getOutgoingCallToken({ authId: callAuthId }).toPromise();
2184
2151
  }
2185
2152
  async connectToDevice(token, callData) {
2186
2153
  const options = {
@@ -2403,7 +2370,7 @@ class CallProgressComponent {
2403
2370
  const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2404
2371
  this.getUserInformation(callAuthId);
2405
2372
  this.recordCall = recordCall;
2406
- const tokenData = await this.getConferenceCallToken(response.conferenceId);
2373
+ const tokenData = await this.getOutgoingCallToken(callAuthId);
2407
2374
  // Connect to new call
2408
2375
  const options = {
2409
2376
  codecPreferences: ['opus', 'pcmu'],