@webex/calling 3.8.1 → 3.9.0-multi-llms.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 +51 -46
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +146 -147
- 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 +9 -10
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +68 -61
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +168 -102
- 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 +530 -219
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +500 -291
- 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 +369 -333
- 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 +67 -68
- 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 +11 -8
- 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 +12 -17
- 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 +557 -442
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +526 -395
- 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 +116 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +256 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/CallingClient/registration/webWorkerStr.js +15 -0
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -0
- 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 -238
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +89 -90
- 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 +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/impl/index.js +2 -2
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Logger/types.js.map +1 -1
- package/dist/Metrics/index.js +175 -86
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/index.test.js +70 -4
- 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 +42 -39
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +119 -120
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +54 -47
- 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 +12 -11
- 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 +78 -70
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +184 -185
- 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 +125 -99
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +283 -143
- 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 +8 -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 +4 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +8 -1
- package/dist/module/CallingClient/CallingClient.js +199 -42
- package/dist/module/CallingClient/calling/call.js +79 -43
- package/dist/module/CallingClient/constants.js +10 -6
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +111 -72
- package/dist/module/CallingClient/registration/webWorker.js +60 -0
- package/dist/module/CallingClient/registration/webWorkerStr.js +93 -0
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +59 -0
- package/dist/module/Contacts/ContactsClient.js +23 -17
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/Metrics/index.js +94 -33
- package/dist/module/Metrics/types.js +14 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +3 -0
- package/dist/module/Voicemail/UcmBackendConnector.js +6 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +8 -0
- package/dist/module/common/Utils.js +37 -12
- package/dist/module/common/types.js +7 -0
- 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/CallSettings/types.d.ts +1 -1
- package/dist/types/CallSettings/types.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 +10 -6
- 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 +2 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts +3 -0
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +3 -0
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -0
- 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/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +20 -4
- 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/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +13 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +10 -8
|
@@ -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;
|
|
@@ -69,57 +75,175 @@ export class CallingClient extends Eventing {
|
|
|
69
75
|
method: this.constructor.name,
|
|
70
76
|
});
|
|
71
77
|
}
|
|
72
|
-
this.
|
|
73
|
-
|
|
74
|
-
this.webex.internal.services._hostCatalog[
|
|
75
|
-
|
|
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
|
+
}
|
|
78
90
|
this.mobiusHost = '';
|
|
79
91
|
this.registerSessionsListener();
|
|
80
92
|
this.registerCallsClearedListener();
|
|
81
93
|
}
|
|
82
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
|
+
}
|
|
83
120
|
await this.getMobiusServers();
|
|
84
121
|
await this.createLine();
|
|
85
|
-
this.
|
|
122
|
+
this.setupNetworkEventListeners();
|
|
86
123
|
}
|
|
87
|
-
async
|
|
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
|
+
}
|
|
144
|
+
}
|
|
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 = () => {
|
|
88
176
|
log.info(METHOD_START_MESSAGE, {
|
|
89
177
|
file: CALLING_CLIENT_FILE,
|
|
90
|
-
method: METHODS.
|
|
178
|
+
method: METHODS.NETWORK_ONLINE,
|
|
91
179
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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
|
+
}
|
|
111
207
|
}
|
|
208
|
+
}, NETWORK_FLAP_TIMEOUT);
|
|
209
|
+
if (Object.keys(this.callManager.getActiveCalls()).length) {
|
|
210
|
+
await this.checkCallStatus();
|
|
112
211
|
}
|
|
113
|
-
|
|
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
|
+
});
|
|
114
232
|
}
|
|
115
233
|
async getClientRegionInfo() {
|
|
234
|
+
let abort;
|
|
116
235
|
log.info(METHOD_START_MESSAGE, {
|
|
117
236
|
file: CALLING_CLIENT_FILE,
|
|
118
237
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
119
238
|
});
|
|
120
239
|
const regionInfo = {};
|
|
121
240
|
for (const mobius of this.mobiusClusters) {
|
|
122
|
-
|
|
241
|
+
if (mobius.host) {
|
|
242
|
+
this.mobiusHost = `https://${mobius.host}${API_V1}`;
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
this.mobiusHost = mobius;
|
|
246
|
+
}
|
|
123
247
|
try {
|
|
124
248
|
const temp = await this.webex.request({
|
|
125
249
|
uri: `${this.mobiusHost}${URL_ENDPOINT}${IP_ENDPOINT}`,
|
|
@@ -130,6 +254,10 @@ export class CallingClient extends Eventing {
|
|
|
130
254
|
},
|
|
131
255
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
132
256
|
});
|
|
257
|
+
log.log(`Response trackingId: ${temp?.headers?.trackingid}`, {
|
|
258
|
+
file: CALLING_CLIENT_FILE,
|
|
259
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
260
|
+
});
|
|
133
261
|
const myIP = temp.body.ipv4;
|
|
134
262
|
const response = await this.webex.request({
|
|
135
263
|
uri: `${DISCOVERY_URL}/${myIP}`,
|
|
@@ -139,11 +267,20 @@ export class CallingClient extends Eventing {
|
|
|
139
267
|
[SPARK_USER_AGENT]: null,
|
|
140
268
|
},
|
|
141
269
|
});
|
|
270
|
+
log.log(`Response trackingId: ${response?.headers?.trackingid}`, {
|
|
271
|
+
file: CALLING_CLIENT_FILE,
|
|
272
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
273
|
+
});
|
|
142
274
|
const clientRegionInfo = response.body;
|
|
143
275
|
regionInfo.clientRegion = clientRegionInfo?.clientRegion
|
|
144
276
|
? clientRegionInfo.clientRegion
|
|
145
277
|
: '';
|
|
146
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 ?? '');
|
|
147
284
|
break;
|
|
148
285
|
}
|
|
149
286
|
catch (err) {
|
|
@@ -152,12 +289,16 @@ export class CallingClient extends Eventing {
|
|
|
152
289
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
153
290
|
file: CALLING_CLIENT_FILE,
|
|
154
291
|
});
|
|
155
|
-
handleCallingClientErrors(err, (clientError) => {
|
|
156
|
-
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
|
|
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);
|
|
157
294
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
158
295
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
159
296
|
regionInfo.clientRegion = '';
|
|
160
297
|
regionInfo.countryCode = '';
|
|
298
|
+
if (abort) {
|
|
299
|
+
await uploadLogs();
|
|
300
|
+
return regionInfo;
|
|
301
|
+
}
|
|
161
302
|
}
|
|
162
303
|
}
|
|
163
304
|
return regionInfo;
|
|
@@ -189,9 +330,12 @@ export class CallingClient extends Eventing {
|
|
|
189
330
|
countryCode = regionInfo.countryCode;
|
|
190
331
|
}
|
|
191
332
|
if (clientRegion && countryCode) {
|
|
192
|
-
log.log(`Found Region: ${clientRegion} and country: ${countryCode}, going to fetch Mobius server`,
|
|
333
|
+
log.log(`Found Region: ${clientRegion} and country: ${countryCode}, going to fetch Mobius server`, {
|
|
334
|
+
file: CALLING_CLIENT_FILE,
|
|
335
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
336
|
+
});
|
|
193
337
|
try {
|
|
194
|
-
const
|
|
338
|
+
const response = await this.webex.request({
|
|
195
339
|
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
196
340
|
method: HTTP_METHODS.GET,
|
|
197
341
|
headers: {
|
|
@@ -200,12 +344,19 @@ export class CallingClient extends Eventing {
|
|
|
200
344
|
},
|
|
201
345
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
202
346
|
});
|
|
203
|
-
log.log(
|
|
204
|
-
|
|
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 ?? '');
|
|
205
353
|
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
206
354
|
this.primaryMobiusUris = mobiusUris.primary;
|
|
207
355
|
this.backupMobiusUris = mobiusUris.backup;
|
|
208
|
-
log.
|
|
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
|
+
});
|
|
209
360
|
}
|
|
210
361
|
catch (err) {
|
|
211
362
|
const extendedError = new Error(`Failed to get Mobius servers: ${err}`);
|
|
@@ -213,10 +364,13 @@ export class CallingClient extends Eventing {
|
|
|
213
364
|
method: METHODS.GET_MOBIUS_SERVERS,
|
|
214
365
|
file: CALLING_CLIENT_FILE,
|
|
215
366
|
});
|
|
216
|
-
handleCallingClientErrors(err, (clientError) => {
|
|
217
|
-
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
|
|
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);
|
|
218
369
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
219
370
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
371
|
+
if (abort) {
|
|
372
|
+
await uploadLogs();
|
|
373
|
+
}
|
|
220
374
|
useDefault = true;
|
|
221
375
|
}
|
|
222
376
|
}
|
|
@@ -224,7 +378,10 @@ export class CallingClient extends Eventing {
|
|
|
224
378
|
useDefault = true;
|
|
225
379
|
}
|
|
226
380
|
if (useDefault) {
|
|
227
|
-
log.warn(`Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers`,
|
|
381
|
+
log.warn(`Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers`, {
|
|
382
|
+
file: CALLING_CLIENT_FILE,
|
|
383
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
384
|
+
});
|
|
228
385
|
this.mobiusHost = `https://${this.mobiusClusters[0].host}${API_V1}`;
|
|
229
386
|
this.primaryMobiusUris = [`${this.mobiusHost}${URL_ENDPOINT}`];
|
|
230
387
|
}
|