@webex/calling 3.0.0-next.2 → 3.0.0-next.21
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 -0
- package/dist/CallHistory/CallHistory.js +1 -3
- package/dist/CallHistory/CallHistory.js.map +1 -1
- package/dist/CallHistory/callHistoryFixtures.js +9 -0
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -1
- package/dist/CallHistory/types.js.map +1 -1
- package/dist/CallSettings/CallSettings.js +0 -2
- package/dist/CallSettings/CallSettings.js.map +1 -1
- package/dist/CallSettings/types.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +119 -62
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +161 -102
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +3 -23
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -1
- package/dist/CallingClient/calling/call.js +78 -33
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +483 -351
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/calling/callManager.js +0 -9
- package/dist/CallingClient/calling/callManager.js.map +1 -1
- package/dist/CallingClient/calling/callManager.test.js +1 -1
- package/dist/CallingClient/calling/callManager.test.js.map +1 -1
- package/dist/CallingClient/calling/types.js.map +1 -1
- package/dist/CallingClient/callingClientFixtures.js +107 -1
- package/dist/CallingClient/callingClientFixtures.js.map +1 -1
- package/dist/CallingClient/constants.js +14 -6
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +12 -12
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +9 -9
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/line/types.js +4 -7
- package/dist/CallingClient/line/types.js.map +1 -1
- package/dist/CallingClient/registration/register.js +62 -80
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +28 -28
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/Contacts/ContactsClient.js +8 -2
- package/dist/Contacts/ContactsClient.js.map +1 -1
- package/dist/Contacts/types.js +3 -0
- package/dist/Contacts/types.js.map +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js +1 -1
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -1
- package/dist/Errors/catalog/LineError.js +2 -2
- package/dist/Errors/catalog/LineError.js.map +1 -1
- package/dist/Errors/index.js +7 -0
- package/dist/Errors/index.js.map +1 -1
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js +0 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/Metrics/index.test.js +1 -1
- package/dist/Metrics/index.test.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/Voicemail/Voicemail.js +18 -21
- package/dist/Voicemail/Voicemail.js.map +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js +1 -1
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -1
- package/dist/Voicemail/types.js.map +1 -1
- package/dist/api.js +43 -20
- package/dist/api.js.map +1 -1
- package/dist/common/Utils.js +13 -18
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +1 -1
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/testUtil.js +2 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/common/types.js +8 -7
- package/dist/common/types.js.map +1 -1
- package/dist/index.js +233 -0
- package/dist/index.js.map +1 -1
- package/dist/module/CallHistory/callHistoryFixtures.js +9 -0
- package/dist/module/CallingClient/CallingClient.js +59 -42
- package/dist/module/CallingClient/calling/CallerId/index.js +3 -23
- package/dist/module/CallingClient/calling/call.js +54 -17
- package/dist/module/CallingClient/calling/callManager.js +0 -6
- package/dist/module/CallingClient/callingClientFixtures.js +119 -1
- package/dist/module/CallingClient/constants.js +8 -4
- package/dist/module/CallingClient/line/index.js +7 -10
- package/dist/module/CallingClient/line/types.js +0 -5
- package/dist/module/CallingClient/registration/register.js +28 -20
- package/dist/module/Contacts/ContactsClient.js +3 -0
- package/dist/module/Errors/catalog/CallingDeviceError.js +2 -2
- package/dist/module/Errors/catalog/LineError.js +2 -2
- package/dist/module/Errors/index.js +1 -0
- package/dist/module/api.js +6 -5
- package/dist/module/common/Utils.js +14 -19
- package/dist/module/common/testUtil.js +2 -1
- package/dist/module/common/types.js +6 -5
- package/dist/module/index.js +7 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
- package/dist/types/CallSettings/CallSettings.d.ts.map +1 -1
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +2 -0
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/index.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +2 -0
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +0 -1
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +30 -30
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts +69 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +7 -3
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +4 -5
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/line/types.d.ts +8 -13
- package/dist/types/CallingClient/line/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -3
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +14 -14
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +6 -4
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +3 -2
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- package/dist/types/Contacts/types.d.ts +2 -0
- package/dist/types/Contacts/types.d.ts.map +1 -1
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +4 -4
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts.map +1 -1
- package/dist/types/Errors/catalog/LineError.d.ts +4 -4
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
- package/dist/types/Errors/index.d.ts +1 -0
- package/dist/types/Errors/index.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -3
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +11 -0
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +2 -1
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/Voicemail.d.ts.map +1 -1
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +1 -1
- package/dist/types/Voicemail/types.d.ts +10 -10
- package/dist/types/Voicemail/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +10 -10
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +1 -0
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +3 -2
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -289,6 +289,15 @@ const WEBEX_CALL_SESSION = {
|
|
|
289
289
|
conversationUrl: 'https://conv-a.wbx2.com/conversation/api/v1/conversations/c9252ff0-9de2-11ec-a582-59d00c02cca9',
|
|
290
290
|
callbackAddress: '123-456-7890',
|
|
291
291
|
},
|
|
292
|
+
callingSpecifics: {
|
|
293
|
+
redirectionDetails: {
|
|
294
|
+
phoneNumber: '+18308508011',
|
|
295
|
+
name: 'Test QA Call Center',
|
|
296
|
+
reason: 'CALLQUEUE',
|
|
297
|
+
userId: '604a966d-7518-4b74-8d78-6c05caf98239',
|
|
298
|
+
isPrivate: false,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
292
301
|
isDeleted: false,
|
|
293
302
|
isPMR: false,
|
|
294
303
|
correlationIds: ['58ea6cd9-852b-4a77-957f-e704c8b0e63e'],
|
|
@@ -5,12 +5,11 @@ import { LOGGER } from '../Logger/types';
|
|
|
5
5
|
import SDKConnector from '../SDKConnector';
|
|
6
6
|
import { Eventing } from '../Events/impl';
|
|
7
7
|
import { MOBIUS_EVENT_KEYS, SessionType, CALLING_CLIENT_EVENT_KEYS, } from '../Events/types';
|
|
8
|
-
import { ServiceIndicator, ALLOWED_SERVICES, HTTP_METHODS, } from '../common/types';
|
|
8
|
+
import { ServiceIndicator, ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, } from '../common/types';
|
|
9
9
|
import log from '../Logger';
|
|
10
10
|
import { getCallManager } from './calling/callManager';
|
|
11
|
-
import { CALLING_CLIENT_FILE, CALLS_CLEARED_HANDLER_UTIL, CALLING_USER_AGENT, CISCO_DEVICE_URL, DISCOVERY_URL, GET_MOBIUS_SERVERS_UTIL, IP_ENDPOINT, SPARK_USER_AGENT, URL_ENDPOINT, NETWORK_FLAP_TIMEOUT, } from './constants';
|
|
11
|
+
import { CALLING_CLIENT_FILE, CALLS_CLEARED_HANDLER_UTIL, CALLING_USER_AGENT, CISCO_DEVICE_URL, DISCOVERY_URL, GET_MOBIUS_SERVERS_UTIL, IP_ENDPOINT, SPARK_USER_AGENT, URL_ENDPOINT, NETWORK_FLAP_TIMEOUT, API_V1, MOBIUS_US_PROD, MOBIUS_EU_PROD, MOBIUS_US_INT, MOBIUS_EU_INT, } from './constants';
|
|
12
12
|
import Line from './line';
|
|
13
|
-
import { LINE_EVENTS, LineStatus } from './line/types';
|
|
14
13
|
import { METRIC_EVENT, REG_ACTION, METRIC_TYPE } from '../Metrics/types';
|
|
15
14
|
import { getMetricManager } from '../Metrics';
|
|
16
15
|
export class CallingClient extends Eventing {
|
|
@@ -22,6 +21,8 @@ export class CallingClient extends Eventing {
|
|
|
22
21
|
sdkConfig;
|
|
23
22
|
primaryMobiusUris;
|
|
24
23
|
backupMobiusUris;
|
|
24
|
+
mobiusClusters;
|
|
25
|
+
mobiusHost;
|
|
25
26
|
mediaEngine;
|
|
26
27
|
lineDict = {};
|
|
27
28
|
constructor(webex, config) {
|
|
@@ -43,6 +44,12 @@ export class CallingClient extends Eventing {
|
|
|
43
44
|
this.mediaEngine = Media;
|
|
44
45
|
this.primaryMobiusUris = [];
|
|
45
46
|
this.backupMobiusUris = [];
|
|
47
|
+
this.mobiusClusters =
|
|
48
|
+
this.webex.internal.services._hostCatalog[MOBIUS_US_PROD] ||
|
|
49
|
+
this.webex.internal.services._hostCatalog[MOBIUS_EU_PROD] ||
|
|
50
|
+
this.webex.internal.services._hostCatalog[MOBIUS_US_INT] ||
|
|
51
|
+
this.webex.internal.services._hostCatalog[MOBIUS_EU_INT];
|
|
52
|
+
this.mobiusHost = '';
|
|
46
53
|
this.registerSessionsListener();
|
|
47
54
|
log.setLogger(logLevel, CALLING_CLIENT_FILE);
|
|
48
55
|
this.registerCallsClearedListener();
|
|
@@ -63,47 +70,57 @@ export class CallingClient extends Eventing {
|
|
|
63
70
|
file: CALLING_CLIENT_FILE,
|
|
64
71
|
method: this.detectNetworkChange.name,
|
|
65
72
|
});
|
|
66
|
-
line.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
67
73
|
line.registration.clearKeepaliveTimer();
|
|
68
74
|
retry = true;
|
|
69
75
|
}
|
|
70
76
|
if (retry && this.webex.internal.mercury.connected) {
|
|
71
|
-
|
|
77
|
+
if (line.getStatus() !== RegistrationStatus.IDLE) {
|
|
78
|
+
retry = await line.registration.handleConnectionRestoration(retry);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
retry = false;
|
|
82
|
+
}
|
|
72
83
|
}
|
|
73
84
|
}, NETWORK_FLAP_TIMEOUT);
|
|
74
85
|
}
|
|
75
86
|
async getClientRegionInfo() {
|
|
76
87
|
const regionInfo = {};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
88
|
+
for (const mobius of this.mobiusClusters) {
|
|
89
|
+
this.mobiusHost = `https://${mobius.host}${API_V1}`;
|
|
90
|
+
try {
|
|
91
|
+
const temp = await this.webex.request({
|
|
92
|
+
uri: `${this.mobiusHost}${URL_ENDPOINT}${IP_ENDPOINT}`,
|
|
93
|
+
method: HTTP_METHODS.GET,
|
|
94
|
+
headers: {
|
|
95
|
+
[CISCO_DEVICE_URL]: this.webex.internal.device.url,
|
|
96
|
+
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
97
|
+
},
|
|
98
|
+
service: ALLOWED_SERVICES.MOBIUS,
|
|
99
|
+
});
|
|
100
|
+
const myIP = temp.body.ipv4;
|
|
101
|
+
const response = await this.webex.request({
|
|
102
|
+
uri: `${DISCOVERY_URL}/${myIP}`,
|
|
103
|
+
method: HTTP_METHODS.GET,
|
|
104
|
+
addAuthHeader: false,
|
|
105
|
+
headers: {
|
|
106
|
+
[SPARK_USER_AGENT]: null,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
const clientRegionInfo = response.body;
|
|
110
|
+
regionInfo.clientRegion = clientRegionInfo?.clientRegion
|
|
111
|
+
? clientRegionInfo.clientRegion
|
|
112
|
+
: '';
|
|
113
|
+
regionInfo.countryCode = clientRegionInfo?.countryCode ? clientRegionInfo.countryCode : '';
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
catch (err) {
|
|
117
|
+
handleCallingClientErrors(err, (clientError) => {
|
|
118
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, clientError);
|
|
119
|
+
this.emit(CALLING_CLIENT_EVENT_KEYS.ERROR, clientError);
|
|
120
|
+
}, { method: GET_MOBIUS_SERVERS_UTIL, file: CALLING_CLIENT_FILE });
|
|
121
|
+
regionInfo.clientRegion = '';
|
|
122
|
+
regionInfo.countryCode = '';
|
|
123
|
+
}
|
|
107
124
|
}
|
|
108
125
|
return regionInfo;
|
|
109
126
|
}
|
|
@@ -118,6 +135,7 @@ export class CallingClient extends Eventing {
|
|
|
118
135
|
});
|
|
119
136
|
clientRegion = this.sdkConfig?.discovery?.region;
|
|
120
137
|
countryCode = this.sdkConfig?.discovery?.country;
|
|
138
|
+
this.mobiusHost = this.webex.internal.services._serviceUrls.mobius;
|
|
121
139
|
}
|
|
122
140
|
else {
|
|
123
141
|
log.info('Updating region and country through Region discovery', {
|
|
@@ -132,7 +150,7 @@ export class CallingClient extends Eventing {
|
|
|
132
150
|
log.log(`Found Region: ${clientRegion} and country: ${countryCode}, going to fetch Mobius server`, '');
|
|
133
151
|
try {
|
|
134
152
|
const temp = await this.webex.request({
|
|
135
|
-
uri: `${this.
|
|
153
|
+
uri: `${this.mobiusHost}${URL_ENDPOINT}?regionCode=${clientRegion}&countryCode=${countryCode}`,
|
|
136
154
|
method: HTTP_METHODS.GET,
|
|
137
155
|
headers: {
|
|
138
156
|
[CISCO_DEVICE_URL]: this.webex.internal.device.url,
|
|
@@ -142,7 +160,7 @@ export class CallingClient extends Eventing {
|
|
|
142
160
|
});
|
|
143
161
|
log.log('Mobius Server found for the region', '');
|
|
144
162
|
const mobiusServers = temp.body;
|
|
145
|
-
const mobiusUris = filterMobiusUris(mobiusServers, this.
|
|
163
|
+
const mobiusUris = filterMobiusUris(mobiusServers, this.mobiusHost);
|
|
146
164
|
this.primaryMobiusUris = mobiusUris.primary;
|
|
147
165
|
this.backupMobiusUris = mobiusUris.backup;
|
|
148
166
|
log.info(`Final list of Mobius Servers, primary: ${mobiusUris.primary} and backup: ${mobiusUris.backup}`, '');
|
|
@@ -159,10 +177,9 @@ export class CallingClient extends Eventing {
|
|
|
159
177
|
useDefault = true;
|
|
160
178
|
}
|
|
161
179
|
if (useDefault) {
|
|
162
|
-
log.warn('
|
|
163
|
-
this.
|
|
164
|
-
|
|
165
|
-
];
|
|
180
|
+
log.warn(`Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers`, '');
|
|
181
|
+
this.mobiusHost = `https://${this.mobiusClusters[0].host}${API_V1}`;
|
|
182
|
+
this.primaryMobiusUris = [`${this.mobiusHost}${URL_ENDPOINT}`];
|
|
166
183
|
}
|
|
167
184
|
}
|
|
168
185
|
registerCallsClearedListener() {
|
|
@@ -212,7 +229,7 @@ export class CallingClient extends Eventing {
|
|
|
212
229
|
});
|
|
213
230
|
}
|
|
214
231
|
async createLine() {
|
|
215
|
-
const line = new Line(this.webex.internal.device.userId, this.webex.internal.device.url,
|
|
232
|
+
const line = new Line(this.webex.internal.device.userId, this.webex.internal.device.url, this.mutex, this.primaryMobiusUris, this.backupMobiusUris, this.getLoggingLevel(), this.sdkConfig?.serviceData);
|
|
216
233
|
this.lineDict[line.lineId] = line;
|
|
217
234
|
}
|
|
218
235
|
getLines() {
|
|
@@ -79,10 +79,6 @@ export class CallerId {
|
|
|
79
79
|
const num = data.substring(data.indexOf(':') + 1, data.length);
|
|
80
80
|
if (nameMatch) {
|
|
81
81
|
result.name = nameMatch[0].trimEnd();
|
|
82
|
-
log.info(`Parsed Name: ${result.name}`, {
|
|
83
|
-
file: CALLER_ID_FILE,
|
|
84
|
-
method: 'parseSipUri',
|
|
85
|
-
});
|
|
86
82
|
}
|
|
87
83
|
else {
|
|
88
84
|
log.warn(`Name field not found!`, {
|
|
@@ -93,10 +89,6 @@ export class CallerId {
|
|
|
93
89
|
const phoneMatch = num.match(VALID_PHONE);
|
|
94
90
|
if (phoneMatch && phoneMatch[0].length === num.length) {
|
|
95
91
|
result.num = num;
|
|
96
|
-
log.info(`Parsed Number: ${result.num}`, {
|
|
97
|
-
file: CALLER_ID_FILE,
|
|
98
|
-
method: 'parseSipUri',
|
|
99
|
-
});
|
|
100
92
|
}
|
|
101
93
|
else {
|
|
102
94
|
log.warn(`Number field not found!`, {
|
|
@@ -112,28 +104,20 @@ export class CallerId {
|
|
|
112
104
|
this.callerInfo.name = undefined;
|
|
113
105
|
this.callerInfo.num = undefined;
|
|
114
106
|
if ('p-asserted-identity' in callerId) {
|
|
115
|
-
log.info(
|
|
107
|
+
log.info('Parsing p-asserted-identity within remote party information', {
|
|
116
108
|
file: CALLER_ID_FILE,
|
|
117
109
|
method: 'fetchCallerDetails',
|
|
118
110
|
});
|
|
119
111
|
const result = this.parseSipUri(callerId['p-asserted-identity']);
|
|
120
112
|
this.callerInfo.name = result.name;
|
|
121
113
|
this.callerInfo.num = result.num;
|
|
122
|
-
log.info(`CallerId retrieved from p-asserted-identity: name: ${this.callerInfo.name} , num: ${this.callerInfo.num}`, {
|
|
123
|
-
file: CALLER_ID_FILE,
|
|
124
|
-
method: 'fetchCallerDetails',
|
|
125
|
-
});
|
|
126
114
|
}
|
|
127
115
|
if (callerId.from) {
|
|
128
|
-
log.info(
|
|
116
|
+
log.info('Parsing from header within the remote party information', {
|
|
129
117
|
file: CALLER_ID_FILE,
|
|
130
118
|
method: 'fetchCallerDetails',
|
|
131
119
|
});
|
|
132
120
|
const result = this.parseSipUri(callerId.from);
|
|
133
|
-
log.info(`CallerId retrieved from FROM: name: ${result.name} , num: ${result.num}`, {
|
|
134
|
-
file: CALLER_ID_FILE,
|
|
135
|
-
method: 'fetchCallerDetails',
|
|
136
|
-
});
|
|
137
121
|
if (!this.callerInfo.name && result.name) {
|
|
138
122
|
log.info('Updating name field from From header', {
|
|
139
123
|
file: CALLER_ID_FILE,
|
|
@@ -153,16 +137,12 @@ export class CallerId {
|
|
|
153
137
|
this.emitter(this.callerInfo);
|
|
154
138
|
}
|
|
155
139
|
if ('x-broadworks-remote-party-info' in callerId) {
|
|
156
|
-
log.info(
|
|
140
|
+
log.info('Parsing x-broadworks-remote-party-info within remote party information', {
|
|
157
141
|
file: CALLER_ID_FILE,
|
|
158
142
|
method: 'fetchCallerDetails',
|
|
159
143
|
});
|
|
160
144
|
this.parseRemotePartyInfo(callerId['x-broadworks-remote-party-info']);
|
|
161
145
|
}
|
|
162
|
-
log.log(`Intermediate callerId :- name: ${this.callerInfo.name} , num: ${this.callerInfo.num}`, {
|
|
163
|
-
file: CALLER_ID_FILE,
|
|
164
|
-
method: 'fetchCallerDetails',
|
|
165
|
-
});
|
|
166
146
|
return this.callerInfo;
|
|
167
147
|
}
|
|
168
148
|
}
|
|
@@ -31,6 +31,7 @@ export class Call extends Eventing {
|
|
|
31
31
|
mediaConnection;
|
|
32
32
|
earlyMedia;
|
|
33
33
|
connected;
|
|
34
|
+
mediaInactivity;
|
|
34
35
|
callerInfo;
|
|
35
36
|
localRoapMessage;
|
|
36
37
|
mobiusUrl;
|
|
@@ -72,6 +73,7 @@ export class Call extends Eventing {
|
|
|
72
73
|
this.correlationId = uuid();
|
|
73
74
|
this.deleteCb = deleteCb;
|
|
74
75
|
this.connected = false;
|
|
76
|
+
this.mediaInactivity = false;
|
|
75
77
|
this.held = false;
|
|
76
78
|
this.earlyMedia = false;
|
|
77
79
|
this.callerInfo = {};
|
|
@@ -79,7 +81,7 @@ export class Call extends Eventing {
|
|
|
79
81
|
this.mobiusUrl = activeUrl;
|
|
80
82
|
this.receivedRoapOKSeq = 0;
|
|
81
83
|
this.mediaNegotiationCompleted = false;
|
|
82
|
-
log.info(`
|
|
84
|
+
log.info(`Webex Calling Url:- ${this.mobiusUrl}`, {
|
|
83
85
|
file: CALL_FILE,
|
|
84
86
|
method: 'constructor',
|
|
85
87
|
});
|
|
@@ -577,7 +579,7 @@ export class Call extends Eventing {
|
|
|
577
579
|
this.setCallId(response.body.callId);
|
|
578
580
|
}
|
|
579
581
|
catch (e) {
|
|
580
|
-
log.warn('
|
|
582
|
+
log.warn('Failed to setup the call', {
|
|
581
583
|
file: CALL_FILE,
|
|
582
584
|
method: this.handleOutgoingCallSetup.name,
|
|
583
585
|
});
|
|
@@ -614,7 +616,7 @@ export class Call extends Eventing {
|
|
|
614
616
|
}
|
|
615
617
|
}
|
|
616
618
|
catch (e) {
|
|
617
|
-
log.warn('
|
|
619
|
+
log.warn('Failed to put the call on hold', {
|
|
618
620
|
file: CALL_FILE,
|
|
619
621
|
method: this.handleCallHold.name,
|
|
620
622
|
});
|
|
@@ -651,7 +653,7 @@ export class Call extends Eventing {
|
|
|
651
653
|
}
|
|
652
654
|
}
|
|
653
655
|
catch (e) {
|
|
654
|
-
log.warn('
|
|
656
|
+
log.warn('Failed to resume the call', {
|
|
655
657
|
file: CALL_FILE,
|
|
656
658
|
method: this.handleCallResume.name,
|
|
657
659
|
});
|
|
@@ -735,7 +737,7 @@ export class Call extends Eventing {
|
|
|
735
737
|
});
|
|
736
738
|
}
|
|
737
739
|
catch (err) {
|
|
738
|
-
log.warn('
|
|
740
|
+
log.warn('Failed to signal call progression', {
|
|
739
741
|
file: CALL_FILE,
|
|
740
742
|
method: this.handleOutgoingCallAlerting.name,
|
|
741
743
|
});
|
|
@@ -771,15 +773,15 @@ export class Call extends Eventing {
|
|
|
771
773
|
return;
|
|
772
774
|
}
|
|
773
775
|
try {
|
|
776
|
+
this.mediaConnection.roapMessageReceived(this.remoteRoapMessage);
|
|
774
777
|
const res = await this.patch(MobiusCallState.CONNECTED);
|
|
775
778
|
log.log(`PATCH response: ${res.statusCode}`, {
|
|
776
779
|
file: CALL_FILE,
|
|
777
780
|
method: this.handleOutgoingCallConnect.name,
|
|
778
781
|
});
|
|
779
|
-
this.mediaConnection.roapMessageReceived(this.remoteRoapMessage);
|
|
780
782
|
}
|
|
781
783
|
catch (err) {
|
|
782
|
-
log.warn('
|
|
784
|
+
log.warn('Failed to connect the call', {
|
|
783
785
|
file: CALL_FILE,
|
|
784
786
|
method: this.handleOutgoingCallConnect.name,
|
|
785
787
|
});
|
|
@@ -805,7 +807,7 @@ export class Call extends Eventing {
|
|
|
805
807
|
});
|
|
806
808
|
}
|
|
807
809
|
catch (e) {
|
|
808
|
-
log.warn('
|
|
810
|
+
log.warn('Failed to delete the call', {
|
|
809
811
|
file: CALL_FILE,
|
|
810
812
|
method: this.handleIncomingCallDisconnect.name,
|
|
811
813
|
});
|
|
@@ -832,7 +834,7 @@ export class Call extends Eventing {
|
|
|
832
834
|
});
|
|
833
835
|
}
|
|
834
836
|
catch (e) {
|
|
835
|
-
log.warn('
|
|
837
|
+
log.warn('Failed to delete the call', {
|
|
836
838
|
file: CALL_FILE,
|
|
837
839
|
method: this.handleOutgoingCallDisconnect.name,
|
|
838
840
|
});
|
|
@@ -909,7 +911,7 @@ export class Call extends Eventing {
|
|
|
909
911
|
});
|
|
910
912
|
}
|
|
911
913
|
catch (e) {
|
|
912
|
-
log.warn('
|
|
914
|
+
log.warn('Failed to delete the call', {
|
|
913
915
|
file: CALL_FILE,
|
|
914
916
|
method: this.handleUnknownState.name,
|
|
915
917
|
});
|
|
@@ -985,7 +987,7 @@ export class Call extends Eventing {
|
|
|
985
987
|
}
|
|
986
988
|
}
|
|
987
989
|
catch (err) {
|
|
988
|
-
log.warn('
|
|
990
|
+
log.warn('Failed to process MediaOk request', {
|
|
989
991
|
file: CALL_FILE,
|
|
990
992
|
method: 'handleRoapEstablished',
|
|
991
993
|
});
|
|
@@ -1039,7 +1041,7 @@ export class Call extends Eventing {
|
|
|
1039
1041
|
});
|
|
1040
1042
|
}
|
|
1041
1043
|
catch (err) {
|
|
1042
|
-
log.warn('Failed to communicate ROAP error
|
|
1044
|
+
log.warn('Failed to communicate ROAP error to Webex Calling', {
|
|
1043
1045
|
file: CALL_FILE,
|
|
1044
1046
|
method: this.handleRoapError.name,
|
|
1045
1047
|
});
|
|
@@ -1080,7 +1082,7 @@ export class Call extends Eventing {
|
|
|
1080
1082
|
});
|
|
1081
1083
|
}
|
|
1082
1084
|
catch (err) {
|
|
1083
|
-
log.warn('
|
|
1085
|
+
log.warn('Failed to process MediaOk request', {
|
|
1084
1086
|
file: CALL_FILE,
|
|
1085
1087
|
method: this.handleOutgoingRoapOffer.name,
|
|
1086
1088
|
});
|
|
@@ -1109,7 +1111,7 @@ export class Call extends Eventing {
|
|
|
1109
1111
|
});
|
|
1110
1112
|
}
|
|
1111
1113
|
catch (err) {
|
|
1112
|
-
log.warn('
|
|
1114
|
+
log.warn('Failed to send MediaAnswer request', {
|
|
1113
1115
|
file: CALL_FILE,
|
|
1114
1116
|
method: this.handleOutgoingRoapAnswer.name,
|
|
1115
1117
|
});
|
|
@@ -1206,7 +1208,11 @@ export class Call extends Eventing {
|
|
|
1206
1208
|
});
|
|
1207
1209
|
};
|
|
1208
1210
|
setDisconnectReason() {
|
|
1209
|
-
if (this.
|
|
1211
|
+
if (this.mediaInactivity) {
|
|
1212
|
+
this.disconnectReason.code = DisconnectCode.MEDIA_INACTIVITY;
|
|
1213
|
+
this.disconnectReason.cause = DisconnectCause.MEDIA_INACTIVITY;
|
|
1214
|
+
}
|
|
1215
|
+
else if (this.connected || this.direction === CallDirection.OUTBOUND) {
|
|
1210
1216
|
this.disconnectReason.code = DisconnectCode.NORMAL;
|
|
1211
1217
|
this.disconnectReason.cause = DisconnectCause.NORMAL;
|
|
1212
1218
|
}
|
|
@@ -1220,6 +1226,15 @@ export class Call extends Eventing {
|
|
|
1220
1226
|
};
|
|
1221
1227
|
async answer(localAudioStream) {
|
|
1222
1228
|
const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
|
|
1229
|
+
if (!localAudioTrack) {
|
|
1230
|
+
log.warn(`Did not find a local track while answering the call ${this.getCorrelationId()}`, {
|
|
1231
|
+
file: CALL_FILE,
|
|
1232
|
+
method: 'answer',
|
|
1233
|
+
});
|
|
1234
|
+
this.mediaInactivity = true;
|
|
1235
|
+
this.sendCallStateMachineEvt({ type: 'E_SEND_CALL_DISCONNECT' });
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1223
1238
|
localAudioTrack.enabled = true;
|
|
1224
1239
|
if (!this.mediaConnection) {
|
|
1225
1240
|
this.initMediaConnection(localAudioTrack);
|
|
@@ -1236,6 +1251,15 @@ export class Call extends Eventing {
|
|
|
1236
1251
|
}
|
|
1237
1252
|
async dial(localAudioStream) {
|
|
1238
1253
|
const localAudioTrack = localAudioStream.outputStream.getAudioTracks()[0];
|
|
1254
|
+
if (!localAudioTrack) {
|
|
1255
|
+
log.warn(`Did not find a local track while dialing the call ${this.getCorrelationId()}`, {
|
|
1256
|
+
file: CALL_FILE,
|
|
1257
|
+
method: 'dial',
|
|
1258
|
+
});
|
|
1259
|
+
this.deleteCb(this.getCorrelationId());
|
|
1260
|
+
this.emit(CALL_EVENT_KEYS.DISCONNECT, this.getCorrelationId());
|
|
1261
|
+
return;
|
|
1262
|
+
}
|
|
1239
1263
|
localAudioTrack.enabled = true;
|
|
1240
1264
|
if (!this.mediaConnection) {
|
|
1241
1265
|
this.initMediaConnection(localAudioTrack);
|
|
@@ -1276,7 +1300,7 @@ export class Call extends Eventing {
|
|
|
1276
1300
|
});
|
|
1277
1301
|
};
|
|
1278
1302
|
async patch(state) {
|
|
1279
|
-
log.info(`Send a PATCH for ${state} to
|
|
1303
|
+
log.info(`Send a PATCH for ${state} to Webex Calling`, {
|
|
1280
1304
|
file: CALL_FILE,
|
|
1281
1305
|
method: this.patch.name,
|
|
1282
1306
|
});
|
|
@@ -1437,7 +1461,7 @@ export class Call extends Eventing {
|
|
|
1437
1461
|
return parseMediaQualityStatistics(stats);
|
|
1438
1462
|
}
|
|
1439
1463
|
async postMedia(roapMessage) {
|
|
1440
|
-
log.log('Posting message to
|
|
1464
|
+
log.log('Posting message to Webex Calling', {
|
|
1441
1465
|
file: CALL_FILE,
|
|
1442
1466
|
method: this.postMedia.name,
|
|
1443
1467
|
});
|
|
@@ -1645,6 +1669,19 @@ export class Call extends Eventing {
|
|
|
1645
1669
|
this.muted = true;
|
|
1646
1670
|
}
|
|
1647
1671
|
};
|
|
1672
|
+
updateMedia = (newAudioStream) => {
|
|
1673
|
+
const localAudioTrack = newAudioStream.outputStream.getAudioTracks()[0];
|
|
1674
|
+
if (!localAudioTrack) {
|
|
1675
|
+
log.warn(`Did not find a local track while updating media for call ${this.getCorrelationId()}. Will not update media`, {
|
|
1676
|
+
file: CALL_FILE,
|
|
1677
|
+
method: 'updateMedia',
|
|
1678
|
+
});
|
|
1679
|
+
return;
|
|
1680
|
+
}
|
|
1681
|
+
this.mediaConnection.updateLocalTracks({
|
|
1682
|
+
audio: localAudioTrack,
|
|
1683
|
+
});
|
|
1684
|
+
};
|
|
1648
1685
|
setBroadworksCorrelationInfo(broadworksCorrelationInfo) {
|
|
1649
1686
|
this.broadworksCorrelationInfo = broadworksCorrelationInfo;
|
|
1650
1687
|
}
|
|
@@ -257,12 +257,6 @@ export class CallManager extends Eventing {
|
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
-
endCall = (correlationId) => {
|
|
261
|
-
const call = this.getCall(correlationId);
|
|
262
|
-
if (call) {
|
|
263
|
-
call.end();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
260
|
getCall = (correlationId) => {
|
|
267
261
|
return this.callCollection[correlationId];
|
|
268
262
|
};
|
|
@@ -35,4 +35,122 @@ const registrationPayload = {
|
|
|
35
35
|
};
|
|
36
36
|
const uri = `${webex.internal.services._serviceUrls.mobius}${URL_ENDPOINT}`;
|
|
37
37
|
const myIP = mockIPReturnBody.ipv4;
|
|
38
|
-
|
|
38
|
+
const mockUSServiceHosts = [
|
|
39
|
+
{
|
|
40
|
+
host: 'mobius-us-east-1.prod.infra.webex.com',
|
|
41
|
+
ttl: -1,
|
|
42
|
+
priority: 5,
|
|
43
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
host: 'mobius-ca-central-1.prod.infra.webex.com',
|
|
47
|
+
ttl: -1,
|
|
48
|
+
priority: 10,
|
|
49
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
host: 'mobius-eu-central-1.prod.infra.webex.com',
|
|
53
|
+
ttl: -1,
|
|
54
|
+
priority: 15,
|
|
55
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
host: 'mobius-ap-southeast-2.prod.infra.webex.com',
|
|
59
|
+
ttl: -1,
|
|
60
|
+
priority: 20,
|
|
61
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
const mockEUServiceHosts = [
|
|
65
|
+
{
|
|
66
|
+
host: 'mobius-eu-central-1.prod.infra.webex.com',
|
|
67
|
+
ttl: -1,
|
|
68
|
+
priority: 5,
|
|
69
|
+
id: 'urn:TEAM:eu-central-1_k:mobius',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
host: 'mobius-us-east-1.prod.infra.webex.com',
|
|
73
|
+
ttl: -1,
|
|
74
|
+
priority: 15,
|
|
75
|
+
id: 'urn:TEAM:eu-central-1_k:mobius',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
host: 'mobius-ca-central-1.prod.infra.webex.com',
|
|
79
|
+
ttl: -1,
|
|
80
|
+
priority: 10,
|
|
81
|
+
id: 'urn:TEAM:eu-central-1_k:mobius',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
host: 'mobius-ap-southeast-2.prod.infra.webex.com',
|
|
85
|
+
ttl: -1,
|
|
86
|
+
priority: 20,
|
|
87
|
+
id: 'urn:TEAM:eu-central-1_k:mobius',
|
|
88
|
+
},
|
|
89
|
+
];
|
|
90
|
+
const mockEUIntServiceHosts = [
|
|
91
|
+
{
|
|
92
|
+
host: 'mobius-eu-central-1.int.infra.webex.com',
|
|
93
|
+
ttl: -1,
|
|
94
|
+
priority: 15,
|
|
95
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
host: 'mobius-us-east-1.int.infra.webex.com',
|
|
99
|
+
ttl: -1,
|
|
100
|
+
priority: 5,
|
|
101
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
host: 'mobius-ca-central-1.int.infra.webex.com',
|
|
105
|
+
ttl: -1,
|
|
106
|
+
priority: 10,
|
|
107
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
host: 'mobius-ap-southeast-2.int.infra.webex.com',
|
|
111
|
+
ttl: -1,
|
|
112
|
+
priority: 20,
|
|
113
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
const mockIntServiceHosts = [
|
|
117
|
+
{
|
|
118
|
+
host: 'mobius-us-east-1.int.infra.webex.com',
|
|
119
|
+
ttl: -1,
|
|
120
|
+
priority: 5,
|
|
121
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
host: 'mobius-ca-central-1.int.infra.webex.com',
|
|
125
|
+
ttl: -1,
|
|
126
|
+
priority: 10,
|
|
127
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
host: 'mobius-eu-central-1.int.infra.webex.com',
|
|
131
|
+
ttl: -1,
|
|
132
|
+
priority: 15,
|
|
133
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
host: 'mobius-ap-southeast-2.int.infra.webex.com',
|
|
137
|
+
ttl: -1,
|
|
138
|
+
priority: 20,
|
|
139
|
+
id: 'urn:TEAM:us-east-2_a:mobius',
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
const mockCatalogEU = {
|
|
143
|
+
'mobius-eu-central-1.prod.infra.webex.com': mockEUServiceHosts,
|
|
144
|
+
};
|
|
145
|
+
const mockCatalogEUInt = {
|
|
146
|
+
'mobius-eu-central-1.int.infra.webex.com': mockEUIntServiceHosts,
|
|
147
|
+
};
|
|
148
|
+
const mockCatalogUS = {
|
|
149
|
+
'mobius-us-east-1.prod.infra.webex.com': mockUSServiceHosts,
|
|
150
|
+
'mobius-eu-central-1.prod.infra.webex.com': mockEUServiceHosts,
|
|
151
|
+
};
|
|
152
|
+
const mockCatalogUSInt = {
|
|
153
|
+
'mobius-us-east-1.int.infra.webex.com': mockIntServiceHosts,
|
|
154
|
+
'mobius-eu-central-1.int.infra.webex.com': mockEUIntServiceHosts,
|
|
155
|
+
};
|
|
156
|
+
export { ipPayload, regionBody, regionPayload, primaryUrl, discoveryPayload, registrationPayload, uri, myIP, mockEUServiceHosts, mockEUIntServiceHosts, mockIntServiceHosts, mockUSServiceHosts, mockCatalogEU, mockCatalogEUInt, mockCatalogUS, mockCatalogUSInt, };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export const VERSION = '
|
|
2
|
-
export const REPO_NAME = '
|
|
3
|
-
export const
|
|
4
|
-
export const CALLING_USER_AGENT = `${REPO_NAME}/${VERSION} (${CALLING_FEATURE})`;
|
|
1
|
+
export const VERSION = 'beta';
|
|
2
|
+
export const REPO_NAME = 'webex-calling';
|
|
3
|
+
export const CALLING_USER_AGENT = `${REPO_NAME}/${VERSION}`;
|
|
5
4
|
export const CALL_ENDPOINT_RESOURCE = 'call';
|
|
6
5
|
export const CALL_STATUS_RESOURCE = 'status';
|
|
7
6
|
export const CALLS_ENDPOINT_RESOURCE = 'calls';
|
|
@@ -59,6 +58,7 @@ export const SCIM_USER_FILTER = 'v1/Users?filter=';
|
|
|
59
58
|
export const SPARK_USER_AGENT = 'spark-user-agent';
|
|
60
59
|
export const REGISTER_RETRY_TIMEOUT = 10000;
|
|
61
60
|
export const SUPPLEMENTARY_SERVICES_TIMEOUT = 10000;
|
|
61
|
+
export const API_V1 = '/api/v1';
|
|
62
62
|
export const URL_ENDPOINT = '/calling/web/';
|
|
63
63
|
export const VALID_PHONE = /[\d\s()*#+.-]+/;
|
|
64
64
|
export const WEB_AGENT = '(web)';
|
|
@@ -120,3 +120,7 @@ export const FAILOVER_UTIL = 'startFailoverTimer';
|
|
|
120
120
|
export const NETWORK_CHANGE_DETECTION_UTIL = 'detectNetworkChange';
|
|
121
121
|
export const CALLS_CLEARED_HANDLER_UTIL = 'callsClearedHandler';
|
|
122
122
|
export const RECONNECT_UTIL = 'reconnectOnFailure';
|
|
123
|
+
export const MOBIUS_US_PROD = 'mobius-us-east-1.prod.infra.webex.com';
|
|
124
|
+
export const MOBIUS_EU_PROD = 'mobius-eu-central-1.prod.infra.webex.com';
|
|
125
|
+
export const MOBIUS_US_INT = 'mobius-us-east-1.int.infra.webex.com';
|
|
126
|
+
export const MOBIUS_EU_INT = 'mobius-eu-central-1.int.infra.webex.com';
|