@webex/calling 0.0.1-next.0 → 0.0.1-next.2
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/README.md +51 -66
- package/dist/module/CallHistory/CallHistory.js +84 -84
- package/dist/module/CallHistory/callHistoryFixtures.js +307 -307
- package/dist/module/CallHistory/constants.js +9 -9
- package/dist/module/CallHistory/types.js +1 -1
- package/dist/module/CallSettings/CallSettings.js +65 -65
- package/dist/module/CallSettings/UcmBackendConnector.js +100 -100
- package/dist/module/CallSettings/WxCallBackendConnector.js +287 -287
- package/dist/module/CallSettings/constants.js +11 -11
- package/dist/module/CallSettings/testFixtures.js +62 -62
- package/dist/module/CallSettings/types.js +1 -1
- package/dist/module/CallingClient/CallingClient.js +268 -268
- package/dist/module/CallingClient/callRecordFixtures.js +93 -93
- package/dist/module/CallingClient/calling/CallerId/index.js +169 -169
- package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
- package/dist/module/CallingClient/calling/call.js +1649 -1649
- package/dist/module/CallingClient/calling/callManager.js +274 -274
- package/dist/module/CallingClient/calling/index.js +2 -2
- package/dist/module/CallingClient/calling/types.js +53 -53
- package/dist/module/CallingClient/callingClientFixtures.js +38 -38
- package/dist/module/CallingClient/constants.js +122 -122
- package/dist/module/CallingClient/line/index.js +110 -110
- package/dist/module/CallingClient/line/types.js +14 -14
- package/dist/module/CallingClient/registration/index.js +1 -1
- package/dist/module/CallingClient/registration/register.js +507 -507
- package/dist/module/CallingClient/registration/registerFixtures.js +28 -28
- package/dist/module/CallingClient/registration/types.js +1 -1
- package/dist/module/CallingClient/types.js +1 -1
- package/dist/module/Contacts/ContactsClient.js +487 -487
- package/dist/module/Contacts/constants.js +20 -20
- package/dist/module/Contacts/contactFixtures.js +284 -284
- package/dist/module/Contacts/types.js +10 -10
- package/dist/module/Errors/catalog/CallError.js +26 -26
- package/dist/module/Errors/catalog/CallingDeviceError.js +18 -18
- package/dist/module/Errors/catalog/ExtendedError.js +10 -10
- package/dist/module/Errors/catalog/LineError.js +24 -24
- package/dist/module/Errors/index.js +2 -2
- package/dist/module/Errors/types.js +48 -48
- package/dist/module/Events/impl/index.js +19 -19
- package/dist/module/Events/types.js +74 -74
- package/dist/module/Logger/index.js +114 -114
- package/dist/module/Logger/types.js +25 -25
- package/dist/module/Metrics/index.js +232 -232
- package/dist/module/Metrics/types.js +37 -37
- package/dist/module/SDKConnector/index.js +39 -39
- package/dist/module/SDKConnector/types.js +1 -1
- package/dist/module/SDKConnector/utils.js +12 -12
- package/dist/module/Voicemail/BroadworksBackendConnector.js +289 -289
- package/dist/module/Voicemail/UcmBackendConnector.js +275 -275
- package/dist/module/Voicemail/Voicemail.js +110 -110
- package/dist/module/Voicemail/WxCallBackendConnector.js +279 -279
- package/dist/module/Voicemail/constants.js +29 -29
- package/dist/module/Voicemail/types.js +1 -1
- package/dist/module/Voicemail/voicemailFixture.js +449 -449
- package/dist/module/common/Utils.js +802 -802
- package/dist/module/common/constants.js +40 -40
- package/dist/module/common/index.js +1 -1
- package/dist/module/common/testUtil.js +938 -938
- package/dist/module/common/types.js +57 -57
- package/dist/module/index.js +8 -8
- package/dist/types/CallHistory/CallHistory.d.ts +18 -18
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +94 -94
- package/dist/types/CallHistory/constants.d.ts +9 -9
- package/dist/types/CallHistory/types.d.ts +20 -20
- package/dist/types/CallSettings/CallSettings.d.ts +19 -19
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts +21 -21
- package/dist/types/CallSettings/constants.d.ts +11 -11
- package/dist/types/CallSettings/testFixtures.d.ts +15 -15
- package/dist/types/CallSettings/types.d.ts +107 -107
- package/dist/types/CallingClient/CallingClient.d.ts +37 -37
- package/dist/types/CallingClient/callRecordFixtures.d.ts +3 -3
- package/dist/types/CallingClient/calling/CallerId/index.d.ts +17 -17
- package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
- package/dist/types/CallingClient/calling/call.d.ts +94 -94
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +21 -21
- package/dist/types/CallingClient/calling/index.d.ts +2 -2
- package/dist/types/CallingClient/calling/types.d.ts +203 -203
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts +18 -18
- package/dist/types/CallingClient/constants.d.ts +122 -122
- package/dist/types/CallingClient/line/index.d.ts +38 -38
- package/dist/types/CallingClient/line/types.d.ts +50 -50
- package/dist/types/CallingClient/registration/index.d.ts +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +64 -64
- package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
- package/dist/types/CallingClient/registration/types.d.ts +20 -20
- package/dist/types/CallingClient/types.d.ts +29 -29
- package/dist/types/Contacts/ContactsClient.d.ts +27 -27
- package/dist/types/Contacts/constants.d.ts +19 -19
- package/dist/types/Contacts/contactFixtures.d.ts +280 -280
- package/dist/types/Contacts/types.d.ts +74 -74
- package/dist/types/Errors/catalog/CallError.d.ts +11 -11
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +10 -10
- package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
- package/dist/types/Errors/catalog/LineError.d.ts +10 -10
- package/dist/types/Errors/index.d.ts +2 -2
- package/dist/types/Errors/types.d.ts +60 -60
- package/dist/types/Events/impl/index.d.ts +8 -8
- package/dist/types/Events/types.d.ts +283 -283
- package/dist/types/Logger/index.d.ts +12 -12
- package/dist/types/Logger/types.d.ts +25 -25
- package/dist/types/Metrics/index.d.ts +5 -5
- package/dist/types/Metrics/types.d.ts +42 -42
- package/dist/types/SDKConnector/index.d.ts +12 -12
- package/dist/types/SDKConnector/types.d.ts +128 -128
- package/dist/types/SDKConnector/utils.d.ts +5 -5
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +27 -27
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +34 -34
- package/dist/types/Voicemail/Voicemail.d.ts +27 -27
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +23 -23
- package/dist/types/Voicemail/constants.d.ts +29 -29
- package/dist/types/Voicemail/types.d.ts +133 -133
- package/dist/types/Voicemail/voicemailFixture.d.ts +349 -349
- package/dist/types/common/Utils.d.ts +34 -34
- package/dist/types/common/constants.d.ts +40 -40
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/common/testUtil.d.ts +3611 -3611
- package/dist/types/common/types.d.ts +191 -191
- package/dist/types/index.d.ts +8 -8
- package/package.json +6 -41
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
import SDKConnector from '../SDKConnector';
|
|
2
|
-
import { CALLING_BACKEND } from '../common/types';
|
|
3
|
-
import log from '../Logger';
|
|
4
|
-
import { getCallingBackEnd } from '../common/Utils';
|
|
5
|
-
import { WxCallBackendConnector } from './WxCallBackendConnector';
|
|
6
|
-
import { BroadworksBackendConnector } from './BroadworksBackendConnector';
|
|
7
|
-
import { Eventing } from '../Events/impl';
|
|
8
|
-
import { UcmBackendConnector } from './UcmBackendConnector';
|
|
9
|
-
import { METRIC_EVENT, METRIC_TYPE, VOICEMAIL_ACTION } from '../Metrics/types';
|
|
10
|
-
import { getMetricManager } from '../Metrics';
|
|
11
|
-
import { VOICEMAIL_FILE } from './constants';
|
|
12
|
-
export class Voicemail extends Eventing {
|
|
13
|
-
logger;
|
|
14
|
-
sdkConnector;
|
|
15
|
-
webex;
|
|
16
|
-
callingBackend;
|
|
17
|
-
backendConnector;
|
|
18
|
-
metricManager;
|
|
19
|
-
constructor(webex, logger) {
|
|
20
|
-
super();
|
|
21
|
-
this.logger = logger;
|
|
22
|
-
this.sdkConnector = SDKConnector;
|
|
23
|
-
if (!this.sdkConnector.getWebex()) {
|
|
24
|
-
SDKConnector.setWebex(webex);
|
|
25
|
-
}
|
|
26
|
-
this.webex = this.sdkConnector.getWebex();
|
|
27
|
-
this.metricManager = getMetricManager(this.webex, undefined);
|
|
28
|
-
this.callingBackend = getCallingBackEnd(this.webex);
|
|
29
|
-
this.initializeBackendConnector();
|
|
30
|
-
log.setLogger(logger.level, VOICEMAIL_FILE);
|
|
31
|
-
}
|
|
32
|
-
init() {
|
|
33
|
-
const response = this.backendConnector.init();
|
|
34
|
-
return response;
|
|
35
|
-
}
|
|
36
|
-
initializeBackendConnector() {
|
|
37
|
-
switch (this.callingBackend) {
|
|
38
|
-
case CALLING_BACKEND.WXC: {
|
|
39
|
-
this.backendConnector = new WxCallBackendConnector(this.webex, this.logger);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
case CALLING_BACKEND.BWRKS: {
|
|
43
|
-
this.backendConnector = new BroadworksBackendConnector(this.webex, this.logger);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case CALLING_BACKEND.UCM: {
|
|
47
|
-
this.backendConnector = new UcmBackendConnector(this.webex, this.logger);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
default: {
|
|
51
|
-
throw new Error('Calling backend is not identified, exiting....');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
submitMetric(response, metricAction, messageId) {
|
|
56
|
-
const { statusCode, data: { error: errorMessage }, } = response;
|
|
57
|
-
if (statusCode >= 200 && statusCode < 300) {
|
|
58
|
-
this.metricManager.submitVoicemailMetric(METRIC_EVENT.VOICEMAIL, metricAction, METRIC_TYPE.BEHAVIORAL, messageId);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
this.metricManager.submitVoicemailMetric(METRIC_EVENT.VOICEMAIL_ERROR, metricAction, METRIC_TYPE.BEHAVIORAL, messageId, errorMessage, statusCode);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async getVoicemailList(offset, offsetLimit, sort, refresh) {
|
|
65
|
-
const response = await this.backendConnector.getVoicemailList(offset, offsetLimit, sort, refresh);
|
|
66
|
-
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAILS);
|
|
67
|
-
return response;
|
|
68
|
-
}
|
|
69
|
-
async getVoicemailContent(messageId) {
|
|
70
|
-
const response = await this.backendConnector.getVoicemailContent(messageId);
|
|
71
|
-
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAIL_CONTENT, messageId);
|
|
72
|
-
return response;
|
|
73
|
-
}
|
|
74
|
-
async getVoicemailSummary() {
|
|
75
|
-
const response = await this.backendConnector.getVoicemailSummary();
|
|
76
|
-
if (response !== null) {
|
|
77
|
-
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAIL_SUMMARY);
|
|
78
|
-
}
|
|
79
|
-
return response;
|
|
80
|
-
}
|
|
81
|
-
async voicemailMarkAsRead(messageId) {
|
|
82
|
-
const response = await this.backendConnector.voicemailMarkAsRead(messageId);
|
|
83
|
-
this.submitMetric(response, VOICEMAIL_ACTION.MARK_READ, messageId);
|
|
84
|
-
return response;
|
|
85
|
-
}
|
|
86
|
-
async voicemailMarkAsUnread(messageId) {
|
|
87
|
-
const response = await this.backendConnector.voicemailMarkAsUnread(messageId);
|
|
88
|
-
this.submitMetric(response, VOICEMAIL_ACTION.MARK_UNREAD, messageId);
|
|
89
|
-
return response;
|
|
90
|
-
}
|
|
91
|
-
async deleteVoicemail(messageId) {
|
|
92
|
-
const response = await this.backendConnector.deleteVoicemail(messageId);
|
|
93
|
-
this.submitMetric(response, VOICEMAIL_ACTION.DELETE, messageId);
|
|
94
|
-
return response;
|
|
95
|
-
}
|
|
96
|
-
async getVMTranscript(messageId) {
|
|
97
|
-
const response = await this.backendConnector.getVMTranscript(messageId);
|
|
98
|
-
if (response !== null) {
|
|
99
|
-
this.submitMetric(response, VOICEMAIL_ACTION.TRANSCRIPT, messageId);
|
|
100
|
-
}
|
|
101
|
-
return response;
|
|
102
|
-
}
|
|
103
|
-
resolveContact(callingPartyInfo) {
|
|
104
|
-
return this.backendConnector.resolveContact(callingPartyInfo);
|
|
105
|
-
}
|
|
106
|
-
getSDKConnector() {
|
|
107
|
-
return this.sdkConnector;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
export const createVoicemailClient = (webex, logger) => new Voicemail(webex, logger);
|
|
1
|
+
import SDKConnector from '../SDKConnector';
|
|
2
|
+
import { CALLING_BACKEND } from '../common/types';
|
|
3
|
+
import log from '../Logger';
|
|
4
|
+
import { getCallingBackEnd } from '../common/Utils';
|
|
5
|
+
import { WxCallBackendConnector } from './WxCallBackendConnector';
|
|
6
|
+
import { BroadworksBackendConnector } from './BroadworksBackendConnector';
|
|
7
|
+
import { Eventing } from '../Events/impl';
|
|
8
|
+
import { UcmBackendConnector } from './UcmBackendConnector';
|
|
9
|
+
import { METRIC_EVENT, METRIC_TYPE, VOICEMAIL_ACTION } from '../Metrics/types';
|
|
10
|
+
import { getMetricManager } from '../Metrics';
|
|
11
|
+
import { VOICEMAIL_FILE } from './constants';
|
|
12
|
+
export class Voicemail extends Eventing {
|
|
13
|
+
logger;
|
|
14
|
+
sdkConnector;
|
|
15
|
+
webex;
|
|
16
|
+
callingBackend;
|
|
17
|
+
backendConnector;
|
|
18
|
+
metricManager;
|
|
19
|
+
constructor(webex, logger) {
|
|
20
|
+
super();
|
|
21
|
+
this.logger = logger;
|
|
22
|
+
this.sdkConnector = SDKConnector;
|
|
23
|
+
if (!this.sdkConnector.getWebex()) {
|
|
24
|
+
SDKConnector.setWebex(webex);
|
|
25
|
+
}
|
|
26
|
+
this.webex = this.sdkConnector.getWebex();
|
|
27
|
+
this.metricManager = getMetricManager(this.webex, undefined);
|
|
28
|
+
this.callingBackend = getCallingBackEnd(this.webex);
|
|
29
|
+
this.initializeBackendConnector();
|
|
30
|
+
log.setLogger(logger.level, VOICEMAIL_FILE);
|
|
31
|
+
}
|
|
32
|
+
init() {
|
|
33
|
+
const response = this.backendConnector.init();
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
initializeBackendConnector() {
|
|
37
|
+
switch (this.callingBackend) {
|
|
38
|
+
case CALLING_BACKEND.WXC: {
|
|
39
|
+
this.backendConnector = new WxCallBackendConnector(this.webex, this.logger);
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
42
|
+
case CALLING_BACKEND.BWRKS: {
|
|
43
|
+
this.backendConnector = new BroadworksBackendConnector(this.webex, this.logger);
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case CALLING_BACKEND.UCM: {
|
|
47
|
+
this.backendConnector = new UcmBackendConnector(this.webex, this.logger);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
default: {
|
|
51
|
+
throw new Error('Calling backend is not identified, exiting....');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
submitMetric(response, metricAction, messageId) {
|
|
56
|
+
const { statusCode, data: { error: errorMessage }, } = response;
|
|
57
|
+
if (statusCode >= 200 && statusCode < 300) {
|
|
58
|
+
this.metricManager.submitVoicemailMetric(METRIC_EVENT.VOICEMAIL, metricAction, METRIC_TYPE.BEHAVIORAL, messageId);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.metricManager.submitVoicemailMetric(METRIC_EVENT.VOICEMAIL_ERROR, metricAction, METRIC_TYPE.BEHAVIORAL, messageId, errorMessage, statusCode);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
async getVoicemailList(offset, offsetLimit, sort, refresh) {
|
|
65
|
+
const response = await this.backendConnector.getVoicemailList(offset, offsetLimit, sort, refresh);
|
|
66
|
+
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAILS);
|
|
67
|
+
return response;
|
|
68
|
+
}
|
|
69
|
+
async getVoicemailContent(messageId) {
|
|
70
|
+
const response = await this.backendConnector.getVoicemailContent(messageId);
|
|
71
|
+
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAIL_CONTENT, messageId);
|
|
72
|
+
return response;
|
|
73
|
+
}
|
|
74
|
+
async getVoicemailSummary() {
|
|
75
|
+
const response = await this.backendConnector.getVoicemailSummary();
|
|
76
|
+
if (response !== null) {
|
|
77
|
+
this.submitMetric(response, VOICEMAIL_ACTION.GET_VOICEMAIL_SUMMARY);
|
|
78
|
+
}
|
|
79
|
+
return response;
|
|
80
|
+
}
|
|
81
|
+
async voicemailMarkAsRead(messageId) {
|
|
82
|
+
const response = await this.backendConnector.voicemailMarkAsRead(messageId);
|
|
83
|
+
this.submitMetric(response, VOICEMAIL_ACTION.MARK_READ, messageId);
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
async voicemailMarkAsUnread(messageId) {
|
|
87
|
+
const response = await this.backendConnector.voicemailMarkAsUnread(messageId);
|
|
88
|
+
this.submitMetric(response, VOICEMAIL_ACTION.MARK_UNREAD, messageId);
|
|
89
|
+
return response;
|
|
90
|
+
}
|
|
91
|
+
async deleteVoicemail(messageId) {
|
|
92
|
+
const response = await this.backendConnector.deleteVoicemail(messageId);
|
|
93
|
+
this.submitMetric(response, VOICEMAIL_ACTION.DELETE, messageId);
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
async getVMTranscript(messageId) {
|
|
97
|
+
const response = await this.backendConnector.getVMTranscript(messageId);
|
|
98
|
+
if (response !== null) {
|
|
99
|
+
this.submitMetric(response, VOICEMAIL_ACTION.TRANSCRIPT, messageId);
|
|
100
|
+
}
|
|
101
|
+
return response;
|
|
102
|
+
}
|
|
103
|
+
resolveContact(callingPartyInfo) {
|
|
104
|
+
return this.backendConnector.resolveContact(callingPartyInfo);
|
|
105
|
+
}
|
|
106
|
+
getSDKConnector() {
|
|
107
|
+
return this.sdkConnector;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
export const createVoicemailClient = (webex, logger) => new Voicemail(webex, logger);
|