@webex/calling 3.10.0-next.2 → 3.10.0-next.21

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.
Files changed (131) hide show
  1. package/dist/CallHistory/CallHistory.js +128 -128
  2. package/dist/CallHistory/CallHistory.js.map +1 -1
  3. package/dist/CallHistory/CallHistory.test.js +278 -181
  4. package/dist/CallHistory/CallHistory.test.js.map +1 -1
  5. package/dist/CallSettings/CallSettings.js +17 -18
  6. package/dist/CallSettings/CallSettings.js.map +1 -1
  7. package/dist/CallSettings/CallSettings.test.js +14 -14
  8. package/dist/CallSettings/CallSettings.test.js.map +1 -1
  9. package/dist/CallSettings/UcmBackendConnector.js +71 -24
  10. package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
  11. package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
  12. package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
  13. package/dist/CallSettings/WxCallBackendConnector.js +137 -138
  14. package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
  15. package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
  16. package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
  17. package/dist/CallingClient/CallingClient.js +297 -345
  18. package/dist/CallingClient/CallingClient.js.map +1 -1
  19. package/dist/CallingClient/CallingClient.test.js +267 -405
  20. package/dist/CallingClient/CallingClient.test.js.map +1 -1
  21. package/dist/CallingClient/calling/CallerId/index.js +7 -8
  22. package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
  23. package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
  24. package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
  25. package/dist/CallingClient/calling/call.js +655 -611
  26. package/dist/CallingClient/calling/call.js.map +1 -1
  27. package/dist/CallingClient/calling/call.test.js +762 -551
  28. package/dist/CallingClient/calling/call.test.js.map +1 -1
  29. package/dist/CallingClient/calling/callManager.js +15 -18
  30. package/dist/CallingClient/calling/callManager.js.map +1 -1
  31. package/dist/CallingClient/calling/callManager.test.js +113 -113
  32. package/dist/CallingClient/calling/callManager.test.js.map +1 -1
  33. package/dist/CallingClient/constants.js +5 -1
  34. package/dist/CallingClient/constants.js.map +1 -1
  35. package/dist/CallingClient/line/index.js +57 -74
  36. package/dist/CallingClient/line/index.js.map +1 -1
  37. package/dist/CallingClient/line/line.test.js +22 -22
  38. package/dist/CallingClient/line/line.test.js.map +1 -1
  39. package/dist/CallingClient/registration/register.js +657 -526
  40. package/dist/CallingClient/registration/register.js.map +1 -1
  41. package/dist/CallingClient/registration/register.test.js +657 -309
  42. package/dist/CallingClient/registration/register.test.js.map +1 -1
  43. package/dist/CallingClient/registration/types.js.map +1 -1
  44. package/dist/CallingClient/registration/webWorker.js +24 -24
  45. package/dist/CallingClient/registration/webWorker.js.map +1 -1
  46. package/dist/CallingClient/registration/webWorker.test.js +20 -20
  47. package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
  48. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
  49. package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
  50. package/dist/Contacts/ContactsClient.js +258 -258
  51. package/dist/Contacts/ContactsClient.js.map +1 -1
  52. package/dist/Contacts/ContactsClient.test.js +60 -60
  53. package/dist/Contacts/ContactsClient.test.js.map +1 -1
  54. package/dist/Errors/catalog/CallError.js +7 -10
  55. package/dist/Errors/catalog/CallError.js.map +1 -1
  56. package/dist/Errors/catalog/CallingDeviceError.js +6 -9
  57. package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
  58. package/dist/Errors/catalog/ExtendedError.js +6 -8
  59. package/dist/Errors/catalog/ExtendedError.js.map +1 -1
  60. package/dist/Errors/catalog/LineError.js +6 -9
  61. package/dist/Errors/catalog/LineError.js.map +1 -1
  62. package/dist/Events/impl/index.js +11 -13
  63. package/dist/Events/impl/index.js.map +1 -1
  64. package/dist/Metrics/index.js +1 -2
  65. package/dist/Metrics/index.js.map +1 -1
  66. package/dist/SDKConnector/index.js +1 -2
  67. package/dist/SDKConnector/index.js.map +1 -1
  68. package/dist/SDKConnector/types.js.map +1 -1
  69. package/dist/Voicemail/BroadworksBackendConnector.js +129 -128
  70. package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
  71. package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
  72. package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
  73. package/dist/Voicemail/UcmBackendConnector.js +86 -86
  74. package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
  75. package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
  76. package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
  77. package/dist/Voicemail/Voicemail.js +58 -61
  78. package/dist/Voicemail/Voicemail.js.map +1 -1
  79. package/dist/Voicemail/Voicemail.test.js +20 -20
  80. package/dist/Voicemail/Voicemail.test.js.map +1 -1
  81. package/dist/Voicemail/WxCallBackendConnector.js +116 -117
  82. package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
  83. package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
  84. package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
  85. package/dist/common/Utils.js +195 -165
  86. package/dist/common/Utils.js.map +1 -1
  87. package/dist/common/Utils.test.js +432 -183
  88. package/dist/common/Utils.test.js.map +1 -1
  89. package/dist/common/constants.js +3 -1
  90. package/dist/common/constants.js.map +1 -1
  91. package/dist/common/testUtil.js +5 -4
  92. package/dist/common/testUtil.js.map +1 -1
  93. package/dist/module/CallHistory/CallHistory.js +7 -3
  94. package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
  95. package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
  96. package/dist/module/CallingClient/CallingClient.js +83 -121
  97. package/dist/module/CallingClient/calling/call.js +60 -39
  98. package/dist/module/CallingClient/constants.js +3 -0
  99. package/dist/module/CallingClient/registration/register.js +82 -2
  100. package/dist/module/Contacts/ContactsClient.js +9 -5
  101. package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
  102. package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
  103. package/dist/module/common/Utils.js +27 -3
  104. package/dist/module/common/constants.js +2 -0
  105. package/dist/module/common/testUtil.js +1 -0
  106. package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
  107. package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
  108. package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
  109. package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
  110. package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
  111. package/dist/types/CallingClient/calling/call.d.ts +4 -0
  112. package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
  113. package/dist/types/CallingClient/constants.d.ts +3 -0
  114. package/dist/types/CallingClient/constants.d.ts.map +1 -1
  115. package/dist/types/CallingClient/registration/register.d.ts +4 -0
  116. package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
  117. package/dist/types/CallingClient/registration/types.d.ts +6 -0
  118. package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
  119. package/dist/types/Contacts/ContactsClient.d.ts +1 -0
  120. package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
  121. package/dist/types/SDKConnector/types.d.ts +16 -0
  122. package/dist/types/SDKConnector/types.d.ts.map +1 -1
  123. package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
  124. package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
  125. package/dist/types/common/Utils.d.ts +1 -1
  126. package/dist/types/common/Utils.d.ts.map +1 -1
  127. package/dist/types/common/constants.d.ts +2 -0
  128. package/dist/types/common/constants.d.ts.map +1 -1
  129. package/dist/types/common/testUtil.d.ts +1 -0
  130. package/dist/types/common/testUtil.d.ts.map +1 -1
  131. package/package.json +4 -4
