@webex/calling 3.10.0 → 3.11.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 +128 -133
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +289 -186
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +17 -18
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/CallSettings.test.js +14 -14
- package/dist/CallSettings/CallSettings.test.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +72 -25
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +138 -48
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +138 -145
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +149 -150
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +407 -359
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +378 -401
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +7 -8
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +24 -24
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +666 -624
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +908 -556
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +22 -18
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +114 -114
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +7 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +57 -74
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +22 -22
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +675 -527
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +657 -309
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.js +24 -24
- package/dist/CallingClient/registration/webWorker.js.map +1 -1
- package/dist/CallingClient/registration/webWorker.test.js +20 -20
- 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 +28 -28
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +259 -268
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +64 -63
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Errors/catalog/CallError.js +7 -10
- package/dist/Errors/catalog/CallError.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +6 -9
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/ExtendedError.js +6 -8
- package/dist/Errors/catalog/ExtendedError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +6 -9
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Events/impl/index.js +12 -14
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Logger/index.js +3 -3
- package/dist/Logger/index.js.map +1 -1
- package/dist/Logger/index.test.js +1 -1
- package/dist/Logger/index.test.js.map +1 -1
- package/dist/Metrics/index.js +1 -2
- package/dist/Metrics/index.js.map +1 -1
- package/dist/SDKConnector/index.js +1 -2
- package/dist/SDKConnector/index.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +131 -139
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +106 -98
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +88 -92
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +72 -72
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +103 -131
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +20 -20
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +117 -131
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +180 -154
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/common/Utils.js +198 -166
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +436 -191
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +3 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/testUtil.js +5 -4
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +20 -11
- package/dist/module/CallSettings/UcmBackendConnector.js +21 -8
- package/dist/module/CallSettings/WxCallBackendConnector.js +10 -15
- package/dist/module/CallingClient/CallingClient.js +125 -123
- package/dist/module/CallingClient/calling/call.js +76 -60
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +5 -0
- package/dist/module/CallingClient/registration/register.js +93 -5
- package/dist/module/CallingClient/registration/webWorker.js +2 -2
- package/dist/module/CallingClient/registration/webWorkerStr.js +2 -2
- package/dist/module/Contacts/ContactsClient.js +19 -25
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Logger/index.js +2 -2
- package/dist/module/Voicemail/BroadworksBackendConnector.js +10 -18
- package/dist/module/Voicemail/UcmBackendConnector.js +7 -11
- package/dist/module/Voicemail/Voicemail.js +42 -68
- package/dist/module/Voicemail/WxCallBackendConnector.js +14 -28
- package/dist/module/common/Utils.js +31 -5
- package/dist/module/common/constants.js +2 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +1 -0
- 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 +2 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +4 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +5 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +6 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +8 -1
- package/dist/types/CallingClient/registration/types.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/types.d.ts +2 -1
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +1 -0
- package/dist/types/Contacts/ContactsClient.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/SDKConnector/types.d.ts +16 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +2 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +4 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -12,6 +12,7 @@ export const DEFAULT_LOCAL_CALL_ID = 'DefaultLocalId';
|
|
|
12
12
|
export const DEFAULT_REHOMING_INTERVAL_MAX = 120;
|
|
13
13
|
export const DEFAULT_REHOMING_INTERVAL_MIN = 60;
|
|
14
14
|
export const DEFAULT_SESSION_TIMER = 1000 * 60 * 10;
|
|
15
|
+
export const MAX_CALL_KEEPALIVE_RETRY_COUNT = 4;
|
|
15
16
|
export const DEVICES_ENDPOINT_RESOURCE = 'devices';
|
|
16
17
|
export const DISCOVERY_URL = 'https://ds.ciscospark.com/v1/region';
|
|
17
18
|
export const DUMMY_METRICS = {
|
|
@@ -112,6 +113,7 @@ export const REGISTRATION_UTIL = 'triggerRegistration';
|
|
|
112
113
|
export const REGISTER_UTIL = 'attemptRegistrationWithServers';
|
|
113
114
|
export const GET_MOBIUS_SERVERS_UTIL = 'getMobiusServers';
|
|
114
115
|
export const KEEPALIVE_UTIL = 'startKeepaliveTimer';
|
|
116
|
+
export const RECONNECT_ON_FAILURE_UTIL = 'reconnectOnFailure';
|
|
115
117
|
export const FAILBACK_UTIL = 'executeFailback';
|
|
116
118
|
export const REG_429_RETRY_UTIL = 'handle429Retry';
|
|
117
119
|
export const FAILOVER_UTIL = 'startFailoverTimer';
|
|
@@ -122,6 +124,8 @@ export const MOBIUS_US_PROD = 'mobius-us-east-1.prod.infra.webex.com';
|
|
|
122
124
|
export const MOBIUS_EU_PROD = 'mobius-eu-central-1.prod.infra.webex.com';
|
|
123
125
|
export const MOBIUS_US_INT = 'mobius-us-east-1.int.infra.webex.com';
|
|
124
126
|
export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
|
|
127
|
+
export const FAILOVER_CACHE_PREFIX = 'wxc-failover-state';
|
|
128
|
+
export const ACTIVE_MOBIUS_STORAGE_KEY = 'wxc-active-mobius';
|
|
125
129
|
export const ICE_CANDIDATES_TIMEOUT = 3000;
|
|
126
130
|
export const METHODS = {
|
|
127
131
|
CONSTRUCTOR: 'constructor',
|
|
@@ -222,6 +226,7 @@ export const METHODS = {
|
|
|
222
226
|
REGISTER_SESSIONS_LISTENER: 'registerSessionsListener',
|
|
223
227
|
CREATE_LINE: 'createLine',
|
|
224
228
|
GET_LINES: 'getLines',
|
|
229
|
+
GET_DEVICES: 'getDevices',
|
|
225
230
|
UPLOAD_LOGS: 'uploadLogs',
|
|
226
231
|
GET_SDK_CONNECTOR: 'getSDKConnector',
|
|
227
232
|
GET_CONNECTED_CALL: 'getConnectedCall',
|
|
@@ -8,7 +8,7 @@ import { getCallManager } from '../calling';
|
|
|
8
8
|
import log from '../../Logger';
|
|
9
9
|
import SDKConnector from '../../SDKConnector';
|
|
10
10
|
import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, ServiceIndicator, WorkerMessageType, } from '../../common/types';
|
|
11
|
-
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, } from '../constants';
|
|
11
|
+
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, WEBEX_WEB_CLIENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, RECONNECT_ON_FAILURE_UTIL, FAILOVER_CACHE_PREFIX, } from '../constants';
|
|
12
12
|
import { LINE_EVENTS } from '../line/types';
|
|
13
13
|
export class Registration {
|
|
14
14
|
sdkConnector;
|
|
@@ -58,6 +58,53 @@ export class Registration {
|
|
|
58
58
|
this.primaryMobiusUris = [];
|
|
59
59
|
this.backupMobiusUris = [];
|
|
60
60
|
}
|
|
61
|
+
getFailoverCacheKey() {
|
|
62
|
+
return `${FAILOVER_CACHE_PREFIX}.${this.userId || 'unknown'}`;
|
|
63
|
+
}
|
|
64
|
+
saveFailoverState(failoverState) {
|
|
65
|
+
try {
|
|
66
|
+
localStorage.setItem(this.getFailoverCacheKey(), JSON.stringify(failoverState));
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
log.warn(`Storing failover state in cache failed with error: ${String(error)}`, {
|
|
70
|
+
file: REGISTRATION_FILE,
|
|
71
|
+
method: 'saveFailoverState',
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
clearFailoverState() {
|
|
76
|
+
try {
|
|
77
|
+
localStorage.removeItem(this.getFailoverCacheKey());
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
log.warn('Clearing failover state from localStorage failed', {
|
|
81
|
+
file: REGISTRATION_FILE,
|
|
82
|
+
method: 'clearFailoverState',
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
async resumeFailover() {
|
|
87
|
+
try {
|
|
88
|
+
const cachedState = localStorage.getItem(this.getFailoverCacheKey());
|
|
89
|
+
const failoverState = cachedState
|
|
90
|
+
? JSON.parse(cachedState)
|
|
91
|
+
: undefined;
|
|
92
|
+
if (failoverState && !this.isDeviceRegistered()) {
|
|
93
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
94
|
+
const newElapsed = failoverState.timeElapsed + (currentTime - failoverState.retryScheduledTime);
|
|
95
|
+
this.clearFailoverState();
|
|
96
|
+
await this.startFailoverTimer(failoverState.attempt, newElapsed);
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
log.warn(`No failover state found in cache`, {
|
|
102
|
+
file: REGISTRATION_FILE,
|
|
103
|
+
method: 'triggerRegistration',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
61
108
|
getActiveMobiusUrl() {
|
|
62
109
|
return this.activeMobiusUrl;
|
|
63
110
|
}
|
|
@@ -69,6 +116,14 @@ export class Registration {
|
|
|
69
116
|
this.activeMobiusUrl = url;
|
|
70
117
|
this.callManager.updateActiveMobius(url);
|
|
71
118
|
}
|
|
119
|
+
setDeviceInfo(devicesInfo) {
|
|
120
|
+
const [device] = devicesInfo.devices;
|
|
121
|
+
this.deviceInfo = {
|
|
122
|
+
userId: devicesInfo.userId,
|
|
123
|
+
device,
|
|
124
|
+
devices: devicesInfo.devices,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
72
127
|
setMobiusServers(primaryMobiusUris, backupMobiusUris) {
|
|
73
128
|
log.log(METHOD_START_MESSAGE, { method: METHODS.SET_MOBIUS_SERVERS, file: REGISTRATION_FILE });
|
|
74
129
|
this.primaryMobiusUris = primaryMobiusUris;
|
|
@@ -88,7 +143,7 @@ export class Registration {
|
|
|
88
143
|
});
|
|
89
144
|
}
|
|
90
145
|
catch (error) {
|
|
91
|
-
log.warn(`Delete failed with Mobius ${error}`, {
|
|
146
|
+
log.warn(`Delete failed with Mobius: ${JSON.stringify(error)}`, {
|
|
92
147
|
file: REGISTRATION_FILE,
|
|
93
148
|
method: METHODS.DELETE_REGISTRATION,
|
|
94
149
|
});
|
|
@@ -119,6 +174,22 @@ export class Registration {
|
|
|
119
174
|
let abort = false;
|
|
120
175
|
if (this.activeMobiusUrl) {
|
|
121
176
|
abort = await this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
177
|
+
if (this.retryAfter) {
|
|
178
|
+
if (this.retryAfter < RETRY_TIMER_UPPER_LIMIT) {
|
|
179
|
+
setTimeout(async () => {
|
|
180
|
+
await this.restartRegistration(caller);
|
|
181
|
+
}, this.retryAfter * 1000);
|
|
182
|
+
}
|
|
183
|
+
else if (this.primaryMobiusUris.includes(this.activeMobiusUrl) &&
|
|
184
|
+
this.backupMobiusUris.length > 0) {
|
|
185
|
+
abort = await this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
this.restartRegistration(caller);
|
|
189
|
+
}
|
|
190
|
+
this.retryAfter = undefined;
|
|
191
|
+
return true;
|
|
192
|
+
}
|
|
122
193
|
}
|
|
123
194
|
return abort;
|
|
124
195
|
}
|
|
@@ -190,6 +261,12 @@ export class Registration {
|
|
|
190
261
|
if (this.retryAfter != null) {
|
|
191
262
|
interval = Math.max(interval, this.retryAfter);
|
|
192
263
|
}
|
|
264
|
+
this.saveFailoverState({
|
|
265
|
+
attempt,
|
|
266
|
+
timeElapsed,
|
|
267
|
+
retryScheduledTime: scheduledTime,
|
|
268
|
+
serverType: 'primary',
|
|
269
|
+
});
|
|
193
270
|
setTimeout(async () => {
|
|
194
271
|
await this.mutex.runExclusive(async () => {
|
|
195
272
|
abort = await this.attemptRegistrationWithServers(FAILOVER_UTIL);
|
|
@@ -202,6 +279,12 @@ export class Registration {
|
|
|
202
279
|
log.log(`Scheduled retry with primary in ${interval} seconds, number of attempts : ${attempt}`, loggerContext);
|
|
203
280
|
}
|
|
204
281
|
else if (this.backupMobiusUris.length) {
|
|
282
|
+
this.saveFailoverState({
|
|
283
|
+
attempt,
|
|
284
|
+
timeElapsed,
|
|
285
|
+
retryScheduledTime: Math.floor(Date.now() / 1000),
|
|
286
|
+
serverType: 'backup',
|
|
287
|
+
});
|
|
205
288
|
log.info('Failing over to backup servers.', loggerContext);
|
|
206
289
|
this.failoverImmediately = false;
|
|
207
290
|
abort = await this.attemptRegistrationWithServers(FAILOVER_UTIL, this.backupMobiusUris);
|
|
@@ -262,7 +345,7 @@ export class Registration {
|
|
|
262
345
|
}
|
|
263
346
|
}
|
|
264
347
|
catch (error) {
|
|
265
|
-
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${error}`, {
|
|
348
|
+
log.warn(`Ping failed for primary Mobius: ${mobiusUrl} with error: ${JSON.stringify(error)}`, {
|
|
266
349
|
file: REGISTRATION_FILE,
|
|
267
350
|
method: FAILBACK_UTIL,
|
|
268
351
|
});
|
|
@@ -417,6 +500,9 @@ export class Registration {
|
|
|
417
500
|
};
|
|
418
501
|
}
|
|
419
502
|
async triggerRegistration() {
|
|
503
|
+
if (await this.resumeFailover()) {
|
|
504
|
+
return;
|
|
505
|
+
}
|
|
420
506
|
if (this.primaryMobiusUris.length > 0) {
|
|
421
507
|
const abort = await this.attemptRegistrationWithServers(REGISTRATION_UTIL, this.primaryMobiusUris);
|
|
422
508
|
if (!this.isDeviceRegistered() && !abort) {
|
|
@@ -450,6 +536,7 @@ export class Registration {
|
|
|
450
536
|
method: REGISTER_UTIL,
|
|
451
537
|
});
|
|
452
538
|
const resp = await this.postRegistration(url);
|
|
539
|
+
this.clearFailoverState();
|
|
453
540
|
this.deviceInfo = resp.body;
|
|
454
541
|
this.registrationStatus = RegistrationStatus.ACTIVE;
|
|
455
542
|
this.setActiveMobiusUrl(url);
|
|
@@ -537,7 +624,7 @@ export class Registration {
|
|
|
537
624
|
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
538
625
|
await uploadLogs();
|
|
539
626
|
if (!abort) {
|
|
540
|
-
await this.reconnectOnFailure(
|
|
627
|
+
await this.reconnectOnFailure(RECONNECT_ON_FAILURE_UTIL);
|
|
541
628
|
}
|
|
542
629
|
else if (error.statusCode === 404) {
|
|
543
630
|
this.handle404KeepaliveFailure(KEEPALIVE_UTIL);
|
|
@@ -571,13 +658,14 @@ export class Registration {
|
|
|
571
658
|
});
|
|
572
659
|
}
|
|
573
660
|
catch (err) {
|
|
574
|
-
log.warn(`Delete failed with Mobius: ${err}`, {
|
|
661
|
+
log.warn(`Delete failed with Mobius: ${JSON.stringify(err)}`, {
|
|
575
662
|
file: REGISTRATION_FILE,
|
|
576
663
|
method: METHODS.DEREGISTER,
|
|
577
664
|
});
|
|
578
665
|
}
|
|
579
666
|
this.clearKeepaliveTimer();
|
|
580
667
|
this.setStatus(RegistrationStatus.INACTIVE);
|
|
668
|
+
this.clearFailoverState();
|
|
581
669
|
}
|
|
582
670
|
isRegRetry() {
|
|
583
671
|
return this.registerRetry;
|
|
@@ -40,10 +40,10 @@ const messageHandler = (event) => {
|
|
|
40
40
|
}
|
|
41
41
|
catch (err) {
|
|
42
42
|
const headers = {};
|
|
43
|
-
if (err.headers
|
|
43
|
+
if (err.headers?.has('Retry-After')) {
|
|
44
44
|
headers['retry-after'] = err.headers.get('Retry-After');
|
|
45
45
|
}
|
|
46
|
-
if (err.headers
|
|
46
|
+
if (err.headers?.has('Trackingid')) {
|
|
47
47
|
headers['trackingid'] = err.headers.get('Trackingid');
|
|
48
48
|
}
|
|
49
49
|
const error = {
|
|
@@ -70,11 +70,11 @@ const messageHandler = (event) => {
|
|
|
70
70
|
keepAliveRetryCount = 0;
|
|
71
71
|
} catch (err) {
|
|
72
72
|
let headers = {};
|
|
73
|
-
if(err.headers
|
|
73
|
+
if(err.headers?.has('Retry-After')) {
|
|
74
74
|
headers['retry-after'] = err.headers.get('Retry-After');
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
if(err.headers
|
|
77
|
+
if(err.headers?.has('Trackingid')) {
|
|
78
78
|
headers['trackingid'] = err.headers.get('Trackingid');
|
|
79
79
|
}
|
|
80
80
|
|
|
@@ -12,6 +12,7 @@ export class ContactsClient {
|
|
|
12
12
|
groups;
|
|
13
13
|
contacts;
|
|
14
14
|
defaultGroupId;
|
|
15
|
+
contactsServiceUrl;
|
|
15
16
|
constructor(webex, logger) {
|
|
16
17
|
this.sdkConnector = SDKConnector;
|
|
17
18
|
if (!this.sdkConnector.getWebex()) {
|
|
@@ -22,6 +23,9 @@ export class ContactsClient {
|
|
|
22
23
|
this.groups = undefined;
|
|
23
24
|
this.contacts = undefined;
|
|
24
25
|
this.defaultGroupId = '';
|
|
26
|
+
this.contactsServiceUrl =
|
|
27
|
+
this.webex.internal.services._serviceUrls?.contactsService ||
|
|
28
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.contactsService);
|
|
25
29
|
log.setLogger(logger.level, CONTACTS_CLIENT);
|
|
26
30
|
}
|
|
27
31
|
async decryptContactDetail(encryptionKeyUrl, contactDetails) {
|
|
@@ -195,7 +199,7 @@ export class ContactsClient {
|
|
|
195
199
|
const cloudContactsMap = {};
|
|
196
200
|
try {
|
|
197
201
|
const response = await this.webex.request({
|
|
198
|
-
uri: `${this.
|
|
202
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
|
|
199
203
|
method: HTTP_METHODS.GET,
|
|
200
204
|
});
|
|
201
205
|
log.log(`Response code: ${response.statusCode} and Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
|
|
@@ -250,10 +254,8 @@ export class ContactsClient {
|
|
|
250
254
|
return contactResponse;
|
|
251
255
|
}
|
|
252
256
|
catch (err) {
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
log.error(extendedError, loggerContext);
|
|
256
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
257
|
+
log.error(`Error fetching contacts: ${JSON.stringify(err)}`, loggerContext);
|
|
258
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
257
259
|
await uploadLogs();
|
|
258
260
|
return errorStatus;
|
|
259
261
|
}
|
|
@@ -374,7 +376,7 @@ export class ContactsClient {
|
|
|
374
376
|
};
|
|
375
377
|
try {
|
|
376
378
|
const response = await this.webex.request({
|
|
377
|
-
uri: `${this.
|
|
379
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}`,
|
|
378
380
|
method: HTTP_METHODS.POST,
|
|
379
381
|
body: groupInfo,
|
|
380
382
|
});
|
|
@@ -394,10 +396,8 @@ export class ContactsClient {
|
|
|
394
396
|
return contactResponse;
|
|
395
397
|
}
|
|
396
398
|
catch (err) {
|
|
397
|
-
|
|
398
|
-
const
|
|
399
|
-
log.error(extendedError, loggerContext);
|
|
400
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
399
|
+
log.error(`Unable to create contact group: ${JSON.stringify(err)}`, loggerContext);
|
|
400
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
401
401
|
await uploadLogs();
|
|
402
402
|
return errorStatus;
|
|
403
403
|
}
|
|
@@ -411,7 +411,7 @@ export class ContactsClient {
|
|
|
411
411
|
try {
|
|
412
412
|
log.info(`Deleting contact group: ${groupId}`, loggerContext);
|
|
413
413
|
const response = await this.webex.request({
|
|
414
|
-
uri: `${this.
|
|
414
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${GROUP_FILTER}/${groupId}`,
|
|
415
415
|
method: HTTP_METHODS.DELETE,
|
|
416
416
|
});
|
|
417
417
|
log.log(`Response trackingId: ${response?.headers?.trackingid}`, loggerContext);
|
|
@@ -431,10 +431,8 @@ export class ContactsClient {
|
|
|
431
431
|
return contactResponse;
|
|
432
432
|
}
|
|
433
433
|
catch (err) {
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
log.error(extendedError, loggerContext);
|
|
437
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
434
|
+
log.error(`Unable to delete contact group ${groupId}: ${JSON.stringify(err)}`, loggerContext);
|
|
435
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
438
436
|
await uploadLogs();
|
|
439
437
|
return errorStatus;
|
|
440
438
|
}
|
|
@@ -487,7 +485,7 @@ export class ContactsClient {
|
|
|
487
485
|
}
|
|
488
486
|
}
|
|
489
487
|
const response = await this.webex.request({
|
|
490
|
-
uri: `${this.
|
|
488
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}`,
|
|
491
489
|
method: HTTP_METHODS.POST,
|
|
492
490
|
body: requestBody,
|
|
493
491
|
});
|
|
@@ -517,10 +515,8 @@ export class ContactsClient {
|
|
|
517
515
|
return contactResponse;
|
|
518
516
|
}
|
|
519
517
|
catch (err) {
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
log.error(extendedError, loggerContext);
|
|
523
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
518
|
+
log.error(`Failed to create contact: ${JSON.stringify(err)}`, loggerContext);
|
|
519
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
524
520
|
await uploadLogs();
|
|
525
521
|
return errorStatus;
|
|
526
522
|
}
|
|
@@ -534,7 +530,7 @@ export class ContactsClient {
|
|
|
534
530
|
try {
|
|
535
531
|
log.info(`Deleting contact : ${contactId}`, loggerContext);
|
|
536
532
|
const response = await this.webex.request({
|
|
537
|
-
uri: `${this.
|
|
533
|
+
uri: `${this.contactsServiceUrl}/${ENCRYPT_FILTER}/${USERS}/${CONTACT_FILTER}/${contactId}`,
|
|
538
534
|
method: HTTP_METHODS.DELETE,
|
|
539
535
|
});
|
|
540
536
|
const contactResponse = {
|
|
@@ -550,10 +546,8 @@ export class ContactsClient {
|
|
|
550
546
|
return contactResponse;
|
|
551
547
|
}
|
|
552
548
|
catch (err) {
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
log.error(extendedError, loggerContext);
|
|
556
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
549
|
+
log.error(`Unable to delete contact ${contactId}: ${JSON.stringify(err)}`, loggerContext);
|
|
550
|
+
const errorStatus = serviceErrorCodeHandler(err, loggerContext);
|
|
557
551
|
await uploadLogs();
|
|
558
552
|
return errorStatus;
|
|
559
553
|
}
|
|
@@ -4,7 +4,7 @@ import { LOG_PREFIX } from '../../Logger/types';
|
|
|
4
4
|
export class Eventing extends EventEmitter {
|
|
5
5
|
emit(event, ...args) {
|
|
6
6
|
const timestamp = new Date().toUTCString();
|
|
7
|
-
Logger.info(`${timestamp} ${LOG_PREFIX.EVENT}: ${event.toString()} - event emitted with parameters -> ${args}
|
|
7
|
+
Logger.info(`${timestamp} ${LOG_PREFIX.EVENT}: ${event.toString()} - event emitted with parameters -> ${args}`, {
|
|
8
8
|
file: 'Events/impl/index.ts',
|
|
9
9
|
method: 'emit',
|
|
10
10
|
});
|
|
@@ -101,9 +101,9 @@ const logTrace = (message, context) => {
|
|
|
101
101
|
writeToLogger(`${format(context, '[TRACE]')} - ${LOG_PREFIX.MESSAGE}:${message}`, LOGGER.TRACE);
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
const logError = (
|
|
104
|
+
const logError = (errorMsg, context) => {
|
|
105
105
|
if (currentLogLevel >= LOGGING_LEVEL.error) {
|
|
106
|
-
writeToLogger(`${format(context, '[ERROR]')} - !${LOG_PREFIX.ERROR}!${LOG_PREFIX.MESSAGE}:${
|
|
106
|
+
writeToLogger(`${format(context, '[ERROR]')} - !${LOG_PREFIX.ERROR}!${LOG_PREFIX.MESSAGE}:${errorMsg}`, LOGGER.ERROR);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
const setWebexLogger = (logger) => {
|
|
@@ -56,8 +56,7 @@ export class BroadworksBackendConnector {
|
|
|
56
56
|
const errorInfo = {
|
|
57
57
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
log.error(extendedError, loggerContext);
|
|
59
|
+
log.error(`Failed to get userId: ${JSON.stringify(err)}`, loggerContext);
|
|
61
60
|
await uploadLogs();
|
|
62
61
|
return serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
63
62
|
}
|
|
@@ -68,9 +67,11 @@ export class BroadworksBackendConnector {
|
|
|
68
67
|
method: METHODS.GET_BW_TOKEN,
|
|
69
68
|
};
|
|
70
69
|
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
70
|
+
const broadworksIdpProxyUrl = this.webex.internal.services._serviceUrls?.broadworksIdpProxy ||
|
|
71
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.broadworksIdpProxy);
|
|
71
72
|
try {
|
|
72
73
|
const bwTokenResponse = await this.webex.request({
|
|
73
|
-
uri: `${
|
|
74
|
+
uri: `${broadworksIdpProxyUrl}${BW_TOKEN_FETCH_ENDPOINT}`,
|
|
74
75
|
method: HTTP_METHODS.GET,
|
|
75
76
|
});
|
|
76
77
|
const response = bwTokenResponse.body;
|
|
@@ -78,11 +79,7 @@ export class BroadworksBackendConnector {
|
|
|
78
79
|
log.log('Successfully fetched Broadworks token', loggerContext);
|
|
79
80
|
}
|
|
80
81
|
catch (err) {
|
|
81
|
-
|
|
82
|
-
log.error(extendedError, {
|
|
83
|
-
file: BROADWORKS_VOICEMAIL_FILE,
|
|
84
|
-
method: METHODS.GET_BW_TOKEN,
|
|
85
|
-
});
|
|
82
|
+
log.error(`Broadworks token exception: ${JSON.stringify(err)}`, loggerContext);
|
|
86
83
|
await uploadLogs();
|
|
87
84
|
}
|
|
88
85
|
}
|
|
@@ -146,8 +143,7 @@ export class BroadworksBackendConnector {
|
|
|
146
143
|
const errorInfo = {
|
|
147
144
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
148
145
|
};
|
|
149
|
-
|
|
150
|
-
log.error(extendedError, loggerContext);
|
|
146
|
+
log.error(`Failed to get voicemail list: ${JSON.stringify(err)}`, loggerContext);
|
|
151
147
|
await uploadLogs();
|
|
152
148
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
153
149
|
return errorStatus;
|
|
@@ -206,8 +202,7 @@ export class BroadworksBackendConnector {
|
|
|
206
202
|
const errorInfo = {
|
|
207
203
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
208
204
|
};
|
|
209
|
-
|
|
210
|
-
log.error(extendedError, loggerContext);
|
|
205
|
+
log.error(`Failed to get voicemail content: ${JSON.stringify(err)}`, loggerContext);
|
|
211
206
|
await uploadLogs();
|
|
212
207
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
213
208
|
return errorStatus;
|
|
@@ -246,8 +241,7 @@ export class BroadworksBackendConnector {
|
|
|
246
241
|
const errorInfo = {
|
|
247
242
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
248
243
|
};
|
|
249
|
-
|
|
250
|
-
log.error(extendedError, loggerContext);
|
|
244
|
+
log.error(`Failed to mark voicemail as read: ${JSON.stringify(err)}`, loggerContext);
|
|
251
245
|
await uploadLogs();
|
|
252
246
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
253
247
|
return errorStatus;
|
|
@@ -282,8 +276,7 @@ export class BroadworksBackendConnector {
|
|
|
282
276
|
const errorInfo = {
|
|
283
277
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
284
278
|
};
|
|
285
|
-
|
|
286
|
-
log.error(extendedError, loggerContext);
|
|
279
|
+
log.error(`Failed to mark voicemail as unread: ${JSON.stringify(err)}`, loggerContext);
|
|
287
280
|
await uploadLogs();
|
|
288
281
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
289
282
|
return errorStatus;
|
|
@@ -318,8 +311,7 @@ export class BroadworksBackendConnector {
|
|
|
318
311
|
const errorInfo = {
|
|
319
312
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
320
313
|
};
|
|
321
|
-
|
|
322
|
-
log.error(extendedError, loggerContext);
|
|
314
|
+
log.error(`Failed to delete voicemail: ${JSON.stringify(err)}`, loggerContext);
|
|
323
315
|
await uploadLogs();
|
|
324
316
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
325
317
|
return errorStatus;
|
|
@@ -102,8 +102,7 @@ export class UcmBackendConnector {
|
|
|
102
102
|
return responseDetails;
|
|
103
103
|
}
|
|
104
104
|
catch (err) {
|
|
105
|
-
|
|
106
|
-
log.error(extendedError, loggerContext);
|
|
105
|
+
log.error(`Failed to get voicemail list: ${JSON.stringify(err)}`, loggerContext);
|
|
107
106
|
await uploadLogs();
|
|
108
107
|
const errorInfo = err;
|
|
109
108
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -122,8 +121,7 @@ export class UcmBackendConnector {
|
|
|
122
121
|
return response;
|
|
123
122
|
}
|
|
124
123
|
catch (err) {
|
|
125
|
-
|
|
126
|
-
log.error(extendedError, loggerContext);
|
|
124
|
+
log.error(`Failed to get voicemail content: ${JSON.stringify(err)}`, loggerContext);
|
|
127
125
|
await uploadLogs();
|
|
128
126
|
const errorInfo = err;
|
|
129
127
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -142,7 +140,8 @@ export class UcmBackendConnector {
|
|
|
142
140
|
log.info(`${METHOD_START_MESSAGE} with Message ID: ${messageId}`, loggerContext);
|
|
143
141
|
return new Promise((resolve, reject) => {
|
|
144
142
|
const voicemailContentUrl = `${this.vgVoiceMessageURI}${VOICEMAILS}/${messageId}/${CONTENT}`;
|
|
145
|
-
const mercuryApi =
|
|
143
|
+
const mercuryApi = this.webex.internal.services._serviceUrls?.mercuryApi ||
|
|
144
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.mercuryApi);
|
|
146
145
|
this.returnUcmPromise(voicemailContentUrl, mercuryApi)
|
|
147
146
|
.then((response) => {
|
|
148
147
|
if (response.statusCode === 200) {
|
|
@@ -237,8 +236,7 @@ export class UcmBackendConnector {
|
|
|
237
236
|
return responseDetails;
|
|
238
237
|
}
|
|
239
238
|
catch (err) {
|
|
240
|
-
|
|
241
|
-
log.error(extendedError, loggerContext);
|
|
239
|
+
log.error(`Failed to mark voicemail as read: ${JSON.stringify(err)}`, loggerContext);
|
|
242
240
|
await uploadLogs();
|
|
243
241
|
const errorInfo = err;
|
|
244
242
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -273,8 +271,7 @@ export class UcmBackendConnector {
|
|
|
273
271
|
return responseDetails;
|
|
274
272
|
}
|
|
275
273
|
catch (err) {
|
|
276
|
-
|
|
277
|
-
log.error(extendedError, loggerContext);
|
|
274
|
+
log.error(`Failed to mark voicemail as unread: ${JSON.stringify(err)}`, loggerContext);
|
|
278
275
|
await uploadLogs();
|
|
279
276
|
const errorInfo = err;
|
|
280
277
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -306,8 +303,7 @@ export class UcmBackendConnector {
|
|
|
306
303
|
return responseDetails;
|
|
307
304
|
}
|
|
308
305
|
catch (err) {
|
|
309
|
-
|
|
310
|
-
log.error(extendedError, loggerContext);
|
|
306
|
+
log.error(`Failed to delete voicemail: ${JSON.stringify(err)}`, loggerContext);
|
|
311
307
|
await uploadLogs();
|
|
312
308
|
const errorInfo = err;
|
|
313
309
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|