@webex/calling 3.10.0 → 3.11.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/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 +83 -123
- package/dist/module/CallingClient/calling/call.js +73 -58
- package/dist/module/CallingClient/calling/callManager.js +7 -0
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/registration/register.js +85 -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.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 +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +4 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +6 -0
- 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/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/package.json +4 -4
- package/dist/CallHistory/CallHistory.js +0 -584
- package/dist/CallHistory/CallHistory.js.map +0 -1
- package/dist/CallHistory/CallHistory.test.js +0 -813
- package/dist/CallHistory/CallHistory.test.js.map +0 -1
- package/dist/CallHistory/callHistoryFixtures.js +0 -650
- package/dist/CallHistory/callHistoryFixtures.js.map +0 -1
- package/dist/CallHistory/constants.js +0 -38
- package/dist/CallHistory/constants.js.map +0 -1
- package/dist/CallHistory/types.js +0 -7
- package/dist/CallHistory/types.js.map +0 -1
- package/dist/CallSettings/CallSettings.js +0 -312
- package/dist/CallSettings/CallSettings.js.map +0 -1
- package/dist/CallSettings/CallSettings.test.js +0 -122
- package/dist/CallSettings/CallSettings.test.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.js +0 -261
- package/dist/CallSettings/UcmBackendConnector.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +0 -321
- package/dist/CallSettings/UcmBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.js +0 -604
- package/dist/CallSettings/WxCallBackendConnector.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +0 -905
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/constants.js +0 -31
- package/dist/CallSettings/constants.js.map +0 -1
- package/dist/CallSettings/testFixtures.js +0 -68
- package/dist/CallSettings/testFixtures.js.map +0 -1
- package/dist/CallSettings/types.js +0 -7
- package/dist/CallSettings/types.js.map +0 -1
- package/dist/CallingClient/CallingClient.js +0 -1071
- package/dist/CallingClient/CallingClient.js.map +0 -1
- package/dist/CallingClient/CallingClient.test.js +0 -1289
- package/dist/CallingClient/CallingClient.test.js.map +0 -1
- package/dist/CallingClient/callRecordFixtures.js +0 -101
- package/dist/CallingClient/callRecordFixtures.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.js +0 -276
- package/dist/CallingClient/calling/CallerId/index.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +0 -275
- package/dist/CallingClient/calling/CallerId/index.test.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/types.js +0 -7
- package/dist/CallingClient/calling/CallerId/types.js.map +0 -1
- package/dist/CallingClient/calling/call.js +0 -3444
- package/dist/CallingClient/calling/call.js.map +0 -1
- package/dist/CallingClient/calling/call.test.js +0 -3260
- package/dist/CallingClient/calling/call.test.js.map +0 -1
- package/dist/CallingClient/calling/callManager.js +0 -456
- package/dist/CallingClient/calling/callManager.js.map +0 -1
- package/dist/CallingClient/calling/callManager.test.js +0 -741
- package/dist/CallingClient/calling/callManager.test.js.map +0 -1
- package/dist/CallingClient/calling/index.js +0 -30
- package/dist/CallingClient/calling/index.js.map +0 -1
- package/dist/CallingClient/calling/types.js +0 -74
- package/dist/CallingClient/calling/types.js.map +0 -1
- package/dist/CallingClient/callingClientFixtures.js +0 -143
- package/dist/CallingClient/callingClientFixtures.js.map +0 -1
- package/dist/CallingClient/constants.js +0 -237
- package/dist/CallingClient/constants.js.map +0 -1
- package/dist/CallingClient/line/index.js +0 -349
- package/dist/CallingClient/line/index.js.map +0 -1
- package/dist/CallingClient/line/line.test.js +0 -327
- package/dist/CallingClient/line/line.test.js.map +0 -1
- package/dist/CallingClient/line/types.js +0 -21
- package/dist/CallingClient/line/types.js.map +0 -1
- package/dist/CallingClient/registration/index.js +0 -19
- package/dist/CallingClient/registration/index.js.map +0 -1
- package/dist/CallingClient/registration/register.js +0 -1538
- package/dist/CallingClient/registration/register.js.map +0 -1
- package/dist/CallingClient/registration/register.test.js +0 -1537
- package/dist/CallingClient/registration/register.test.js.map +0 -1
- package/dist/CallingClient/registration/registerFixtures.js +0 -36
- package/dist/CallingClient/registration/registerFixtures.js.map +0 -1
- package/dist/CallingClient/registration/types.js +0 -7
- package/dist/CallingClient/registration/types.js.map +0 -1
- package/dist/CallingClient/registration/webWorker.js +0 -130
- package/dist/CallingClient/registration/webWorker.js.map +0 -1
- package/dist/CallingClient/registration/webWorker.test.js +0 -303
- package/dist/CallingClient/registration/webWorker.test.js.map +0 -1
- package/dist/CallingClient/registration/webWorkerStr.js +0 -15
- package/dist/CallingClient/registration/webWorkerStr.js.map +0 -1
- package/dist/CallingClient/types.js +0 -7
- package/dist/CallingClient/types.js.map +0 -1
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +0 -142
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +0 -1
- package/dist/Contacts/ContactsClient.js +0 -1215
- package/dist/Contacts/ContactsClient.js.map +0 -1
- package/dist/Contacts/ContactsClient.test.js +0 -1003
- package/dist/Contacts/ContactsClient.test.js.map +0 -1
- package/dist/Contacts/constants.js +0 -40
- package/dist/Contacts/constants.js.map +0 -1
- package/dist/Contacts/contactFixtures.js +0 -430
- package/dist/Contacts/contactFixtures.js.map +0 -1
- package/dist/Contacts/types.js +0 -43
- package/dist/Contacts/types.js.map +0 -1
- package/dist/Errors/catalog/CallError.js +0 -92
- package/dist/Errors/catalog/CallError.js.map +0 -1
- package/dist/Errors/catalog/CallingDeviceError.js +0 -86
- package/dist/Errors/catalog/CallingDeviceError.js.map +0 -1
- package/dist/Errors/catalog/ExtendedError.js +0 -44
- package/dist/Errors/catalog/ExtendedError.js.map +0 -1
- package/dist/Errors/catalog/LineError.js +0 -88
- package/dist/Errors/catalog/LineError.js.map +0 -1
- package/dist/Errors/index.js +0 -28
- package/dist/Errors/index.js.map +0 -1
- package/dist/Errors/types.js +0 -59
- package/dist/Errors/types.js.map +0 -1
- package/dist/Events/impl/index.js +0 -81
- package/dist/Events/impl/index.js.map +0 -1
- package/dist/Events/types.js +0 -107
- package/dist/Events/types.js.map +0 -1
- package/dist/Logger/index.js +0 -228
- package/dist/Logger/index.js.map +0 -1
- package/dist/Logger/index.test.js +0 -87
- package/dist/Logger/index.test.js.map +0 -1
- package/dist/Logger/types.js +0 -34
- package/dist/Logger/types.js.map +0 -1
- package/dist/Metrics/index.js +0 -535
- package/dist/Metrics/index.js.map +0 -1
- package/dist/Metrics/index.test.js +0 -463
- package/dist/Metrics/index.test.js.map +0 -1
- package/dist/Metrics/types.js +0 -64
- package/dist/Metrics/types.js.map +0 -1
- package/dist/SDKConnector/index.js +0 -103
- package/dist/SDKConnector/index.js.map +0 -1
- package/dist/SDKConnector/index.test.js +0 -9
- package/dist/SDKConnector/index.test.js.map +0 -1
- package/dist/SDKConnector/types.js +0 -7
- package/dist/SDKConnector/types.js.map +0 -1
- package/dist/SDKConnector/utils.js +0 -39
- package/dist/SDKConnector/utils.js.map +0 -1
- package/dist/SDKConnector/utils.test.js +0 -9
- package/dist/SDKConnector/utils.test.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +0 -707
- package/dist/Voicemail/BroadworksBackendConnector.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +0 -812
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.js +0 -632
- package/dist/Voicemail/UcmBackendConnector.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +0 -738
- package/dist/Voicemail/UcmBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/Voicemail.js +0 -500
- package/dist/Voicemail/Voicemail.js.map +0 -1
- package/dist/Voicemail/Voicemail.test.js +0 -391
- package/dist/Voicemail/Voicemail.test.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.js +0 -671
- package/dist/Voicemail/WxCallBackendConnector.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +0 -1199
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/constants.js +0 -61
- package/dist/Voicemail/constants.js.map +0 -1
- package/dist/Voicemail/types.js +0 -7
- package/dist/Voicemail/types.js.map +0 -1
- package/dist/Voicemail/voicemailFixture.js +0 -524
- package/dist/Voicemail/voicemailFixture.js.map +0 -1
- package/dist/api.js +0 -157
- package/dist/api.js.map +0 -1
- package/dist/common/Utils.js +0 -1451
- package/dist/common/Utils.js.map +0 -1
- package/dist/common/Utils.test.js +0 -1744
- package/dist/common/Utils.test.js.map +0 -1
- package/dist/common/constants.js +0 -60
- package/dist/common/constants.js.map +0 -1
- package/dist/common/index.js +0 -19
- package/dist/common/index.js.map +0 -1
- package/dist/common/testUtil.js +0 -982
- package/dist/common/testUtil.js.map +0 -1
- package/dist/common/types.js +0 -75
- package/dist/common/types.js.map +0 -1
- package/dist/index.js +0 -321
- package/dist/index.js.map +0 -1
|
@@ -23,12 +23,15 @@ export class CallHistory extends Eventing {
|
|
|
23
23
|
SDKConnector.setWebex(webex);
|
|
24
24
|
}
|
|
25
25
|
this.webex = this.sdkConnector.getWebex();
|
|
26
|
-
this.janusUrl =
|
|
26
|
+
this.janusUrl =
|
|
27
|
+
this.webex.internal.services._serviceUrls?.janus ||
|
|
28
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.janus);
|
|
27
29
|
this.registerSessionsListener();
|
|
28
30
|
log.setLogger(logger.level, CALL_HISTORY_FILE);
|
|
29
31
|
}
|
|
30
32
|
async getCallHistoryData(days = NUMBER_OF_DAYS, limit = LIMIT, sort = SORT.DEFAULT, sortBy = SORT_BY.DEFAULT) {
|
|
31
33
|
const date = new Date();
|
|
34
|
+
const callingBackend = getCallingBackEnd(this.webex);
|
|
32
35
|
date.setDate(date.getDate() - days);
|
|
33
36
|
this.fromDate = date.toISOString();
|
|
34
37
|
const sortByParam = Object.values(SORT_BY).includes(sortBy) ? sortBy : SORT_BY.DEFAULT;
|
|
@@ -36,7 +39,9 @@ export class CallHistory extends Eventing {
|
|
|
36
39
|
log.info(`${METHOD_START_MESSAGE} with days=${days}, limit=${limit}, sort=${sortParam}, sortBy=${sortByParam}`, this.loggerContext);
|
|
37
40
|
log.info(`Janus API URL: ${this.janusUrl}`, this.loggerContext);
|
|
38
41
|
log.info(`Call history from date : ${this.fromDate}`, this.loggerContext);
|
|
39
|
-
const
|
|
42
|
+
const sharedSessionsParam = callingBackend === CALLING_BACKEND.WXC ? '&includeSharedSessions=true' : '';
|
|
43
|
+
log.info(`Fetching call history for ${callingBackend} backend${callingBackend === CALLING_BACKEND.WXC ? ' with shared sessions' : ''}`, this.loggerContext);
|
|
44
|
+
const url = `${this.janusUrl}/${HISTORY}/${USER_SESSIONS}${FROM_DATE}=${this.fromDate}&limit=${limit}&includeNewSessionTypes=true&sort=${sortParam}${sharedSessionsParam}`;
|
|
40
45
|
try {
|
|
41
46
|
const janusResponse = await this.webex.request({
|
|
42
47
|
uri: `${url}`,
|
|
@@ -55,7 +60,6 @@ export class CallHistory extends Eventing {
|
|
|
55
60
|
new Date(compareElement[sortByParam]).getTime());
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
|
-
const callingBackend = getCallingBackEnd(this.webex);
|
|
59
63
|
if (callingBackend === CALLING_BACKEND.UCM) {
|
|
60
64
|
if (this.userSessions[USER_SESSIONS] && this.userSessions[USER_SESSIONS].length > 0) {
|
|
61
65
|
const hasCucmDN = this.userSessions[USER_SESSIONS].some((session) => session.self.cucmDN && session.self.cucmDN.length > 0);
|
|
@@ -90,8 +94,10 @@ export class CallHistory extends Eventing {
|
|
|
90
94
|
return responseDetails;
|
|
91
95
|
}
|
|
92
96
|
catch (err) {
|
|
93
|
-
|
|
94
|
-
|
|
97
|
+
log.error(`Failed to get call history: ${JSON.stringify(err)}`, {
|
|
98
|
+
file: CALL_HISTORY_FILE,
|
|
99
|
+
method: METHODS.GET_CALL_HISTORY_DATA,
|
|
100
|
+
});
|
|
95
101
|
await uploadLogs();
|
|
96
102
|
const errorInfo = err;
|
|
97
103
|
const errorStatus = serviceErrorCodeHandler(errorInfo, this.loggerContext);
|
|
@@ -138,8 +144,10 @@ export class CallHistory extends Eventing {
|
|
|
138
144
|
return responseDetails;
|
|
139
145
|
}
|
|
140
146
|
catch (err) {
|
|
141
|
-
|
|
142
|
-
|
|
147
|
+
log.error(`Failed to update missed calls: ${JSON.stringify(err)}`, {
|
|
148
|
+
file: CALL_HISTORY_FILE,
|
|
149
|
+
method: METHODS.UPDATE_MISSED_CALLS,
|
|
150
|
+
});
|
|
143
151
|
await uploadLogs();
|
|
144
152
|
const errorInfo = {
|
|
145
153
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
@@ -175,8 +183,10 @@ export class CallHistory extends Eventing {
|
|
|
175
183
|
return ucmLineDetails;
|
|
176
184
|
}
|
|
177
185
|
catch (err) {
|
|
178
|
-
|
|
179
|
-
|
|
186
|
+
log.error(`Failed to fetch UCM lines data: ${JSON.stringify(err)}`, {
|
|
187
|
+
file: CALL_HISTORY_FILE,
|
|
188
|
+
method: METHODS.FETCH_UCM_LINES_DATA,
|
|
189
|
+
});
|
|
180
190
|
await uploadLogs();
|
|
181
191
|
const errorInfo = err;
|
|
182
192
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -234,8 +244,7 @@ export class CallHistory extends Eventing {
|
|
|
234
244
|
return responseDetails;
|
|
235
245
|
}
|
|
236
246
|
catch (err) {
|
|
237
|
-
|
|
238
|
-
log.error(extendedError, {
|
|
247
|
+
log.error(`Failed to delete call history records: ${JSON.stringify(err)}`, {
|
|
239
248
|
file: CALL_HISTORY_FILE,
|
|
240
249
|
method: METHODS.DELETE_CALL_HISTORY_RECORDS,
|
|
241
250
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import log from '../Logger';
|
|
2
2
|
import SDKConnector from '../SDKConnector';
|
|
3
3
|
import { serviceErrorCodeHandler, uploadLogs } from '../common/Utils';
|
|
4
|
-
import { FAILURE_MESSAGE, METHOD_START_MESSAGE, STATUS_CODE, SUCCESS_MESSAGE, UCM_CONNECTOR_FILE, VOICEMAIL, WEBEX_API_CONFIG_INT_URL, WEBEX_API_CONFIG_PROD_URL, } from '../common/constants';
|
|
4
|
+
import { FAILURE_MESSAGE, METHOD_START_MESSAGE, STATUS_CODE, SUCCESS_MESSAGE, UCM_CONNECTOR_FILE, VOICEMAIL, WEBEX_API_CONFIG_INT_URL, WEBEX_API_CONFIG_PROD_URL, WEBEX_API_CONFIG_FEDRAMP_URL, } from '../common/constants';
|
|
5
5
|
import { HTTP_METHODS } from '../common/types';
|
|
6
6
|
import { CF_ENDPOINT, METHODS, ORG_ENDPOINT, PEOPLE_ENDPOINT } from './constants';
|
|
7
7
|
export class UcmBackendConnector {
|
|
@@ -92,15 +92,22 @@ export class UcmBackendConnector {
|
|
|
92
92
|
method: METHODS.GET_CALL_FORWARD_ALWAYS_SETTING,
|
|
93
93
|
};
|
|
94
94
|
log.info(directoryNumber ? `${METHOD_START_MESSAGE} with ${directoryNumber}` : METHOD_START_MESSAGE, loggerContext);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const headers = await this.getAuthHeaders();
|
|
96
|
+
let webexApisUrl;
|
|
97
|
+
if (this.webex?.config?.fedramp) {
|
|
98
|
+
webexApisUrl = WEBEX_API_CONFIG_FEDRAMP_URL;
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
webexApisUrl = this.useProdWebexApis ? WEBEX_API_CONFIG_PROD_URL : WEBEX_API_CONFIG_INT_URL;
|
|
102
|
+
}
|
|
98
103
|
try {
|
|
99
104
|
if (directoryNumber) {
|
|
100
|
-
const
|
|
105
|
+
const requestOptions = {
|
|
101
106
|
uri: `${webexApisUrl}/${PEOPLE_ENDPOINT}/${this.userId}/${CF_ENDPOINT.toLowerCase()}?${ORG_ENDPOINT}=${this.orgId}`,
|
|
102
107
|
method: HTTP_METHODS.GET,
|
|
103
|
-
|
|
108
|
+
headers,
|
|
109
|
+
};
|
|
110
|
+
const resp = await this.webex.request(requestOptions);
|
|
104
111
|
log.log(`Response code: ${resp.statusCode}`, loggerContext);
|
|
105
112
|
const { callForwarding } = resp.body;
|
|
106
113
|
const cfa = callForwarding.always.find((item) => item.dn.endsWith(directoryNumber) || item.e164Number.endsWith(directoryNumber));
|
|
@@ -138,11 +145,17 @@ export class UcmBackendConnector {
|
|
|
138
145
|
}
|
|
139
146
|
catch (err) {
|
|
140
147
|
const errorInfo = err;
|
|
141
|
-
|
|
142
|
-
log.error(extendedError, loggerContext);
|
|
148
|
+
log.error(`Failed to get call forward always setting: ${JSON.stringify(err)}`, loggerContext);
|
|
143
149
|
await uploadLogs();
|
|
144
150
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
145
151
|
return errorStatus;
|
|
146
152
|
}
|
|
147
153
|
}
|
|
154
|
+
async getAuthHeaders() {
|
|
155
|
+
const headers = {};
|
|
156
|
+
if (this.webex?.config?.fedramp) {
|
|
157
|
+
headers.authorization = await this.webex.credentials.getUserToken();
|
|
158
|
+
}
|
|
159
|
+
return headers;
|
|
160
|
+
}
|
|
148
161
|
}
|
|
@@ -19,7 +19,9 @@ export class WxCallBackendConnector {
|
|
|
19
19
|
SDKConnector.setWebex(webex);
|
|
20
20
|
}
|
|
21
21
|
this.webex = this.sdkConnector.getWebex();
|
|
22
|
-
this.hydraEndpoint =
|
|
22
|
+
this.hydraEndpoint =
|
|
23
|
+
this.webex.internal.services._serviceUrls?.hydra ||
|
|
24
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.hydra);
|
|
23
25
|
log.setLogger(logger.level, WEBEX_CALLING_CONNECTOR_FILE);
|
|
24
26
|
this.userId = this.webex.internal.device.userId;
|
|
25
27
|
this.personId = inferIdFromUuid(this.webex.internal.device.userId, DecodeType.PEOPLE);
|
|
@@ -66,8 +68,7 @@ export class WxCallBackendConnector {
|
|
|
66
68
|
return responseDetails;
|
|
67
69
|
}
|
|
68
70
|
catch (err) {
|
|
69
|
-
|
|
70
|
-
log.error(extendedError, loggerContext);
|
|
71
|
+
log.error(`Failed to get call waiting setting: ${JSON.stringify(err)}`, loggerContext);
|
|
71
72
|
await uploadLogs();
|
|
72
73
|
const errorInfo = {
|
|
73
74
|
statusCode: err instanceof Error ? Number(err.message) : '',
|
|
@@ -100,8 +101,7 @@ export class WxCallBackendConnector {
|
|
|
100
101
|
return responseDetails;
|
|
101
102
|
}
|
|
102
103
|
catch (err) {
|
|
103
|
-
|
|
104
|
-
log.error(extendedError, loggerContext);
|
|
104
|
+
log.error(`Failed to get DoNotDisturb setting: ${JSON.stringify(err)}`, loggerContext);
|
|
105
105
|
await uploadLogs();
|
|
106
106
|
const errorInfo = err;
|
|
107
107
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -136,8 +136,7 @@ export class WxCallBackendConnector {
|
|
|
136
136
|
return responseDetails;
|
|
137
137
|
}
|
|
138
138
|
catch (err) {
|
|
139
|
-
|
|
140
|
-
log.error(extendedError, loggerContext);
|
|
139
|
+
log.error(`Failed to set DoNotDisturb setting: ${JSON.stringify(err)}`, loggerContext);
|
|
141
140
|
await uploadLogs();
|
|
142
141
|
const errorInfo = err;
|
|
143
142
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -168,8 +167,7 @@ export class WxCallBackendConnector {
|
|
|
168
167
|
return responseDetails;
|
|
169
168
|
}
|
|
170
169
|
catch (err) {
|
|
171
|
-
|
|
172
|
-
log.error(extendedError, loggerContext);
|
|
170
|
+
log.error(`Failed to get Call Forward setting: ${JSON.stringify(err)}`, loggerContext);
|
|
173
171
|
await uploadLogs();
|
|
174
172
|
const errorInfo = err;
|
|
175
173
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -200,8 +198,7 @@ export class WxCallBackendConnector {
|
|
|
200
198
|
return responseDetails;
|
|
201
199
|
}
|
|
202
200
|
catch (err) {
|
|
203
|
-
|
|
204
|
-
log.error(extendedError, loggerContext);
|
|
201
|
+
log.error(`Failed to set Call Forward setting: ${JSON.stringify(err)}`, loggerContext);
|
|
205
202
|
await uploadLogs();
|
|
206
203
|
const errorInfo = err;
|
|
207
204
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -232,8 +229,7 @@ export class WxCallBackendConnector {
|
|
|
232
229
|
return responseDetails;
|
|
233
230
|
}
|
|
234
231
|
catch (err) {
|
|
235
|
-
|
|
236
|
-
log.error(extendedError, loggerContext);
|
|
232
|
+
log.error(`Failed to get Voicemail setting: ${JSON.stringify(err)}`, loggerContext);
|
|
237
233
|
await uploadLogs();
|
|
238
234
|
const errorInfo = err;
|
|
239
235
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -264,8 +260,7 @@ export class WxCallBackendConnector {
|
|
|
264
260
|
return responseDetails;
|
|
265
261
|
}
|
|
266
262
|
catch (err) {
|
|
267
|
-
|
|
268
|
-
log.error(extendedError, loggerContext);
|
|
263
|
+
log.error(`Failed to set Voicemail setting: ${JSON.stringify(err)}`, loggerContext);
|
|
269
264
|
await uploadLogs();
|
|
270
265
|
const errorInfo = err;
|
|
271
266
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
@@ -9,7 +9,7 @@ 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,
|
|
12
|
+
import { CALLING_CLIENT_FILE, CALLS_CLEARED_HANDLER_UTIL, CALLING_USER_AGENT, CISCO_DEVICE_URL, DISCOVERY_URL, GET_MOBIUS_SERVERS_UTIL, SPARK_USER_AGENT, URL_ENDPOINT, API_V1, METHODS, NETWORK_FLAP_TIMEOUT, } from './constants';
|
|
13
13
|
import Line from './line';
|
|
14
14
|
import { METRIC_EVENT, REG_ACTION, METRIC_TYPE, CONNECTION_ACTION, MOBIUS_SERVER_ACTION, } from '../Metrics/types';
|
|
15
15
|
import { getMetricManager } from '../Metrics';
|
|
@@ -65,28 +65,7 @@ export class CallingClient extends Eventing {
|
|
|
65
65
|
this.mediaEngine.setLogger(adaptedLogger);
|
|
66
66
|
this.primaryMobiusUris = [];
|
|
67
67
|
this.backupMobiusUris = [];
|
|
68
|
-
|
|
69
|
-
try {
|
|
70
|
-
mobiusServiceHost = new URL(this.webex.internal.services._serviceUrls.mobius).host;
|
|
71
|
-
}
|
|
72
|
-
catch (error) {
|
|
73
|
-
log.warn(`Failed to parse mobius service URL`, {
|
|
74
|
-
file: CALLING_CLIENT_FILE,
|
|
75
|
-
method: this.constructor.name,
|
|
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
|
-
}
|
|
68
|
+
this.mobiusClusters = this.webex.internal.services.getMobiusClusters();
|
|
90
69
|
this.mobiusHost = '';
|
|
91
70
|
this.registerSessionsListener();
|
|
92
71
|
this.registerCallsClearedListener();
|
|
@@ -237,68 +216,38 @@ export class CallingClient extends Eventing {
|
|
|
237
216
|
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
238
217
|
});
|
|
239
218
|
const regionInfo = {};
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
273
|
-
});
|
|
274
|
-
const clientRegionInfo = response.body;
|
|
275
|
-
regionInfo.clientRegion = clientRegionInfo?.clientRegion
|
|
276
|
-
? clientRegionInfo.clientRegion
|
|
277
|
-
: '';
|
|
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 ?? '');
|
|
284
|
-
break;
|
|
285
|
-
}
|
|
286
|
-
catch (err) {
|
|
287
|
-
const extendedError = new Error(`Failed to get client region info: ${err}`);
|
|
288
|
-
log.error(extendedError, {
|
|
289
|
-
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
290
|
-
file: CALLING_CLIENT_FILE,
|
|
291
|
-
});
|
|
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);
|
|
294
|
-
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
295
|
-
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
296
|
-
regionInfo.clientRegion = '';
|
|
297
|
-
regionInfo.countryCode = '';
|
|
298
|
-
if (abort) {
|
|
299
|
-
await uploadLogs();
|
|
300
|
-
return regionInfo;
|
|
301
|
-
}
|
|
219
|
+
try {
|
|
220
|
+
const response = await this.webex.request({
|
|
221
|
+
uri: `${DISCOVERY_URL}`,
|
|
222
|
+
method: HTTP_METHODS.GET,
|
|
223
|
+
addAuthHeader: false,
|
|
224
|
+
headers: {
|
|
225
|
+
[SPARK_USER_AGENT]: null,
|
|
226
|
+
},
|
|
227
|
+
});
|
|
228
|
+
const clientRegionInfo = response.body;
|
|
229
|
+
regionInfo.clientRegion = clientRegionInfo?.clientRegion || '';
|
|
230
|
+
regionInfo.countryCode = clientRegionInfo?.countryCode || '';
|
|
231
|
+
log.log(`Successfully fetched Client region info: ${regionInfo.clientRegion}, countryCode: ${regionInfo.countryCode}, and response trackingid: ${response?.headers?.trackingid}`, {
|
|
232
|
+
file: CALLING_CLIENT_FILE,
|
|
233
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
234
|
+
});
|
|
235
|
+
this.metricManager.submitRegionInfoMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.REGION_INFO, METRIC_TYPE.BEHAVIORAL, this.mobiusHost, clientRegionInfo.clientRegion, clientRegionInfo.countryCode, response?.headers?.trackingid ?? '');
|
|
236
|
+
}
|
|
237
|
+
catch (err) {
|
|
238
|
+
log.error(`Failed to get client region info: ${JSON.stringify(err)}`, {
|
|
239
|
+
method: METHODS.GET_CLIENT_REGION_INFO,
|
|
240
|
+
file: CALLING_CLIENT_FILE,
|
|
241
|
+
});
|
|
242
|
+
abort = await handleCallingClientErrors(err, (clientError) => {
|
|
243
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
244
|
+
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
245
|
+
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
246
|
+
regionInfo.clientRegion = '';
|
|
247
|
+
regionInfo.countryCode = '';
|
|
248
|
+
if (abort) {
|
|
249
|
+
await uploadLogs();
|
|
250
|
+
return regionInfo;
|
|
302
251
|
}
|
|
303
252
|
}
|
|
304
253
|
return regionInfo;
|
|
@@ -318,7 +267,9 @@ export class CallingClient extends Eventing {
|
|
|
318
267
|
});
|
|
319
268
|
clientRegion = this.sdkConfig?.discovery?.region;
|
|
320
269
|
countryCode = this.sdkConfig?.discovery?.country;
|
|
321
|
-
this.mobiusHost =
|
|
270
|
+
this.mobiusHost =
|
|
271
|
+
this.webex.internal.services._serviceUrls?.mobius ||
|
|
272
|
+
this.webex.internal.services.get(this.webex.internal.services._activeServices.mobius);
|
|
322
273
|
}
|
|
323
274
|
else {
|
|
324
275
|
log.log('Updating region and country through Region discovery', {
|
|
@@ -334,44 +285,53 @@ export class CallingClient extends Eventing {
|
|
|
334
285
|
file: CALLING_CLIENT_FILE,
|
|
335
286
|
method: GET_MOBIUS_SERVERS_UTIL,
|
|
336
287
|
});
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
288
|
+
for (const mobius of this.mobiusClusters) {
|
|
289
|
+
if (mobius.host) {
|
|
290
|
+
this.mobiusHost = `https://${mobius.host}${API_V1}`;
|
|
291
|
+
}
|
|
292
|
+
else {
|
|
293
|
+
this.mobiusHost = mobius;
|
|
294
|
+
}
|
|
295
|
+
try {
|
|
296
|
+
const response = await this.webex.request({
|
|
297
|
+
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
298
|
+
method: HTTP_METHODS.GET,
|
|
299
|
+
headers: {
|
|
300
|
+
[CISCO_DEVICE_URL]: this.webex.internal.device.url,
|
|
301
|
+
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
302
|
+
},
|
|
303
|
+
service: ALLOWED_SERVICES.MOBIUS,
|
|
304
|
+
});
|
|
305
|
+
log.log(`Mobius Server found for the region. Response trackingId: ${response?.headers?.trackingid}`, {
|
|
306
|
+
file: CALLING_CLIENT_FILE,
|
|
307
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
308
|
+
});
|
|
309
|
+
const mobiusServers = response.body;
|
|
310
|
+
this.metricManager.submitMobiusServersMetric(METRIC_EVENT.MOBIUS_DISCOVERY, MOBIUS_SERVER_ACTION.MOBIUS_SERVERS, METRIC_TYPE.BEHAVIORAL, mobiusServers, response?.headers?.trackingid ?? '');
|
|
311
|
+
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
312
|
+
this.primaryMobiusUris = mobiusUris.primary;
|
|
313
|
+
this.backupMobiusUris = mobiusUris.backup;
|
|
314
|
+
log.log(`Final list of Mobius Servers, primary: ${mobiusUris.primary} and backup: ${mobiusUris.backup}`, {
|
|
315
|
+
file: CALLING_CLIENT_FILE,
|
|
316
|
+
method: GET_MOBIUS_SERVERS_UTIL,
|
|
317
|
+
});
|
|
318
|
+
break;
|
|
319
|
+
}
|
|
320
|
+
catch (err) {
|
|
321
|
+
log.error(`Failed to get Mobius servers: ${JSON.stringify(err)}`, {
|
|
322
|
+
method: METHODS.GET_MOBIUS_SERVERS,
|
|
323
|
+
file: CALLING_CLIENT_FILE,
|
|
324
|
+
});
|
|
325
|
+
const abort = await handleCallingClientErrors(err, (clientError) => {
|
|
326
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, GET_MOBIUS_SERVERS_UTIL, 'UNKNOWN', err.headers?.trackingId ?? '', undefined, clientError);
|
|
327
|
+
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
328
|
+
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
329
|
+
if (abort) {
|
|
330
|
+
useDefault = true;
|
|
331
|
+
await uploadLogs();
|
|
332
|
+
break;
|
|
333
|
+
}
|
|
373
334
|
}
|
|
374
|
-
useDefault = true;
|
|
375
335
|
}
|
|
376
336
|
}
|
|
377
337
|
else {
|