@@ -9,7 +9,7 @@ import { MOBIUS_EVENT_KEYS, SessionType, CALLING_CLIENT_EVENT_KEYS, } from '../E
9
9
  import { ServiceIndicator, ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, } from '../common/types';
10
10
  import log from '../Logger';
11
11
  import { getCallManager } from './calling/callManager';
12
- import { CALLING_CLIENT_FILE, CALLS_CLEARED_HANDLER_UTIL, CALLING_USER_AGENT, CISCO_DEVICE_URL, DISCOVERY_URL, GET_MOBIUS_SERVERS_UTIL, IP_ENDPOINT, SPARK_USER_AGENT, URL_ENDPOINT, API_V1, MOBIUS_US_PROD, MOBIUS_EU_PROD, MOBIUS_US_INT, MOBIUS_EU_INT, METHODS, NETWORK_FLAP_TIMEOUT, } from './constants';
12
+ import { CALLING_CLIENT_FILE, CALLS_CLEARED_HANDLER_UTIL, CALLING_USER_AGENT, CISCO_DEVICE_URL, DISCOVERY_URL, GET_MOBIUS_SERVERS_UTIL, SPARK_USER_AGENT, URL_ENDPOINT, API_V1, METHODS, NETWORK_FLAP_TIMEOUT, } from './constants';
13
13
  import Line from './line';
14
14
  import { METRIC_EVENT, REG_ACTION, METRIC_TYPE, CONNECTION_ACTION, MOBIUS_SERVER_ACTION, } from '../Metrics/types';
15
15
  import { getMetricManager } from '../Metrics';
@@ -65,28 +65,7 @@ export class CallingClient extends Eventing {
65
65
  this.mediaEngine.setLogger(adaptedLogger);
66
66
  this.primaryMobiusUris = [];
67
67
  this.backupMobiusUris = [];
68
- let mobiusServiceHost = '';
69
- try {
70
- mobiusServiceHost = new URL(this.webex.internal.services._serviceUrls.mobius).host;
71
- }
72
- catch (error) {
73
- log.warn(`Failed to parse mobius service URL`, {
74
- file: CALLING_CLIENT_FILE,
75
- method: this.constructor.name,
76
- });
77
- }
78
- if (this.webex.internal.services._hostCatalog) {
79
- this.mobiusClusters =
80
- (mobiusServiceHost && this.webex.internal.services._hostCatalog[mobiusServiceHost]) ||
81
- this.webex.internal.services._hostCatalog[MOBIUS_US_PROD] ||
82
- this.webex.internal.services._hostCatalog[MOBIUS_EU_PROD] ||
83
- this.webex.internal.services._hostCatalog[MOBIUS_US_INT] ||
84
- this.webex.internal.services._hostCatalog[MOBIUS_EU_INT];
85
- }
86
- else {
87
- const mobiusObject = this.webex.internal.services._services.find((item) => item.serviceName === 'mobius');
88
- this.mobiusClusters = [mobiusObject.serviceUrls[0].baseUrl];
89
- }
68
+ this.mobiusClusters = this.webex.internal.services.getMobiusClusters();
90
69
  this.mobiusHost = '';
91
70
  this.registerSessionsListener();
92
71
  this.registerCallsClearedListener();
@@ -237,67 +216,38 @@ export class CallingClient extends Eventing {
237
216
  method: METHODS.GET_CLIENT_REGION_INFO,
238
217
  });
