@webex/calling 0.0.1-next.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/README.md +67 -0
- package/dist/module/CallHistory/CallHistory.js +84 -0
- package/dist/module/CallHistory/callHistoryFixtures.js +307 -0
- package/dist/module/CallHistory/constants.js +9 -0
- package/dist/module/CallHistory/types.js +1 -0
- package/dist/module/CallSettings/CallSettings.js +65 -0
- package/dist/module/CallSettings/UcmBackendConnector.js +100 -0
- package/dist/module/CallSettings/WxCallBackendConnector.js +287 -0
- package/dist/module/CallSettings/constants.js +11 -0
- package/dist/module/CallSettings/testFixtures.js +62 -0
- package/dist/module/CallSettings/types.js +1 -0
- package/dist/module/CallingClient/CallingClient.js +268 -0
- package/dist/module/CallingClient/callRecordFixtures.js +93 -0
- package/dist/module/CallingClient/calling/CallerId/index.js +169 -0
- package/dist/module/CallingClient/calling/CallerId/types.js +1 -0
- package/dist/module/CallingClient/calling/call.js +1649 -0
- package/dist/module/CallingClient/calling/callManager.js +274 -0
- package/dist/module/CallingClient/calling/index.js +2 -0
- package/dist/module/CallingClient/calling/types.js +53 -0
- package/dist/module/CallingClient/callingClientFixtures.js +38 -0
- package/dist/module/CallingClient/constants.js +122 -0
- package/dist/module/CallingClient/line/index.js +110 -0
- package/dist/module/CallingClient/line/types.js +14 -0
- package/dist/module/CallingClient/registration/index.js +1 -0
- package/dist/module/CallingClient/registration/register.js +507 -0
- package/dist/module/CallingClient/registration/registerFixtures.js +28 -0
- package/dist/module/CallingClient/registration/types.js +1 -0
- package/dist/module/CallingClient/types.js +1 -0
- package/dist/module/Contacts/ContactsClient.js +487 -0
- package/dist/module/Contacts/constants.js +20 -0
- package/dist/module/Contacts/contactFixtures.js +284 -0
- package/dist/module/Contacts/types.js +10 -0
- package/dist/module/Errors/catalog/CallError.js +26 -0
- package/dist/module/Errors/catalog/CallingDeviceError.js +18 -0
- package/dist/module/Errors/catalog/ExtendedError.js +10 -0
- package/dist/module/Errors/catalog/LineError.js +24 -0
- package/dist/module/Errors/index.js +2 -0
- package/dist/module/Errors/types.js +48 -0
- package/dist/module/Events/impl/index.js +19 -0
- package/dist/module/Events/types.js +74 -0
- package/dist/module/Logger/index.js +114 -0
- package/dist/module/Logger/types.js +25 -0
- package/dist/module/Metrics/index.js +232 -0
- package/dist/module/Metrics/types.js +37 -0
- package/dist/module/SDKConnector/index.js +39 -0
- package/dist/module/SDKConnector/types.js +1 -0
- package/dist/module/SDKConnector/utils.js +12 -0
- package/dist/module/Voicemail/BroadworksBackendConnector.js +289 -0
- package/dist/module/Voicemail/UcmBackendConnector.js +275 -0
- package/dist/module/Voicemail/Voicemail.js +110 -0
- package/dist/module/Voicemail/WxCallBackendConnector.js +279 -0
- package/dist/module/Voicemail/constants.js +29 -0
- package/dist/module/Voicemail/types.js +1 -0
- package/dist/module/Voicemail/voicemailFixture.js +449 -0
- package/dist/module/common/Utils.js +802 -0
- package/dist/module/common/constants.js +40 -0
- package/dist/module/common/index.js +1 -0
- package/dist/module/common/testUtil.js +938 -0
- package/dist/module/common/types.js +57 -0
- package/dist/module/index.js +8 -0
- package/dist/types/CallHistory/CallHistory.d.ts +19 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -0
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +95 -0
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -0
- package/dist/types/CallHistory/constants.d.ts +10 -0
- package/dist/types/CallHistory/constants.d.ts.map +1 -0
- package/dist/types/CallHistory/types.d.ts +21 -0
- package/dist/types/CallHistory/types.d.ts.map +1 -0
- package/dist/types/CallSettings/CallSettings.d.ts +20 -0
- package/dist/types/CallSettings/CallSettings.d.ts.map +1 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +20 -0
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -0
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts +22 -0
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts.map +1 -0
- package/dist/types/CallSettings/constants.d.ts +12 -0
- package/dist/types/CallSettings/constants.d.ts.map +1 -0
- package/dist/types/CallSettings/testFixtures.d.ts +16 -0
- package/dist/types/CallSettings/testFixtures.d.ts.map +1 -0
- package/dist/types/CallSettings/types.d.ts +108 -0
- package/dist/types/CallSettings/types.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +38 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -0
- package/dist/types/CallingClient/callRecordFixtures.d.ts +4 -0
- package/dist/types/CallingClient/callRecordFixtures.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/CallerId/index.d.ts +18 -0
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/CallerId/types.d.ts +42 -0
- package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/call.d.ts +95 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/callManager.d.ts +22 -0
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/index.d.ts +3 -0
- package/dist/types/CallingClient/calling/index.d.ts.map +1 -0
- package/dist/types/CallingClient/calling/types.d.ts +204 -0
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -0
- package/dist/types/CallingClient/callingClientFixtures.d.ts +19 -0
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -0
- package/dist/types/CallingClient/constants.d.ts +123 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -0
- package/dist/types/CallingClient/line/index.d.ts +39 -0
- package/dist/types/CallingClient/line/index.d.ts.map +1 -0
- package/dist/types/CallingClient/line/types.d.ts +51 -0
- package/dist/types/CallingClient/line/types.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/index.d.ts +2 -0
- package/dist/types/CallingClient/registration/index.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/register.d.ts +65 -0
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/registerFixtures.d.ts +29 -0
- package/dist/types/CallingClient/registration/registerFixtures.d.ts.map +1 -0
- package/dist/types/CallingClient/registration/types.d.ts +21 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -0
- package/dist/types/CallingClient/types.d.ts +30 -0
- package/dist/types/CallingClient/types.d.ts.map +1 -0
- package/dist/types/Contacts/ContactsClient.d.ts +28 -0
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -0
- package/dist/types/Contacts/constants.d.ts +20 -0
- package/dist/types/Contacts/constants.d.ts.map +1 -0
- package/dist/types/Contacts/contactFixtures.d.ts +281 -0
- package/dist/types/Contacts/contactFixtures.d.ts.map +1 -0
- package/dist/types/Contacts/types.d.ts +75 -0
- package/dist/types/Contacts/types.d.ts.map +1 -0
- package/dist/types/Errors/catalog/CallError.d.ts +12 -0
- package/dist/types/Errors/catalog/CallError.d.ts.map +1 -0
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +11 -0
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -0
- package/dist/types/Errors/catalog/ExtendedError.d.ts +7 -0
- package/dist/types/Errors/catalog/ExtendedError.d.ts.map +1 -0
- package/dist/types/Errors/catalog/LineError.d.ts +11 -0
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -0
- package/dist/types/Errors/index.d.ts +3 -0
- package/dist/types/Errors/index.d.ts.map +1 -0
- package/dist/types/Errors/types.d.ts +61 -0
- package/dist/types/Errors/types.d.ts.map +1 -0
- package/dist/types/Events/impl/index.d.ts +9 -0
- package/dist/types/Events/impl/index.d.ts.map +1 -0
- package/dist/types/Events/types.d.ts +284 -0
- package/dist/types/Events/types.d.ts.map +1 -0
- package/dist/types/Logger/index.d.ts +13 -0
- package/dist/types/Logger/index.d.ts.map +1 -0
- package/dist/types/Logger/types.d.ts +26 -0
- package/dist/types/Logger/types.d.ts.map +1 -0
- package/dist/types/Metrics/index.d.ts +6 -0
- package/dist/types/Metrics/index.d.ts.map +1 -0
- package/dist/types/Metrics/types.d.ts +43 -0
- package/dist/types/Metrics/types.d.ts.map +1 -0
- package/dist/types/SDKConnector/index.d.ts +13 -0
- package/dist/types/SDKConnector/index.d.ts.map +1 -0
- package/dist/types/SDKConnector/types.d.ts +129 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -0
- package/dist/types/SDKConnector/utils.d.ts +6 -0
- package/dist/types/SDKConnector/utils.d.ts.map +1 -0
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +28 -0
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts.map +1 -0
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +35 -0
- package/dist/types/Voicemail/UcmBackendConnector.d.ts.map +1 -0
- package/dist/types/Voicemail/Voicemail.d.ts +28 -0
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -0
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +24 -0
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts.map +1 -0
- package/dist/types/Voicemail/constants.d.ts +30 -0
- package/dist/types/Voicemail/constants.d.ts.map +1 -0
- package/dist/types/Voicemail/types.d.ts +134 -0
- package/dist/types/Voicemail/types.d.ts.map +1 -0
- package/dist/types/Voicemail/voicemailFixture.d.ts +350 -0
- package/dist/types/Voicemail/voicemailFixture.d.ts.map +1 -0
- package/dist/types/common/Utils.d.ts +35 -0
- package/dist/types/common/Utils.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +41 -0
- package/dist/types/common/constants.d.ts.map +1 -0
- package/dist/types/common/index.d.ts +2 -0
- package/dist/types/common/index.d.ts.map +1 -0
- package/dist/types/common/testUtil.d.ts +3612 -0
- package/dist/types/common/testUtil.d.ts.map +1 -0
- package/dist/types/common/types.d.ts +192 -0
- package/dist/types/common/types.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +161 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# web-calling-sdk
|
|
2
|
+
|
|
3
|
+
> A framework for interacting with Web Calling API across multiple browsers.
|
|
4
|
+
|
|
5
|
+
> API guide https://sqbu-github.cisco.com/pages/webrtc-calling/mobius/mobius-api-spec/docs/
|
|
6
|
+
> Registration flow details https://wiki.cisco.com/display/IPCBU/Registration+Flows
|
|
7
|
+
> Calling SDK API https://wiki.cisco.com/display/IPCBU/Calling+SDK+API
|
|
8
|
+
|
|
9
|
+
## Developing
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
git clone https://github.com/webex/webex-js-sdk.git
|
|
13
|
+
cd web-js-sdk/
|
|
14
|
+
yarn i
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Building
|
|
18
|
+
|
|
19
|
+
If your project needs some additional steps for the developer to build the
|
|
20
|
+
project after some code changes, state them here:
|
|
21
|
+
|
|
22
|
+
```shell
|
|
23
|
+
yarn workspaces foreach --parallel --verbose run build:src
|
|
24
|
+
|
|
25
|
+
yarn workspace @webex/calling run build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Testing
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
yarn workspace @webex/calling run test
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Testing on samples // This will change in future for now
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
yarn workspace @webex/calling run build:browser
|
|
39
|
+
yarn run samples:serve
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
### Deploying / Publishing
|
|
44
|
+
|
|
45
|
+
In case there's some step you have to take that publishes this project to a
|
|
46
|
+
server, this is the right time to state it.
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
yarn release
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Consuming the SDK
|
|
53
|
+
|
|
54
|
+
The Calling SDK package can be incorporated into an existing project by updating the .npmrc and package.json. Add the line pasted below to get access to the calling-sdk package located in the artifactory.
|
|
55
|
+
|
|
56
|
+
```shell
|
|
57
|
+
@webex:registry=https://engci-maven.cisco.com/artifactory/api/npm/webex-npm-group
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use the following commands to update the package.json and package.lock/yarn.lock with the latest version of the calling-sdk package.
|
|
61
|
+
```shell
|
|
62
|
+
npm install @webex/web-calling-sdk
|
|
63
|
+
```
|
|
64
|
+
(or)
|
|
65
|
+
```shell
|
|
66
|
+
yarn add @webex/web-calling-sdk
|
|
67
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import SDKConnector from '../SDKConnector';
|
|
2
|
+
import { ALLOWED_SERVICES, HTTP_METHODS, SORT, SORT_BY } from '../common/types';
|
|
3
|
+
import log from '../Logger';
|
|
4
|
+
import { serviceErrorCodeHandler } from '../common/Utils';
|
|
5
|
+
import { CALL_HISTORY_FILE, FROM_DATE, HISTORY, LIMIT, NUMBER_OF_DAYS } from './constants';
|
|
6
|
+
import { STATUS_CODE, SUCCESS_MESSAGE, USER_SESSIONS } from '../common/constants';
|
|
7
|
+
import { EVENT_KEYS, MOBIUS_EVENT_KEYS, } from '../Events/types';
|
|
8
|
+
import { Eventing } from '../Events/impl';
|
|
9
|
+
export class CallHistory extends Eventing {
|
|
10
|
+
sdkConnector;
|
|
11
|
+
webex;
|
|
12
|
+
janusUrl = '';
|
|
13
|
+
fromDate = '';
|
|
14
|
+
loggerContext = {
|
|
15
|
+
file: CALL_HISTORY_FILE,
|
|
16
|
+
method: 'getCallHistoryData',
|
|
17
|
+
};
|
|
18
|
+
userSessions;
|
|
19
|
+
constructor(webex, logger) {
|
|
20
|
+
super();
|
|
21
|
+
this.sdkConnector = SDKConnector;
|
|
22
|
+
if (!this.sdkConnector.getWebex()) {
|
|
23
|
+
SDKConnector.setWebex(webex);
|
|
24
|
+
}
|
|
25
|
+
this.webex = this.sdkConnector.getWebex();
|
|
26
|
+
this.janusUrl = this.webex.internal.services._serviceUrls.janus;
|
|
27
|
+
this.registerSessionsListener();
|
|
28
|
+
log.setLogger(logger.level, CALL_HISTORY_FILE);
|
|
29
|
+
}
|
|
30
|
+
async getCallHistoryData(days = NUMBER_OF_DAYS, limit = LIMIT, sort = SORT.DEFAULT, sortBy = SORT_BY.DEFAULT) {
|
|
31
|
+
const date = new Date();
|
|
32
|
+
date.setDate(date.getDate() - days);
|
|
33
|
+
this.fromDate = date.toISOString();
|
|
34
|
+
const sortByParam = Object.values(SORT_BY).includes(sortBy) ? sortBy : SORT_BY.DEFAULT;
|
|
35
|
+
const sortParam = Object.values(SORT).includes(sort) ? sort : SORT.DEFAULT;
|
|
36
|
+
log.log(`Janus API URL ${this.janusUrl}`, this.loggerContext);
|
|
37
|
+
log.info(`Call history from date : ${this.fromDate}`, this.loggerContext);
|
|
38
|
+
log.info(`Call history sort type : ${sortParam}`, this.loggerContext);
|
|
39
|
+
log.info(`Call history sortby type : ${sortByParam}`, this.loggerContext);
|
|
40
|
+
const url = `${this.janusUrl}/${HISTORY}/${USER_SESSIONS}${FROM_DATE}=${this.fromDate}&limit=${limit}&includeNewSessionTypes=true&sort=${sortParam}`;
|
|
41
|
+
try {
|
|
42
|
+
const janusResponse = await this.webex.request({
|
|
43
|
+
uri: `${url}`,
|
|
44
|
+
method: HTTP_METHODS.GET,
|
|
45
|
+
service: ALLOWED_SERVICES.JANUS,
|
|
46
|
+
});
|
|
47
|
+
this.userSessions = janusResponse.body;
|
|
48
|
+
if (sortByParam === SORT_BY.START_TIME) {
|
|
49
|
+
if (sortParam === SORT.DESC) {
|
|
50
|
+
this.userSessions[USER_SESSIONS].sort((element, compareElement) => new Date(compareElement[sortByParam]).getTime() -
|
|
51
|
+
new Date(element[sortByParam]).getTime());
|
|
52
|
+
}
|
|
53
|
+
else if (sortParam === SORT.ASC) {
|
|
54
|
+
this.userSessions[USER_SESSIONS].sort((element, compareElement) => new Date(element[sortByParam]).getTime() -
|
|
55
|
+
new Date(compareElement[sortByParam]).getTime());
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const responseDetails = {
|
|
59
|
+
statusCode: this.userSessions[STATUS_CODE],
|
|
60
|
+
data: {
|
|
61
|
+
userSessions: this.userSessions[USER_SESSIONS],
|
|
62
|
+
},
|
|
63
|
+
message: SUCCESS_MESSAGE,
|
|
64
|
+
};
|
|
65
|
+
return responseDetails;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
const errorInfo = err;
|
|
69
|
+
const errorStatus = serviceErrorCodeHandler(errorInfo, this.loggerContext);
|
|
70
|
+
return errorStatus;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
getSDKConnector() {
|
|
74
|
+
return this.sdkConnector;
|
|
75
|
+
}
|
|
76
|
+
registerSessionsListener() {
|
|
77
|
+
this.sdkConnector.registerListener(MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE, async (event) => {
|
|
78
|
+
if (event && event.data.userSessions.userSessions) {
|
|
79
|
+
this.emit(EVENT_KEYS.CALL_HISTORY_USER_SESSION_INFO, event);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export const createCallHistoryClient = (webex, logger) => new CallHistory(webex, logger);
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { Disposition, MOBIUS_EVENT_KEYS, SessionType } from '../Events/types';
|
|
2
|
+
export const sortedCallHistory = {
|
|
3
|
+
body: {
|
|
4
|
+
statusCode: 200,
|
|
5
|
+
userSessions: [
|
|
6
|
+
{
|
|
7
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
8
|
+
durationSecs: 438,
|
|
9
|
+
self: {
|
|
10
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
11
|
+
name: 'Mark',
|
|
12
|
+
incomingCallProtocols: [],
|
|
13
|
+
callbackInfo: {
|
|
14
|
+
callbackAddress: 'test@cisco.com',
|
|
15
|
+
callbackType: 'EMAIL',
|
|
16
|
+
},
|
|
17
|
+
lookUpInfo: {
|
|
18
|
+
lookupLink: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
19
|
+
type: 'CONVERSATION',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
23
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
24
|
+
sessionType: 'SPARK',
|
|
25
|
+
startTime: '2022-08-09T10:45:21.565Z',
|
|
26
|
+
endTime: '2022-08-09T10:53:01.624Z',
|
|
27
|
+
direction: 'OUTGOING',
|
|
28
|
+
disposition: 'INITIATED',
|
|
29
|
+
other: {
|
|
30
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
31
|
+
name: 'test',
|
|
32
|
+
isPrivate: false,
|
|
33
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
34
|
+
},
|
|
35
|
+
durationSeconds: 438,
|
|
36
|
+
joinedDurationSeconds: 457,
|
|
37
|
+
participantCount: 2,
|
|
38
|
+
links: {
|
|
39
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
40
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
41
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
42
|
+
},
|
|
43
|
+
isDeleted: false,
|
|
44
|
+
isPMR: false,
|
|
45
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
49
|
+
durationSecs: 438,
|
|
50
|
+
self: {
|
|
51
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
52
|
+
name: 'Mark',
|
|
53
|
+
incomingCallProtocols: [],
|
|
54
|
+
callbackInfo: {
|
|
55
|
+
callbackAddress: 'test@cisco.com',
|
|
56
|
+
callbackType: 'EMAIL',
|
|
57
|
+
},
|
|
58
|
+
lookUpInfo: {
|
|
59
|
+
lookupLink: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
60
|
+
type: 'CONVERSATION',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
64
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
65
|
+
sessionType: 'SPARK',
|
|
66
|
+
startTime: '2022-08-22T10:45:21.565Z',
|
|
67
|
+
endTime: '2022-08-22T10:53:01.624Z',
|
|
68
|
+
direction: 'OUTGOING',
|
|
69
|
+
disposition: 'INITIATED',
|
|
70
|
+
other: {
|
|
71
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
72
|
+
name: 'test',
|
|
73
|
+
isPrivate: false,
|
|
74
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
75
|
+
},
|
|
76
|
+
durationSeconds: 438,
|
|
77
|
+
joinedDurationSeconds: 457,
|
|
78
|
+
participantCount: 2,
|
|
79
|
+
links: {
|
|
80
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
81
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
82
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
83
|
+
},
|
|
84
|
+
isDeleted: false,
|
|
85
|
+
isPMR: false,
|
|
86
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
90
|
+
durationSecs: 438,
|
|
91
|
+
self: {
|
|
92
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
93
|
+
name: 'Mark',
|
|
94
|
+
incomingCallProtocols: [],
|
|
95
|
+
callbackInfo: {
|
|
96
|
+
callbackAddress: 'test@cisco.com',
|
|
97
|
+
callbackType: 'EMAIL',
|
|
98
|
+
},
|
|
99
|
+
lookUpInfo: {
|
|
100
|
+
lookupLink: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
101
|
+
type: 'CONVERSATION',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
105
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
106
|
+
sessionType: 'SPARK',
|
|
107
|
+
startTime: '2022-08-30T10:45:21.565Z',
|
|
108
|
+
endTime: '2022-08-30T10:53:01.624Z',
|
|
109
|
+
direction: 'OUTGOING',
|
|
110
|
+
disposition: 'INITIATED',
|
|
111
|
+
other: {
|
|
112
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
113
|
+
name: 'test',
|
|
114
|
+
isPrivate: false,
|
|
115
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
116
|
+
},
|
|
117
|
+
durationSeconds: 438,
|
|
118
|
+
joinedDurationSeconds: 457,
|
|
119
|
+
participantCount: 2,
|
|
120
|
+
links: {
|
|
121
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
122
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
123
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
124
|
+
},
|
|
125
|
+
isDeleted: false,
|
|
126
|
+
isPMR: false,
|
|
127
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
export const mockCallHistoryBody = {
|
|
133
|
+
body: {
|
|
134
|
+
statusCode: 200,
|
|
135
|
+
userSessions: [
|
|
136
|
+
{
|
|
137
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
138
|
+
durationSecs: 438,
|
|
139
|
+
self: {
|
|
140
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
141
|
+
name: 'Mark',
|
|
142
|
+
incomingCallProtocols: [],
|
|
143
|
+
callbackInfo: {
|
|
144
|
+
callbackAddress: 'test@cisco.com',
|
|
145
|
+
callbackType: 'EMAIL',
|
|
146
|
+
},
|
|
147
|
+
lookUpInfo: {
|
|
148
|
+
lookupLink: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
149
|
+
type: 'CONVERSATION',
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
153
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
154
|
+
sessionType: 'SPARK',
|
|
155
|
+
startTime: '2022-08-22T10:45:21.565Z',
|
|
156
|
+
endTime: '2022-08-22T10:53:01.624Z',
|
|
157
|
+
direction: 'OUTGOING',
|
|
158
|
+
disposition: 'INITIATED',
|
|
159
|
+
other: {
|
|
160
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
161
|
+
name: 'test',
|
|
162
|
+
isPrivate: false,
|
|
163
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
164
|
+
},
|
|
165
|
+
durationSeconds: 438,
|
|
166
|
+
joinedDurationSeconds: 457,
|
|
167
|
+
participantCount: 2,
|
|
168
|
+
links: {
|
|
169
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
170
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
171
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
172
|
+
},
|
|
173
|
+
isDeleted: false,
|
|
174
|
+
isPMR: false,
|
|
175
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
179
|
+
durationSecs: 438,
|
|
180
|
+
self: {
|
|
181
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
182
|
+
name: 'Mark',
|
|
183
|
+
incomingCallProtocols: [],
|
|
184
|
+
callbackInfo: {
|
|
185
|
+
callbackAddress: 'test@cisco.com',
|
|
186
|
+
callbackType: 'EMAIL',
|
|
187
|
+
},
|
|
188
|
+
lookUpInfo: {
|
|
189
|
+
lookupLink: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
190
|
+
type: 'CONVERSATION',
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
194
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
195
|
+
sessionType: 'SPARK',
|
|
196
|
+
startTime: '2022-08-30T10:45:21.565Z',
|
|
197
|
+
endTime: '2022-08-30T10:53:01.624Z',
|
|
198
|
+
direction: 'OUTGOING',
|
|
199
|
+
disposition: 'INITIATED',
|
|
200
|
+
other: {
|
|
201
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
202
|
+
name: 'test',
|
|
203
|
+
isPrivate: false,
|
|
204
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
205
|
+
},
|
|
206
|
+
durationSeconds: 438,
|
|
207
|
+
joinedDurationSeconds: 457,
|
|
208
|
+
participantCount: 2,
|
|
209
|
+
links: {
|
|
210
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
211
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
212
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
213
|
+
},
|
|
214
|
+
isDeleted: false,
|
|
215
|
+
isPMR: false,
|
|
216
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
220
|
+
durationSecs: 438,
|
|
221
|
+
self: {
|
|
222
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
223
|
+
name: 'Mark',
|
|
224
|
+
incomingCallProtocols: [],
|
|
225
|
+
callbackInfo: {
|
|
226
|
+
callbackAddress: 'test@cisco.com',
|
|
227
|
+
callbackType: 'EMAIL',
|
|
228
|
+
},
|
|
229
|
+
lookUpInfo: {
|
|
230
|
+
lookupLink: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
231
|
+
type: 'CONVERSATION',
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
235
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
236
|
+
sessionType: 'SPARK',
|
|
237
|
+
startTime: '2022-08-09T10:45:21.565Z',
|
|
238
|
+
endTime: '2022-08-09T10:53:01.624Z',
|
|
239
|
+
direction: 'OUTGOING',
|
|
240
|
+
disposition: 'INITIATED',
|
|
241
|
+
other: {
|
|
242
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
243
|
+
name: 'test',
|
|
244
|
+
isPrivate: false,
|
|
245
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
246
|
+
},
|
|
247
|
+
durationSeconds: 438,
|
|
248
|
+
joinedDurationSeconds: 457,
|
|
249
|
+
participantCount: 2,
|
|
250
|
+
links: {
|
|
251
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
252
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
253
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
254
|
+
},
|
|
255
|
+
isDeleted: false,
|
|
256
|
+
isPMR: false,
|
|
257
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
const WEBEX_CALL_SESSION = {
|
|
263
|
+
id: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
264
|
+
durationSecs: 438,
|
|
265
|
+
self: {
|
|
266
|
+
id: 'a24027e7-9b6e-4047-a950-42f4492148ec',
|
|
267
|
+
name: 'Mark',
|
|
268
|
+
phoneNumber: '123456',
|
|
269
|
+
},
|
|
270
|
+
url: 'https://janus-a.wbx2.com/janus/api/v1/history/userSessions/d74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
271
|
+
sessionId: 'd74d19cc-6aa7-f341-6012-aec433cc6f8d',
|
|
272
|
+
sessionType: SessionType.WEBEX_CALLING,
|
|
273
|
+
startTime: '2022-08-02T10:45:21.565Z',
|
|
274
|
+
endTime: '2022-08-02T10:53:01.624Z',
|
|
275
|
+
direction: 'OUTGOING',
|
|
276
|
+
disposition: Disposition.INITIATED,
|
|
277
|
+
other: {
|
|
278
|
+
id: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
279
|
+
name: 'test',
|
|
280
|
+
isPrivate: false,
|
|
281
|
+
callbackAddress: 'c9bde63c-e3e2-4db4-ba45-0d6c698ffd65',
|
|
282
|
+
phoneNumber: '123456679',
|
|
283
|
+
},
|
|
284
|
+
durationSeconds: 438,
|
|
285
|
+
joinedDurationSeconds: 457,
|
|
286
|
+
participantCount: 2,
|
|
287
|
+
links: {
|
|
288
|
+
locusUrl: 'https://locus-a.wbx2.com/locus/api/v1/loci/f5dbe4da-663b-3f73-a2fc-3a2fb0f12080',
|
|
289
|
+
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
290
|
+
callbackAddress: '123-456-7890',
|
|
291
|
+
},
|
|
292
|
+
isDeleted: false,
|
|
293
|
+
isPMR: false,
|
|
294
|
+
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
295
|
+
};
|
|
296
|
+
export const MOCK_SESSION_EVENT = {
|
|
297
|
+
id: 'id',
|
|
298
|
+
data: {
|
|
299
|
+
userSessions: {
|
|
300
|
+
userSessions: [WEBEX_CALL_SESSION],
|
|
301
|
+
statusCode: 0,
|
|
302
|
+
},
|
|
303
|
+
eventType: MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE,
|
|
304
|
+
},
|
|
305
|
+
timestamp: 12345,
|
|
306
|
+
trackingId: 'tracking-id',
|
|
307
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const CALL_HISTORY_FILE = 'CallHistory';
|
|
2
|
+
export const FROM_DATE = '?from';
|
|
3
|
+
export const HISTORY = 'history';
|
|
4
|
+
export const LIMIT = 50;
|
|
5
|
+
export const NUMBER_OF_DAYS = 10;
|
|
6
|
+
export const RESPONSE_MESSAGE = 'responseMessage';
|
|
7
|
+
export const SUCCESS_MESSAGE = 'SUCCESS';
|
|
8
|
+
export const STATUS_CODE = 'statusCode';
|
|
9
|
+
export const USER_SESSIONS = 'userSessions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +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);
|
|
@@ -0,0 +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
|
+
}
|