@webex/calling 3.8.0-next.32 → 3.8.0-next.33
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 +100 -63
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/CallHistory.test.js +115 -19
- package/dist/CallHistory/CallHistory.test.js.map +1 -1
- package/dist/CallHistory/constants.js +9 -1
- package/dist/CallHistory/constants.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +46 -13
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.js +62 -18
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +70 -7
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.js +153 -103
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +52 -15
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -1
- package/dist/CallSettings/constants.js +15 -1
- package/dist/CallSettings/constants.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +148 -107
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +53 -24
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +251 -189
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +96 -41
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +73 -48
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +96 -37
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/constants.js +101 -1
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +47 -18
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/registration/register.js +151 -115
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +43 -21
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +156 -102
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/ContactsClient.test.js +197 -49
- package/dist/Contacts/ContactsClient.test.js.map +1 -1
- package/dist/Contacts/constants.js +11 -1
- package/dist/Contacts/constants.js.map +1 -1
- package/dist/Events/impl/index.js +1 -1
- package/dist/Events/impl/index.js.map +1 -1
- package/dist/Metrics/index.js +93 -39
- package/dist/Metrics/index.js.map +1 -1
- package/dist/Metrics/types.js +4 -1
- package/dist/Metrics/types.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +154 -91
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +99 -19
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.js +105 -54
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +127 -17
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +198 -79
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/Voicemail.test.js +188 -23
- package/dist/Voicemail/Voicemail.test.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +123 -76
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +69 -6
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -1
- package/dist/Voicemail/constants.js +25 -1
- package/dist/Voicemail/constants.js.map +1 -1
- package/dist/common/Utils.js +113 -64
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +154 -21
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/constants.js +2 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/types.js.map +1 -1
- package/dist/module/CallHistory/CallHistory.js +32 -13
- package/dist/module/CallHistory/constants.js +6 -0
- package/dist/module/CallSettings/CallSettings.js +36 -3
- package/dist/module/CallSettings/UcmBackendConnector.js +50 -5
- package/dist/module/CallSettings/WxCallBackendConnector.js +54 -18
- package/dist/module/CallSettings/constants.js +12 -0
- package/dist/module/CallingClient/CallingClient.js +52 -14
- package/dist/module/CallingClient/calling/call.js +172 -121
- package/dist/module/CallingClient/calling/callManager.js +51 -26
- package/dist/module/CallingClient/constants.js +98 -0
- package/dist/module/CallingClient/line/index.js +37 -8
- package/dist/module/CallingClient/registration/register.js +37 -11
- package/dist/module/Contacts/ContactsClient.js +65 -21
- package/dist/module/Contacts/constants.js +10 -0
- package/dist/module/Events/impl/index.js +1 -1
- package/dist/module/Metrics/index.js +49 -1
- package/dist/module/Metrics/types.js +3 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +66 -17
- package/dist/module/Voicemail/UcmBackendConnector.js +51 -11
- package/dist/module/Voicemail/Voicemail.js +109 -9
- package/dist/module/Voicemail/WxCallBackendConnector.js +50 -17
- package/dist/module/Voicemail/constants.js +21 -0
- package/dist/module/common/Utils.js +26 -4
- package/dist/module/common/constants.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/constants.d.ts +6 -0
- package/dist/types/CallHistory/constants.d.ts.map +1 -1
- package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -1
- package/dist/types/CallSettings/constants.d.ts +12 -0
- package/dist/types/CallSettings/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -3
- 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/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +98 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/constants.d.ts +10 -0
- package/dist/types/Contacts/constants.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +5 -1
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +8 -2
- 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 +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/Voicemail/constants.d.ts +21 -0
- package/dist/types/Voicemail/constants.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +2 -2
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/constants.d.ts +1 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +12 -0
- package/dist/types/common/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import SDKConnector from '../SDKConnector';
|
|
2
2
|
import { HTTP_METHODS, CALLING_BACKEND, } from '../common/types';
|
|
3
|
-
import { getVgActionEndpoint, serviceErrorCodeHandler } from '../common/Utils';
|
|
4
|
-
import { SUCCESS_MESSAGE, USERS, CONTENT, UCM_CONNECTOR_FILE, FAILURE_MESSAGE, } from '../common/constants';
|
|
3
|
+
import { getVgActionEndpoint, serviceErrorCodeHandler, uploadLogs } from '../common/Utils';
|
|
4
|
+
import { SUCCESS_MESSAGE, USERS, CONTENT, UCM_CONNECTOR_FILE, FAILURE_MESSAGE, METHOD_START_MESSAGE, } from '../common/constants';
|
|
5
5
|
import log from '../Logger';
|
|
6
|
-
import { API_V1, LIMIT, OFFSET, SORT_ORDER, VMGATEWAY, VOICEMAILS } from './constants';
|
|
6
|
+
import { API_V1, LIMIT, METHODS, OFFSET, SORT_ORDER, VMGATEWAY, VOICEMAILS } from './constants';
|
|
7
7
|
export class UcmBackendConnector {
|
|
8
8
|
vgEndpoint;
|
|
9
9
|
userId;
|
|
@@ -24,16 +24,22 @@ export class UcmBackendConnector {
|
|
|
24
24
|
init() {
|
|
25
25
|
const loggerContext = {
|
|
26
26
|
file: UCM_CONNECTOR_FILE,
|
|
27
|
-
method:
|
|
27
|
+
method: METHODS.INIT,
|
|
28
28
|
};
|
|
29
|
-
log.info(
|
|
29
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
30
30
|
const response = this.setUcmVoiceMessageBaseURI();
|
|
31
|
+
log.log('UCM calling voicemail connector initialized successfully', loggerContext);
|
|
31
32
|
return response;
|
|
32
33
|
}
|
|
33
34
|
getSDKConnector() {
|
|
34
35
|
return this.sdkConnector;
|
|
35
36
|
}
|
|
36
37
|
setUcmVoiceMessageBaseURI() {
|
|
38
|
+
const loggerContext = {
|
|
39
|
+
file: UCM_CONNECTOR_FILE,
|
|
40
|
+
method: METHODS.SET_UCM_VOICE_MESSAGE_BASE_URI,
|
|
41
|
+
};
|
|
42
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
37
43
|
this.vgEndpoint = getVgActionEndpoint(this.webex, CALLING_BACKEND.UCM);
|
|
38
44
|
this.vgVoiceMessageURI = `${this.vgEndpoint}/${VMGATEWAY}/${API_V1}/${USERS}/${this.userId}/`;
|
|
39
45
|
return this.vgVoiceMessageURI;
|
|
@@ -41,9 +47,9 @@ export class UcmBackendConnector {
|
|
|
41
47
|
async getVoicemailList(offset, offsetLimit, sort) {
|
|
42
48
|
const loggerContext = {
|
|
43
49
|
file: UCM_CONNECTOR_FILE,
|
|
44
|
-
method:
|
|
50
|
+
method: METHODS.GET_VOICEMAIL_LIST,
|
|
45
51
|
};
|
|
46
|
-
log.info(
|
|
52
|
+
log.info(`${METHOD_START_MESSAGE} with Offset: ${offset} Offset limit: ${offsetLimit} Sort type:${sort}`, loggerContext);
|
|
47
53
|
const urlVg = `${this.vgVoiceMessageURI}${VOICEMAILS}/${OFFSET}=${offset}${LIMIT}=${offsetLimit}${SORT_ORDER}=${sort}`;
|
|
48
54
|
try {
|
|
49
55
|
const response = await this.webex.request({
|
|
@@ -91,9 +97,13 @@ export class UcmBackendConnector {
|
|
|
91
97
|
},
|
|
92
98
|
message: SUCCESS_MESSAGE,
|
|
93
99
|
};
|
|
100
|
+
log.log('Successfully retrieved voicemail list', loggerContext);
|
|
94
101
|
return responseDetails;
|
|
95
102
|
}
|
|
96
103
|
catch (err) {
|
|
104
|
+
const extendedError = new Error(`Failed to get voicemail list: ${err}`);
|
|
105
|
+
log.error(extendedError, loggerContext);
|
|
106
|
+
await uploadLogs();
|
|
97
107
|
const errorInfo = err;
|
|
98
108
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
99
109
|
return errorStatus;
|
|
@@ -102,13 +112,18 @@ export class UcmBackendConnector {
|
|
|
102
112
|
async getVoicemailContent(messageId) {
|
|
103
113
|
const loggerContext = {
|
|
104
114
|
file: UCM_CONNECTOR_FILE,
|
|
105
|
-
method:
|
|
115
|
+
method: METHODS.GET_VOICEMAIL_CONTENT,
|
|
106
116
|
};
|
|
117
|
+
log.info(`${METHOD_START_MESSAGE} with Message ID: ${messageId}`, loggerContext);
|
|
107
118
|
try {
|
|
108
119
|
const response = (await this.getVoicemailContentUcm(messageId));
|
|
120
|
+
log.log(`Successfully retrieved voicemail content with Message ID: ${messageId}`, loggerContext);
|
|
109
121
|
return response;
|
|
110
122
|
}
|
|
111
123
|
catch (err) {
|
|
124
|
+
const extendedError = new Error(`Failed to get voicemail content: ${err}`);
|
|
125
|
+
log.error(extendedError, loggerContext);
|
|
126
|
+
await uploadLogs();
|
|
112
127
|
const errorInfo = err;
|
|
113
128
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
114
129
|
log.info(`Voice mail content error is ${errorStatus}`, loggerContext);
|
|
@@ -119,6 +134,11 @@ export class UcmBackendConnector {
|
|
|
119
134
|
return Promise.resolve(null);
|
|
120
135
|
}
|
|
121
136
|
async getVoicemailContentUcm(messageId) {
|
|
137
|
+
const loggerContext = {
|
|
138
|
+
file: UCM_CONNECTOR_FILE,
|
|
139
|
+
method: METHODS.GET_VOICEMAIL_CONTENT_UCM,
|
|
140
|
+
};
|
|
141
|
+
log.info(`${METHOD_START_MESSAGE} with Message ID: ${messageId}`, loggerContext);
|
|
122
142
|
return new Promise((resolve, reject) => {
|
|
123
143
|
const voicemailContentUrl = `${this.vgVoiceMessageURI}${VOICEMAILS}/${messageId}/${CONTENT}`;
|
|
124
144
|
const mercuryApi = `${this.webex.internal.services._serviceUrls.mercuryApi}`;
|
|
@@ -152,6 +172,11 @@ export class UcmBackendConnector {
|
|
|
152
172
|
});
|
|
153
173
|
}
|
|
154
174
|
async returnUcmPromise(voicemailContentUrl, mercuryApi) {
|
|
175
|
+
const loggerContext = {
|
|
176
|
+
file: UCM_CONNECTOR_FILE,
|
|
177
|
+
method: METHODS.RETURN_UCM_PROMISE,
|
|
178
|
+
};
|
|
179
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
155
180
|
const response = await this.webex.request({
|
|
156
181
|
uri: `${voicemailContentUrl}`,
|
|
157
182
|
method: HTTP_METHODS.GET,
|
|
@@ -184,8 +209,9 @@ export class UcmBackendConnector {
|
|
|
184
209
|
async voicemailMarkAsRead(messageId) {
|
|
185
210
|
const loggerContext = {
|
|
186
211
|
file: UCM_CONNECTOR_FILE,
|
|
187
|
-
method:
|
|
212
|
+
method: METHODS.VOICEMAIL_MARK_AS_READ,
|
|
188
213
|
};
|
|
214
|
+
log.info(`${METHOD_START_MESSAGE} with Message ID: ${messageId}`, loggerContext);
|
|
189
215
|
try {
|
|
190
216
|
const voicemailContentUrl = `${this.vgVoiceMessageURI}${VOICEMAILS}/${messageId}`;
|
|
191
217
|
const response = await this.webex.request({
|
|
@@ -203,9 +229,13 @@ export class UcmBackendConnector {
|
|
|
203
229
|
data: {},
|
|
204
230
|
message: SUCCESS_MESSAGE,
|
|
205
231
|
};
|
|
232
|
+
log.log('Successfully marked voicemail as read', loggerContext);
|
|
206
233
|
return responseDetails;
|
|
207
234
|
}
|
|
208
235
|
catch (err) {
|
|
236
|
+
const extendedError = new Error(`Failed to mark voicemail as read: ${err}`);
|
|
237
|
+
log.error(extendedError, loggerContext);
|
|
238
|
+
await uploadLogs();
|
|
209
239
|
const errorInfo = err;
|
|
210
240
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
211
241
|
return errorStatus;
|
|
@@ -214,8 +244,9 @@ export class UcmBackendConnector {
|
|
|
214
244
|
async voicemailMarkAsUnread(messageId) {
|
|
215
245
|
const loggerContext = {
|
|
216
246
|
file: UCM_CONNECTOR_FILE,
|
|
217
|
-
method:
|
|
247
|
+
method: METHODS.VOICEMAIL_MARK_AS_UNREAD,
|
|
218
248
|
};
|
|
249
|
+
log.info(`${METHOD_START_MESSAGE} with Message ID: ${messageId}`, loggerContext);
|
|
219
250
|
try {
|
|
220
251
|
const voicemailContentUrl = `${this.vgVoiceMessageURI}${VOICEMAILS}/${messageId}`;
|
|
221
252
|
const response = await this.webex.request({
|
|
@@ -233,9 +264,13 @@ export class UcmBackendConnector {
|
|
|
233
264
|
data: {},
|
|
234
265
|
message: SUCCESS_MESSAGE,
|
|
235
266
|
};
|
|
267
|
+
log.log('Successfully marked voicemail as unread', loggerContext);
|
|
236
268
|
return responseDetails;
|
|
237
269
|
}
|
|
238
270
|
catch (err) {
|
|
271
|
+
const extendedError = new Error(`Failed to mark voicemail as unread: ${err}`);
|
|
272
|
+
log.error(extendedError, loggerContext);
|
|
273
|
+
await uploadLogs();
|
|
239
274
|
const errorInfo = err;
|
|
240
275
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
241
276
|
return errorStatus;
|
|
@@ -244,8 +279,9 @@ export class UcmBackendConnector {
|
|
|
244
279
|
async deleteVoicemail(messageId) {
|
|
245
280
|
const loggerContext = {
|
|
246
281
|
file: UCM_CONNECTOR_FILE,
|
|
247
|
-
method:
|
|
282
|
+
method: METHODS.DELETE_VOICEMAIL,
|
|
248
283
|
};
|
|
284
|
+
log.info(`${METHOD_START_MESSAGE} with Message ID: ${messageId}`, loggerContext);
|
|
249
285
|
try {
|
|
250
286
|
const voicemailContentUrl = `${this.vgVoiceMessageURI}${VOICEMAILS}/${messageId}`;
|
|
251
287
|
const response = await this.webex.request({
|
|
@@ -260,9 +296,13 @@ export class UcmBackendConnector {
|
|
|
260
296
|
data: {},
|
|
261
297
|
message: SUCCESS_MESSAGE,
|
|
262
298
|
};
|
|
299
|
+
log.log('Successfully deleted voicemail', loggerContext);
|
|
263
300
|
return responseDetails;
|
|
264
301
|
}
|
|
265
302
|
catch (err) {
|
|
303
|
+
const extendedError = new Error(`Failed to delete voicemail: ${err}`);
|
|
304
|
+
log.error(extendedError, loggerContext);
|
|
305
|
+
await uploadLogs();
|
|
266
306
|
const errorInfo = err;
|
|
267
307
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
268
308
|
return errorStatus;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { METHOD_START_MESSAGE } from '../common/constants';
|
|
1
2
|
import SDKConnector from '../SDKConnector';
|
|
2
3
|
import { CALLING_BACKEND } from '../common/types';
|
|
3
4
|
import log from '../Logger';
|
|
4
|
-
import { getCallingBackEnd } from '../common/Utils';
|
|
5
|
+
import { getCallingBackEnd, uploadLogs } from '../common/Utils';
|
|
5
6
|
import { WxCallBackendConnector } from './WxCallBackendConnector';
|
|
6
7
|
import { BroadworksBackendConnector } from './BroadworksBackendConnector';
|
|
7
8
|
import { Eventing } from '../Events/impl';
|
|
8
9
|
import { UcmBackendConnector } from './UcmBackendConnector';
|
|
9
10
|
import { METRIC_EVENT, METRIC_TYPE, VOICEMAIL_ACTION } from '../Metrics/types';
|
|
10
11
|
import { getMetricManager } from '../Metrics';
|
|
11
|
-
import { VOICEMAIL_FILE } from './constants';
|
|
12
|
+
import { VOICEMAIL_FILE, METHODS } from './constants';
|
|
12
13
|
export class Voicemail extends Eventing {
|
|
13
14
|
logger;
|
|
14
15
|
sdkConnector;
|
|
@@ -29,11 +30,34 @@ export class Voicemail extends Eventing {
|
|
|
29
30
|
this.initializeBackendConnector();
|
|
30
31
|
log.setLogger(logger.level, VOICEMAIL_FILE);
|
|
31
32
|
}
|
|
32
|
-
init() {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
async init() {
|
|
34
|
+
try {
|
|
35
|
+
log.info(METHOD_START_MESSAGE, {
|
|
36
|
+
file: VOICEMAIL_FILE,
|
|
37
|
+
method: METHODS.INIT,
|
|
38
|
+
});
|
|
39
|
+
const response = this.backendConnector.init();
|
|
40
|
+
log.log('Voicemail connector initialized successfully', {
|
|
41
|
+
file: VOICEMAIL_FILE,
|
|
42
|
+
method: METHODS.INIT,
|
|
43
|
+
});
|
|
44
|
+
return response;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const extendedError = new Error(`Failed to initialize voicemail: ${err}`);
|
|
48
|
+
log.error(extendedError, {
|
|
49
|
+
file: VOICEMAIL_FILE,
|
|
50
|
+
method: METHODS.INIT,
|
|
51
|
+
});
|
|
52
|
+
await uploadLogs();
|
|
53
|
+
throw err;
|
|
54
|
+
}
|
|
35
55
|
}
|
|
36
56
|
initializeBackendConnector() {
|
|
57
|
+
log.info(METHOD_START_MESSAGE, {
|
|
58
|
+
file: VOICEMAIL_FILE,
|
|
59
|
+
method: METHODS.INITIALIZE_BACKEND_CONNECTOR,
|
|
60
|
+
});
|
|
37
61
|
switch (this.callingBackend) {
|
|
38
62
|
case CALLING_BACKEND.WXC: {
|
|
39
63
|
this.backendConnector = new WxCallBackendConnector(this.webex, this.logger);
|
|
@@ -62,46 +86,122 @@ export class Voicemail extends Eventing {
|
|
|
62
86
|
}
|
|
63
87
|
}
|
|
64
88
|
async getVoicemailList(offset, offsetLimit, sort, refresh) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
89
|
+
try {
|
|
90
|
+
log.info(`${METHOD_START_MESSAGE} with: offset=${offset}, limit=${offsetLimit}, sort=${sort}, refresh=${refresh}`, {
|
|
91
|
+
file: VOICEMAIL_FILE,
|
|
92
|
+
method: METHODS.GET_VOICEMAIL_LIST,
|
|
93
|
+
});
|
|
94
|
+
const response = await this.backendConnector.getVoicemailList(offset, offsetLimit, sort, refresh);
|
|
95
|
+
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAILS);
|
|
96
|
+
log.log(`Successfully retrieved voicemail list: statusCode=${response.statusCode}`, {
|
|
97
|
+
file: VOICEMAIL_FILE,
|
|
98
|
+
method: METHODS.GET_VOICEMAIL_LIST,
|
|
99
|
+
});
|
|
100
|
+
return response;
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
const extendedError = new Error(`Failed to get voicemail list: ${err}`);
|
|
104
|
+
log.error(extendedError, {
|
|
105
|
+
file: VOICEMAIL_FILE,
|
|
106
|
+
method: METHODS.GET_VOICEMAIL_LIST,
|
|
107
|
+
});
|
|
108
|
+
await uploadLogs();
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
68
111
|
}
|
|
69
112
|
async getVoicemailContent(messageId) {
|
|
113
|
+
log.info(`${METHOD_START_MESSAGE} with: messageId=${messageId}`, {
|
|
114
|
+
file: VOICEMAIL_FILE,
|
|
115
|
+
method: METHODS.GET_VOICEMAIL_CONTENT,
|
|
116
|
+
});
|
|
70
117
|
const response = await this.backendConnector.getVoicemailContent(messageId);
|
|
71
118
|
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAIL_CONTENT, messageId);
|
|
119
|
+
log.log(`Successfully retrieved voicemail content for messageId=${messageId}, statusCode=${response.statusCode}`, {
|
|
120
|
+
file: VOICEMAIL_FILE,
|
|
121
|
+
method: METHODS.GET_VOICEMAIL_CONTENT,
|
|
122
|
+
});
|
|
72
123
|
return response;
|
|
73
124
|
}
|
|
74
125
|
async getVoicemailSummary() {
|
|
126
|
+
log.info(METHOD_START_MESSAGE, {
|
|
127
|
+
file: VOICEMAIL_FILE,
|
|
128
|
+
method: METHODS.GET_VOICEMAIL_SUMMARY,
|
|
129
|
+
});
|
|
75
130
|
const response = await this.backendConnector.getVoicemailSummary();
|
|
76
131
|
if (response !== null) {
|
|
77
132
|
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAIL_SUMMARY);
|
|
133
|
+
log.log(`Successfully retrieved voicemail summary: statusCode=${response.statusCode}`, {
|
|
134
|
+
file: VOICEMAIL_FILE,
|
|
135
|
+
method: METHODS.GET_VOICEMAIL_SUMMARY,
|
|
136
|
+
});
|
|
78
137
|
}
|
|
79
138
|
return response;
|
|
80
139
|
}
|
|
81
140
|
async voicemailMarkAsRead(messageId) {
|
|
141
|
+
log.info(`${METHOD_START_MESSAGE} with: messageId=${messageId}`, {
|
|
142
|
+
file: VOICEMAIL_FILE,
|
|
143
|
+
method: METHODS.VOICEMAIL_MARK_AS_READ,
|
|
144
|
+
});
|
|
82
145
|
const response = await this.backendConnector.voicemailMarkAsRead(messageId);
|
|
83
146
|
this.submitMetric(response, VOICEMAIL_ACTION.MARK_READ, messageId);
|
|
147
|
+
log.log(`Successfully marked voicemail as read: messageId=${messageId}, statusCode=${response.statusCode}`, {
|
|
148
|
+
file: VOICEMAIL_FILE,
|
|
149
|
+
method: METHODS.VOICEMAIL_MARK_AS_READ,
|
|
150
|
+
});
|
|
84
151
|
return response;
|
|
85
152
|
}
|
|
86
153
|
async voicemailMarkAsUnread(messageId) {
|
|
154
|
+
log.info(`${METHOD_START_MESSAGE} with: messageId=${messageId}`, {
|
|
155
|
+
file: VOICEMAIL_FILE,
|
|
156
|
+
method: METHODS.VOICEMAIL_MARK_AS_UNREAD,
|
|
157
|
+
});
|
|
87
158
|
const response = await this.backendConnector.voicemailMarkAsUnread(messageId);
|
|
88
159
|
this.submitMetric(response, VOICEMAIL_ACTION.MARK_UNREAD, messageId);
|
|
160
|
+
log.log(`Successfully marked voicemail as unread: messageId=${messageId}, statusCode=${response.statusCode}`, {
|
|
161
|
+
file: VOICEMAIL_FILE,
|
|
162
|
+
method: METHODS.VOICEMAIL_MARK_AS_UNREAD,
|
|
163
|
+
});
|
|
89
164
|
return response;
|
|
90
165
|
}
|
|
91
166
|
async deleteVoicemail(messageId) {
|
|
167
|
+
log.info(`${METHOD_START_MESSAGE} with: messageId=${messageId}`, {
|
|
168
|
+
file: VOICEMAIL_FILE,
|
|
169
|
+
method: METHODS.DELETE_VOICEMAIL,
|
|
170
|
+
});
|
|
92
171
|
const response = await this.backendConnector.deleteVoicemail(messageId);
|
|
93
172
|
this.submitMetric(response, VOICEMAIL_ACTION.DELETE, messageId);
|
|
173
|
+
log.log(`Successfully deleted voicemail: messageId=${messageId}, statusCode=${response.statusCode}`, {
|
|
174
|
+
file: VOICEMAIL_FILE,
|
|
175
|
+
method: METHODS.DELETE_VOICEMAIL,
|
|
176
|
+
});
|
|
94
177
|
return response;
|
|
95
178
|
}
|
|
96
179
|
async getVMTranscript(messageId) {
|
|
180
|
+
log.info(`${METHOD_START_MESSAGE} with: messageId=${messageId}`, {
|
|
181
|
+
file: VOICEMAIL_FILE,
|
|
182
|
+
method: METHODS.GET_VM_TRANSCRIPT,
|
|
183
|
+
});
|
|
97
184
|
const response = await this.backendConnector.getVMTranscript(messageId);
|
|
98
185
|
if (response !== null) {
|
|
99
186
|
this.submitMetric(response, VOICEMAIL_ACTION.TRANSCRIPT, messageId);
|
|
187
|
+
log.log(`Successfully retrieved voicemail transcript: messageId=${messageId}, statusCode=${response.statusCode}`, {
|
|
188
|
+
file: VOICEMAIL_FILE,
|
|
189
|
+
method: METHODS.GET_VM_TRANSCRIPT,
|
|
190
|
+
});
|
|
100
191
|
}
|
|
101
192
|
return response;
|
|
102
193
|
}
|
|
103
194
|
resolveContact(callingPartyInfo) {
|
|
104
|
-
|
|
195
|
+
log.info(METHOD_START_MESSAGE, {
|
|
196
|
+
file: VOICEMAIL_FILE,
|
|
197
|
+
method: METHODS.RESOLVE_CONTACT,
|
|
198
|
+
});
|
|
199
|
+
const response = this.backendConnector.resolveContact(callingPartyInfo);
|
|
200
|
+
log.log('Contact resolution completed successfully', {
|
|
201
|
+
file: VOICEMAIL_FILE,
|
|
202
|
+
method: METHODS.RESOLVE_CONTACT,
|
|
203
|
+
});
|
|
204
|
+
return response;
|
|
105
205
|
}
|
|
106
206
|
getSDKConnector() {
|
|
107
207
|
return this.sdkConnector;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import SDKConnector from '../SDKConnector';
|
|
2
|
-
import { RAW_REQUEST, SUCCESS_MESSAGE, SUCCESS_STATUS_CODE, TRANSCRIPT, USER, XML_TYPE, BW_XSI_ENDPOINT_VERSION, WEBEX_CALLING_CONNECTOR_FILE, } from '../common/constants';
|
|
3
|
-
import { serviceErrorCodeHandler, getXsiActionEndpoint, getSortedVoicemailList, resolveContact, storeVoicemailList, fetchVoicemailList, } from '../common/Utils';
|
|
2
|
+
import { RAW_REQUEST, SUCCESS_MESSAGE, SUCCESS_STATUS_CODE, TRANSCRIPT, USER, XML_TYPE, BW_XSI_ENDPOINT_VERSION, WEBEX_CALLING_CONNECTOR_FILE, METHOD_START_MESSAGE, } from '../common/constants';
|
|
3
|
+
import { serviceErrorCodeHandler, getXsiActionEndpoint, getSortedVoicemailList, resolveContact, storeVoicemailList, fetchVoicemailList, uploadLogs, } from '../common/Utils';
|
|
4
4
|
import { CALLING_BACKEND, HTTP_METHODS, SORT, } from '../common/types';
|
|
5
5
|
import log from '../Logger';
|
|
6
|
-
import { JSON_FORMAT, MARK_AS_READ, MARK_AS_UNREAD, MESSAGE_MEDIA_CONTENT, TRANSCRIPT_CONTENT, VOICE_MESSAGING_MESSAGES, NO_VOICEMAIL_MSG, NO_VOICEMAIL_STATUS_CODE, RADIX_RAND, PREFIX, TRANSCRIPT_STATUS, MESSAGE_SUMMARY, CALLS, SUMMARY, NEW_MESSAGES, NEW_URGENT_MESSAGES, OLD_URGENT_MESSAGES, OLD_MESSAGES, } from './constants';
|
|
6
|
+
import { JSON_FORMAT, MARK_AS_READ, MARK_AS_UNREAD, MESSAGE_MEDIA_CONTENT, TRANSCRIPT_CONTENT, VOICE_MESSAGING_MESSAGES, NO_VOICEMAIL_MSG, NO_VOICEMAIL_STATUS_CODE, RADIX_RAND, PREFIX, TRANSCRIPT_STATUS, MESSAGE_SUMMARY, CALLS, SUMMARY, NEW_MESSAGES, NEW_URGENT_MESSAGES, OLD_URGENT_MESSAGES, OLD_MESSAGES, METHODS, } from './constants';
|
|
7
7
|
export class WxCallBackendConnector {
|
|
8
8
|
xsiEndpoint;
|
|
9
9
|
userId;
|
|
@@ -26,9 +26,9 @@ export class WxCallBackendConnector {
|
|
|
26
26
|
this.authHeaders = await this.getAuthHeaders();
|
|
27
27
|
const loggerContext = {
|
|
28
28
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
29
|
-
method:
|
|
29
|
+
method: METHODS.INIT,
|
|
30
30
|
};
|
|
31
|
-
log.info(
|
|
31
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
32
32
|
const response = this.setXsiVoiceMessageURI();
|
|
33
33
|
return response;
|
|
34
34
|
}
|
|
@@ -39,10 +39,11 @@ export class WxCallBackendConnector {
|
|
|
39
39
|
let responseDetails;
|
|
40
40
|
const loggerContext = {
|
|
41
41
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
42
|
-
method:
|
|
42
|
+
method: METHODS.SET_XSI_VOICE_MESSAGE_URI,
|
|
43
43
|
};
|
|
44
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
44
45
|
this.xsiEndpoint = await getXsiActionEndpoint(this.webex, loggerContext, CALLING_BACKEND.WXC);
|
|
45
|
-
log.
|
|
46
|
+
log.log(`XsiEndpoint is ${this.xsiEndpoint}`, loggerContext);
|
|
46
47
|
if (this.userId) {
|
|
47
48
|
this.xsiVoiceMessageURI = `${this.xsiEndpoint}/${BW_XSI_ENDPOINT_VERSION}/${USER}/${this.userId}/${VOICE_MESSAGING_MESSAGES}`;
|
|
48
49
|
responseDetails = {
|
|
@@ -56,9 +57,9 @@ export class WxCallBackendConnector {
|
|
|
56
57
|
async getVoicemailList(offset, offsetLimit, sort, refresh) {
|
|
57
58
|
const loggerContext = {
|
|
58
59
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
59
|
-
method:
|
|
60
|
+
method: METHODS.GET_VOICEMAIL_LIST,
|
|
60
61
|
};
|
|
61
|
-
log.info(
|
|
62
|
+
log.info(`${METHOD_START_MESSAGE} with Offset: ${offset} Offset limit: ${offsetLimit} Sort type:${sort}`, loggerContext);
|
|
62
63
|
let messageinfo;
|
|
63
64
|
if (refresh) {
|
|
64
65
|
const urlXsi = `${this.xsiVoiceMessageURI}${JSON_FORMAT}`;
|
|
@@ -85,6 +86,9 @@ export class WxCallBackendConnector {
|
|
|
85
86
|
}
|
|
86
87
|
catch (err) {
|
|
87
88
|
const errorInfo = err;
|
|
89
|
+
const extendedError = new Error(`Failed to get voicemail list: ${err}`);
|
|
90
|
+
log.error(extendedError, loggerContext);
|
|
91
|
+
await uploadLogs();
|
|
88
92
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
89
93
|
return errorStatus;
|
|
90
94
|
}
|
|
@@ -97,13 +101,15 @@ export class WxCallBackendConnector {
|
|
|
97
101
|
},
|
|
98
102
|
message: moreVMAvailable ? SUCCESS_MESSAGE : NO_VOICEMAIL_MSG,
|
|
99
103
|
};
|
|
104
|
+
log.log('Successfully fetched voicemail list', loggerContext);
|
|
100
105
|
return responseDetails;
|
|
101
106
|
}
|
|
102
107
|
async getVoicemailContent(messageId) {
|
|
103
108
|
const loggerContext = {
|
|
104
109
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
105
|
-
method:
|
|
110
|
+
method: METHODS.GET_VOICEMAIL_CONTENT,
|
|
106
111
|
};
|
|
112
|
+
log.info(`${METHOD_START_MESSAGE} with messageId: ${messageId}`, loggerContext);
|
|
107
113
|
try {
|
|
108
114
|
const voicemailContentUrl = `${this.xsiEndpoint}${messageId}`;
|
|
109
115
|
const response = await this.webex.request({
|
|
@@ -127,20 +133,24 @@ export class WxCallBackendConnector {
|
|
|
127
133
|
},
|
|
128
134
|
message: SUCCESS_MESSAGE,
|
|
129
135
|
};
|
|
136
|
+
log.log('Successfully fetched voicemail content', loggerContext);
|
|
130
137
|
return responseDetails;
|
|
131
138
|
}
|
|
132
139
|
catch (err) {
|
|
133
140
|
const errorInfo = err;
|
|
141
|
+
const extendedError = new Error(`Failed to get voicemail content: ${err}`);
|
|
142
|
+
log.error(extendedError, loggerContext);
|
|
143
|
+
await uploadLogs();
|
|
134
144
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
135
|
-
log.info(`Voice mail content error is ${errorStatus}`, loggerContext);
|
|
136
145
|
return errorStatus;
|
|
137
146
|
}
|
|
138
147
|
}
|
|
139
148
|
async getVoicemailSummary() {
|
|
140
149
|
const loggerContext = {
|
|
141
150
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
142
|
-
method:
|
|
151
|
+
method: METHODS.GET_VOICEMAIL_SUMMARY,
|
|
143
152
|
};
|
|
153
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
144
154
|
try {
|
|
145
155
|
const voicemailSummaryUrl = `${this.xsiEndpoint}/${BW_XSI_ENDPOINT_VERSION}/${USER}/${this.userId}/${CALLS}/${MESSAGE_SUMMARY}`;
|
|
146
156
|
const response = await this.webex.request({
|
|
@@ -167,20 +177,24 @@ export class WxCallBackendConnector {
|
|
|
167
177
|
},
|
|
168
178
|
message: SUCCESS_MESSAGE,
|
|
169
179
|
};
|
|
180
|
+
log.log('Successfully fetched voicemail summary', loggerContext);
|
|
170
181
|
return responseDetails;
|
|
171
182
|
}
|
|
172
183
|
catch (err) {
|
|
173
184
|
const errorInfo = err;
|
|
185
|
+
const extendedError = new Error(`Failed to get voicemail summary: ${err}`);
|
|
186
|
+
log.error(extendedError, loggerContext);
|
|
187
|
+
await uploadLogs();
|
|
174
188
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
175
|
-
log.error(new Error(`Voicemail summary error is ${errorStatus}`), loggerContext);
|
|
176
189
|
return errorStatus;
|
|
177
190
|
}
|
|
178
191
|
}
|
|
179
192
|
async voicemailMarkAsRead(messageId) {
|
|
180
193
|
const loggerContext = {
|
|
181
194
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
182
|
-
method:
|
|
195
|
+
method: METHODS.VOICEMAIL_MARK_AS_READ,
|
|
183
196
|
};
|
|
197
|
+
log.info(`${METHOD_START_MESSAGE} with messageId: ${messageId}`, loggerContext);
|
|
184
198
|
try {
|
|
185
199
|
const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${MARK_AS_READ}`;
|
|
186
200
|
const response = await this.webex.request({
|
|
@@ -193,10 +207,14 @@ export class WxCallBackendConnector {
|
|
|
193
207
|
data: {},
|
|
194
208
|
message: SUCCESS_MESSAGE,
|
|
195
209
|
};
|
|
210
|
+
log.log('Successfully marked voicemail as read', loggerContext);
|
|
196
211
|
return responseDetails;
|
|
197
212
|
}
|
|
198
213
|
catch (err) {
|
|
199
214
|
const errorInfo = err;
|
|
215
|
+
const extendedError = new Error(`Failed to mark voicemail as read: ${err}`);
|
|
216
|
+
log.error(extendedError, loggerContext);
|
|
217
|
+
await uploadLogs();
|
|
200
218
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
201
219
|
return errorStatus;
|
|
202
220
|
}
|
|
@@ -204,8 +222,9 @@ export class WxCallBackendConnector {
|
|
|
204
222
|
async voicemailMarkAsUnread(messageId) {
|
|
205
223
|
const loggerContext = {
|
|
206
224
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
207
|
-
method:
|
|
225
|
+
method: METHODS.VOICEMAIL_MARK_AS_UNREAD,
|
|
208
226
|
};
|
|
227
|
+
log.info(`${METHOD_START_MESSAGE} with messageId: ${messageId}`, loggerContext);
|
|
209
228
|
try {
|
|
210
229
|
const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${MARK_AS_UNREAD}`;
|
|
211
230
|
const response = await this.webex.request({
|
|
@@ -218,10 +237,14 @@ export class WxCallBackendConnector {
|
|
|
218
237
|
data: {},
|
|
219
238
|
message: SUCCESS_MESSAGE,
|
|
220
239
|
};
|
|
240
|
+
log.log('Successfully marked voicemail as unread', loggerContext);
|
|
221
241
|
return responseDetails;
|
|
222
242
|
}
|
|
223
243
|
catch (err) {
|
|
224
244
|
const errorInfo = err;
|
|
245
|
+
const extendedError = new Error(`Failed to mark voicemail as unread: ${err}`);
|
|
246
|
+
log.error(extendedError, loggerContext);
|
|
247
|
+
await uploadLogs();
|
|
225
248
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
226
249
|
return errorStatus;
|
|
227
250
|
}
|
|
@@ -229,8 +252,9 @@ export class WxCallBackendConnector {
|
|
|
229
252
|
async deleteVoicemail(messageId) {
|
|
230
253
|
const loggerContext = {
|
|
231
254
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
232
|
-
method:
|
|
255
|
+
method: METHODS.DELETE_VOICEMAIL,
|
|
233
256
|
};
|
|
257
|
+
log.info(`${METHOD_START_MESSAGE} with messageId: ${messageId}`, loggerContext);
|
|
234
258
|
try {
|
|
235
259
|
const voicemailContentUrl = `${this.xsiEndpoint}${messageId}`;
|
|
236
260
|
const response = await this.webex.request({
|
|
@@ -243,10 +267,14 @@ export class WxCallBackendConnector {
|
|
|
243
267
|
data: {},
|
|
244
268
|
message: SUCCESS_MESSAGE,
|
|
245
269
|
};
|
|
270
|
+
log.log('Successfully deleted voicemail', loggerContext);
|
|
246
271
|
return responseDetails;
|
|
247
272
|
}
|
|
248
273
|
catch (err) {
|
|
249
274
|
const errorInfo = err;
|
|
275
|
+
const extendedError = new Error(`Failed to delete voicemail: ${err}`);
|
|
276
|
+
log.error(extendedError, loggerContext);
|
|
277
|
+
await uploadLogs();
|
|
250
278
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
251
279
|
return errorStatus;
|
|
252
280
|
}
|
|
@@ -254,8 +282,9 @@ export class WxCallBackendConnector {
|
|
|
254
282
|
async getVMTranscript(messageId) {
|
|
255
283
|
const loggerContext = {
|
|
256
284
|
file: WEBEX_CALLING_CONNECTOR_FILE,
|
|
257
|
-
method:
|
|
285
|
+
method: METHODS.GET_VM_TRANSCRIPT,
|
|
258
286
|
};
|
|
287
|
+
log.info(`${METHOD_START_MESSAGE} with messageId: ${messageId}`, loggerContext);
|
|
259
288
|
try {
|
|
260
289
|
const voicemailContentUrl = `${this.xsiEndpoint}${messageId}/${TRANSCRIPT}`;
|
|
261
290
|
const response = await this.webex.request({
|
|
@@ -274,10 +303,14 @@ export class WxCallBackendConnector {
|
|
|
274
303
|
},
|
|
275
304
|
message: status.textContent,
|
|
276
305
|
};
|
|
306
|
+
log.log('Successfully fetched voicemail transcript', loggerContext);
|
|
277
307
|
return responseDetails;
|
|
278
308
|
}
|
|
279
309
|
catch (err) {
|
|
280
310
|
const errorInfo = err;
|
|
311
|
+
const extendedError = new Error(`Failed to get voicemail transcript: ${err}`);
|
|
312
|
+
log.error(extendedError, loggerContext);
|
|
313
|
+
await uploadLogs();
|
|
281
314
|
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
282
315
|
return errorStatus;
|
|
283
316
|
}
|
|
@@ -27,3 +27,24 @@ export const NEW_MESSAGES = 'newMessages';
|
|
|
27
27
|
export const OLD_MESSAGES = 'oldMessages';
|
|
28
28
|
export const NEW_URGENT_MESSAGES = 'newUrgentMessages';
|
|
29
29
|
export const OLD_URGENT_MESSAGES = 'oldUrgentMessages';
|
|
30
|
+
export const METHODS = {
|
|
31
|
+
INIT: 'init',
|
|
32
|
+
GET_SDK_CONNECTOR: 'getSDKConnector',
|
|
33
|
+
GET_USER_ID: 'getUserId',
|
|
34
|
+
GET_BW_TOKEN: 'getBwToken',
|
|
35
|
+
SET_XSI_VOICE_MESSAGE_URI: 'setXsiVoiceMessageURI',
|
|
36
|
+
GET_VOICEMAIL_LIST: 'getVoicemailList',
|
|
37
|
+
GET_VOICEMAIL_CONTENT: 'getVoicemailContent',
|
|
38
|
+
GET_VOICEMAIL_SUMMARY: 'getVoicemailSummary',
|
|
39
|
+
VOICEMAIL_MARK_AS_READ: 'voicemailMarkAsRead',
|
|
40
|
+
VOICEMAIL_MARK_AS_UNREAD: 'voicemailMarkAsUnread',
|
|
41
|
+
DELETE_VOICEMAIL: 'deleteVoicemail',
|
|
42
|
+
GET_VM_TRANSCRIPT: 'getVMTranscript',
|
|
43
|
+
RESOLVE_CONTACT: 'resolveContact',
|
|
44
|
+
GET_VOICEMAIL_CONTENT_UCM: 'getVoicemailContentUcm',
|
|
45
|
+
RETURN_UCM_PROMISE: 'returnUcmPromise',
|
|
46
|
+
INITIALIZE_BACKEND_CONNECTOR: 'initializeBackendConnector',
|
|
47
|
+
SUBMIT_METRIC: 'submitMetric',
|
|
48
|
+
GET_AUTH_HEADERS: 'getAuthHeaders',
|
|
49
|
+
SET_UCM_VOICE_MESSAGE_BASE_URI: 'setUcmVoiceMessageBaseURI',
|
|
50
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import * as platform from 'platform';
|
|
2
|
+
import { METRIC_EVENT, METRIC_TYPE, UPLOAD_LOGS_ACTION } from '../Metrics/types';
|
|
3
|
+
import { getMetricManager } from '../Metrics';
|
|
2
4
|
import { createCallError } from '../Errors/catalog/CallError';
|
|
3
5
|
import { DEVICE_ERROR_CODE, ERROR_CODE, ERROR_TYPE, CALL_ERROR_CODE, } from '../Errors/types';
|
|
4
6
|
import { CALLING_BACKEND, HTTP_METHODS, RegistrationStatus, SORT, ServiceIndicator, } from './types';
|
|
@@ -195,6 +197,7 @@ export async function handleCallingClientErrors(err, emitterCb, loggerContext) {
|
|
|
195
197
|
emitterCb(clientError, finalError);
|
|
196
198
|
}
|
|
197
199
|
}
|
|
200
|
+
await uploadLogs();
|
|
198
201
|
return finalError;
|
|
199
202
|
}
|
|
200
203
|
export async function handleCallErrors(emitterCb, errorLayer, retryCb, correlationId, err, caller, file) {
|
|
@@ -856,15 +859,34 @@ export function modifySdpForIPv4(sdp) {
|
|
|
856
859
|
return sdp;
|
|
857
860
|
}
|
|
858
861
|
}
|
|
859
|
-
export async function uploadLogs(
|
|
862
|
+
export async function uploadLogs(metaData = {}, throwError = false) {
|
|
863
|
+
const webex = SDKConnector.getWebex();
|
|
864
|
+
const feedbackId = crypto.randomUUID();
|
|
860
865
|
try {
|
|
861
|
-
const
|
|
862
|
-
|
|
866
|
+
const response = await webex.internal.support.submitLogs({ ...metaData, feedbackId }, undefined, { type: 'diff' });
|
|
867
|
+
log.info(`Logs uploaded successfully with feedbackId: ${feedbackId}`, {
|
|
868
|
+
file: UTILS_FILE,
|
|
869
|
+
method: 'uploadLogs',
|
|
870
|
+
});
|
|
871
|
+
getMetricManager().submitUploadLogsMetric(METRIC_EVENT.UPLOAD_LOGS_SUCCESS, UPLOAD_LOGS_ACTION, METRIC_TYPE.BEHAVIORAL, response?.trackingid, feedbackId, metaData?.correlationId);
|
|
872
|
+
return {
|
|
873
|
+
trackingid: response.trackingid,
|
|
874
|
+
...(response.url ? { url: response.url } : {}),
|
|
875
|
+
...(response.userId ? { userId: response.userId } : {}),
|
|
876
|
+
...(response.correlationId ? { correlationId: response.correlationId } : {}),
|
|
877
|
+
feedbackId,
|
|
878
|
+
};
|
|
863
879
|
}
|
|
864
880
|
catch (error) {
|
|
865
|
-
|
|
881
|
+
const errorLog = new Error(`Failed to upload Logs ${error}`);
|
|
882
|
+
log.error(errorLog, {
|
|
866
883
|
file: UTILS_FILE,
|
|
867
884
|
method: 'uploadLogs',
|
|
868
885
|
});
|
|
886
|
+
getMetricManager().submitUploadLogsMetric(METRIC_EVENT.UPLOAD_LOGS_FAILED, UPLOAD_LOGS_ACTION, METRIC_TYPE.BEHAVIORAL, feedbackId, metaData?.correlationId, errorLog.message);
|
|
887
|
+
if (throwError) {
|
|
888
|
+
throw error;
|
|
889
|
+
}
|
|
890
|
+
return undefined;
|
|
869
891
|
}
|
|
870
892
|
}
|
|
@@ -49,3 +49,4 @@ export const WEBEX_API_PROD = 'https://webexapis.com';
|
|
|
49
49
|
export const WEBEX_API_BTS = 'https://integration.webexapis.com';
|
|
50
50
|
export const WEBEX_API_CONFIG_INT_URL = `${WEBEX_API_BTS}/v1/uc/config`;
|
|
51
51
|
export const WEBEX_API_CONFIG_PROD_URL = `${WEBEX_API_PROD}/v1/uc/config`;
|
|
52
|
+
export const METHOD_START_MESSAGE = 'invoking';
|