239
218
  const regionInfo = {};
240
- for (const mobius of this.mobiusClusters) {
241
- if (mobius.host) {
242
- this.mobiusHost = `https://${mobius.host}${API_V1}`;
243
- }
244
- else {
245
- this.mobiusHost = mobius;
246
- }
247
- try {
248
- const temp = await this.webex.request({
249
- uri: `${this.mobiusHost}${URL_ENDPOINT}${IP_ENDPOINT}`,
250
- method: HTTP_METHODS.GET,
251
- headers: {
252
- [CISCO_DEVICE_URL]: this.webex.internal.device.url,
253
- [SPARK_USER_AGENT]: CALLING_USER_AGENT,
254
- },
255
- service: ALLOWED_SERVICES.MOBIUS,
256
- });
257
- log.log(`Response trackingId: ${temp?.headers?.trackingid}`, {
258
- file: CALLING_CLIENT_FILE,
259
- method: METHODS.GET_CLIENT_REGION_INFO,
260
- });
261
- const myIP = temp.body.ipv4;
262
- const response = await this.webex.request({
263
- uri: `${DISCOVERY_URL}/${myIP}`,
264
- method: HTTP_METHODS.GET,
265
- addAuthHeader: false,
266
- headers: {
267
- [SPARK_USER_AGENT]: null,
268
- },
269
- });
270
- log.log(`Response trackingId: ${response?.headers?.trackingid}`, {
271
- file: CALLING_CLIENT_FILE,
272
- method: METHODS.GET_CLIENT_REGION_INFO,
273
- });
274
- const clientRegionInfo = response.body;
275
- regionInfo.clientRegion = clientRegionInfo?.clientRegion
276
- ? clientRegionInfo.clientRegion
277
- : '';
278
- regionInfo.countryCode = clientRegionInfo?.countryCode ? clientRegionInfo.countryCode : '';
279
- log.log(`Successfully fetched Client region info: ${regionInfo.clientRegion}, countryCode: ${regionInfo.countryCode}, and response trackingid: ${response?.headers?.trackingid}`, {
280
- file: CALLING_CLIENT_FILE,
281
- method: METHODS.GET_CLIENT_REGION_INFO,
282
- });
283
- this.metricManager.submitRegionInfoMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.REGION_INFO, METRIC_TYPE.BEHAVIORAL, this.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, response?.headers?.trackingid ?? '');
284
- break;
285
- }
286
- catch (err) {
287
- log.error(`Failed to get client region info: ${JSON.stringify(err)}`, {
288
- method: METHODS.GET_CLIENT_REGION_INFO,
289
- file: CALLING_CLIENT_FILE,
290
- });
291
- abort = await handleCallingClientErrors(err, (clientError) => {
292
- this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
293
- this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
294
- }, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
295
- regionInfo.clientRegion = '';
296
- regionInfo.countryCode = '';
297
- if (abort) {
298
- await uploadLogs();
299
- return regionInfo;
300
- }
219
+ try {
220
+ const response = await this.webex.request({
221
+ uri: `${DISCOVERY_URL}`,
222
+ method: HTTP_METHODS.GET,
223
+ addAuthHeader: false,
224
+ headers: {
225
+ [SPARK_USER_AGENT]: null,
226
+ },
227
+ });
228
+ const clientRegionInfo = response.body;
229
+ regionInfo.clientRegion = clientRegionInfo?.clientRegion || '';
230
+ regionInfo.countryCode = clientRegionInfo?.countryCode || '';
231
+ log.log(`Successfully fetched Client region info: ${regionInfo.clientRegion}, countryCode: ${regionInfo.countryCode}, and response trackingid: ${response?.headers?.trackingid}`, {
232
+ file: CALLING_CLIENT_FILE,
233
+ method: METHODS.GET_CLIENT_REGION_INFO,
234
+ });
235
+ this.metricManager.submitRegionInfoMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.REGION_INFO, METRIC_TYPE.BEHAVIORAL, this.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, response?.headers?.trackingid ?? '');
236
+ }
237
+ catch (err) {
238
+ log.error(`Failed to get client region info: ${JSON.stringify(err)}`, {
239
+ method: METHODS.GET_CLIENT_REGION_INFO,
240
+ file: CALLING_CLIENT_FILE,
241
+ });
242
+ abort = await handleCallingClientErrors(err, (clientError) => {
243
+ this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
244
+ this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
245
+ }, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
246
+ regionInfo.clientRegion = '';
247
+ regionInfo.countryCode = '';
248
+ if (abort) {
249
+ await uploadLogs();
250
+ return regionInfo;
301
251
  }
302
252
  }
303
253
  return regionInfo;
@@ -317,7 +267,9 @@ export class CallingClient extends Eventing {
317
267
  });
318
268
  clientRegion = this.sdkConfig?.discovery?.region;
319
269
  countryCode = this.sdkConfig?.discovery?.country;
320
- this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
270
+ this.mobiusHost =
271
+ this.webex.internal.services._serviceUrls?.mobius ||
272
+ this.webex.internal.services.get(this.webex.internal.services._activeServices.mobius);
321
273
  }
