@webex/calling 3.9.0 → 3.10.0-next.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 +43 -43
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +157 -152
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +8 -8
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +1 -1
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +12 -11
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +11 -11
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +53 -52
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +112 -110
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallSettings/testFixtures.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +458 -203
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +458 -315
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/callRecordFixtures.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +8 -7
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +405 -372
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +411 -410
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +3 -4
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +68 -69
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/index.js.map +1 -1
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +9 -6
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +10 -11
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +10 -9
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/index.js.map +1 -1
- package/dist/CallingClient/registration/register.js +285 -205
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +251 -180
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +25 -10
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +85 -38
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +142 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +244 -247
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +93 -93
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +2 -2
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Contacts/contactFixtures.js.map +1 -1
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +2 -2
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +3 -3
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +2 -2
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +4 -3
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.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/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +221 -104
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +112 -23
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/Metrics/types.js +15 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/index.js +0 -1
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/SDKConnector/utils.js.map +1 -1
- package/dist/SDKConnector/utils.test.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +55 -61
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +129 -122
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +53 -50
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +73 -74
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +89 -113
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +2 -2
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +87 -92
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +228 -203
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/Voicemail/voicemailFixture.js.map +1 -1
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +85 -66
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +113 -123
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +1 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +17 -8
- package/dist/module/CallSettings/UcmBackendConnector.js +2 -2
- package/dist/module/CallSettings/WxCallBackendConnector.js +14 -14
- package/dist/module/CallingClient/CallingClient.js +176 -36
- package/dist/module/CallingClient/calling/call.js +91 -61
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +37 -13
- package/dist/module/CallingClient/registration/webWorker.js +17 -3
- package/dist/module/CallingClient/registration/webWorkerStr.js +19 -3
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +59 -0
- package/dist/module/Contacts/ContactsClient.js +33 -37
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Events/impl/index.js +2 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Metrics/index.js +142 -55
- package/dist/module/Metrics/types.js +14 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -17
- package/dist/module/Voicemail/UcmBackendConnector.js +11 -10
- package/dist/module/Voicemail/Voicemail.js +42 -68
- package/dist/module/Voicemail/WxCallBackendConnector.js +22 -28
- package/dist/module/common/Utils.js +29 -12
- 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 +12 -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/calling/types.d.ts +2 -1
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +8 -4
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +1 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +2 -1
- package/dist/types/CallingClient/registration/webWorker.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/CallingClient/windowsChromiumIceWarmupUtils.d.ts +5 -0
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/constants.d.ts +1 -1
- package/dist/types/Contacts/constants.d.ts.map +1 -1
- package/dist/types/Events/impl/index.d.ts.map +1 -1
- package/dist/types/Logger/index.d.ts +1 -2
- package/dist/types/Logger/index.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +18 -3
- package/dist/types/Metrics/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/types.d.ts +1 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -46,6 +46,7 @@ export class WxCallBackendConnector {
|
|
|
46
46
|
if (!response.ok) {
|
|
47
47
|
throw new Error(`${response.status}`);
|
|
48
48
|
}
|
|
49
|
+
log.log(`Response trackingId: ${response.headers?.get('trackingid')}`, loggerContext);
|
|
49
50
|
const xmlData = await response.text();
|
|
50
51
|
const parser = new DOMParser();
|
|
51
52
|
const xmlDOM = parser.parseFromString(xmlData, XML_TYPE);
|
|
@@ -65,8 +66,7 @@ export class WxCallBackendConnector {
|
|
|
65
66
|
return responseDetails;
|
|
66
67
|
}
|
|
67
68
|
catch (err) {
|
|
68
|
-
|
|
69
|
-
log.error(extendedError, loggerContext);
|
|
69
|
+
log.error(`Failed to get call waiting setting: ${JSON.stringify(err)}`, loggerContext);
|
|
70
70
|
await uploadLogs();
|
|
71
71
|
const errorInfo = {
|
|
72
72
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
@@ -86,6 +86,7 @@ export class WxCallBackendConnector {
|
|
|
86
86
|
uri: `${this.hydraEndpoint}/${PEOPLE_ENDPOINT}/${this.personId}/${DND_ENDPOINT}?${ORG_ENDPOINT}=${this.orgId}`,
|
|
87
87
|
method: HTTP_METHODS.GET,
|
|
88
88
|
});
|
|
89
|
+
log.log(`Response trackingId: ${resp?.headers?.trackingid}`, loggerContext);
|
|
89
90
|
const dndSettingResponse = resp.body;
|
|
90
91
|
const responseDetails = {
|
|
91
92
|
statusCode: Number(resp[STATUS_CODE]),
|
|
@@ -98,8 +99,7 @@ export class WxCallBackendConnector {
|
|
|
98
99
|
return responseDetails;
|
|
99
100
|
}
|
|
100
101
|
catch (err) {
|
|
101
|
-
|
|
102
|
-
log.error(extendedError, loggerContext);
|
|
102
|
+
log.error(`Failed to get DoNotDisturb setting: ${JSON.stringify(err)}`, loggerContext);
|
|
103
103
|
await uploadLogs();
|
|
104
104
|
const errorInfo = err;
|
|
105
105
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -122,6 +122,7 @@ export class WxCallBackendConnector {
|
|
|
122
122
|
method: HTTP_METHODS.PUT,
|
|
123
123
|
body: dndRequestBody,
|
|
124
124
|
});
|
|
125
|
+
log.log(`Response trackingId: ${resp?.headers?.trackingid}`, loggerContext);
|
|
125
126
|
const responseDetails = {
|
|
126
127
|
statusCode: Number(resp[STATUS_CODE]),
|
|
127
128
|
data: {
|
|
@@ -133,8 +134,7 @@ export class WxCallBackendConnector {
|
|
|
133
134
|
return responseDetails;
|
|
134
135
|
}
|
|
135
136
|
catch (err) {
|
|
136
|
-
|
|
137
|
-
log.error(extendedError, loggerContext);
|
|
137
|
+
log.error(`Failed to set DoNotDisturb setting: ${JSON.stringify(err)}`, loggerContext);
|
|
138
138
|
await uploadLogs();
|
|
139
139
|
const errorInfo = err;
|
|
140
140
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -152,6 +152,7 @@ export class WxCallBackendConnector {
|
|
|
152
152
|
uri: `${this.hydraEndpoint}/${PEOPLE_ENDPOINT}/${this.personId}/${CF_ENDPOINT}?${ORG_ENDPOINT}=${this.orgId}`,
|
|
153
153
|
method: HTTP_METHODS.GET,
|
|
154
154
|
});
|
|
155
|
+
log.log(`Response trackingId: ${resp?.headers?.trackingid}`, loggerContext);
|
|
155
156
|
const cfResponse = resp.body;
|
|
156
157
|
const responseDetails = {
|
|
157
158
|
statusCode: Number(resp[STATUS_CODE]),
|
|
@@ -164,8 +165,7 @@ export class WxCallBackendConnector {
|
|
|
164
165
|
return responseDetails;
|
|
165
166
|
}
|
|
166
167
|
catch (err) {
|
|
167
|
-
|
|
168
|
-
log.error(extendedError, loggerContext);
|
|
168
|
+
log.error(`Failed to get Call Forward setting: ${JSON.stringify(err)}`, loggerContext);
|
|
169
169
|
await uploadLogs();
|
|
170
170
|
const errorInfo = err;
|
|
171
171
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -184,6 +184,7 @@ export class WxCallBackendConnector {
|
|
|
184
184
|
method: HTTP_METHODS.PUT,
|
|
185
185
|
body: callForwardingRequest,
|
|
186
186
|
});
|
|
187
|
+
log.log(`Response trackingId: ${resp?.headers?.trackingid}`, loggerContext);
|
|
187
188
|
const responseDetails = {
|
|
188
189
|
statusCode: Number(resp[STATUS_CODE]),
|
|
189
190
|
data: {
|
|
@@ -195,8 +196,7 @@ export class WxCallBackendConnector {
|
|
|
195
196
|
return responseDetails;
|
|
196
197
|
}
|
|
197
198
|
catch (err) {
|
|
198
|
-
|
|
199
|
-
log.error(extendedError, loggerContext);
|
|
199
|
+
log.error(`Failed to set Call Forward setting: ${JSON.stringify(err)}`, loggerContext);
|
|
200
200
|
await uploadLogs();
|
|
201
201
|
const errorInfo = err;
|
|
202
202
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -214,6 +214,7 @@ export class WxCallBackendConnector {
|
|
|
214
214
|
uri: `${this.hydraEndpoint}/${PEOPLE_ENDPOINT}/${this.personId}/${VM_ENDPOINT}?${ORG_ENDPOINT}=${this.orgId}`,
|
|
215
215
|
method: HTTP_METHODS.GET,
|
|
216
216
|
});
|
|
217
|
+
log.log(`Response trackingId: ${resp?.headers?.trackingid}`, loggerContext);
|
|
217
218
|
const vmResponse = resp.body;
|
|
218
219
|
const responseDetails = {
|
|
219
220
|
statusCode: Number(resp[STATUS_CODE]),
|
|
@@ -226,8 +227,7 @@ export class WxCallBackendConnector {
|
|
|
226
227
|
return responseDetails;
|
|
227
228
|
}
|
|
228
229
|
catch (err) {
|
|
229
|
-
|
|
230
|
-
log.error(extendedError, loggerContext);
|
|
230
|
+
log.error(`Failed to get Voicemail setting: ${JSON.stringify(err)}`, loggerContext);
|
|
231
231
|
await uploadLogs();
|
|
232
232
|
const errorInfo = err;
|
|
233
233
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -246,6 +246,7 @@ export class WxCallBackendConnector {
|
|
|
246
246
|
method: HTTP_METHODS.PUT,
|
|
247
247
|
body: voicemailRequest,
|
|
248
248
|
});
|
|
249
|
+
log.log(`Response trackingId: ${resp?.headers?.trackingid}`, loggerContext);
|
|
249
250
|
const responseDetails = {
|
|
250
251
|
statusCode: Number(resp[STATUS_CODE]),
|
|
251
252
|
data: {
|
|
@@ -257,8 +258,7 @@ export class WxCallBackendConnector {
|
|
|
257
258
|
return responseDetails;
|
|
258
259
|
}
|
|
259
260
|
catch (err) {
|
|
260
|
-
|
|
261
|
-
log.error(extendedError, loggerContext);
|
|
261
|
+
log.error(`Failed to set Voicemail setting: ${JSON.stringify(err)}`, loggerContext);
|
|
262
262
|
await uploadLogs();
|
|
263
263
|
const errorInfo = err;
|
|
264
264
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -9,10 +9,11 @@ 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,
|
|
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
|
-
import { METRIC_EVENT, REG_ACTION, METRIC_TYPE } from '../Metrics/types';
|
|
14
|
+
import { METRIC_EVENT, REG_ACTION, METRIC_TYPE, CONNECTION_ACTION, MOBIUS_SERVER_ACTION, } from '../Metrics/types';
|
|
15
15
|
import { getMetricManager } from '../Metrics';
|
|
16
|
+
import windowsChromiumIceWarmup from './windowsChromiumIceWarmupUtils';
|
|
16
17
|
export class CallingClient extends Eventing {
|
|
17
18
|
sdkConnector;
|
|
18
19
|
webex;
|
|
@@ -26,6 +27,11 @@ export class CallingClient extends Eventing {
|
|
|
26
27
|
mobiusHost;
|
|
27
28
|
mediaEngine;
|
|
28
29
|
lineDict = {};
|
|
30
|
+
isNetworkDown = false;
|
|
31
|
+
networkDownTimestamp = '';
|
|
32
|
+
networkUpTimestamp = '';
|
|
33
|
+
mercuryDownTimestamp = '';
|
|
34
|
+
mercuryUpTimestamp = '';
|
|
29
35
|
constructor(webex, config) {
|
|
30
36
|
super();
|
|
31
37
|
this.sdkConnector = SDKConnector;
|
|
@@ -86,37 +92,143 @@ export class CallingClient extends Eventing {
|
|
|
86
92
|
this.registerCallsClearedListener();
|
|
87
93
|
}
|
|
88
94
|
async init() {
|
|
95
|
+
if (typeof window !== 'undefined' && window?.navigator?.userAgent) {
|
|
96
|
+
const ua = window.navigator.userAgent;
|
|
97
|
+
if (ua.toLowerCase().includes('windows')) {
|
|
98
|
+
log.info('Starting ICE warmup for Windows Chromium based browser', {
|
|
99
|
+
file: CALLING_CLIENT_FILE,
|
|
100
|
+
method: 'init',
|
|
101
|
+
});
|
|
102
|
+
try {
|
|
103
|
+
await windowsChromiumIceWarmup({
|
|
104
|
+
iceServers: [],
|
|
105
|
+
timeoutMs: 1000,
|
|
106
|
+
});
|
|
107
|
+
log.info(`ICE warmup completed`, {
|
|
108
|
+
file: CALLING_CLIENT_FILE,
|
|
109
|
+
method: 'init',
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
log.warn(`ICE warmup failed: ${err}`, {
|
|
114
|
+
file: CALLING_CLIENT_FILE,
|
|
115
|
+
method: 'init',
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
89
120
|
await this.getMobiusServers();
|
|
90
121
|
await this.createLine();
|
|
91
|
-
this.
|
|
122
|
+
this.setupNetworkEventListeners();
|
|
123
|
+
}
|
|
124
|
+
async checkNetworkReachability() {
|
|
125
|
+
try {
|
|
126
|
+
const controller = new AbortController();
|
|
127
|
+
const timeoutId = setTimeout(() => controller.abort(), 3000);
|
|
128
|
+
await fetch('https://www.google.com/generate_204', {
|
|
129
|
+
method: 'GET',
|
|
130
|
+
cache: 'no-cache',
|
|
131
|
+
mode: 'no-cors',
|
|
132
|
+
signal: controller.signal,
|
|
133
|
+
});
|
|
134
|
+
clearTimeout(timeoutId);
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
log.warn(`Network connectivity probe failed: ${error}`, {
|
|
139
|
+
file: CALLING_CLIENT_FILE,
|
|
140
|
+
method: 'pingExternal',
|
|
141
|
+
});
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
92
144
|
}
|
|
93
|
-
async
|
|
145
|
+
async checkCallStatus() {
|
|
146
|
+
const loggerContext = {
|
|
147
|
+
file: CALLING_CLIENT_FILE,
|
|
148
|
+
method: 'checkCallStatus',
|
|
149
|
+
};
|
|
150
|
+
const calls = Object.values(this.callManager.getActiveCalls());
|
|
151
|
+
for (const call of calls) {
|
|
152
|
+
call
|
|
153
|
+
.postStatus()
|
|
154
|
+
.then(() => {
|
|
155
|
+
log.info(`Call is active`, loggerContext);
|
|
156
|
+
})
|
|
157
|
+
.catch((err) => {
|
|
158
|
+
log.warn(`Call Keepalive failed: ${err}`, loggerContext);
|
|
159
|
+
call.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
handleNetworkOffline = async () => {
|
|
164
|
+
this.networkDownTimestamp = new Date().toISOString();
|
|
165
|
+
this.isNetworkDown = !(await this.checkNetworkReachability());
|
|
166
|
+
log.warn(`Network has gone down, wait for it to come back up`, {
|
|
167
|
+
file: CALLING_CLIENT_FILE,
|
|
168
|
+
method: METHODS.NETWORK_OFFLINE,
|
|
169
|
+
});
|
|
170
|
+
if (this.isNetworkDown) {
|
|
171
|
+
const line = Object.values(this.lineDict)[0];
|
|
172
|
+
line.registration.clearKeepaliveTimer();
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
handleNetworkOnline = () => {
|
|
94
176
|
log.info(METHOD_START_MESSAGE, {
|
|
95
177
|
file: CALLING_CLIENT_FILE,
|
|
96
|
-
method: METHODS.
|
|
178
|
+
method: METHODS.NETWORK_ONLINE,
|
|
97
179
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
180
|
+
this.networkUpTimestamp = new Date().toISOString();
|
|
181
|
+
};
|
|
182
|
+
handleMercuryOffline = () => {
|
|
183
|
+
log.warn(`Mercury down, waiting for connection to be up`, {
|
|
184
|
+
file: CALLING_CLIENT_FILE,
|
|
185
|
+
method: METHODS.MERCURY_OFFLINE,
|
|
186
|
+
});
|
|
187
|
+
this.mercuryDownTimestamp = new Date().toISOString();
|
|
188
|
+
this.metricManager.submitConnectionMetrics(METRIC_EVENT.CONNECTION_ERROR, CONNECTION_ACTION.MERCURY_DOWN, METRIC_TYPE.BEHAVIORAL, this.mercuryDownTimestamp, this.mercuryUpTimestamp);
|
|
189
|
+
};
|
|
190
|
+
handleMercuryOnline = async () => {
|
|
191
|
+
log.info(METHOD_START_MESSAGE, {
|
|
192
|
+
file: CALLING_CLIENT_FILE,
|
|
193
|
+
method: METHODS.MERCURY_ONLINE,
|
|
194
|
+
});
|
|
195
|
+
this.mercuryUpTimestamp = new Date().toISOString();
|
|
196
|
+
if (this.isNetworkDown) {
|
|
197
|
+
const callCheckInterval = setInterval(async () => {
|
|
198
|
+
if (!Object.keys(this.callManager.getActiveCalls()).length) {
|
|
199
|
+
clearInterval(callCheckInterval);
|
|
200
|
+
const line = Object.values(this.lineDict)[0];
|
|
201
|
+
if (line.getStatus() !== RegistrationStatus.IDLE) {
|
|
202
|
+
this.isNetworkDown = await line.registration.handleConnectionRestoration(this.isNetworkDown);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
this.isNetworkDown = false;
|
|
206
|
+
}
|
|
117
207
|
}
|
|
208
|
+
}, NETWORK_FLAP_TIMEOUT);
|
|
209
|
+
if (Object.keys(this.callManager.getActiveCalls()).length) {
|
|
210
|
+
await this.checkCallStatus();
|
|
118
211
|
}
|
|
119
|
-
|
|
212
|
+
this.metricManager.submitConnectionMetrics(METRIC_EVENT.CONNECTION_ERROR, CONNECTION_ACTION.NETWORK_FLAP, METRIC_TYPE.BEHAVIORAL, this.networkDownTimestamp, this.networkUpTimestamp);
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
if (Object.keys(this.callManager.getActiveCalls()).length) {
|
|
216
|
+
await this.checkCallStatus();
|
|
217
|
+
}
|
|
218
|
+
this.metricManager.submitConnectionMetrics(METRIC_EVENT.CONNECTION_ERROR, CONNECTION_ACTION.MERCURY_UP, METRIC_TYPE.BEHAVIORAL, this.mercuryDownTimestamp, this.mercuryUpTimestamp);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
setupNetworkEventListeners() {
|
|
222
|
+
if (typeof window !== 'undefined' && window.addEventListener) {
|
|
223
|
+
window.addEventListener('online', this.handleNetworkOnline);
|
|
224
|
+
window.addEventListener('offline', this.handleNetworkOffline);
|
|
225
|
+
}
|
|
226
|
+
this.webex.internal.mercury.on('offline', () => {
|
|
227
|
+
this.handleMercuryOffline();
|
|
228
|
+
});
|
|
229
|
+
this.webex.internal.mercury.on('online', () => {
|
|
230
|
+
this.handleMercuryOnline();
|
|
231
|
+
});
|
|
120
232
|
}
|
|
121
233
|
async getClientRegionInfo() {
|
|
122
234
|
let abort;
|
|
@@ -142,6 +254,10 @@ export class CallingClient extends Eventing {
|
|
|
142
254
|
},
|
|
143
255
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
144
256
|
});
|
|
257
|
+
log.log(`Response trackingId: ${temp?.headers?.trackingid}`, {
|
|
258
|
+
file: CALLING_CLIENT_FILE,
|
|
259
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
260
|
+
});
|
|
145
261
|
const myIP = temp.body.ipv4;
|
|
146
262
|
const response = await this.webex.request({
|
|
147
263
|
uri: `${DISCOVERY_URL}/${myIP}`,
|
|
@@ -151,16 +267,24 @@ export class CallingClient extends Eventing {
|
|
|
151
267
|
[SPARK_USER_AGENT]: null,
|
|
152
268
|
},
|
|
153
269
|
});
|
|
270
|
+
log.log(`Response trackingId: ${response?.headers?.trackingid}`, {
|
|
271
|
+
file: CALLING_CLIENT_FILE,
|
|
272
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
273
|
+
});
|
|
154
274
|
const clientRegionInfo = response.body;
|
|
155
275
|
regionInfo.clientRegion = clientRegionInfo?.clientRegion
|
|
156
276
|
? clientRegionInfo.clientRegion
|
|
157
277
|
: '';
|
|
158
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 ?? '');
|
|
159
284
|
break;
|
|
160
285
|
}
|
|
161
286
|
catch (err) {
|
|
162
|
-
|
|
163
|
-
log.error(extendedError, {
|
|
287
|
+
log.error(`Failed to get client region info: ${JSON.stringify(err)}`, {
|
|
164
288
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
165
289
|
file: CALLING_CLIENT_FILE,
|
|
166
290
|
});
|
|
@@ -171,6 +295,7 @@ export class CallingClient extends Eventing {
|
|
|
171
295
|
regionInfo.clientRegion = '';
|
|
172
296
|
regionInfo.countryCode = '';
|
|
173
297
|
if (abort) {
|
|
298
|
+
await uploadLogs();
|
|
174
299
|
return regionInfo;
|
|
175
300
|
}
|
|
176
301
|
}
|
|
@@ -204,9 +329,12 @@ export class CallingClient extends Eventing {
|
|
|
204
329
|
countryCode = regionInfo.countryCode;
|
|
205
330
|
}
|
|
206
331
|
if (clientRegion && countryCode) {
|
|
207
|
-
log.log(`Found Region: ${clientRegion} and country: ${countryCode}, going to fetch Mobius server`,
|
|
332
|
+
log.log(`Found Region: ${clientRegion} and country: ${countryCode}, going to fetch Mobius server`, {
|
|
333
|
+
file: CALLING_CLIENT_FILE,
|
|
334
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
335
|
+
});
|
|
208
336
|
try {
|
|
209
|
-
const
|
|
337
|
+
const response = await this.webex.request({
|
|
210
338
|
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
211
339
|
method: HTTP_METHODS.GET,
|
|
212
340
|
headers: {
|
|
@@ -215,23 +343,32 @@ export class CallingClient extends Eventing {
|
|
|
215
343
|
},
|
|
216
344
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
217
345
|
});
|
|
218
|
-
log.log(
|
|
219
|
-
|
|
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 ?? '');
|
|
220
352
|
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
221
353
|
this.primaryMobiusUris = mobiusUris.primary;
|
|
222
354
|
this.backupMobiusUris = mobiusUris.backup;
|
|
223
|
-
log.
|
|
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
|
+
});
|
|
224
359
|
}
|
|
225
360
|
catch (err) {
|
|
226
|
-
|
|
227
|
-
log.error(extendedError, {
|
|
361
|
+
log.error(`Failed to get Mobius servers: ${JSON.stringify(err)}`, {
|
|
228
362
|
method: METHODS.GET_MOBIUS_SERVERS,
|
|
229
363
|
file: CALLING_CLIENT_FILE,
|
|
230
364
|
});
|
|
231
|
-
handleCallingClientErrors(err, (clientError) => {
|
|
365
|
+
const abort = await handleCallingClientErrors(err, (clientError) => {
|
|
232
366
|
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
233
367
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
234
368
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
369
|
+
if (abort) {
|
|
370
|
+
await uploadLogs();
|
|
371
|
+
}
|
|
235
372
|
useDefault = true;
|
|
236
373
|
}
|
|
237
374
|
}
|
|
@@ -239,7 +376,10 @@ export class CallingClient extends Eventing {
|
|
|
239
376
|
useDefault = true;
|
|
240
377
|
}
|
|
241
378
|
if (useDefault) {
|
|
242
|
-
log.warn(`Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers`,
|
|
379
|
+
log.warn(`Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers`, {
|
|
380
|
+
file: CALLING_CLIENT_FILE,
|
|
381
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
382
|
+
});
|
|
243
383
|
this.mobiusHost = `https://${this.mobiusClusters[0].host}${API_V1}`;
|
|
244
384
|
this.primaryMobiusUris = [`${this.mobiusHost}${URL_ENDPOINT}`];
|
|
245
385
|
}
|