@webex/calling 3.0.0-next.4 → 3.0.0-next.5
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/CHANGELOG.md +1403 -1403
- package/README.md +74 -74
- package/dist/module/CallHistory/CallHistory.js +81 -81
- 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 +248 -248
- 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 +1658 -1658
- package/dist/module/CallingClient/calling/callManager.js +284 -284
- 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 +158 -158
- package/dist/module/CallingClient/line/types.js +15 -15
- 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 +484 -484
- 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 +83 -83
- 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 +291 -291
- package/dist/module/Voicemail/UcmBackendConnector.js +279 -279
- 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 +510 -510
- package/dist/module/api.js +6 -6
- package/dist/module/common/Utils.js +802 -802
- package/dist/module/common/constants.js +41 -41
- 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 +17 -17
- 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 +18 -18
- 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 +35 -35
- 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 +96 -96
- package/dist/types/CallingClient/calling/callManager.d.ts +25 -25
- package/dist/types/CallingClient/calling/index.d.ts +2 -2
- package/dist/types/CallingClient/calling/types.d.ts +206 -206
- 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 +43 -43
- package/dist/types/CallingClient/line/types.d.ts +55 -55
- 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 +26 -26
- 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 +72 -72
- 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 +288 -288
- 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 +417 -417
- package/dist/types/api.d.ts +16 -16
- package/dist/types/common/Utils.d.ts +34 -34
- package/dist/types/common/constants.d.ts +41 -41
- 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 +2 -2
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { getCallingBackEnd } from '../common/Utils';
|
|
2
|
-
import SDKConnector from '../SDKConnector';
|
|
3
|
-
import log from '../Logger';
|
|
4
|
-
import { CALLING_BACKEND } from '../common/types';
|
|
5
|
-
import { WxCallBackendConnector } from './WxCallBackendConnector';
|
|
6
|
-
import { CALL_SETTINGS_FILE } from './constants';
|
|
7
|
-
import { UcmBackendConnector } from './UcmBackendConnector';
|
|
8
|
-
export class CallSettings {
|
|
9
|
-
sdkConnector;
|
|
10
|
-
webex;
|
|
11
|
-
callingBackend;
|
|
12
|
-
backendConnector;
|
|
13
|
-
constructor(webex, logger, useProdWebexApis) {
|
|
14
|
-
this.sdkConnector = SDKConnector;
|
|
15
|
-
if (!this.sdkConnector.getWebex()) {
|
|
16
|
-
SDKConnector.setWebex(webex);
|
|
17
|
-
}
|
|
18
|
-
log.setLogger(logger.level, CALL_SETTINGS_FILE);
|
|
19
|
-
this.webex = this.sdkConnector.getWebex();
|
|
20
|
-
this.initializeBackendConnector(logger, useProdWebexApis);
|
|
21
|
-
}
|
|
22
|
-
initializeBackendConnector(logger, useProdWebexApis) {
|
|
23
|
-
this.callingBackend = getCallingBackEnd(this.webex);
|
|
24
|
-
log.info(`Initializing Connector for ${this.callingBackend} backend`, {
|
|
25
|
-
file: CALL_SETTINGS_FILE,
|
|
26
|
-
method: this.initializeBackendConnector.name,
|
|
27
|
-
});
|
|
28
|
-
switch (this.callingBackend) {
|
|
29
|
-
case CALLING_BACKEND.BWRKS:
|
|
30
|
-
case CALLING_BACKEND.WXC:
|
|
31
|
-
this.backendConnector = new WxCallBackendConnector(this.webex, logger);
|
|
32
|
-
break;
|
|
33
|
-
case CALLING_BACKEND.UCM:
|
|
34
|
-
this.backendConnector = new UcmBackendConnector(this.webex, logger, useProdWebexApis);
|
|
35
|
-
break;
|
|
36
|
-
default:
|
|
37
|
-
throw new Error('Calling backend is not identified, exiting....');
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async getCallWaitingSetting() {
|
|
41
|
-
return this.backendConnector.getCallWaitingSetting();
|
|
42
|
-
}
|
|
43
|
-
async getDoNotDisturbSetting() {
|
|
44
|
-
return this.backendConnector.getDoNotDisturbSetting();
|
|
45
|
-
}
|
|
46
|
-
async setDoNotDisturbSetting(enabled) {
|
|
47
|
-
return this.backendConnector.setDoNotDisturbSetting(enabled);
|
|
48
|
-
}
|
|
49
|
-
async getCallForwardSetting() {
|
|
50
|
-
return this.backendConnector.getCallForwardSetting();
|
|
51
|
-
}
|
|
52
|
-
async setCallForwardSetting(callForwardingRequest) {
|
|
53
|
-
return this.backendConnector.setCallForwardSetting(callForwardingRequest);
|
|
54
|
-
}
|
|
55
|
-
async getVoicemailSetting() {
|
|
56
|
-
return this.backendConnector.getVoicemailSetting();
|
|
57
|
-
}
|
|
58
|
-
async setVoicemailSetting(voicemailRequest) {
|
|
59
|
-
return this.backendConnector.setVoicemailSetting(voicemailRequest);
|
|
60
|
-
}
|
|
61
|
-
async getCallForwardAlwaysSetting(directoryNumber) {
|
|
62
|
-
return this.backendConnector.getCallForwardAlwaysSetting(directoryNumber);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export const createCallSettingsClient = (webex, logger, useProdWebexApis) => new CallSettings(webex, logger, useProdWebexApis);
|
|
1
|
+
import { getCallingBackEnd } from '../common/Utils';
|
|
2
|
+
import SDKConnector from '../SDKConnector';
|
|
3
|
+
import log from '../Logger';
|
|
4
|
+
import { CALLING_BACKEND } from '../common/types';
|
|
5
|
+
import { WxCallBackendConnector } from './WxCallBackendConnector';
|
|
6
|
+
import { CALL_SETTINGS_FILE } from './constants';
|
|
7
|
+
import { UcmBackendConnector } from './UcmBackendConnector';
|
|
8
|
+
export class CallSettings {
|
|
9
|
+
sdkConnector;
|
|
10
|
+
webex;
|
|
11
|
+
callingBackend;
|
|
12
|
+
backendConnector;
|
|
13
|
+
constructor(webex, logger, useProdWebexApis) {
|
|
14
|
+
this.sdkConnector = SDKConnector;
|
|
15
|
+
if (!this.sdkConnector.getWebex()) {
|
|
16
|
+
SDKConnector.setWebex(webex);
|
|
17
|
+
}
|
|
18
|
+
log.setLogger(logger.level, CALL_SETTINGS_FILE);
|
|
19
|
+
this.webex = this.sdkConnector.getWebex();
|
|
20
|
+
this.initializeBackendConnector(logger, useProdWebexApis);
|
|
21
|
+
}
|
|
22
|
+
initializeBackendConnector(logger, useProdWebexApis) {
|
|
23
|
+
this.callingBackend = getCallingBackEnd(this.webex);
|
|
24
|
+
log.info(`Initializing Connector for ${this.callingBackend} backend`, {
|
|
25
|
+
file: CALL_SETTINGS_FILE,
|
|
26
|
+
method: this.initializeBackendConnector.name,
|
|
27
|
+
});
|
|
28
|
+
switch (this.callingBackend) {
|
|
29
|
+
case CALLING_BACKEND.BWRKS:
|
|
30
|
+
case CALLING_BACKEND.WXC:
|
|
31
|
+
this.backendConnector = new WxCallBackendConnector(this.webex, logger);
|
|
32
|
+
break;
|
|
33
|
+
case CALLING_BACKEND.UCM:
|
|
34
|
+
this.backendConnector = new UcmBackendConnector(this.webex, logger, useProdWebexApis);
|
|
35
|
+
break;
|
|
36
|
+
default:
|
|
37
|
+
throw new Error('Calling backend is not identified, exiting....');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async getCallWaitingSetting() {
|
|
41
|
+
return this.backendConnector.getCallWaitingSetting();
|
|
42
|
+
}
|
|
43
|
+
async getDoNotDisturbSetting() {
|
|
44
|
+
return this.backendConnector.getDoNotDisturbSetting();
|
|
45
|
+
}
|
|
46
|
+
async setDoNotDisturbSetting(enabled) {
|
|
47
|
+
return this.backendConnector.setDoNotDisturbSetting(enabled);
|
|
48
|
+
}
|
|
49
|
+
async getCallForwardSetting() {
|
|
50
|
+
return this.backendConnector.getCallForwardSetting();
|
|
51
|
+
}
|
|
52
|
+
async setCallForwardSetting(callForwardingRequest) {
|
|
53
|
+
return this.backendConnector.setCallForwardSetting(callForwardingRequest);
|
|
54
|
+
}
|
|
55
|
+
async getVoicemailSetting() {
|
|
56
|
+
return this.backendConnector.getVoicemailSetting();
|
|
57
|
+
}
|
|
58
|
+
async setVoicemailSetting(voicemailRequest) {
|
|
59
|
+
return this.backendConnector.setVoicemailSetting(voicemailRequest);
|
|
60
|
+
}
|
|
61
|
+
async getCallForwardAlwaysSetting(directoryNumber) {
|
|
62
|
+
return this.backendConnector.getCallForwardAlwaysSetting(directoryNumber);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
export const createCallSettingsClient = (webex, logger, useProdWebexApis) => new CallSettings(webex, logger, useProdWebexApis);
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { FAILURE_MESSAGE, STATUS_CODE, SUCCESS_MESSAGE, UCM_CONNECTOR_FILE, VOICEMAIL, } from '../common/constants';
|
|
2
|
-
import SDKConnector from '../SDKConnector';
|
|
3
|
-
import log from '../Logger';
|
|
4
|
-
import { HTTP_METHODS } from '../common/types';
|
|
5
|
-
import { CF_ENDPOINT, ORG_ENDPOINT, PEOPLE_ENDPOINT, WEBEX_APIS_INT_URL, WEBEX_APIS_PROD_URL, } from './constants';
|
|
6
|
-
import { serviceErrorCodeHandler } from '../common/Utils';
|
|
7
|
-
export class UcmBackendConnector {
|
|
8
|
-
sdkConnector;
|
|
9
|
-
webex;
|
|
10
|
-
userId;
|
|
11
|
-
orgId;
|
|
12
|
-
useProdWebexApis;
|
|
13
|
-
constructor(webex, logger, useProdWebexApis = true) {
|
|
14
|
-
this.sdkConnector = SDKConnector;
|
|
15
|
-
if (!this.sdkConnector.getWebex()) {
|
|
16
|
-
SDKConnector.setWebex(webex);
|
|
17
|
-
}
|
|
18
|
-
this.webex = this.sdkConnector.getWebex();
|
|
19
|
-
log.setLogger(logger.level, UCM_CONNECTOR_FILE);
|
|
20
|
-
this.userId = this.webex.internal.device.userId;
|
|
21
|
-
this.orgId = this.webex.internal.device.orgId;
|
|
22
|
-
this.useProdWebexApis = useProdWebexApis;
|
|
23
|
-
}
|
|
24
|
-
getCallWaitingSetting() {
|
|
25
|
-
return this.getMethodNotSupportedResponse();
|
|
26
|
-
}
|
|
27
|
-
getDoNotDisturbSetting() {
|
|
28
|
-
return this.getMethodNotSupportedResponse();
|
|
29
|
-
}
|
|
30
|
-
setDoNotDisturbSetting() {
|
|
31
|
-
return this.getMethodNotSupportedResponse();
|
|
32
|
-
}
|
|
33
|
-
getCallForwardSetting() {
|
|
34
|
-
return this.getMethodNotSupportedResponse();
|
|
35
|
-
}
|
|
36
|
-
setCallForwardSetting() {
|
|
37
|
-
return this.getMethodNotSupportedResponse();
|
|
38
|
-
}
|
|
39
|
-
getVoicemailSetting() {
|
|
40
|
-
return this.getMethodNotSupportedResponse();
|
|
41
|
-
}
|
|
42
|
-
setVoicemailSetting() {
|
|
43
|
-
return this.getMethodNotSupportedResponse();
|
|
44
|
-
}
|
|
45
|
-
getMethodNotSupportedResponse() {
|
|
46
|
-
const response = serviceErrorCodeHandler({ statusCode: 501 }, { file: UCM_CONNECTOR_FILE, method: this.getMethodNotSupportedResponse.name });
|
|
47
|
-
return Promise.resolve(response);
|
|
48
|
-
}
|
|
49
|
-
async getCallForwardAlwaysSetting(directoryNumber) {
|
|
50
|
-
const loggerContext = {
|
|
51
|
-
file: UCM_CONNECTOR_FILE,
|
|
52
|
-
method: this.getCallForwardAlwaysSetting.name,
|
|
53
|
-
};
|
|
54
|
-
const webexApisUrl = this.useProdWebexApis ? WEBEX_APIS_PROD_URL : WEBEX_APIS_INT_URL;
|
|
55
|
-
try {
|
|
56
|
-
if (directoryNumber) {
|
|
57
|
-
const resp = await this.webex.request({
|
|
58
|
-
uri: `${webexApisUrl}/${PEOPLE_ENDPOINT}/${this.userId}/${CF_ENDPOINT.toLowerCase()}?${ORG_ENDPOINT}=${this.orgId}`,
|
|
59
|
-
method: HTTP_METHODS.GET,
|
|
60
|
-
});
|
|
61
|
-
const { callForwarding } = resp.body;
|
|
62
|
-
const cfa = callForwarding.always.find((item) => item.dn.endsWith(directoryNumber));
|
|
63
|
-
if (cfa) {
|
|
64
|
-
const response = {
|
|
65
|
-
statusCode: Number(resp[STATUS_CODE]),
|
|
66
|
-
message: SUCCESS_MESSAGE,
|
|
67
|
-
data: {
|
|
68
|
-
callSetting: {
|
|
69
|
-
enabled: cfa.destinationVoicemailEnabled || !!cfa.destination,
|
|
70
|
-
destination: cfa.destinationVoicemailEnabled ? VOICEMAIL : cfa.destination,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
return response;
|
|
75
|
-
}
|
|
76
|
-
const response = {
|
|
77
|
-
statusCode: 404,
|
|
78
|
-
message: FAILURE_MESSAGE,
|
|
79
|
-
data: {
|
|
80
|
-
error: 'Directory Number is not assigned to the user',
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
return response;
|
|
84
|
-
}
|
|
85
|
-
const response = {
|
|
86
|
-
statusCode: 400,
|
|
87
|
-
message: FAILURE_MESSAGE,
|
|
88
|
-
data: {
|
|
89
|
-
error: 'Directory Number is mandatory for UCM backend',
|
|
90
|
-
},
|
|
91
|
-
};
|
|
92
|
-
return response;
|
|
93
|
-
}
|
|
94
|
-
catch (err) {
|
|
95
|
-
const errorInfo = err;
|
|
96
|
-
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
97
|
-
return errorStatus;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
1
|
+
import { FAILURE_MESSAGE, STATUS_CODE, SUCCESS_MESSAGE, UCM_CONNECTOR_FILE, VOICEMAIL, } from '../common/constants';
|
|
2
|
+
import SDKConnector from '../SDKConnector';
|
|
3
|
+
import log from '../Logger';
|
|
4
|
+
import { HTTP_METHODS } from '../common/types';
|
|
5
|
+
import { CF_ENDPOINT, ORG_ENDPOINT, PEOPLE_ENDPOINT, WEBEX_APIS_INT_URL, WEBEX_APIS_PROD_URL, } from './constants';
|
|
6
|
+
import { serviceErrorCodeHandler } from '../common/Utils';
|
|
7
|
+
export class UcmBackendConnector {
|
|
8
|
+
sdkConnector;
|
|
9
|
+
webex;
|
|
10
|
+
userId;
|
|
11
|
+
orgId;
|
|
12
|
+
useProdWebexApis;
|
|
13
|
+
constructor(webex, logger, useProdWebexApis = true) {
|
|
14
|
+
this.sdkConnector = SDKConnector;
|
|
15
|
+
if (!this.sdkConnector.getWebex()) {
|
|
16
|
+
SDKConnector.setWebex(webex);
|
|
17
|
+
}
|
|
18
|
+
this.webex = this.sdkConnector.getWebex();
|
|
19
|
+
log.setLogger(logger.level, UCM_CONNECTOR_FILE);
|
|
20
|
+
this.userId = this.webex.internal.device.userId;
|
|
21
|
+
this.orgId = this.webex.internal.device.orgId;
|
|
22
|
+
this.useProdWebexApis = useProdWebexApis;
|
|
23
|
+
}
|
|
24
|
+
getCallWaitingSetting() {
|
|
25
|
+
return this.getMethodNotSupportedResponse();
|
|
26
|
+
}
|
|
27
|
+
getDoNotDisturbSetting() {
|
|
28
|
+
return this.getMethodNotSupportedResponse();
|
|
29
|
+
}
|
|
30
|
+
setDoNotDisturbSetting() {
|
|
31
|
+
return this.getMethodNotSupportedResponse();
|
|
32
|
+
}
|
|
33
|
+
getCallForwardSetting() {
|
|
34
|
+
return this.getMethodNotSupportedResponse();
|
|
35
|
+
}
|
|
36
|
+
setCallForwardSetting() {
|
|
37
|
+
return this.getMethodNotSupportedResponse();
|
|
38
|
+
}
|
|
39
|
+
getVoicemailSetting() {
|
|
40
|
+
return this.getMethodNotSupportedResponse();
|
|
41
|
+
}
|
|
42
|
+
setVoicemailSetting() {
|
|
43
|
+
return this.getMethodNotSupportedResponse();
|
|
44
|
+
}
|
|
45
|
+
getMethodNotSupportedResponse() {
|
|
46
|
+
const response = serviceErrorCodeHandler({ statusCode: 501 }, { file: UCM_CONNECTOR_FILE, method: this.getMethodNotSupportedResponse.name });
|
|
47
|
+
return Promise.resolve(response);
|
|
48
|
+
}
|
|
49
|
+
async getCallForwardAlwaysSetting(directoryNumber) {
|
|
50
|
+
const loggerContext = {
|
|
51
|
+
file: UCM_CONNECTOR_FILE,
|
|
52
|
+
method: this.getCallForwardAlwaysSetting.name,
|
|
53
|
+
};
|
|
54
|
+
const webexApisUrl = this.useProdWebexApis ? WEBEX_APIS_PROD_URL : WEBEX_APIS_INT_URL;
|
|
55
|
+
try {
|
|
56
|
+
if (directoryNumber) {
|
|
57
|
+
const resp = await this.webex.request({
|
|
58
|
+
uri: `${webexApisUrl}/${PEOPLE_ENDPOINT}/${this.userId}/${CF_ENDPOINT.toLowerCase()}?${ORG_ENDPOINT}=${this.orgId}`,
|
|
59
|
+
method: HTTP_METHODS.GET,
|
|
60
|
+
});
|
|
61
|
+
const { callForwarding } = resp.body;
|
|
62
|
+
const cfa = callForwarding.always.find((item) => item.dn.endsWith(directoryNumber));
|
|
63
|
+
if (cfa) {
|
|
64
|
+
const response = {
|
|
65
|
+
statusCode: Number(resp[STATUS_CODE]),
|
|
66
|
+
message: SUCCESS_MESSAGE,
|
|
67
|
+
data: {
|
|
68
|
+
callSetting: {
|
|
69
|
+
enabled: cfa.destinationVoicemailEnabled || !!cfa.destination,
|
|
70
|
+
destination: cfa.destinationVoicemailEnabled ? VOICEMAIL : cfa.destination,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
return response;
|
|
75
|
+
}
|
|
76
|
+
const response = {
|
|
77
|
+
statusCode: 404,
|
|
78
|
+
message: FAILURE_MESSAGE,
|
|
79
|
+
data: {
|
|
80
|
+
error: 'Directory Number is not assigned to the user',
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
const response = {
|
|
86
|
+
statusCode: 400,
|
|
87
|
+
message: FAILURE_MESSAGE,
|
|
88
|
+
data: {
|
|
89
|
+
error: 'Directory Number is mandatory for UCM backend',
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
return response;
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
const errorInfo = err;
|
|
96
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
97
|
+
return errorStatus;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|