322
274
  else {
323
275
  log.log('Updating region and country through Region discovery', {
@@ -333,43 +285,53 @@ export class CallingClient extends Eventing {
333
285
  file: CALLING_CLIENT_FILE,
334
286
  method: GET_MOBIUS_SERVERS_UTIL,
335
287
  });
336
- try {
337
- const response = await this.webex.request({
338
- uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
339
- method: HTTP_METHODS.GET,
340
- headers: {
341
- [CISCO_DEVICE_URL]: this.webex.internal.device.url,
342
- [SPARK_USER_AGENT]: CALLING_USER_AGENT,
343
- },
344
- service: ALLOWED_SERVICES.MOBIUS,
345
- });
346
- log.log(`Mobius Server found for the region. Response trackingId: ${response?.headers?.trackingid}`, {
347
- file: CALLING_CLIENT_FILE,
348
- method: GET_MOBIUS_SERVERS_UTIL,
349
- });
350
- const mobiusServers = response.body;
351
- this.metricManager.submitMobiusServersMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, METRIC_TYPE.BEHAVIORAL, mobiusServers, response?.headers?.trackingid ?? '');
352
- const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
353
- this.primaryMobiusUris = mobiusUris.primary;
354
- this.backupMobiusUris = mobiusUris.backup;
355
- log.log(`Final list of Mobius Servers, primary: ${mobiusUris.primary} and backup: ${mobiusUris.backup}`, {
356
- file: CALLING_CLIENT_FILE,
357
- method: GET_MOBIUS_SERVERS_UTIL,
358
- });
359
- }
360
- catch (err) {
361
- log.error(`Failed to get Mobius servers: ${JSON.stringify(err)}`, {
362
- method: METHODS.GET_MOBIUS_SERVERS,
363
- file: CALLING_CLIENT_FILE,
364
- });
365
- const abort = await handleCallingClientErrors(err, (clientError) => {
366
- this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
367
- this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
368
- }, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
369
- if (abort) {
370
- await uploadLogs();
288
+ for (const mobius of this.mobiusClusters) {
289
+ if (mobius.host) {
290
+ this.mobiusHost = `https://${mobius.host}${API_V1}`;
291
+ }
292
+ else {
293
+ this.mobiusHost = mobius;
294
+ }
295
+ try {
296
+ const response = await this.webex.request({
297
+ uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
298
+ method: HTTP_METHODS.GET,
299
+ headers: {
300
+ [CISCO_DEVICE_URL]: this.webex.internal.device.url,
301
+ [SPARK_USER_AGENT]: CALLING_USER_AGENT,
302
+ },
303
+ service: ALLOWED_SERVICES.MOBIUS,
304
+ });
305
+ log.log(`Mobius Server found for the region. Response trackingId: ${response?.headers?.trackingid}`, {
306
+ file: CALLING_CLIENT_FILE,
307
+ method: GET_MOBIUS_SERVERS_UTIL,
308
+ });
309
+ const mobiusServers = response.body;
310
+ this.metricManager.submitMobiusServersMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, METRIC_TYPE.BEHAVIORAL, mobiusServers, response?.headers?.trackingid ?? '');
311
+ const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
312
+ this.primaryMobiusUris = mobiusUris.primary;
313
+ this.backupMobiusUris = mobiusUris.backup;
314
+ log.log(`Final list of Mobius Servers, primary: ${mobiusUris.primary} and backup: ${mobiusUris.backup}`, {
315
+ file: CALLING_CLIENT_FILE,
316
+ method: GET_MOBIUS_SERVERS_UTIL,
317
+ });
318
+ break;
319
+ }
320
+ catch (err) {
321
+ log.error(`Failed to get Mobius servers: ${JSON.stringify(err)}`, {
322
+ method: METHODS.GET_MOBIUS_SERVERS,
323
+ file: CALLING_CLIENT_FILE,
324
+ });
325
+ const abort = await handleCallingClientErrors(err, (clientError) => {
326
+ this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
327
+ this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
328
+ }, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
329
+ if (abort) {
330
+ useDefault = true;
331
+ await uploadLogs();
332
+ break;
333
+ }
371
334
  }
372
- useDefault = true;
373
335
  }
374
336
  }
375
337
  else {
@@ -7,7 +7,7 @@ import { ERROR_LAYER, ERROR_TYPE } from '../../Errors/types';
7
7
  import { handleCallErrors, modifySdpForIPv4, parseMediaQualityStatistics, serviceErrorCodeHandler, uploadLogs, } from '../../common/Utils';
8
8
  import { ALLOWED_SERVICES, CallDirection, HTTP_METHODS, } from '../../common/types';
9
9
  import { createCallError } from '../../Errors/catalog/CallError';
10
- import { CALL_ENDPOINT_RESOURCE, CALL_FILE, CALL_HOLD_SERVICE, CALL_STATUS_RESOURCE, CALL_TRANSFER_SERVICE, CALLING_USER_AGENT, CALLS_ENDPOINT_RESOURCE, CISCO_DEVICE_URL, DEFAULT_LOCAL_CALL_ID, DEFAULT_SESSION_TIMER, DEVICES_ENDPOINT_RESOURCE, HOLD_ENDPOINT, ICE_CANDIDATES_TIMEOUT, INITIAL_SEQ_NUMBER, MEDIA_ENDPOINT_RESOURCE, METHODS, NOISE_REDUCTION_EFFECT, RESUME_ENDPOINT, SPARK_USER_AGENT, SUPPLEMENTARY_SERVICES_TIMEOUT, TRANSFER_ENDPOINT, } from '../constants';
10
+ import { CALL_ENDPOINT_RESOURCE, CALL_FILE, CALL_HOLD_SERVICE, CALL_STATUS_RESOURCE, CALL_TRANSFER_SERVICE, CALLING_USER_AGENT, CALLS_ENDPOINT_RESOURCE, CISCO_DEVICE_URL, DEFAULT_LOCAL_CALL_ID, DEFAULT_SESSION_TIMER, DEVICES_ENDPOINT_RESOURCE, HOLD_ENDPOINT, ICE_CANDIDATES_TIMEOUT, INITIAL_SEQ_NUMBER, MAX_CALL_KEEPALIVE_RETRY_COUNT, MEDIA_ENDPOINT_RESOURCE, METHODS, NOISE_REDUCTION_EFFECT, RESUME_ENDPOINT, SPARK_USER_AGENT, SUPPLEMENTARY_SERVICES_TIMEOUT, TRANSFER_ENDPOINT, } from '../constants';
11
11
  import SDKConnector from '../../SDKConnector';
12
12
  import { Eventing } from '../../Events/impl';
13
13
  import { CALL_EVENT_KEYS, MEDIA_CONNECTION_EVENT_KEYS, MOBIUS_MIDCALL_STATE, SUPPLEMENTARY_SERVICES, } from '../../Events/types';
@@ -51,6 +51,7 @@ export class Call extends Eventing {
51
51
  receivedRoapOKSeq;
52
52
  localAudioStream;
53
53
  rtcMetrics;
54
+ callKeepaliveRetryCount = 0;
54
55
  isMuted() {
55
56
  return this.muted;
56
57
  }
@@ -881,20 +882,21 @@ export class Call extends Eventing {
881
882
  async handleIncomingCallDisconnect(event) {
882
883
  log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
883
884
  file: CALL_FILE,
884
- method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
885
+ method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
885
886
  });
887
+ this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
886
888
  this.setDisconnectReason();
887
889
  try {
888
890
  const response = await this.delete();
889
891
  log.log(`Response code: ${response.statusCode}`, {
890
892
  file: CALL_FILE,
891
- method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
893
+ method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
892
894
  });
893
895
  }
894
896
  catch (e) {
895
897
  log.warn(`Failed to delete the call: ${JSON.stringify(e)}`, {
896
898
  file: CALL_FILE,
897
- method: METHODS.HANDLE_OUTGOING_CALL_DISCONNECT,
899
+ method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
898
900
  });
899
901
  uploadLogs({
900
902
  correlationId: this.correlationId,
@@ -916,7 +918,6 @@ export class Call extends Eventing {
916
918
  }
917
919
  this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
918
920
  this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
919
- this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
920
921
  }
921
922
  async handleOutgoingCallDisconnect(event) {
922
923
  log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
@@ -961,50 +962,70 @@ export class Call extends Eventing {
961
962
  this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
962
963
  this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
963
964
  }
964
- handleCallEstablished(event) {
965
- log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
966
- file: CALL_FILE,
967
- method: METHODS.HANDLE_CALL_ESTABLISHED,
968
- });
969
- this.emit(CALL_EVENT_KEYS.ESTABLISHED, this.correlationId);
970
- this.earlyMedia = false;
971
- this.connected = true;
972
- if (this.sessionTimer) {
973
- log.log('Resetting session timer', {
965
+ callKeepaliveRetryCallback = (interval) => {
966
+ if (this.callKeepaliveRetryCount === MAX_CALL_KEEPALIVE_RETRY_COUNT) {
967
+ log.warn(`Max keepalive retry attempts reached. Aborting call keepalive for callId: ${this.callId}`, {
974
968
  file: CALL_FILE,
975
- method: METHODS.HANDLE_CALL_ESTABLISHED,
969
+ method: 'keepaliveRetryCallback',
976
970
  });
971
+ return;
972
+ }
973
+ this.callKeepaliveRetryCount += 1;
974
+ setTimeout(async () => {
975
+ try {
976
+ await this.postStatus();
977
+ this.scheduleCallKeepaliveInterval();
978
+ }
979
+ catch (err) {
980
+ await this.handleCallKeepaliveError(err);
981
+ }
982
+ }, interval * 1000);
983
+ };
984
+ handleCallKeepaliveError = async (err) => {
985
+ const error = err;
986
+ if (this.sessionTimer) {
977
987
  clearInterval(this.sessionTimer);
978
988
  }
989
+ const abort = await handleCallErrors((callError) => {
990
+ this.emit(CALL_EVENT_KEYS.CALL_ERROR, callError);
991
+ this.submitCallErrorMetric(callError);
992
+ }, ERROR_LAYER.CALL_CONTROL, this.callKeepaliveRetryCallback, this.getCorrelationId(), error, 'handleCallEstablished', CALL_FILE);
993
+ if (abort) {
994
+ this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
995
+ this.emit(CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
996
+ this.callKeepaliveRetryCount = 0;
997
+ }
998
+ await uploadLogs({
999
+ correlationId: this.correlationId,
1000
+ callId: this.callId,
1001
+ broadworksCorrelationInfo: this.broadworksCorrelationInfo,
1002
+ });
1003
+ };
1004
+ scheduleCallKeepaliveInterval = () => {
1005
+ const loggerContext = {
1006
+ file: CALL_FILE,
1007
+ method: 'scheduleCallKeepaliveInterval',
1008
+ };
979
1009
  this.sessionTimer = setInterval(async () => {
980
1010
  try {
981
1011
  const res = await this.postStatus();
982
- log.info(`Session refresh successful`, {
983
- file: CALL_FILE,
984
- method: METHODS.HANDLE_CALL_ESTABLISHED,
985
- });
1012
+ log.info(`Session refresh successful`, loggerContext);
986
1013
  }
987
1014
  catch (err) {
988
- const error = err;
989
- if (this.sessionTimer) {
990
- clearInterval(this.sessionTimer);
991
- }
992
- handleCallErrors((callError) => {
993
- this.emit(CALL_EVENT_KEYS.CALL_ERROR, callError);
994
- this.submitCallErrorMetric(callError);
995
- }, ERROR_LAYER.CALL_CONTROL, (interval) => {
996
- setTimeout(() => {
997
- this.postStatus();
998
- this.sendCallStateMachineEvt({ type: 'E_CALL_ESTABLISHED' });
999
- }, interval * 1000);
1000
- }, this.getCorrelationId(), error, this.handleCallEstablished.name, CALL_FILE);
1001
- await uploadLogs({
1002
- correlationId: this.correlationId,
1003
- callId: this.callId,
1004
- broadworksCorrelationInfo: this.broadworksCorrelationInfo,
1005
- });
1015
+ await this.handleCallKeepaliveError(err);
1006
1016
  }
1007
1017
  }, DEFAULT_SESSION_TIMER);
1018
+ };
1019
+ handleCallEstablished(event) {
1020
+ const loggerContext = {
1021
+ file: CALL_FILE,
1022
+ method: METHODS.HANDLE_CALL_ESTABLISHED,
1023
+ };
1024
+ log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, loggerContext);
1025
+ this.emit(CALL_EVENT_KEYS.ESTABLISHED, this.correlationId);
1026
+ this.earlyMedia = false;
1027
+ this.connected = true;
1028
+ this.scheduleCallKeepaliveInterval();
1008
1029
  }
1009
1030
  async handleUnknownState(event) {
1010
1031
  log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
@@ -1159,7 +1180,7 @@ export class Call extends Eventing {
1159
1180
  method: METHODS.HANDLE_ROAP_ERROR,
1160
1181
  });
1161
1182
  const message = event.data;
1162
- if (message) {
1183
+ if (message && message.messageType === 'ERROR') {
1163
1184
  try {
1164
1185
  const res = await this.postMedia(message);
1165
1186
  log.info(`Response code: ${res.statusCode}`, {
@@ -12,6 +12,7 @@ export const DEFAULT_LOCAL_CALL_ID = 'DefaultLocalId';
12
12
  export const DEFAULT_REHOMING_INTERVAL_MAX = 120;
13
13
  export const DEFAULT_REHOMING_INTERVAL_MIN = 60;
14
14
  export const DEFAULT_SESSION_TIMER = 1000 * 60 * 10;
15
+ export const MAX_CALL_KEEPALIVE_RETRY_COUNT = 4;
15
16
  export const DEVICES_ENDPOINT_RESOURCE = 'devices';
16
17
  export const DISCOVERY_URL = 'https://ds.ciscospark.com/v1/region';
17
18
  export const DUMMY_METRICS = {
@@ -112,6 +113,7 @@ export const REGISTRATION_UTIL = 'triggerRegistration';
112
113
  export const REGISTER_UTIL = 'attemptRegistrationWithServers';
113
114
  export const GET_MOBIUS_SERVERS_UTIL = 'getMobiusServers';
114
115
  export const KEEPALIVE_UTIL = 'startKeepaliveTimer';
116
+ export const RECONNECT_ON_FAILURE_UTIL = 'reconnectOnFailure';
115
117
  export const FAILBACK_UTIL = 'executeFailback';
116
118
  export const REG_429_RETRY_UTIL = 'handle429Retry';
117
119
  export const FAILOVER_UTIL = 'startFailoverTimer';
@@ -122,6 +124,7 @@ export const MOBIUS_US_PROD = 'mobius-us-east-1.prod.infra.webex.com';
122
124
  export const MOBIUS_EU_PROD = 'mobius-eu-central-1.prod.infra.webex.com';
123
125
  export const MOBIUS_US_INT = 'mobius-us-east-1.int.infra.webex.com';
124
126
  export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
127
+ export const FAILOVER_CACHE_PREFIX = 'wxc-failover-state';
125
128
  export const ICE_CANDIDATES_TIMEOUT = 3000;
126
129
  export const METHODS = {
127
130
  CONSTRUCTOR: 'constructor',
@@ -8,7 +8,7 @@ import { getCallManager } from '../calling';
8
8
  import log from '../../Logger';
9
9
  import SDKConnector from '../../SDKConnector';
10
10
  import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, ServiceIndicator, WorkerMessageType, } from '../../common/types';
11
- import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, } from '../constants';
11
+ import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, RECONNECT_ON_FAILURE_UTIL, FAILOVER_CACHE_PREFIX, } from '../constants';
12
12
  import { LINE_EVENTS } from '../line/types';
13
13
  export class Registration {
14
14
  sdkConnector;
@@ -58,6 +58,53 @@ export class Registration {
58
58
  this.primaryMobiusUris = [];
59
59
  this.backupMobiusUris = [];
60
60
  }
61
+ getFailoverCacheKey() {
62
+ return `${FAILOVER_CACHE_PREFIX}.${this.userId || 'unknown'}`;
63
+ }
64
+ saveFailoverState(failoverState) {
65
+ try {
66
+ localStorage.setItem(this.getFailoverCacheKey(), JSON.stringify(failoverState));
67
+ }
68
+ catch (error) {
69
+ log.warn(`Storing failover state in cache failed with error: ${String(error)}`, {
70
+ file: REGISTRATION_FILE,
71
+ method: 'saveFailoverState',
72
+ });
73
+ }
74
+ }
75
+ clearFailoverState() {
76
+ try {
77
+ localStorage.removeItem(this.getFailoverCacheKey());
78
+ }
79
+ catch {
80
+ log.warn('Clearing failover state from localStorage failed', {
81
+ file: REGISTRATION_FILE,
82
+ method: 'clearFailoverState',
83
+ });
84
+ }
85
+ }
86
+ async resumeFailover() {
87
+ try {
88
+ const cachedState = localStorage.getItem(this.getFailoverCacheKey());
89
+ const failoverState = cachedState
90
+ ? JSON.parse(cachedState)
91
+ : undefined;
92
+ if (failoverState && !this.isDeviceRegistered()) {
93
+ const currentTime = Math.floor(Date.now() / 1000);
94
+ const newElapsed = failoverState.timeElapsed + (currentTime - failoverState.retryScheduledTime);
95
+ this.clearFailoverState();
96
+ await this.startFailoverTimer(failoverState.attempt, newElapsed);
97
+ return true;
98
+ }
99
+ }
100
+ catch (error) {
101
+ log.warn(`No failover state found in cache`, {
102
+ file: REGISTRATION_FILE,
103
+ method: 'triggerRegistration',
104
+ });
105
+ }
106
+ return false;
107
+ }
61
108
  getActiveMobiusUrl() {
62
109
  return this.activeMobiusUrl;
63
110
  }
@@ -119,6 +166,22 @@ export class Registration {
119
166
  let abort = false;
120
167
  if (this.activeMobiusUrl) {
121
168
  abort = await this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
169
+ if (this.retryAfter) {
170
+ if (this.retryAfter < RETRY_TIMER_UPPER_LIMIT) {
171
+ setTimeout(async () => {
172
+ await this.restartRegistration(caller);
173
+ }, this.retryAfter * 1000);
174
+ }
175
+ else if (this.primaryMobiusUris.includes(this.activeMobiusUrl) &&
176
+ this.backupMobiusUris.length > 0) {
177
+ abort = await this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
178
+ }
179
+ else {
180
+ this.restartRegistration(caller);
181
+ }
182
+ this.retryAfter = undefined;
183
+ return true;
184
+ }
122
185
  }
123
186
  return abort;
124
187
  }
@@ -190,6 +253,12 @@ export class Registration {
190
253
  if (this.retryAfter != null) {
191
254
  interval = Math.max(interval, this.retryAfter);
192
255
  }
256
+ this.saveFailoverState({
257
+ attempt,
258
+ timeElapsed,
259
+ retryScheduledTime: scheduledTime,
260
+ serverType: 'primary',
261
+ });
193
262
  setTimeout(async () => {
194
263
  await this.mutex.runExclusive(async () => {
195
264
  abort = await this.attemptRegistrationWithServers(FAILOVER_UTIL);
@@ -202,6 +271,12 @@ export class Registration {
202
271
  log.log(`Scheduled retry with primary in ${interval} seconds, number of attempts : ${attempt}`, loggerContext);
203
272
  }
204
273
  else if (this.backupMobiusUris.length) {
274
+ this.saveFailoverState({
275
+ attempt,
276
+ timeElapsed,
277
+ retryScheduledTime: Math.floor(Date.now() / 1000),
278
+ serverType: 'backup',
279
+ });
205
280
  log.info('Failing over to backup servers.', loggerContext);
206
281
  this.failoverImmediately = false;
207
282
  abort = await this.attemptRegistrationWithServers(FAILOVER_UTIL, this.backupMobiusUris);
@@ -417,6 +492,9 @@ export class Registration {
417
492
  };
418
493
  }
419
494
  async triggerRegistration() {
495
+ if (await this.resumeFailover()) {
496
+ return;
497
+ }
420
498
  if (this.primaryMobiusUris.length > 0) {
421
499
  const abort = await this.attemptRegistrationWithServers(REGISTRATION_UTIL, this.primaryMobiusUris);
422
500
  if (!this.isDeviceRegistered() && !abort) {
@@ -450,6 +528,7 @@ export class Registration {
450
528
  method: REGISTER_UTIL,
451
529
  });
452
530
  const resp = await this.postRegistration(url);
531
+ this.clearFailoverState();
453
532
  this.deviceInfo = resp.body;
454
533
  this.registrationStatus = RegistrationStatus.ACTIVE;
455
534
  this.setActiveMobiusUrl(url);
@@ -537,7 +616,7 @@ export class Registration {
537
616
  this.lineEmitter(LINE_EVENTS.UNREGISTERED);
538
617
  await uploadLogs();
539
618
  if (!abort) {
540
- await this.reconnectOnFailure(KEEPALIVE_UTIL);
619
+ await this.reconnectOnFailure(RECONNECT_ON_FAILURE_UTIL);
541
620
  }
542
621
  else if (error.statusCode === 404) {
543
622
  this.handle404KeepaliveFailure(KEEPALIVE_UTIL);
@@ -578,6 +657,7 @@ export class Registration {
578
657
  }
579
658
  this.clearKeepaliveTimer();
580
659
  this.setStatus(RegistrationStatus.INACTIVE);
660
+ this.clearFailoverState();
581
661
  }
582
662
  isRegRetry() {
583
663
  return this.registerRetry;
@@ -12,6 +12,7 @@ export class ContactsClient {
12
12
  groups;
13
13
  contacts;
14
14
  defaultGroupId;
15
+ contactsServiceUrl;
15
16
  constructor(webex, logger) {
16
17
  this.sdkConnector = SDKConnector;
17
18
  if (!this.sdkConnector.getWebex()) {
@@ -22,6 +23,9 @@ export class ContactsClient {
22
23
  this.groups = undefined;
23
24
  this.contacts = undefined;
24
25
  this.defaultGroupId = '';
26
+ this.contactsServiceUrl =
27
+ this.webex.internal.services._serviceUrls?.contactsService ||
28
+ this.webex.internal.services.get(this.webex.internal.services._activeServices.contactsService);
25
29
  log.setLogger(logger.level, CONTACTS_CLIENT);
26
30
  }
27
31
  async decryptContactDetail(encryptionKeyUrl, contactDetails) {
@@ -195,7 +199,7 @@ export class ContactsClient {
195
199
  const cloudContactsMap = {};
196
200
  try {
197
201
  const response = await this.webex.request({
198
- uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
202
+ uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
199
203
  method: HTTP_METHODS.GET,
200
204
  });
201
205
  log.log(`Response code: ${response.statusCode} and Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
@@ -372,7 +376,7 @@ export class ContactsClient {
372
376
  };
373
377
  try {
374
378
  const response = await this.webex.request({
375
- uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}`,
379
+ uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}`,
376
380
  method: HTTP_METHODS.POST,
377
381
  body: groupInfo,
378
382
  });
@@ -407,7 +411,7 @@ export class ContactsClient {
407
411
  try {
408
412
  log.info(`Deleting contact group: ${groupId}`, loggerContext);
409
413
  const response = await this.webex.request({
410
- uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}/${groupId}`,
414
+ uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}/${groupId}`,
411
415
  method: HTTP_METHODS.DELETE,
412
416
  });
413
417
  log.log(`Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
@@ -481,7 +485,7 @@ export class ContactsClient {
481
485
  }
482
486
  }
483
487
  const response = await this.webex.request({
484
- uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
488
+ uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
485
489
  method: HTTP_METHODS.POST,
486
490
  body: requestBody,
487
491
  });
@@ -526,7 +530,7 @@ export class ContactsClient {
526
530
  try {
527
531
  log.info(`Deleting contact : ${contactId}`, loggerContext);
528
532
  const response = await this.webex.request({
529
- uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}/${contactId}`,
533
+ uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}/${contactId}`,
530
534
  method: HTTP_METHODS.DELETE,
531
535
  });
532
536
  const contactResponse = {
@@ -67,9 +67,11 @@ export class BroadworksBackendConnector {
67
67
  method: METHODS.GET_BW_TOKEN,
68
68
  };
69
69
  log.info(METHOD_START_MESSAGE, loggerContext);
70
+ const broadworksIdpProxyUrl = this.webex.internal.services._serviceUrls?.broadworksIdpProxy ||
71
+ this.webex.internal.services.get(this.webex.internal.services._activeServices.broadworksIdpProxy);
70
72
  try {
71
73
  const bwTokenResponse = await this.webex.request({
72
- uri: `${this.webex.internal.services._serviceUrls.broadworksIdpProxy}${BW_TOKEN_FETCH_ENDPOINT}`,
74
+ uri: `${broadworksIdpProxyUrl}${BW_TOKEN_FETCH_ENDPOINT}`,
73
75
  method: HTTP_METHODS.GET,
74
76
  });
75
77
  const response = bwTokenResponse.body;