@webex/calling 3.9.0-webinar5k.1 → 3.10.0
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 +66 -59
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +108 -109
- 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 +457 -201
- 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 +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 +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 +280 -201
- 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 -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.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 +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 +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 +84 -65
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +111 -117
- 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 +4 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +1 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +7 -0
- package/dist/module/CallingClient/CallingClient.js +174 -32
- package/dist/module/CallingClient/calling/call.js +79 -43
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +3 -3
- package/dist/module/CallingClient/registration/register.js +34 -10
- 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 +23 -17
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Metrics/index.js +142 -55
- 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 +27 -10
- 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/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/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
|
@@ -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,11 +267,20 @@ 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) {
|
|
@@ -171,6 +296,7 @@ export class CallingClient extends Eventing {
|
|
|
171
296
|
regionInfo.clientRegion = '';
|
|
172
297
|
regionInfo.countryCode = '';
|
|
173
298
|
if (abort) {
|
|
299
|
+
await uploadLogs();
|
|
174
300
|
return regionInfo;
|
|
175
301
|
}
|
|
176
302
|
}
|
|
@@ -204,9 +330,12 @@ export class CallingClient extends Eventing {
|
|
|
204
330
|
countryCode = regionInfo.countryCode;
|
|
205
331
|
}
|
|
206
332
|
if (clientRegion && countryCode) {
|
|
207
|
-
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
|
+
});
|
|
208
337
|
try {
|
|
209
|
-
const
|
|
338
|
+
const response = await this.webex.request({
|
|
210
339
|
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
211
340
|
method: HTTP_METHODS.GET,
|
|
212
341
|
headers: {
|
|
@@ -215,12 +344,19 @@ export class CallingClient extends Eventing {
|
|
|
215
344
|
},
|
|
216
345
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
217
346
|
});
|
|
218
|
-
log.log(
|
|
219
|
-
|
|
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 ?? '');
|
|
220
353
|
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
221
354
|
this.primaryMobiusUris = mobiusUris.primary;
|
|
222
355
|
this.backupMobiusUris = mobiusUris.backup;
|
|
223
|
-
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
|
+
});
|
|
224
360
|
}
|
|
225
361
|
catch (err) {
|
|
226
362
|
const extendedError = new Error(`Failed to get Mobius servers: ${err}`);
|
|
@@ -228,10 +364,13 @@ export class CallingClient extends Eventing {
|
|
|
228
364
|
method: METHODS.GET_MOBIUS_SERVERS,
|
|
229
365
|
file: CALLING_CLIENT_FILE,
|
|
230
366
|
});
|
|
231
|
-
handleCallingClientErrors(err, (clientError) => {
|
|
367
|
+
const abort = await handleCallingClientErrors(err, (clientError) => {
|
|
232
368
|
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
233
369
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
234
370
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
371
|
+
if (abort) {
|
|
372
|
+
await uploadLogs();
|
|
373
|
+
}
|
|
235
374
|
useDefault = true;
|
|
236
375
|
}
|
|
237
376
|
}
|
|
@@ -239,7 +378,10 @@ export class CallingClient extends Eventing {
|
|
|
239
378
|
useDefault = true;
|
|
240
379
|
}
|
|
241
380
|
if (useDefault) {
|
|
242
|
-
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
|
+
});
|
|
243
385
|
this.mobiusHost = `https://${this.mobiusClusters[0].host}${API_V1}`;
|
|
244
386
|
this.primaryMobiusUris = [`${this.mobiusHost}${URL_ENDPOINT}`];
|
|
245
387
|
}
|