@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.
- package/dist/CallHistory/CallHistory.js +128 -128
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +278 -181
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +71 -24
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +136 -47
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +137 -138
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +145 -149
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +297 -345
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +267 -405
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +655 -611
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +762 -551
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +15 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +113 -113
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +657 -526
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +258 -258
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +60 -60
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +11 -13
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +129 -128
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +98 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +86 -86
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +58 -61
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +116 -117
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +140 -140
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +195 -165
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +432 -183
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +7 -3
- package/dist/module/CallSettings/UcmBackendConnector.js +20 -6
- package/dist/module/CallSettings/WxCallBackendConnector.js +3 -1
- package/dist/module/CallingClient/CallingClient.js +83 -121
- package/dist/module/CallingClient/calling/call.js +60 -39
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +82 -2
- package/dist/module/Contacts/ContactsClient.js +9 -5
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -1
- package/dist/module/Voicemail/UcmBackendConnector.js +2 -1
- package/dist/module/common/Utils.js +27 -3
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- 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,
|
|
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
|
-
|
|
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
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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 =
|
|
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
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
-
|
|
965
|
-
|
|
966
|
-
|
|
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:
|
|
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
|
-
|
|
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(
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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: `${
|
|
74
|
+
uri: `${broadworksIdpProxyUrl}${BW_TOKEN_FETCH_ENDPOINT}`,
|
|
73
75
|
method: HTTP_METHODS.GET,
|
|
74
76
|
});
|
|
75
77
|
const response = bwTokenResponse.body;
|