@webex/calling 3.12.0-webex-services-ready.4 → 3.13.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/dist/CallRecording/WxcCallRecordingConnector.js +345 -174
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -1
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +354 -182
- package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -1
- package/dist/CallRecording/callRecordingFixtures.js +40 -9
- package/dist/CallRecording/callRecordingFixtures.js.map +1 -1
- package/dist/CallRecording/constants.js +12 -27
- package/dist/CallRecording/constants.js.map +1 -1
- package/dist/CallRecording/types.js +21 -16
- package/dist/CallRecording/types.js.map +1 -1
- package/dist/CallRecording/userhub.js +117 -0
- package/dist/CallRecording/userhub.js.map +1 -0
- package/dist/CallRecording/utils.js +3 -3
- package/dist/CallRecording/utils.js.map +1 -1
- package/dist/CallingClient/CallingClient.js +19 -13
- package/dist/CallingClient/CallingClient.js.map +1 -1
- package/dist/CallingClient/CallingClient.test.js +383 -185
- package/dist/CallingClient/CallingClient.test.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.js +3 -1
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +12 -2
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -1
- package/dist/CallingClient/calling/call.js +15 -8
- package/dist/CallingClient/calling/call.js.map +1 -1
- package/dist/CallingClient/calling/call.test.js +617 -527
- package/dist/CallingClient/calling/call.test.js.map +1 -1
- package/dist/CallingClient/constants.js +5 -2
- package/dist/CallingClient/constants.js.map +1 -1
- package/dist/CallingClient/line/index.js +23 -2
- package/dist/CallingClient/line/index.js.map +1 -1
- package/dist/CallingClient/line/line.test.js +87 -17
- package/dist/CallingClient/line/line.test.js.map +1 -1
- package/dist/CallingClient/registration/register.js +559 -411
- package/dist/CallingClient/registration/register.js.map +1 -1
- package/dist/CallingClient/registration/register.test.js +646 -83
- package/dist/CallingClient/registration/register.test.js.map +1 -1
- package/dist/CallingClient/registration/types.js +26 -0
- package/dist/CallingClient/registration/types.js.map +1 -1
- package/dist/CallingClient/types.js.map +1 -1
- package/dist/Errors/types.js +2 -0
- package/dist/Errors/types.js.map +1 -1
- package/dist/Events/types.js.map +1 -1
- package/dist/SDKConnector/types.js.map +1 -1
- package/dist/common/Utils.js +124 -105
- package/dist/common/Utils.js.map +1 -1
- package/dist/common/Utils.test.js +346 -243
- package/dist/common/Utils.test.js.map +1 -1
- package/dist/common/callUtils.js +187 -0
- package/dist/common/callUtils.js.map +1 -0
- package/dist/common/callUtils.test.js +313 -0
- package/dist/common/callUtils.test.js.map +1 -0
- package/dist/common/constants.js +27 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/index.js +11 -0
- package/dist/common/index.js.map +1 -1
- package/dist/common/testUtil.js +2 -1
- package/dist/common/testUtil.js.map +1 -1
- package/dist/mobius-socket/mobius-socket-events.test.js +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -1
- package/dist/mobius-socket/mobius-socket.test.js +12 -12
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -1
- package/dist/mobius-socket/socket/socket-base.js +10 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -1
- package/dist/mobius-socket/socket.test.js +34 -14
- package/dist/mobius-socket/socket.test.js.map +1 -1
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +155 -63
- package/dist/module/CallRecording/callRecordingFixtures.js +38 -8
- package/dist/module/CallRecording/constants.js +11 -12
- package/dist/module/CallRecording/userhub.js +100 -0
- package/dist/module/CallingClient/CallingClient.js +12 -11
- package/dist/module/CallingClient/calling/CallerId/index.js +2 -2
- package/dist/module/CallingClient/calling/call.js +10 -3
- package/dist/module/CallingClient/constants.js +3 -0
- package/dist/module/CallingClient/line/index.js +9 -1
- package/dist/module/CallingClient/registration/register.js +69 -16
- package/dist/module/CallingClient/registration/types.js +5 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/common/Utils.js +43 -43
- package/dist/module/common/callUtils.js +90 -0
- package/dist/module/common/constants.js +11 -0
- package/dist/module/common/index.js +1 -0
- package/dist/module/common/testUtil.js +1 -0
- package/dist/module/mobius-socket/socket/socket-base.js +8 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +6 -2
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -1
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +95 -4
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -1
- package/dist/types/CallRecording/constants.d.ts +11 -12
- package/dist/types/CallRecording/constants.d.ts.map +1 -1
- package/dist/types/CallRecording/types.d.ts +11 -3
- package/dist/types/CallRecording/types.d.ts.map +1 -1
- package/dist/types/CallRecording/userhub.d.ts +44 -0
- package/dist/types/CallRecording/userhub.d.ts.map +1 -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/call.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +3 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +2 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +3 -1
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +22 -0
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +2 -0
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +1 -1
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +1 -0
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +4 -6
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/callUtils.d.ts +6 -0
- package/dist/types/common/callUtils.d.ts.map +1 -0
- package/dist/types/common/constants.d.ts +6 -0
- package/dist/types/common/constants.d.ts.map +1 -1
- package/dist/types/common/index.d.ts +1 -0
- package/dist/types/common/index.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/mobius-socket/socket/socket-base.d.ts.map +1 -1
- package/package.json +12 -11
package/dist/common/Utils.js
CHANGED
|
@@ -17,6 +17,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
17
17
|
value: true
|
|
18
18
|
});
|
|
19
19
|
exports.emitFinalFailure = emitFinalFailure;
|
|
20
|
+
exports.escapeScimFilterValue = escapeScimFilterValue;
|
|
20
21
|
exports.fetchVoicemailList = fetchVoicemailList;
|
|
21
22
|
exports.filterMobiusUris = filterMobiusUris;
|
|
22
23
|
exports.getCallingBackEnd = getCallingBackEnd;
|
|
@@ -27,8 +28,8 @@ exports.handleCallErrors = handleCallErrors;
|
|
|
27
28
|
exports.handleCallingClientErrors = handleCallingClientErrors;
|
|
28
29
|
exports.handleRegistrationErrors = handleRegistrationErrors;
|
|
29
30
|
exports.inferIdFromUuid = inferIdFromUuid;
|
|
31
|
+
exports.isMobiusWssHostAllowed = isMobiusWssHostAllowed;
|
|
30
32
|
exports.isValidServiceDomain = isValidServiceDomain;
|
|
31
|
-
exports.modifySdpForIPv4 = modifySdpForIPv4;
|
|
32
33
|
exports.normalizeMobiusUris = normalizeMobiusUris;
|
|
33
34
|
exports.parseMediaQualityStatistics = parseMediaQualityStatistics;
|
|
34
35
|
exports.resolveCallerIdByName = resolveCallerIdByName;
|
|
@@ -46,7 +47,6 @@ var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/objec
|
|
|
46
47
|
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
47
48
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
48
49
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
49
|
-
var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/parse-int"));
|
|
50
50
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
51
51
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
52
52
|
var platform = _interopRequireWildcard(require("platform"));
|
|
@@ -68,6 +68,29 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
68
68
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && r[_Symbol$iterator] || r["@@iterator"]; if (!t) { if (_Array$isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
69
69
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
70
70
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; } /* eslint-disable no-fallthrough */ /* eslint-disable no-underscore-dangle */ /* eslint-disable @typescript-eslint/no-shadow */
|
|
71
|
+
/**
|
|
72
|
+
* Shared predicate for the Mobius WSS host allowlist (AC-2). Used by both
|
|
73
|
+
* `Socket#open` and `filterMobiusUris` so the two enforcement points cannot
|
|
74
|
+
* drift apart.
|
|
75
|
+
*/
|
|
76
|
+
function isMobiusWssHostAllowed(host) {
|
|
77
|
+
return _constants2.MOBIUS_WSS_ALLOWED_DOMAINS.some(function (domain) {
|
|
78
|
+
return host === domain || host.endsWith(".".concat(domain));
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Returns true when the hostname of the given WSS URI ends with one of the
|
|
84
|
+
* trusted Mobius/Webex domain suffixes. URIs with unparseable hostnames are
|
|
85
|
+
* dropped for safety.
|
|
86
|
+
*/
|
|
87
|
+
function isTrustedMobiusWssHost(wssUri) {
|
|
88
|
+
try {
|
|
89
|
+
return isMobiusWssHostAllowed(new URL(wssUri).hostname);
|
|
90
|
+
} catch (_unused) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
71
94
|
function filterMobiusUris(mobiusServers, defaultMobiusUrl) {
|
|
72
95
|
var _mobiusServers$primar, _mobiusServers$primar2, _mobiusServers$backup, _mobiusServers$backup2;
|
|
73
96
|
var logContext = {
|
|
@@ -100,7 +123,12 @@ function filterMobiusUris(mobiusServers, defaultMobiusUrl) {
|
|
|
100
123
|
try {
|
|
101
124
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
102
125
|
var wssUri = _step2.value;
|
|
103
|
-
|
|
126
|
+
/* Drop WSS URIs whose host is not in the trusted allowlist (AC-2) */
|
|
127
|
+
if (isTrustedMobiusWssHost(wssUri)) {
|
|
128
|
+
wssArrayPrimary.push(wssUri);
|
|
129
|
+
} else {
|
|
130
|
+
_Logger.default.warn("Dropping untrusted primary WSS URI: host not in allowed domains", logContext);
|
|
131
|
+
}
|
|
104
132
|
}
|
|
105
133
|
} catch (err) {
|
|
106
134
|
_iterator2.e(err);
|
|
@@ -130,7 +158,12 @@ function filterMobiusUris(mobiusServers, defaultMobiusUrl) {
|
|
|
130
158
|
try {
|
|
131
159
|
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
132
160
|
var _wssUri = _step4.value;
|
|
133
|
-
|
|
161
|
+
/* Drop WSS URIs whose host is not in the trusted allowlist (AC-2) */
|
|
162
|
+
if (isTrustedMobiusWssHost(_wssUri)) {
|
|
163
|
+
wssArrayBackup.push(_wssUri);
|
|
164
|
+
} else {
|
|
165
|
+
_Logger.default.warn("Dropping untrusted backup WSS URI: host not in allowed domains", logContext);
|
|
166
|
+
}
|
|
134
167
|
}
|
|
135
168
|
} catch (err) {
|
|
136
169
|
_iterator4.e(err);
|
|
@@ -260,7 +293,9 @@ function emitFinalFailure(emitterCb, loggerContext, message) {
|
|
|
260
293
|
* @param err - Error body.
|
|
261
294
|
* @param emitterCb - LineErrorEmitterCallback
|
|
262
295
|
* @param loggerContext - Logging context that has method and file name
|
|
263
|
-
* @param
|
|
296
|
+
* @param handlers - Specialized per-status-code handlers the caller opts into, as
|
|
297
|
+
* {@link RegistrationErrorHandlers}.
|
|
298
|
+
* @param serverCount - Number of servers in the list.
|
|
264
299
|
*
|
|
265
300
|
* In emitterCb,
|
|
266
301
|
* For non final error scenarios in registration flow,
|
|
@@ -271,7 +306,7 @@ function emitFinalFailure(emitterCb, loggerContext, message) {
|
|
|
271
306
|
* be scheduled to attempt registration again.
|
|
272
307
|
*
|
|
273
308
|
*/
|
|
274
|
-
function handleRegistrationErrors(_x, _x2, _x3
|
|
309
|
+
function handleRegistrationErrors(_x, _x2, _x3) {
|
|
275
310
|
return _handleRegistrationErrors.apply(this, arguments);
|
|
276
311
|
}
|
|
277
312
|
/**
|
|
@@ -282,8 +317,12 @@ function handleRegistrationErrors(_x, _x2, _x3, _x4, _x5) {
|
|
|
282
317
|
* @param restoreRegCb - Callback which will try restoring resgistration in case of 403
|
|
283
318
|
*/
|
|
284
319
|
function _handleRegistrationErrors() {
|
|
285
|
-
_handleRegistrationErrors = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(err, emitterCb, loggerContext
|
|
286
|
-
var
|
|
320
|
+
_handleRegistrationErrors = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee(err, emitterCb, loggerContext) {
|
|
321
|
+
var handlers,
|
|
322
|
+
serverCount,
|
|
323
|
+
retry429Cb,
|
|
324
|
+
restoreRegCb,
|
|
325
|
+
sessionSupersededCb,
|
|
287
326
|
shouldDisconnect,
|
|
288
327
|
lineError,
|
|
289
328
|
errorCode,
|
|
@@ -303,14 +342,16 @@ function _handleRegistrationErrors() {
|
|
|
303
342
|
return _regenerator.default.wrap(function (_context) {
|
|
304
343
|
while (1) switch (_context.prev = _context.next) {
|
|
305
344
|
case 0:
|
|
306
|
-
|
|
345
|
+
handlers = _args.length > 3 && _args[3] !== undefined ? _args[3] : {};
|
|
346
|
+
serverCount = _args.length > 4 && _args[4] !== undefined ? _args[4] : 1;
|
|
347
|
+
retry429Cb = handlers.retry429Cb, restoreRegCb = handlers.restoreRegCb, sessionSupersededCb = handlers.sessionSupersededCb;
|
|
307
348
|
shouldDisconnect = false;
|
|
308
349
|
lineError = (0, _LineError.createLineError)('', {}, _types2.ERROR_TYPE.DEFAULT, _types3.RegistrationStatus.INACTIVE);
|
|
309
350
|
errorCode = Number(err.statusCode);
|
|
310
351
|
finalError = false;
|
|
311
352
|
_Logger.default.warn("Status code: -> ".concat(errorCode), loggerContext);
|
|
312
353
|
_t = errorCode;
|
|
313
|
-
_context.next = _t === _types2.ERROR_CODE.BAD_REQUEST ? 1 : _t === _types2.ERROR_CODE.UNAUTHORIZED ? 2 : _t === _types2.ERROR_CODE.DEVICE_NOT_FOUND ? 3 : _t === _types2.ERROR_CODE.
|
|
354
|
+
_context.next = _t === _types2.ERROR_CODE.BAD_REQUEST ? 1 : _t === _types2.ERROR_CODE.UNAUTHORIZED ? 2 : _t === _types2.ERROR_CODE.DEVICE_NOT_FOUND ? 3 : _t === _types2.ERROR_CODE.CONFLICT ? 4 : _t === _types2.ERROR_CODE.TOO_MANY_REQUESTS ? 7 : _t === _types2.ERROR_CODE.INTERNAL_SERVER_ERROR ? 9 : _t === _types2.ERROR_CODE.SERVICE_UNAVAILABLE ? 10 : _t === _types2.ERROR_CODE.FORBIDDEN ? 11 : 19;
|
|
314
355
|
break;
|
|
315
356
|
case 1:
|
|
316
357
|
finalError = true;
|
|
@@ -318,7 +359,7 @@ function _handleRegistrationErrors() {
|
|
|
318
359
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.BAD_REQUEST, 'Invalid input. Please verify the required parameters, sign out and then sign back in with the valid data', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
319
360
|
emitterCb(lineError, finalError);
|
|
320
361
|
shouldDisconnect = serverCount > 1;
|
|
321
|
-
return _context.abrupt("continue",
|
|
362
|
+
return _context.abrupt("continue", 20);
|
|
322
363
|
case 2:
|
|
323
364
|
// Return it to the Caller
|
|
324
365
|
finalError = true;
|
|
@@ -326,45 +367,61 @@ function _handleRegistrationErrors() {
|
|
|
326
367
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.TOKEN_ERROR, 'User is unauthorized due to an expired token. Sign out, then sign back in.', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
327
368
|
emitterCb(lineError, finalError);
|
|
328
369
|
shouldDisconnect = serverCount > 1;
|
|
329
|
-
return _context.abrupt("continue",
|
|
370
|
+
return _context.abrupt("continue", 20);
|
|
330
371
|
case 3:
|
|
331
372
|
finalError = true;
|
|
332
373
|
_Logger.default.warn("404 Device Not Found", loggerContext);
|
|
333
374
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.NOT_FOUND, 'Webex Calling is unable to find your device. Sign out, then sign back in', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
334
375
|
emitterCb(lineError, finalError);
|
|
335
376
|
shouldDisconnect = serverCount > 1;
|
|
336
|
-
return _context.abrupt("continue",
|
|
377
|
+
return _context.abrupt("continue", 20);
|
|
337
378
|
case 4:
|
|
379
|
+
if (sessionSupersededCb) {
|
|
380
|
+
_context.next = 5;
|
|
381
|
+
break;
|
|
382
|
+
}
|
|
383
|
+
_Logger.default.warn("409 Conflict: ignored, caller does not handle a superseded session", loggerContext);
|
|
384
|
+
return _context.abrupt("continue", 20);
|
|
385
|
+
case 5:
|
|
386
|
+
finalError = true;
|
|
387
|
+
_Logger.default.warn("409 Conflict: session superseded by another device for this user", loggerContext);
|
|
388
|
+
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.SESSION_SUPERSEDED, _constants.SESSION_SUPERSEDED_MESSAGE, _types3.RegistrationStatus.INACTIVE, lineError);
|
|
389
|
+
_context.next = 6;
|
|
390
|
+
return sessionSupersededCb(lineError);
|
|
391
|
+
case 6:
|
|
392
|
+
shouldDisconnect = false;
|
|
393
|
+
return _context.abrupt("continue", 20);
|
|
394
|
+
case 7:
|
|
338
395
|
_Logger.default.warn("429 Too Many Requests", loggerContext);
|
|
339
396
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.TOO_MANY_REQUESTS, 'Server is handling too many request at the time. Wait a moment and try again', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
340
397
|
caller = loggerContext.method || 'handleErrors';
|
|
341
398
|
if (!(retry429Cb && err.headers)) {
|
|
342
|
-
_context.next =
|
|
399
|
+
_context.next = 8;
|
|
343
400
|
break;
|
|
344
401
|
}
|
|
345
402
|
retryAfter = Number(err.headers['retry-after']);
|
|
346
|
-
_context.next =
|
|
403
|
+
_context.next = 8;
|
|
347
404
|
return retry429Cb(retryAfter, caller);
|
|
348
|
-
case
|
|
405
|
+
case 8:
|
|
349
406
|
shouldDisconnect = false;
|
|
350
|
-
return _context.abrupt("continue",
|
|
351
|
-
case
|
|
407
|
+
return _context.abrupt("continue", 20);
|
|
408
|
+
case 9:
|
|
352
409
|
_Logger.default.warn("500 Internal Server Error", loggerContext);
|
|
353
410
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.SERVER_ERROR, 'An unknown error occurred while placing the request. Wait a moment and try again.', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
354
411
|
emitterCb(lineError, finalError);
|
|
355
412
|
shouldDisconnect = serverCount > 1;
|
|
356
|
-
return _context.abrupt("continue",
|
|
357
|
-
case
|
|
413
|
+
return _context.abrupt("continue", 20);
|
|
414
|
+
case 10:
|
|
358
415
|
_Logger.default.warn("503 Service Unavailable", loggerContext);
|
|
359
416
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.SERVICE_UNAVAILABLE, 'An error occurred on the server while processing the request. Wait a moment and try again.', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
360
417
|
emitterCb(lineError, finalError);
|
|
361
418
|
shouldDisconnect = serverCount > 1;
|
|
362
|
-
return _context.abrupt("continue",
|
|
363
|
-
case
|
|
419
|
+
return _context.abrupt("continue", 20);
|
|
420
|
+
case 11:
|
|
364
421
|
_Logger.default.warn("403 Forbidden", loggerContext);
|
|
365
422
|
errorBody = err.body;
|
|
366
423
|
if (errorBody) {
|
|
367
|
-
_context.next =
|
|
424
|
+
_context.next = 12;
|
|
368
425
|
break;
|
|
369
426
|
}
|
|
370
427
|
_Logger.default.warn('Error response has no body, throwing default error', loggerContext);
|
|
@@ -375,59 +432,59 @@ function _handleRegistrationErrors() {
|
|
|
375
432
|
finalError: finalError,
|
|
376
433
|
shouldDisconnect: shouldDisconnect
|
|
377
434
|
});
|
|
378
|
-
case
|
|
435
|
+
case 12:
|
|
379
436
|
code = Number(errorBody.errorCode);
|
|
380
437
|
_Logger.default.warn("Error code found : ".concat(code), loggerContext);
|
|
381
438
|
_t2 = code;
|
|
382
|
-
_context.next = _t2 === _types2.DEVICE_ERROR_CODE.DEVICE_LIMIT_EXCEEDED ?
|
|
439
|
+
_context.next = _t2 === _types2.DEVICE_ERROR_CODE.DEVICE_LIMIT_EXCEEDED ? 13 : _t2 === _types2.DEVICE_ERROR_CODE.DEVICE_CREATION_DISABLED ? 15 : _t2 === _types2.DEVICE_ERROR_CODE.DEVICE_CREATION_FAILED ? 16 : 17;
|
|
383
440
|
break;
|
|
384
|
-
case
|
|
441
|
+
case 13:
|
|
385
442
|
errorMessage = 'User device limit exceeded';
|
|
386
443
|
_Logger.default.warn(errorMessage, loggerContext);
|
|
387
444
|
if (!restoreRegCb) {
|
|
388
|
-
_context.next =
|
|
445
|
+
_context.next = 14;
|
|
389
446
|
break;
|
|
390
447
|
}
|
|
391
448
|
_caller = loggerContext.method || 'handleErrors';
|
|
392
|
-
_context.next =
|
|
449
|
+
_context.next = 14;
|
|
393
450
|
return restoreRegCb(errorBody, _caller);
|
|
394
|
-
case
|
|
451
|
+
case 14:
|
|
395
452
|
shouldDisconnect = false;
|
|
396
|
-
return _context.abrupt("continue",
|
|
397
|
-
case
|
|
453
|
+
return _context.abrupt("continue", 18);
|
|
454
|
+
case 15:
|
|
398
455
|
_errorMessage = 'User is not configured for WebRTC calling. Please contact the administrator to resolve this issue.';
|
|
399
456
|
finalError = true;
|
|
400
457
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage, _types3.RegistrationStatus.INACTIVE, lineError);
|
|
401
458
|
_Logger.default.warn(_errorMessage, loggerContext);
|
|
402
459
|
emitterCb(lineError, true);
|
|
403
460
|
shouldDisconnect = true;
|
|
404
|
-
return _context.abrupt("continue",
|
|
405
|
-
case
|
|
461
|
+
return _context.abrupt("continue", 18);
|
|
462
|
+
case 16:
|
|
406
463
|
_errorMessage2 = 'An unknown error occurred while provisioning the device. Wait a moment and try again.';
|
|
407
464
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage2, _types3.RegistrationStatus.INACTIVE, lineError);
|
|
408
465
|
_Logger.default.warn(_errorMessage2, loggerContext);
|
|
409
466
|
emitterCb(lineError, finalError);
|
|
410
467
|
shouldDisconnect = serverCount > 1;
|
|
411
|
-
return _context.abrupt("continue",
|
|
412
|
-
case
|
|
468
|
+
return _context.abrupt("continue", 18);
|
|
469
|
+
case 17:
|
|
413
470
|
_errorMessage3 = 'An unknown error occurred. Wait a moment and try again. Please contact the administrator if the problem persists.';
|
|
414
471
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage3, _types3.RegistrationStatus.INACTIVE, lineError);
|
|
415
472
|
_Logger.default.warn(_errorMessage3, loggerContext);
|
|
416
473
|
emitterCb(lineError, finalError);
|
|
417
474
|
shouldDisconnect = serverCount > 1;
|
|
418
|
-
case
|
|
419
|
-
return _context.abrupt("continue",
|
|
420
|
-
case
|
|
475
|
+
case 18:
|
|
476
|
+
return _context.abrupt("continue", 20);
|
|
477
|
+
case 19:
|
|
421
478
|
updateLineErrorContext(loggerContext, _types2.ERROR_TYPE.DEFAULT, 'Unknown error', _types3.RegistrationStatus.INACTIVE, lineError);
|
|
422
479
|
_Logger.default.warn("Unknown Error", loggerContext);
|
|
423
480
|
emitterCb(lineError, finalError);
|
|
424
481
|
shouldDisconnect = serverCount > 1;
|
|
425
|
-
case
|
|
482
|
+
case 20:
|
|
426
483
|
return _context.abrupt("return", {
|
|
427
484
|
finalError: finalError,
|
|
428
485
|
shouldDisconnect: shouldDisconnect
|
|
429
486
|
});
|
|
430
|
-
case
|
|
487
|
+
case 21:
|
|
431
488
|
case "end":
|
|
432
489
|
return _context.stop();
|
|
433
490
|
}
|
|
@@ -435,7 +492,7 @@ function _handleRegistrationErrors() {
|
|
|
435
492
|
}));
|
|
436
493
|
return _handleRegistrationErrors.apply(this, arguments);
|
|
437
494
|
}
|
|
438
|
-
function handleCallingClientErrors(
|
|
495
|
+
function handleCallingClientErrors(_x4, _x5, _x6) {
|
|
439
496
|
return _handleCallingClientErrors.apply(this, arguments);
|
|
440
497
|
}
|
|
441
498
|
/**
|
|
@@ -493,7 +550,7 @@ function _handleCallingClientErrors() {
|
|
|
493
550
|
}));
|
|
494
551
|
return _handleCallingClientErrors.apply(this, arguments);
|
|
495
552
|
}
|
|
496
|
-
function handleCallErrors(_x9, _x0, _x1, _x10, _x11
|
|
553
|
+
function handleCallErrors(_x7, _x8, _x9, _x0, _x1, _x10, _x11) {
|
|
497
554
|
return _handleCallErrors.apply(this, arguments);
|
|
498
555
|
}
|
|
499
556
|
/**
|
|
@@ -634,7 +691,7 @@ function _handleCallErrors() {
|
|
|
634
691
|
}));
|
|
635
692
|
return _handleCallErrors.apply(this, arguments);
|
|
636
693
|
}
|
|
637
|
-
function serviceErrorCodeHandler(
|
|
694
|
+
function serviceErrorCodeHandler(_x12, _x13) {
|
|
638
695
|
return _serviceErrorCodeHandler.apply(this, arguments);
|
|
639
696
|
}
|
|
640
697
|
/**
|
|
@@ -1015,7 +1072,7 @@ function getCallingBackEnd(webex) {
|
|
|
1015
1072
|
* @param callingBackend -.
|
|
1016
1073
|
* @returns Promise.
|
|
1017
1074
|
*/
|
|
1018
|
-
function getXsiActionEndpoint(
|
|
1075
|
+
function getXsiActionEndpoint(_x14, _x15, _x16) {
|
|
1019
1076
|
return _getXsiActionEndpoint.apply(this, arguments);
|
|
1020
1077
|
}
|
|
1021
1078
|
/**
|
|
@@ -1130,7 +1187,7 @@ function getSortedVoicemailList(voiceMessageList, sortOrder) {
|
|
|
1130
1187
|
* @param filter - A filter for the query.
|
|
1131
1188
|
* @returns - Promise.
|
|
1132
1189
|
*/
|
|
1133
|
-
function scimQuery(
|
|
1190
|
+
function scimQuery(_x17) {
|
|
1134
1191
|
return _scimQuery.apply(this, arguments);
|
|
1135
1192
|
}
|
|
1136
1193
|
/**
|
|
@@ -1176,7 +1233,7 @@ function _scimQuery() {
|
|
|
1176
1233
|
}));
|
|
1177
1234
|
return _scimQuery.apply(this, arguments);
|
|
1178
1235
|
}
|
|
1179
|
-
function resolveCallerIdDisplay(
|
|
1236
|
+
function resolveCallerIdDisplay(_x18) {
|
|
1180
1237
|
return _resolveCallerIdDisplay.apply(this, arguments);
|
|
1181
1238
|
}
|
|
1182
1239
|
/**
|
|
@@ -1253,13 +1310,19 @@ function _resolveCallerIdDisplay() {
|
|
|
1253
1310
|
}));
|
|
1254
1311
|
return _resolveCallerIdDisplay.apply(this, arguments);
|
|
1255
1312
|
}
|
|
1256
|
-
function resolveCallerIdByName(
|
|
1313
|
+
function resolveCallerIdByName(_x19) {
|
|
1257
1314
|
return _resolveCallerIdByName.apply(this, arguments);
|
|
1258
1315
|
}
|
|
1259
1316
|
/**
|
|
1260
|
-
*
|
|
1317
|
+
* Escapes SCIM filter-grammar metacharacters in an opaque identifier value.
|
|
1261
1318
|
*
|
|
1262
|
-
*
|
|
1319
|
+
* Prevents filter injection when a value is interpolated into `id eq "..."`.
|
|
1320
|
+
* Only the backslash and double-quote characters are significant in SCIM
|
|
1321
|
+
* quoted-string literals; all other characters are kept as-is so that
|
|
1322
|
+
* legitimate identifiers (UUIDs, SIP addresses, etc.) resolve unchanged.
|
|
1323
|
+
*
|
|
1324
|
+
* @param value - The raw identifier value to escape.
|
|
1325
|
+
* @returns The escaped value safe for use inside a SCIM quoted-string literal.
|
|
1263
1326
|
*/
|
|
1264
1327
|
function _resolveCallerIdByName() {
|
|
1265
1328
|
_resolveCallerIdByName = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8(name) {
|
|
@@ -1317,7 +1380,17 @@ function _resolveCallerIdByName() {
|
|
|
1317
1380
|
}));
|
|
1318
1381
|
return _resolveCallerIdByName.apply(this, arguments);
|
|
1319
1382
|
}
|
|
1320
|
-
function
|
|
1383
|
+
function escapeScimFilterValue(value) {
|
|
1384
|
+
// Escape backslash first (order matters: must precede quote escaping)
|
|
1385
|
+
return value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
/**
|
|
1389
|
+
* Resolve the contact information.
|
|
1390
|
+
*
|
|
1391
|
+
* @param callingPartyInfo - Calling Party Info.
|
|
1392
|
+
*/
|
|
1393
|
+
function resolveContact(_x20) {
|
|
1321
1394
|
return _resolveContact.apply(this, arguments);
|
|
1322
1395
|
}
|
|
1323
1396
|
/**
|
|
@@ -1335,7 +1408,7 @@ function _resolveContact() {
|
|
|
1335
1408
|
_context9.next = 1;
|
|
1336
1409
|
break;
|
|
1337
1410
|
}
|
|
1338
|
-
return _context9.abrupt("return", resolveCallerIdDisplay("id eq \"".concat(callingPartyInfo.userExternalId
|
|
1411
|
+
return _context9.abrupt("return", resolveCallerIdDisplay("id eq \"".concat(escapeScimFilterValue(callingPartyInfo.userExternalId.$), "\"")));
|
|
1339
1412
|
case 1:
|
|
1340
1413
|
if (!(callingPartyInfo.name && callingPartyInfo.name.$)) {
|
|
1341
1414
|
_context9.next = 2;
|
|
@@ -1446,60 +1519,6 @@ function validateServiceData(serviceData) {
|
|
|
1446
1519
|
}
|
|
1447
1520
|
}
|
|
1448
1521
|
|
|
1449
|
-
/**
|
|
1450
|
-
* Modifies SDP to replace IPv6 "c=" lines with IPv4.And adds an IPv4 candidate if none exists.
|
|
1451
|
-
*
|
|
1452
|
-
* @param sdp - Session Description Protocol string.
|
|
1453
|
-
* @returns Modified SDP string.
|
|
1454
|
-
*/
|
|
1455
|
-
function modifySdpForIPv4(sdp) {
|
|
1456
|
-
try {
|
|
1457
|
-
// Normalize line endings to avoid issues
|
|
1458
|
-
sdp = sdp.replace(/\r\n|\r/g, '\n');
|
|
1459
|
-
|
|
1460
|
-
// Ensure consistent spacing without removing intentional indentation
|
|
1461
|
-
sdp = sdp.replace(/^[ \t]+/gm, '');
|
|
1462
|
-
|
|
1463
|
-
// Check if at least one IPv6 "c=" line is present
|
|
1464
|
-
var ipv6CLineMatches = sdp.match(/c=IN IP6 [\da-f:.]+/gi) || [];
|
|
1465
|
-
var hasIPv6CLine = ipv6CLineMatches.length > 0;
|
|
1466
|
-
if (hasIPv6CLine) {
|
|
1467
|
-
_Logger.default.info('Modifying SDP for IPv4 compatibility', {
|
|
1468
|
-
file: _constants.UTILS_FILE,
|
|
1469
|
-
method: 'modifySdpForIPv4'
|
|
1470
|
-
});
|
|
1471
|
-
|
|
1472
|
-
// Extract an existing IPv4 candidate's IP, if available
|
|
1473
|
-
var ipv4CandidateMatch = sdp.match(/a=candidate:\d+ \d+ \w+ \d+ ([\d.]+) \d+ typ \w+/);
|
|
1474
|
-
var ipv4Address = (ipv4CandidateMatch === null || ipv4CandidateMatch === void 0 ? void 0 : ipv4CandidateMatch[1]) || '192.1.1.1'; // Default fallback
|
|
1475
|
-
|
|
1476
|
-
// Replace all IPv6 "c=" lines with IPv4 using the extracted IP (or default)
|
|
1477
|
-
sdp = sdp.replace(/c=IN IP6 [\da-f:.]+/gi, "c=IN IP4 ".concat(ipv4Address));
|
|
1478
|
-
|
|
1479
|
-
// Ensure newline separation between candidate lines
|
|
1480
|
-
if (!ipv4CandidateMatch) {
|
|
1481
|
-
var ipv4CandidateAdded = false;
|
|
1482
|
-
sdp = sdp.replace(/(a=candidate:(\d+) (\d+) (\w+) (\d+) ([\da-f:.]+) (\d+) typ (\w+)[^\n]*)/g, function (match, full, foundation, componentId, transport, priority, connectionAddress, port, candidateType) {
|
|
1483
|
-
if (!ipv4CandidateAdded && connectionAddress.includes(':')) {
|
|
1484
|
-
// Ensure it's IPv6 and only add once
|
|
1485
|
-
ipv4CandidateAdded = true;
|
|
1486
|
-
var newFoundation = ((0, _parseInt2.default)(foundation, 10) + 1).toString();
|
|
1487
|
-
return "".concat(full, "\n") + "a=candidate:".concat(newFoundation, " ").concat(componentId, " ").concat(transport, " ").concat(priority, " ").concat(ipv4Address, " ").concat(port, " typ ").concat(candidateType, " generation 0 network-id 1 network-cost 10");
|
|
1488
|
-
}
|
|
1489
|
-
return match;
|
|
1490
|
-
});
|
|
1491
|
-
}
|
|
1492
|
-
}
|
|
1493
|
-
return sdp;
|
|
1494
|
-
} catch (error) {
|
|
1495
|
-
_Logger.default.warn("Error modifying SDP for IPv4 compatibility: ".concat(error), {
|
|
1496
|
-
file: _constants.UTILS_FILE,
|
|
1497
|
-
method: 'modifySdpForIPv4'
|
|
1498
|
-
});
|
|
1499
|
-
return sdp; // Return original SDP in case of an error
|
|
1500
|
-
}
|
|
1501
|
-
}
|
|
1502
|
-
|
|
1503
1522
|
/**
|
|
1504
1523
|
* Uploads logs to backend.
|
|
1505
1524
|
*
|