@webex/calling 3.10.0-next.8 → 3.10.0-wxc-disconnect.1
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 +41 -42
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +5 -120
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +6 -6
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +1 -2
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +43 -38
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +1 -4
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +207 -161
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +290 -152
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +53 -50
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +51 -93
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +1 -1
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +4 -5
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +3 -3
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +45 -39
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +3 -4
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Events/impl/index.js +1 -1
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Logger/index.js +3 -3
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +54 -47
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +2 -10
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +32 -29
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +102 -77
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +59 -46
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +18 -44
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +2 -2
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +8 -4
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +1 -2
- package/dist/common/testUtil.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +11 -20
- package/dist/module/CallSettings/UcmBackendConnector.js +2 -1
- package/dist/module/CallSettings/WxCallBackendConnector.js +15 -10
- package/dist/module/CallingClient/CallingClient.js +123 -83
- package/dist/module/CallingClient/calling/call.js +23 -17
- package/dist/module/CallingClient/registration/register.js +3 -3
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +25 -19
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +18 -10
- package/dist/module/Voicemail/UcmBackendConnector.js +11 -7
- package/dist/module/Voicemail/Voicemail.js +68 -42
- package/dist/module/Voicemail/WxCallBackendConnector.js +28 -14
- package/dist/module/common/Utils.js +2 -2
- package/dist/module/common/testUtil.js +0 -1
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +0 -1
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +2 -1
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +0 -10
- 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/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +0 -1
- 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, SPARK_USER_AGENT, URL_ENDPOINT, API_V1, 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, 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';
|
|
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,7 +65,28 @@ export class CallingClient extends Eventing {
|
|
|
65
65
|
this.mediaEngine.setLogger(adaptedLogger);
|
|
66
66
|
this.primaryMobiusUris = [];
|
|
67
67
|
this.backupMobiusUris = [];
|
|
68
|
-
|
|
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
|
+
}
|
|
69
90
|
this.mobiusHost = '';
|
|
70
91
|
this.registerSessionsListener();
|
|
71
92
|
this.registerCallsClearedListener();
|
|
@@ -216,38 +237,68 @@ export class CallingClient extends Eventing {
|
|
|
216
237
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
217
238
|
});
|
|
218
239
|
const regionInfo = {};
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
+
const extendedError = new Error(`Failed to get client region info: ${err}`);
|
|
288
|
+
log.error(extendedError, {
|
|
289
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
290
|
+
file: CALLING_CLIENT_FILE,
|
|
291
|
+
});
|
|
292
|
+
abort = await handleCallingClientErrors(err, (clientError) => {
|
|
293
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
294
|
+
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
295
|
+
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
296
|
+
regionInfo.clientRegion = '';
|
|
297
|
+
regionInfo.countryCode = '';
|
|
298
|
+
if (abort) {
|
|
299
|
+
await uploadLogs();
|
|
300
|
+
return regionInfo;
|
|
301
|
+
}
|
|
251
302
|
}
|
|
252
303
|
}
|
|
253
304
|
return regionInfo;
|
|
@@ -267,9 +318,7 @@ export class CallingClient extends Eventing {
|
|
|
267
318
|
});
|
|
268
319
|
clientRegion = this.sdkConfig?.discovery?.region;
|
|
269
320
|
countryCode = this.sdkConfig?.discovery?.country;
|
|
270
|
-
this.mobiusHost =
|
|
271
|
-
this.webex.internal.services._serviceUrls?.mobius ||
|
|
272
|
-
this.webex.internal.services.get(this.webex.internal.services._activeServices.mobius);
|
|
321
|
+
this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
|
|
273
322
|
}
|
|
274
323
|
else {
|
|
275
324
|
log.log('Updating region and country through Region discovery', {
|
|
@@ -285,53 +334,44 @@ export class CallingClient extends Eventing {
|
|
|
285
334
|
file: CALLING_CLIENT_FILE,
|
|
286
335
|
method: GET_MOBIUS_SERVERS_UTIL,
|
|
287
336
|
});
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
this.mobiusHost
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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
|
-
}
|
|
337
|
+
try {
|
|
338
|
+
const response = await this.webex.request({
|
|
339
|
+
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
340
|
+
method: HTTP_METHODS.GET,
|
|
341
|
+
headers: {
|
|
342
|
+
[CISCO_DEVICE_URL]: this.webex.internal.device.url,
|
|
343
|
+
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
344
|
+
},
|
|
345
|
+
service: ALLOWED_SERVICES.MOBIUS,
|
|
346
|
+
});
|
|
347
|
+
log.log(`Mobius Server found for the region. Response trackingId: ${response?.headers?.trackingid}`, {
|
|
348
|
+
file: CALLING_CLIENT_FILE,
|
|
349
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
350
|
+
});
|
|
351
|
+
const mobiusServers = response.body;
|
|
352
|
+
this.metricManager.submitMobiusServersMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, METRIC_TYPE.BEHAVIORAL, mobiusServers, response?.headers?.trackingid ?? '');
|
|
353
|
+
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
354
|
+
this.primaryMobiusUris = mobiusUris.primary;
|
|
355
|
+
this.backupMobiusUris = mobiusUris.backup;
|
|
356
|
+
log.log(`Final list of Mobius Servers, primary: ${mobiusUris.primary} and backup: ${mobiusUris.backup}`, {
|
|
357
|
+
file: CALLING_CLIENT_FILE,
|
|
358
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
catch (err) {
|
|
362
|
+
const extendedError = new Error(`Failed to get Mobius servers: ${err}`);
|
|
363
|
+
log.error(extendedError, {
|
|
364
|
+
method: METHODS.GET_MOBIUS_SERVERS,
|
|
365
|
+
file: CALLING_CLIENT_FILE,
|
|
366
|
+
});
|
|
367
|
+
const abort = await handleCallingClientErrors(err, (clientError) => {
|
|
368
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
369
|
+
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
370
|
+
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
371
|
+
if (abort) {
|
|
372
|
+
await uploadLogs();
|
|
334
373
|
}
|
|
374
|
+
useDefault = true;
|
|
335
375
|
}
|
|
336
376
|
}
|
|
337
377
|
else {
|
|
@@ -639,7 +639,8 @@ export class Call extends Eventing {
|
|
|
639
639
|
});
|
|
640
640
|
}
|
|
641
641
|
catch (e) {
|
|
642
|
-
|
|
642
|
+
const extendedError = new Error(`Failed to setup the call: ${e}`);
|
|
643
|
+
log.error(extendedError, {
|
|
643
644
|
file: CALL_FILE,
|
|
644
645
|
method: METHODS.HANDLE_OUTGOING_CALL_SETUP,
|
|
645
646
|
});
|
|
@@ -681,7 +682,8 @@ export class Call extends Eventing {
|
|
|
681
682
|
}
|
|
682
683
|
}
|
|
683
684
|
catch (e) {
|
|
684
|
-
|
|
685
|
+
const extendedError = new Error(`Failed to put the call on hold: ${e}`);
|
|
686
|
+
log.error(extendedError, {
|
|
685
687
|
file: CALL_FILE,
|
|
686
688
|
method: METHODS.HANDLE_CALL_HOLD,
|
|
687
689
|
});
|
|
@@ -723,7 +725,8 @@ export class Call extends Eventing {
|
|
|
723
725
|
}
|
|
724
726
|
}
|
|
725
727
|
catch (e) {
|
|
726
|
-
|
|
728
|
+
const extendedError = new Error(`Failed to resume the call: ${e}`);
|
|
729
|
+
log.error(extendedError, {
|
|
727
730
|
file: CALL_FILE,
|
|
728
731
|
method: METHODS.HANDLE_CALL_RESUME,
|
|
729
732
|
});
|
|
@@ -811,12 +814,13 @@ export class Call extends Eventing {
|
|
|
811
814
|
method: METHODS.HANDLE_OUTGOING_CALL_ALERTING,
|
|
812
815
|
});
|
|
813
816
|
}
|
|
814
|
-
catch (
|
|
815
|
-
|
|
817
|
+
catch (err) {
|
|
818
|
+
const extendedError = new Error(`Failed to signal call progression: ${err}`);
|
|
819
|
+
log.error(extendedError, {
|
|
816
820
|
file: CALL_FILE,
|
|
817
821
|
method: METHODS.HANDLE_OUTGOING_CALL_ALERTING,
|
|
818
822
|
});
|
|
819
|
-
const errData =
|
|
823
|
+
const errData = err;
|
|
820
824
|
handleCallErrors((error) => {
|
|
821
825
|
this.emit(CALL_EVENT_KEYS.CALL_ERROR, error);
|
|
822
826
|
this.submitCallErrorMetric(error);
|
|
@@ -860,12 +864,13 @@ export class Call extends Eventing {
|
|
|
860
864
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
861
865
|
});
|
|
862
866
|
}
|
|
863
|
-
catch (
|
|
864
|
-
|
|
867
|
+
catch (err) {
|
|
868
|
+
const extendedError = new Error(`Failed to connect the call: ${err}`);
|
|
869
|
+
log.error(extendedError, {
|
|
865
870
|
file: CALL_FILE,
|
|
866
871
|
method: METHODS.HANDLE_OUTGOING_CALL_CONNECT,
|
|
867
872
|
});
|
|
868
|
-
const errData =
|
|
873
|
+
const errData = err;
|
|
869
874
|
handleCallErrors((error) => {
|
|
870
875
|
this.emit(CALL_EVENT_KEYS.CALL_ERROR, error);
|
|
871
876
|
this.submitCallErrorMetric(error);
|
|
@@ -881,20 +886,21 @@ export class Call extends Eventing {
|
|
|
881
886
|
async handleIncomingCallDisconnect(event) {
|
|
882
887
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
883
888
|
file: CALL_FILE,
|
|
884
|
-
method: METHODS.
|
|
889
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
885
890
|
});
|
|
891
|
+
this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
|
|
886
892
|
this.setDisconnectReason();
|
|
887
893
|
try {
|
|
888
894
|
const response = await this.delete();
|
|
889
895
|
log.log(`Response code: ${response.statusCode}`, {
|
|
890
896
|
file: CALL_FILE,
|
|
891
|
-
method: METHODS.
|
|
897
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
892
898
|
});
|
|
893
899
|
}
|
|
894
900
|
catch (e) {
|
|
895
|
-
log.warn(
|
|
901
|
+
log.warn('Failed to delete the call', {
|
|
896
902
|
file: CALL_FILE,
|
|
897
|
-
method: METHODS.
|
|
903
|
+
method: METHODS.HANDLE_INCOMING_CALL_DISCONNECT,
|
|
898
904
|
});
|
|
899
905
|
uploadLogs({
|
|
900
906
|
correlationId: this.correlationId,
|
|
@@ -916,7 +922,6 @@ export class Call extends Eventing {
|
|
|
916
922
|
}
|
|
917
923
|
this.sendMediaStateMachineEvt({ type: 'E_ROAP_TEARDOWN' });
|
|
918
924
|
this.sendCallStateMachineEvt({ type: 'E_CALL_CLEARED' });
|
|
919
|
-
this.emit(CALL_EVENT_KEYS.DISCONNECT, this.correlationId);
|
|
920
925
|
}
|
|
921
926
|
async handleOutgoingCallDisconnect(event) {
|
|
922
927
|
log.info(`${METHOD_START_MESSAGE} with: ${this.getCorrelationId()}`, {
|
|
@@ -1159,7 +1164,7 @@ export class Call extends Eventing {
|
|
|
1159
1164
|
method: METHODS.HANDLE_ROAP_ERROR,
|
|
1160
1165
|
});
|
|
1161
1166
|
const message = event.data;
|
|
1162
|
-
if (message
|
|
1167
|
+
if (message) {
|
|
1163
1168
|
try {
|
|
1164
1169
|
const res = await this.postMedia(message);
|
|
1165
1170
|
log.info(`Response code: ${res.statusCode}`, {
|
|
@@ -1327,8 +1332,9 @@ export class Call extends Eventing {
|
|
|
1327
1332
|
}
|
|
1328
1333
|
catch (error) {
|
|
1329
1334
|
const errorInfo = error;
|
|
1330
|
-
const errorStatus =
|
|
1331
|
-
|
|
1335
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
1336
|
+
const errorLog = new Error(`Failed to upload webrtc telemetry statistics. ${errorStatus}`);
|
|
1337
|
+
log.error(errorLog, loggerContext);
|
|
1332
1338
|
await uploadLogs({
|
|
1333
1339
|
correlationId: this.correlationId,
|
|
1334
1340
|
callId: this.callId,
|
|
@@ -88,7 +88,7 @@ export class Registration {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
catch (error) {
|
|
91
|
-
log.warn(`Delete failed with Mobius
|
|
91
|
+
log.warn(`Delete failed with Mobius ${error}`, {
|
|
92
92
|
file: REGISTRATION_FILE,
|
|
93
93
|
method: METHODS.DELETE_REGISTRATION,
|
|
94
94
|
});
|
|
@@ -262,7 +262,7 @@ export class Registration {
|
|
|
262
262
|
}
|
|
263
263
|
}
|
|
264
264
|
catch (error) {
|
|
265
|
-
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${
|
|
265
|
+
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${error}`, {
|
|
266
266
|
file: REGISTRATION_FILE,
|
|
267
267
|
method: FAILBACK_UTIL,
|
|
268
268
|
});
|
|
@@ -571,7 +571,7 @@ export class Registration {
|
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
573
|
catch (err) {
|
|
574
|
-
log.warn(`Delete failed with Mobius: ${
|
|
574
|
+
log.warn(`Delete failed with Mobius: ${err}`, {
|
|
575
575
|
file: REGISTRATION_FILE,
|
|
576
576
|
method: METHODS.DEREGISTER,
|
|
577
577
|
});
|
|
@@ -40,10 +40,10 @@ const messageHandler = (event) => {
|
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
42
|
const headers = {};
|
|
43
|
-
if (err.headers
|
|
43
|
+
if (err.headers.has('Retry-After')) {
|
|
44
44
|
headers['retry-after'] = err.headers.get('Retry-After');
|
|
45
45
|
}
|
|
46
|
-
if (err.headers
|
|
46
|
+
if (err.headers.has('Trackingid')) {
|
|
47
47
|
headers['trackingid'] = err.headers.get('Trackingid');
|
|
48
48
|
}
|
|
49
49
|
const error = {
|
|
@@ -70,11 +70,11 @@ const messageHandler = (event) => {
|
|
|
70
70
|
keepAliveRetryCount = 0;
|
|
71
71
|
} catch (err) {
|
|
72
72
|
let headers = {};
|
|
73
|
-
if(err.headers
|
|
73
|
+
if(err.headers.has('Retry-After')) {
|
|
74
74
|
headers['retry-after'] = err.headers.get('Retry-After');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if(err.headers
|
|
77
|
+
if(err.headers.has('Trackingid')) {
|
|
78
78
|
headers['trackingid'] = err.headers.get('Trackingid');
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -12,7 +12,6 @@ export class ContactsClient {
|
|
|
12
12
|
groups;
|
|
13
13
|
contacts;
|
|
14
14
|
defaultGroupId;
|
|
15
|
-
contactsServiceUrl;
|
|
16
15
|
constructor(webex, logger) {
|
|
17
16
|
this.sdkConnector = SDKConnector;
|
|
18
17
|
if (!this.sdkConnector.getWebex()) {
|
|
@@ -23,9 +22,6 @@ export class ContactsClient {
|
|
|
23
22
|
this.groups = undefined;
|
|
24
23
|
this.contacts = undefined;
|
|
25
24
|
this.defaultGroupId = '';
|
|
26
|
-
this.contactsServiceUrl =
|
|
27
|
-
this.webex.internal.services._serviceUrls?.contactsService ||
|
|
28
|
-
this.webex.internal.services.get(this.webex.internal.services._activeServices.contactsService);
|
|
29
25
|
log.setLogger(logger.level, CONTACTS_CLIENT);
|
|
30
26
|
}
|
|
31
27
|
async decryptContactDetail(encryptionKeyUrl, contactDetails) {
|
|
@@ -199,7 +195,7 @@ export class ContactsClient {
|
|
|
199
195
|
const cloudContactsMap = {};
|
|
200
196
|
try {
|
|
201
197
|
const response = await this.webex.request({
|
|
202
|
-
uri: `${this.
|
|
198
|
+
uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
|
|
203
199
|
method: HTTP_METHODS.GET,
|
|
204
200
|
});
|
|
205
201
|
log.log(`Response code: ${response.statusCode} and Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
|
|
@@ -254,8 +250,10 @@ export class ContactsClient {
|
|
|
254
250
|
return contactResponse;
|
|
255
251
|
}
|
|
256
252
|
catch (err) {
|
|
257
|
-
|
|
258
|
-
const
|
|
253
|
+
const errorInfo = err;
|
|
254
|
+
const extendedError = new Error(`Error fetching contacts: ${err}`);
|
|
255
|
+
log.error(extendedError, loggerContext);
|
|
256
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
259
257
|
await uploadLogs();
|
|
260
258
|
return errorStatus;
|
|
261
259
|
}
|
|
@@ -376,7 +374,7 @@ export class ContactsClient {
|
|
|
376
374
|
};
|
|
377
375
|
try {
|
|
378
376
|
const response = await this.webex.request({
|
|
379
|
-
uri: `${this.
|
|
377
|
+
uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}`,
|
|
380
378
|
method: HTTP_METHODS.POST,
|
|
381
379
|
body: groupInfo,
|
|
382
380
|
});
|
|
@@ -396,8 +394,10 @@ export class ContactsClient {
|
|
|
396
394
|
return contactResponse;
|
|
397
395
|
}
|
|
398
396
|
catch (err) {
|
|
399
|
-
|
|
400
|
-
const
|
|
397
|
+
const errorInfo = err;
|
|
398
|
+
const extendedError = new Error(`Unable to create contact group: ${err}`);
|
|
399
|
+
log.error(extendedError, loggerContext);
|
|
400
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
401
401
|
await uploadLogs();
|
|
402
402
|
return errorStatus;
|
|
403
403
|
}
|
|
@@ -411,7 +411,7 @@ export class ContactsClient {
|
|
|
411
411
|
try {
|
|
412
412
|
log.info(`Deleting contact group: ${groupId}`, loggerContext);
|
|
413
413
|
const response = await this.webex.request({
|
|
414
|
-
uri: `${this.
|
|
414
|
+
uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}/${groupId}`,
|
|
415
415
|
method: HTTP_METHODS.DELETE,
|
|
416
416
|
});
|
|
417
417
|
log.log(`Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
|
|
@@ -431,8 +431,10 @@ export class ContactsClient {
|
|
|
431
431
|
return contactResponse;
|
|
432
432
|
}
|
|
433
433
|
catch (err) {
|
|
434
|
-
|
|
435
|
-
const
|
|
434
|
+
const errorInfo = err;
|
|
435
|
+
const extendedError = new Error(`Unable to delete contact group ${groupId}: ${err}`);
|
|
436
|
+
log.error(extendedError, loggerContext);
|
|
437
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
436
438
|
await uploadLogs();
|
|
437
439
|
return errorStatus;
|
|
438
440
|
}
|
|
@@ -485,7 +487,7 @@ export class ContactsClient {
|
|
|
485
487
|
}
|
|
486
488
|
}
|
|
487
489
|
const response = await this.webex.request({
|
|
488
|
-
uri: `${this.
|
|
490
|
+
uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
|
|
489
491
|
method: HTTP_METHODS.POST,
|
|
490
492
|
body: requestBody,
|
|
491
493
|
});
|
|
@@ -515,8 +517,10 @@ export class ContactsClient {
|
|
|
515
517
|
return contactResponse;
|
|
516
518
|
}
|
|
517
519
|
catch (err) {
|
|
518
|
-
|
|
519
|
-
const
|
|
520
|
+
const errorInfo = err;
|
|
521
|
+
const extendedError = new Error(`Failed to create contact: ${err}`);
|
|
522
|
+
log.error(extendedError, loggerContext);
|
|
523
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
520
524
|
await uploadLogs();
|
|
521
525
|
return errorStatus;
|
|
522
526
|
}
|
|
@@ -530,7 +534,7 @@ export class ContactsClient {
|
|
|
530
534
|
try {
|
|
531
535
|
log.info(`Deleting contact : ${contactId}`, loggerContext);
|
|
532
536
|
const response = await this.webex.request({
|
|
533
|
-
uri: `${this.
|
|
537
|
+
uri: `${this.webex.internal.services._serviceUrls.contactsService}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}/${contactId}`,
|
|
534
538
|
method: HTTP_METHODS.DELETE,
|
|
535
539
|
});
|
|
536
540
|
const contactResponse = {
|
|
@@ -546,8 +550,10 @@ export class ContactsClient {
|
|
|
546
550
|
return contactResponse;
|
|
547
551
|
}
|
|
548
552
|
catch (err) {
|
|
549
|
-
|
|
550
|
-
const
|
|
553
|
+
const errorInfo = err;
|
|
554
|
+
const extendedError = new Error(`Unable to delete contact ${contactId}: ${err}`);
|
|
555
|
+
log.error(extendedError, loggerContext);
|
|
556
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
551
557
|
await uploadLogs();
|
|
552
558
|
return errorStatus;
|
|
553
559
|
}
|
|
@@ -4,7 +4,7 @@ import { LOG_PREFIX } from '../../Logger/types';
|
|
|
4
4
|
export class Eventing extends EventEmitter {
|
|
5
5
|
emit(event, ...args) {
|
|
6
6
|
const timestamp = new Date().toUTCString();
|
|
7
|
-
Logger.info(`${timestamp} ${LOG_PREFIX.EVENT}: ${event.toString()} - event emitted with parameters -> ${args}`, {
|
|
7
|
+
Logger.info(`${timestamp} ${LOG_PREFIX.EVENT}: ${event.toString()} - event emitted with parameters -> ${args} = `, {
|
|
8
8
|
file: 'Events/impl/index.ts',
|
|
9
9
|
method: 'emit',
|
|
10
10
|
});
|
|
@@ -101,9 +101,9 @@ const logTrace = (message, context) => {
|
|
|
101
101
|
writeToLogger(`${format(context, '[TRACE]')} - ${LOG_PREFIX.MESSAGE}:${message}`, LOGGER.TRACE);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
const logError = (
|
|
104
|
+
const logError = (error, context) => {
|
|
105
105
|
if (currentLogLevel >= LOGGING_LEVEL.error) {
|
|
106
|
-
writeToLogger(`${format(context, '[ERROR]')} - !${LOG_PREFIX.ERROR}!${LOG_PREFIX.MESSAGE}:${
|
|
106
|
+
writeToLogger(`${format(context, '[ERROR]')} - !${LOG_PREFIX.ERROR}!${LOG_PREFIX.MESSAGE}:${error.message}`, LOGGER.ERROR);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
const setWebexLogger = (logger) => {
|
|
@@ -56,7 +56,8 @@ export class BroadworksBackendConnector {
|
|
|
56
56
|
const errorInfo = {
|
|
57
57
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
const extendedError = new Error(`Failed to get userId: ${err}`);
|
|
60
|
+
log.error(extendedError, loggerContext);
|
|
60
61
|
await uploadLogs();
|
|
61
62
|
return serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
62
63
|
}
|
|
@@ -67,11 +68,9 @@ export class BroadworksBackendConnector {
|
|
|
67
68
|
method: METHODS.GET_BW_TOKEN,
|
|
68
69
|
};
|
|
69
70
|
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);
|
|
72
71
|
try {
|
|
73
72
|
const bwTokenResponse = await this.webex.request({
|
|
74
|
-
uri: `${
|
|
73
|
+
uri: `${this.webex.internal.services._serviceUrls.broadworksIdpProxy}${BW_TOKEN_FETCH_ENDPOINT}`,
|
|
75
74
|
method: HTTP_METHODS.GET,
|
|
76
75
|
});
|
|
77
76
|
const response = bwTokenResponse.body;
|
|
@@ -79,7 +78,11 @@ export class BroadworksBackendConnector {
|
|
|
79
78
|
log.log('Successfully fetched Broadworks token', loggerContext);
|
|
80
79
|
}
|
|
81
80
|
catch (err) {
|
|
82
|
-
|
|
81
|
+
const extendedError = new Error(`Broadworks token exception: ${err}`);
|
|
82
|
+
log.error(extendedError, {
|
|
83
|
+
file: BROADWORKS_VOICEMAIL_FILE,
|
|
84
|
+
method: METHODS.GET_BW_TOKEN,
|
|
85
|
+
});
|
|
83
86
|
await uploadLogs();
|
|
84
87
|
}
|
|
85
88
|
}
|
|
@@ -143,7 +146,8 @@ export class BroadworksBackendConnector {
|
|
|
143
146
|
const errorInfo = {
|
|
144
147
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
145
148
|
};
|
|
146
|
-
|
|
149
|
+
const extendedError = new Error(`Failed to get voicemail list: ${err}`);
|
|
150
|
+
log.error(extendedError, loggerContext);
|
|
147
151
|
await uploadLogs();
|
|
148
152
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
149
153
|
return errorStatus;
|
|
@@ -202,7 +206,8 @@ export class BroadworksBackendConnector {
|
|
|
202
206
|
const errorInfo = {
|
|
203
207
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
204
208
|
};
|
|
205
|
-
|
|
209
|
+
const extendedError = new Error(`Failed to get voicemail content: ${err}`);
|
|
210
|
+
log.error(extendedError, loggerContext);
|
|
206
211
|
await uploadLogs();
|
|
207
212
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
208
213
|
return errorStatus;
|
|
@@ -241,7 +246,8 @@ export class BroadworksBackendConnector {
|
|
|
241
246
|
const errorInfo = {
|
|
242
247
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
243
248
|
};
|
|
244
|
-
|
|
249
|
+
const extendedError = new Error(`Failed to mark voicemail as read: ${err}`);
|
|
250
|
+
log.error(extendedError, loggerContext);
|
|
245
251
|
await uploadLogs();
|
|
246
252
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
247
253
|
return errorStatus;
|
|
@@ -276,7 +282,8 @@ export class BroadworksBackendConnector {
|
|
|
276
282
|
const errorInfo = {
|
|
277
283
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
278
284
|
};
|
|
279
|
-
|
|
285
|
+
const extendedError = new Error(`Failed to mark voicemail as unread: ${err}`);
|
|
286
|
+
log.error(extendedError, loggerContext);
|
|
280
287
|
await uploadLogs();
|
|
281
288
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
282
289
|
return errorStatus;
|
|
@@ -311,7 +318,8 @@ export class BroadworksBackendConnector {
|
|
|
311
318
|
const errorInfo = {
|
|
312
319
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
313
320
|
};
|
|
314
|
-
|
|
321
|
+
const extendedError = new Error(`Failed to delete voicemail: ${err}`);
|
|
322
|
+
log.error(extendedError, loggerContext);
|
|
315
323
|
await uploadLogs();
|
|
316
324
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
317
325
|
return errorStatus;
|