@webex/calling 3.9.0-multipleLLM.2 → 3.9.0-next.10
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 +452 -216
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +374 -321
- 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 +343 -320
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +405 -406
- 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 +8 -6
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +7 -7
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +6 -6
- 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 +243 -234
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +172 -173
- 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 +5 -4
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +14 -14
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -1
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +2 -6
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- 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 +136 -50
- package/dist/Metrics/index.js.map +1 -1
- 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 +80 -63
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +95 -104
- 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 +171 -43
- package/dist/module/CallingClient/calling/call.js +66 -43
- package/dist/module/CallingClient/constants.js +7 -4
- package/dist/module/CallingClient/registration/register.js +10 -7
- package/dist/module/CallingClient/registration/webWorker.js +2 -1
- package/dist/module/CallingClient/windowsChromiumIceWarmupUtils.js +1 -4
- package/dist/module/Contacts/ContactsClient.js +23 -17
- package/dist/module/Contacts/constants.js +1 -1
- package/dist/module/Metrics/index.js +63 -1
- 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 +22 -8
- 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 +7 -4
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- 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/windowsChromiumIceWarmupUtils.d.ts +2 -4
- package/dist/types/CallingClient/windowsChromiumIceWarmupUtils.d.ts.map +1 -1
- 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 +17 -2
- 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/package.json +9 -7
|
@@ -9,9 +9,9 @@ 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
16
|
import windowsChromiumIceWarmup from './windowsChromiumIceWarmupUtils';
|
|
17
17
|
export class CallingClient extends Eventing {
|
|
@@ -27,6 +27,11 @@ export class CallingClient extends Eventing {
|
|
|
27
27
|
mobiusHost;
|
|
28
28
|
mediaEngine;
|
|
29
29
|
lineDict = {};
|
|
30
|
+
isNetworkDown = false;
|
|
31
|
+
networkDownTimestamp = '';
|
|
32
|
+
networkUpTimestamp = '';
|
|
33
|
+
mercuryDownTimestamp = '';
|
|
34
|
+
mercuryUpTimestamp = '';
|
|
30
35
|
constructor(webex, config) {
|
|
31
36
|
super();
|
|
32
37
|
this.sdkConnector = SDKConnector;
|
|
@@ -87,50 +92,143 @@ export class CallingClient extends Eventing {
|
|
|
87
92
|
this.registerCallsClearedListener();
|
|
88
93
|
}
|
|
89
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
|
+
}
|
|
120
|
+
await this.getMobiusServers();
|
|
121
|
+
await this.createLine();
|
|
122
|
+
this.setupNetworkEventListeners();
|
|
123
|
+
}
|
|
124
|
+
async checkNetworkReachability() {
|
|
90
125
|
try {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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,
|
|
97
133
|
});
|
|
98
|
-
|
|
134
|
+
clearTimeout(timeoutId);
|
|
135
|
+
return true;
|
|
99
136
|
}
|
|
100
|
-
catch (
|
|
101
|
-
log.warn(`
|
|
137
|
+
catch (error) {
|
|
138
|
+
log.warn(`Network connectivity probe failed: ${error}`, {
|
|
139
|
+
file: CALLING_CLIENT_FILE,
|
|
140
|
+
method: 'pingExternal',
|
|
141
|
+
});
|
|
142
|
+
return false;
|
|
102
143
|
}
|
|
103
|
-
await this.getMobiusServers();
|
|
104
|
-
await this.createLine();
|
|
105
|
-
this.detectNetworkChange();
|
|
106
144
|
}
|
|
107
|
-
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 = () => {
|
|
108
176
|
log.info(METHOD_START_MESSAGE, {
|
|
109
177
|
file: CALLING_CLIENT_FILE,
|
|
110
|
-
method: METHODS.
|
|
178
|
+
method: METHODS.NETWORK_ONLINE,
|
|
111
179
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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
|
+
}
|
|
131
207
|
}
|
|
208
|
+
}, NETWORK_FLAP_TIMEOUT);
|
|
209
|
+
if (Object.keys(this.callManager.getActiveCalls()).length) {
|
|
210
|
+
await this.checkCallStatus();
|
|
132
211
|
}
|
|
133
|
-
|
|
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
|
+
});
|
|
134
232
|
}
|
|
135
233
|
async getClientRegionInfo() {
|
|
136
234
|
let abort;
|
|
@@ -156,6 +254,10 @@ export class CallingClient extends Eventing {
|
|
|
156
254
|
},
|
|
157
255
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
158
256
|
});
|
|
257
|
+
log.log(`Response trackingId: ${temp?.headers?.trackingid}`, {
|
|
258
|
+
file: CALLING_CLIENT_FILE,
|
|
259
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
260
|
+
});
|
|
159
261
|
const myIP = temp.body.ipv4;
|
|
160
262
|
const response = await this.webex.request({
|
|
161
263
|
uri: `${DISCOVERY_URL}/${myIP}`,
|
|
@@ -165,11 +267,20 @@ export class CallingClient extends Eventing {
|
|
|
165
267
|
[SPARK_USER_AGENT]: null,
|
|
166
268
|
},
|
|
167
269
|
});
|
|
270
|
+
log.log(`Response trackingId: ${response?.headers?.trackingid}`, {
|
|
271
|
+
file: CALLING_CLIENT_FILE,
|
|
272
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
273
|
+
});
|
|
168
274
|
const clientRegionInfo = response.body;
|
|
169
275
|
regionInfo.clientRegion = clientRegionInfo?.clientRegion
|
|
170
276
|
? clientRegionInfo.clientRegion
|
|
171
277
|
: '';
|
|
172
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 ?? '');
|
|
173
284
|
break;
|
|
174
285
|
}
|
|
175
286
|
catch (err) {
|
|
@@ -185,6 +296,7 @@ export class CallingClient extends Eventing {
|
|
|
185
296
|
regionInfo.clientRegion = '';
|
|
186
297
|
regionInfo.countryCode = '';
|
|
187
298
|
if (abort) {
|
|
299
|
+
await uploadLogs();
|
|
188
300
|
return regionInfo;
|
|
189
301
|
}
|
|
190
302
|
}
|
|
@@ -218,9 +330,12 @@ export class CallingClient extends Eventing {
|
|
|
218
330
|
countryCode = regionInfo.countryCode;
|
|
219
331
|
}
|
|
220
332
|
if (clientRegion && countryCode) {
|
|
221
|
-
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
|
+
});
|
|
222
337
|
try {
|
|
223
|
-
const
|
|
338
|
+
const response = await this.webex.request({
|
|
224
339
|
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
225
340
|
method: HTTP_METHODS.GET,
|
|
226
341
|
headers: {
|
|
@@ -229,12 +344,19 @@ export class CallingClient extends Eventing {
|
|
|
229
344
|
},
|
|
230
345
|
service: ALLOWED_SERVICES.MOBIUS,
|
|
231
346
|
});
|
|
232
|
-
log.log(
|
|
233
|
-
|
|
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 ?? '');
|
|
234
353
|
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
235
354
|
this.primaryMobiusUris = mobiusUris.primary;
|
|
236
355
|
this.backupMobiusUris = mobiusUris.backup;
|
|
237
|
-
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
|
+
});
|
|
238
360
|
}
|
|
239
361
|
catch (err) {
|
|
240
362
|
const extendedError = new Error(`Failed to get Mobius servers: ${err}`);
|
|
@@ -242,10 +364,13 @@ export class CallingClient extends Eventing {
|
|
|
242
364
|
method: METHODS.GET_MOBIUS_SERVERS,
|
|
243
365
|
file: CALLING_CLIENT_FILE,
|
|
244
366
|
});
|
|
245
|
-
handleCallingClientErrors(err, (clientError) => {
|
|
367
|
+
const abort = await handleCallingClientErrors(err, (clientError) => {
|
|
246
368
|
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
247
369
|
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
248
370
|
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
371
|
+
if (abort) {
|
|
372
|
+
await uploadLogs();
|
|
373
|
+
}
|
|
249
374
|
useDefault = true;
|
|
250
375
|
}
|
|
251
376
|
}
|
|
@@ -253,7 +378,10 @@ export class CallingClient extends Eventing {
|
|
|
253
378
|
useDefault = true;
|
|
254
379
|
}
|
|
255
380
|
if (useDefault) {
|
|
256
|
-
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
|
+
});
|
|
257
385
|
this.mobiusHost = `https://${this.mobiusClusters[0].host}${API_V1}`;
|
|
258
386
|
this.primaryMobiusUris = [`${this.mobiusHost}${URL_ENDPOINT}`];
|
|
259
387
|
}
|