@vgroup/dialbox 0.2.50 → 0.2.52

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.
@@ -587,8 +587,9 @@ class ExtensionService {
587
587
  }
588
588
  getConferenceCallToken(payload) {
589
589
  const params = {
590
- "conferenceId": payload.conferenceId,
591
- "userId": payload.userId
590
+ 'Content-Type': 'application/json',
591
+ 'Auth-Key': "Bearer " + localStorage.getItem('ext_token'),
592
+ 'c2c-request': window.location.hostname
592
593
  };
593
594
  const httpOptions = { headers: new HttpHeaders(params) };
594
595
  return this.http.post(environment.apiUrl + '/utilities/ext/ur/generate/conference/token', params, httpOptions);
@@ -2116,13 +2117,13 @@ class CallProgressComponent {
2116
2117
  };
2117
2118
  const response = await this.initiateCall(payload);
2118
2119
  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);
2120
+ const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2121
+ this.getUserInformation(callAuthId);
2122
+ this.recordCall = recordCall; // Store the recordCall value
2123
+ const tokenData = await this.getOutgoingCallToken(callAuthId);
2123
2124
  await this.connectToDevice(tokenData.token, callData);
2124
2125
  // Poll the status for 30-45 seconds
2125
- this.pollCallStatus(authId);
2126
+ this.pollCallStatus(callAuthId);
2126
2127
  }
2127
2128
  else if (response.status == 201) {
2128
2129
  swal("Error", response.message.join("<br/>"), "error");
@@ -2140,19 +2141,14 @@ class CallProgressComponent {
2140
2141
  async initiateCall(payload) {
2141
2142
  return await this.extensionService.initiateCall(payload).toPromise();
2142
2143
  }
2143
- // private async getCallAuthId(response: any) {
2144
- // return {
2145
- // id: response.callauth.id,
2146
- // recordCall: response.callauth.recordCall
2147
- // };
2148
- // }
2149
- getConferenceCallToken(response) {
2144
+ async getCallAuthId(response) {
2150
2145
  return {
2151
- authId: response.callauth.id,
2146
+ id: response.callauth.id,
2147
+ recordCall: response.callauth.recordCall
2152
2148
  };
2153
2149
  }
2154
2150
  async getOutgoingCallToken(callAuthId) {
2155
- return await this.extensionService.getOutgoingCallToken({ authId: callAuthId }).toPromise();
2151
+ return await this.extensionService.getConferenceCallToken({ authId: callAuthId }).toPromise();
2156
2152
  }
2157
2153
  async connectToDevice(token, callData) {
2158
2154
  const options = {
@@ -2372,10 +2368,10 @@ class CallProgressComponent {
2372
2368
  };
2373
2369
  const response = await this.initiateCall(payload);
2374
2370
  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);
2371
+ const { id: callAuthId, recordCall } = await this.getCallAuthId(response);
2372
+ this.getUserInformation(callAuthId);
2373
+ this.recordCall = recordCall;
2374
+ const tokenData = await this.getOutgoingCallToken(callAuthId);
2379
2375
  // Connect to new call
2380
2376
  const options = {
2381
2377
  codecPreferences: ['opus', 'pcmu'],
@@ -2413,7 +2409,7 @@ class CallProgressComponent {
2413
2409
  // Setup event listeners for new call
2414
2410
  this.setupEventListeners();
2415
2411
  // Poll call status
2416
- this.pollCallStatus(authId);
2412
+ this.pollCallStatus(callAuthId);
2417
2413
  console.log('New call initiated to:', phoneNumber);
2418
2414
  this.cdr.detectChanges();
2419
2415
  }