@webex/calling 3.0.0-next.2 → 3.0.0-next.4
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/README.md +74 -74
- package/dist/module/CallHistory/CallHistory.js +81 -81
- package/dist/module/CallHistory/callHistoryFixtures.js +307 -307
- package/dist/module/CallHistory/constants.js +9 -9
- package/dist/module/CallHistory/types.js +1 -1
- package/dist/module/CallSettings/CallSettings.js +65 -65
- package/dist/module/CallSettings/UcmBackendConnector.js +100 -100
- package/dist/module/CallSettings/WxCallBackendConnector.js +287 -287
- package/dist/module/CallSettings/constants.js +11 -11
- package/dist/module/CallSettings/testFixtures.js +62 -62
- package/dist/module/CallSettings/types.js +1 -1
- package/dist/module/CallingClient/CallingClient.js +248 -248
- package/dist/module/CallingClient/callRecordFixtures.js +93 -93
- package/dist/module/CallingClient/calling/CallerId/index.js +169 -169
- package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
- package/dist/module/CallingClient/calling/call.js +1658 -1658
- package/dist/module/CallingClient/calling/callManager.js +284 -284
- package/dist/module/CallingClient/calling/index.js +2 -2
- package/dist/module/CallingClient/calling/types.js +53 -53
- package/dist/module/CallingClient/callingClientFixtures.js +38 -38
- package/dist/module/CallingClient/constants.js +122 -122
- package/dist/module/CallingClient/line/index.js +158 -158
- package/dist/module/CallingClient/line/types.js +15 -15
- package/dist/module/CallingClient/registration/index.js +1 -1
- package/dist/module/CallingClient/registration/register.js +507 -507
- package/dist/module/CallingClient/registration/registerFixtures.js +28 -28
- package/dist/module/CallingClient/registration/types.js +1 -1
- package/dist/module/CallingClient/types.js +1 -1
- package/dist/module/Contacts/ContactsClient.js +484 -484
- package/dist/module/Contacts/constants.js +20 -20
- package/dist/module/Contacts/contactFixtures.js +284 -284
- package/dist/module/Contacts/types.js +10 -10
- package/dist/module/Errors/catalog/CallError.js +26 -26
- package/dist/module/Errors/catalog/CallingDeviceError.js +18 -18
- package/dist/module/Errors/catalog/ExtendedError.js +10 -10
- package/dist/module/Errors/catalog/LineError.js +24 -24
- package/dist/module/Errors/index.js +2 -2
- package/dist/module/Errors/types.js +48 -48
- package/dist/module/Events/impl/index.js +19 -19
- package/dist/module/Events/types.js +83 -83
- package/dist/module/Logger/index.js +114 -114
- package/dist/module/Logger/types.js +25 -25
- package/dist/module/Metrics/index.js +232 -232
- package/dist/module/Metrics/types.js +37 -37
- package/dist/module/SDKConnector/index.js +39 -39
- package/dist/module/SDKConnector/types.js +1 -1
- package/dist/module/SDKConnector/utils.js +12 -12
- package/dist/module/Voicemail/BroadworksBackendConnector.js +291 -291
- package/dist/module/Voicemail/UcmBackendConnector.js +279 -279
- package/dist/module/Voicemail/Voicemail.js +110 -110
- package/dist/module/Voicemail/WxCallBackendConnector.js +279 -279
- package/dist/module/Voicemail/constants.js +29 -29
- package/dist/module/Voicemail/types.js +1 -1
- package/dist/module/Voicemail/voicemailFixture.js +510 -510
- package/dist/module/api.js +6 -6
- package/dist/module/common/Utils.js +802 -802
- package/dist/module/common/constants.js +41 -41
- package/dist/module/common/index.js +1 -1
- package/dist/module/common/testUtil.js +938 -938
- package/dist/module/common/types.js +57 -57
- package/dist/module/index.js +8 -8
- package/dist/types/CallHistory/CallHistory.d.ts +17 -17
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +94 -94
- package/dist/types/CallHistory/constants.d.ts +9 -9
- package/dist/types/CallHistory/types.d.ts +18 -18
- package/dist/types/CallSettings/CallSettings.d.ts +19 -19
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
- package/dist/types/CallSettings/WxCallBackendConnector.d.ts +21 -21
- package/dist/types/CallSettings/constants.d.ts +11 -11
- package/dist/types/CallSettings/testFixtures.d.ts +15 -15
- package/dist/types/CallSettings/types.d.ts +107 -107
- package/dist/types/CallingClient/CallingClient.d.ts +35 -35
- package/dist/types/CallingClient/callRecordFixtures.d.ts +3 -3
- package/dist/types/CallingClient/calling/CallerId/index.d.ts +17 -17
- package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
- package/dist/types/CallingClient/calling/call.d.ts +96 -96
- package/dist/types/CallingClient/calling/callManager.d.ts +25 -25
- package/dist/types/CallingClient/calling/index.d.ts +2 -2
- package/dist/types/CallingClient/calling/types.d.ts +206 -206
- package/dist/types/CallingClient/callingClientFixtures.d.ts +18 -18
- package/dist/types/CallingClient/constants.d.ts +122 -122
- package/dist/types/CallingClient/line/index.d.ts +43 -43
- package/dist/types/CallingClient/line/types.d.ts +55 -55
- package/dist/types/CallingClient/registration/index.d.ts +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +64 -64
- package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
- package/dist/types/CallingClient/registration/types.d.ts +20 -20
- package/dist/types/CallingClient/types.d.ts +29 -29
- package/dist/types/Contacts/ContactsClient.d.ts +26 -26
- package/dist/types/Contacts/constants.d.ts +19 -19
- package/dist/types/Contacts/contactFixtures.d.ts +280 -280
- package/dist/types/Contacts/types.d.ts +72 -72
- package/dist/types/Errors/catalog/CallError.d.ts +11 -11
- package/dist/types/Errors/catalog/CallingDeviceError.d.ts +10 -10
- package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
- package/dist/types/Errors/catalog/LineError.d.ts +10 -10
- package/dist/types/Errors/index.d.ts +2 -2
- package/dist/types/Errors/types.d.ts +60 -60
- package/dist/types/Events/impl/index.d.ts +8 -8
- package/dist/types/Events/types.d.ts +288 -288
- package/dist/types/Logger/index.d.ts +12 -12
- package/dist/types/Logger/types.d.ts +25 -25
- package/dist/types/Metrics/index.d.ts +5 -5
- package/dist/types/Metrics/types.d.ts +42 -42
- package/dist/types/SDKConnector/index.d.ts +12 -12
- package/dist/types/SDKConnector/types.d.ts +128 -128
- package/dist/types/SDKConnector/utils.d.ts +5 -5
- package/dist/types/Voicemail/BroadworksBackendConnector.d.ts +27 -27
- package/dist/types/Voicemail/UcmBackendConnector.d.ts +34 -34
- package/dist/types/Voicemail/Voicemail.d.ts +27 -27
- package/dist/types/Voicemail/WxCallBackendConnector.d.ts +23 -23
- package/dist/types/Voicemail/constants.d.ts +29 -29
- package/dist/types/Voicemail/types.d.ts +133 -133
- package/dist/types/Voicemail/voicemailFixture.d.ts +417 -417
- package/dist/types/api.d.ts +16 -16
- package/dist/types/common/Utils.d.ts +34 -34
- package/dist/types/common/constants.d.ts +41 -41
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/common/testUtil.d.ts +3611 -3611
- package/dist/types/common/types.d.ts +191 -191
- package/dist/types/index.d.ts +8 -8
- package/package.json +4 -4
- package/dist/CallHistory/CallHistory.js +0 -203
- package/dist/CallHistory/CallHistory.js.map +0 -1
- package/dist/CallHistory/CallHistory.test.js +0 -133
- package/dist/CallHistory/CallHistory.test.js.map +0 -1
- package/dist/CallHistory/callHistoryFixtures.js +0 -310
- package/dist/CallHistory/callHistoryFixtures.js.map +0 -1
- package/dist/CallHistory/constants.js +0 -26
- package/dist/CallHistory/constants.js.map +0 -1
- package/dist/CallHistory/types.js +0 -7
- package/dist/CallHistory/types.js.map +0 -1
- package/dist/CallSettings/CallSettings.js +0 -276
- package/dist/CallSettings/CallSettings.js.map +0 -1
- package/dist/CallSettings/CallSettings.test.js +0 -122
- package/dist/CallSettings/CallSettings.test.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.js +0 -217
- package/dist/CallSettings/UcmBackendConnector.js.map +0 -1
- package/dist/CallSettings/UcmBackendConnector.test.js +0 -227
- package/dist/CallSettings/UcmBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.js +0 -541
- package/dist/CallSettings/WxCallBackendConnector.js.map +0 -1
- package/dist/CallSettings/WxCallBackendConnector.test.js +0 -802
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +0 -1
- package/dist/CallSettings/constants.js +0 -30
- package/dist/CallSettings/constants.js.map +0 -1
- package/dist/CallSettings/testFixtures.js +0 -72
- package/dist/CallSettings/testFixtures.js.map +0 -1
- package/dist/CallSettings/types.js +0 -7
- package/dist/CallSettings/types.js.map +0 -1
- package/dist/CallingClient/CallingClient.js +0 -572
- package/dist/CallingClient/CallingClient.js.map +0 -1
- package/dist/CallingClient/CallingClient.test.js +0 -931
- package/dist/CallingClient/CallingClient.test.js.map +0 -1
- package/dist/CallingClient/callRecordFixtures.js +0 -103
- package/dist/CallingClient/callRecordFixtures.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.js +0 -287
- package/dist/CallingClient/calling/CallerId/index.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/index.test.js +0 -274
- package/dist/CallingClient/calling/CallerId/index.test.js.map +0 -1
- package/dist/CallingClient/calling/CallerId/types.js +0 -7
- package/dist/CallingClient/calling/CallerId/types.js.map +0 -1
- package/dist/CallingClient/calling/call.js +0 -2995
- package/dist/CallingClient/calling/call.js.map +0 -1
- package/dist/CallingClient/calling/call.test.js +0 -2614
- package/dist/CallingClient/calling/call.test.js.map +0 -1
- package/dist/CallingClient/calling/callManager.js +0 -443
- package/dist/CallingClient/calling/callManager.js.map +0 -1
- package/dist/CallingClient/calling/callManager.test.js +0 -683
- package/dist/CallingClient/calling/callManager.test.js.map +0 -1
- package/dist/CallingClient/calling/index.js +0 -30
- package/dist/CallingClient/calling/index.js.map +0 -1
- package/dist/CallingClient/calling/types.js +0 -71
- package/dist/CallingClient/calling/types.js.map +0 -1
- package/dist/CallingClient/callingClientFixtures.js +0 -53
- package/dist/CallingClient/callingClientFixtures.js.map +0 -1
- package/dist/CallingClient/constants.js +0 -226
- package/dist/CallingClient/constants.js.map +0 -1
- package/dist/CallingClient/line/index.js +0 -312
- package/dist/CallingClient/line/index.js.map +0 -1
- package/dist/CallingClient/line/line.test.js +0 -270
- package/dist/CallingClient/line/line.test.js.map +0 -1
- package/dist/CallingClient/line/types.js +0 -25
- package/dist/CallingClient/line/types.js.map +0 -1
- package/dist/CallingClient/registration/index.js +0 -19
- package/dist/CallingClient/registration/index.js.map +0 -1
- package/dist/CallingClient/registration/register.js +0 -1295
- package/dist/CallingClient/registration/register.js.map +0 -1
- package/dist/CallingClient/registration/register.test.js +0 -838
- package/dist/CallingClient/registration/register.test.js.map +0 -1
- package/dist/CallingClient/registration/registerFixtures.js +0 -41
- package/dist/CallingClient/registration/registerFixtures.js.map +0 -1
- package/dist/CallingClient/registration/types.js +0 -7
- package/dist/CallingClient/registration/types.js.map +0 -1
- package/dist/CallingClient/types.js +0 -7
- package/dist/CallingClient/types.js.map +0 -1
- package/dist/Contacts/ContactsClient.js +0 -1139
- package/dist/Contacts/ContactsClient.js.map +0 -1
- package/dist/Contacts/ContactsClient.test.js +0 -725
- package/dist/Contacts/ContactsClient.test.js.map +0 -1
- package/dist/Contacts/constants.js +0 -36
- package/dist/Contacts/constants.js.map +0 -1
- package/dist/Contacts/contactFixtures.js +0 -340
- package/dist/Contacts/contactFixtures.js.map +0 -1
- package/dist/Contacts/types.js +0 -20
- package/dist/Contacts/types.js.map +0 -1
- package/dist/Errors/catalog/CallError.js +0 -94
- package/dist/Errors/catalog/CallError.js.map +0 -1
- package/dist/Errors/catalog/CallingDeviceError.js +0 -88
- package/dist/Errors/catalog/CallingDeviceError.js.map +0 -1
- package/dist/Errors/catalog/ExtendedError.js +0 -45
- package/dist/Errors/catalog/ExtendedError.js.map +0 -1
- package/dist/Errors/catalog/LineError.js +0 -90
- package/dist/Errors/catalog/LineError.js.map +0 -1
- package/dist/Errors/index.js +0 -21
- package/dist/Errors/index.js.map +0 -1
- package/dist/Errors/types.js +0 -62
- package/dist/Errors/types.js.map +0 -1
- package/dist/Events/impl/index.js +0 -82
- package/dist/Events/impl/index.js.map +0 -1
- package/dist/Events/types.js +0 -111
- package/dist/Events/types.js.map +0 -1
- package/dist/Logger/index.js +0 -221
- package/dist/Logger/index.js.map +0 -1
- package/dist/Logger/index.test.js +0 -62
- package/dist/Logger/index.test.js.map +0 -1
- package/dist/Logger/types.js +0 -37
- package/dist/Logger/types.js.map +0 -1
- package/dist/Metrics/index.js +0 -329
- package/dist/Metrics/index.js.map +0 -1
- package/dist/Metrics/index.test.js +0 -291
- package/dist/Metrics/index.test.js.map +0 -1
- package/dist/Metrics/types.js +0 -50
- package/dist/Metrics/types.js.map +0 -1
- package/dist/SDKConnector/index.js +0 -105
- package/dist/SDKConnector/index.js.map +0 -1
- package/dist/SDKConnector/index.test.js +0 -9
- package/dist/SDKConnector/index.test.js.map +0 -1
- package/dist/SDKConnector/types.js +0 -7
- package/dist/SDKConnector/types.js.map +0 -1
- package/dist/SDKConnector/utils.js +0 -40
- package/dist/SDKConnector/utils.js.map +0 -1
- package/dist/SDKConnector/utils.test.js +0 -9
- package/dist/SDKConnector/utils.test.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.js +0 -632
- package/dist/Voicemail/BroadworksBackendConnector.js.map +0 -1
- package/dist/Voicemail/BroadworksBackendConnector.test.js +0 -733
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.js +0 -566
- package/dist/Voicemail/UcmBackendConnector.js.map +0 -1
- package/dist/Voicemail/UcmBackendConnector.test.js +0 -628
- package/dist/Voicemail/UcmBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/Voicemail.js +0 -378
- package/dist/Voicemail/Voicemail.js.map +0 -1
- package/dist/Voicemail/Voicemail.test.js +0 -226
- package/dist/Voicemail/Voicemail.test.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.js +0 -540
- package/dist/Voicemail/WxCallBackendConnector.js.map +0 -1
- package/dist/Voicemail/WxCallBackendConnector.test.js +0 -942
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +0 -1
- package/dist/Voicemail/constants.js +0 -66
- package/dist/Voicemail/constants.js.map +0 -1
- package/dist/Voicemail/types.js +0 -7
- package/dist/Voicemail/types.js.map +0 -1
- package/dist/Voicemail/voicemailFixture.js +0 -559
- package/dist/Voicemail/voicemailFixture.js.map +0 -1
- package/dist/api.js +0 -134
- package/dist/api.js.map +0 -1
- package/dist/common/Utils.js +0 -1264
- package/dist/common/Utils.js.map +0 -1
- package/dist/common/Utils.test.js +0 -1227
- package/dist/common/Utils.test.js.map +0 -1
- package/dist/common/constants.js +0 -90
- package/dist/common/constants.js.map +0 -1
- package/dist/common/index.js +0 -19
- package/dist/common/index.js.map +0 -1
- package/dist/common/testUtil.js +0 -968
- package/dist/common/testUtil.js.map +0 -1
- package/dist/common/types.js +0 -75
- package/dist/common/types.js.map +0 -1
- package/dist/index.js +0 -63
- package/dist/index.js.map +0 -1
package/dist/common/Utils.js
DELETED
|
@@ -1,1264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
4
|
-
var _Array$from = require("@babel/runtime-corejs2/core-js/array/from");
|
|
5
|
-
var _Symbol = require("@babel/runtime-corejs2/core-js/symbol");
|
|
6
|
-
var _Symbol$iterator = require("@babel/runtime-corejs2/core-js/symbol/iterator");
|
|
7
|
-
var _Array$isArray = require("@babel/runtime-corejs2/core-js/array/is-array");
|
|
8
|
-
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
9
|
-
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
10
|
-
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
11
|
-
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
12
|
-
_Object$defineProperty(exports, "__esModule", {
|
|
13
|
-
value: true
|
|
14
|
-
});
|
|
15
|
-
exports.emitFinalFailure = emitFinalFailure;
|
|
16
|
-
exports.fetchVoicemailList = fetchVoicemailList;
|
|
17
|
-
exports.filterMobiusUris = filterMobiusUris;
|
|
18
|
-
exports.getCallingBackEnd = getCallingBackEnd;
|
|
19
|
-
exports.getSortedVoicemailList = getSortedVoicemailList;
|
|
20
|
-
exports.getVgActionEndpoint = getVgActionEndpoint;
|
|
21
|
-
exports.getXsiActionEndpoint = getXsiActionEndpoint;
|
|
22
|
-
exports.handleCallErrors = handleCallErrors;
|
|
23
|
-
exports.handleCallingClientErrors = handleCallingClientErrors;
|
|
24
|
-
exports.handleRegistrationErrors = handleRegistrationErrors;
|
|
25
|
-
exports.inferIdFromUuid = inferIdFromUuid;
|
|
26
|
-
exports.parseMediaQualityStatistics = parseMediaQualityStatistics;
|
|
27
|
-
exports.resolveCallerIdByName = resolveCallerIdByName;
|
|
28
|
-
exports.resolveCallerIdDisplay = resolveCallerIdDisplay;
|
|
29
|
-
exports.resolveContact = resolveContact;
|
|
30
|
-
exports.serviceErrorCodeHandler = serviceErrorCodeHandler;
|
|
31
|
-
exports.storeVoicemailList = storeVoicemailList;
|
|
32
|
-
exports.validateServiceData = validateServiceData;
|
|
33
|
-
exports.waitForMsecs = void 0;
|
|
34
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
35
|
-
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
36
|
-
var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
|
|
37
|
-
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
38
|
-
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
39
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
40
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
41
|
-
var platform = _interopRequireWildcard(require("platform"));
|
|
42
|
-
var _CallError = require("../Errors/catalog/CallError");
|
|
43
|
-
var _types = require("../Errors/types");
|
|
44
|
-
var _types2 = require("./types");
|
|
45
|
-
var _Logger = _interopRequireDefault(require("../Logger"));
|
|
46
|
-
var _CallingDeviceError = require("../Errors/catalog/CallingDeviceError");
|
|
47
|
-
var _constants = require("../CallingClient/constants");
|
|
48
|
-
var _constants2 = require("./constants");
|
|
49
|
-
var _SDKConnector = _interopRequireDefault(require("../SDKConnector"));
|
|
50
|
-
var _types3 = require("../CallingClient/line/types");
|
|
51
|
-
var _LineError = require("../Errors/catalog/LineError");
|
|
52
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
53
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
54
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && o[_Symbol$iterator] || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, 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 normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
55
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
56
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
57
|
-
function filterMobiusUris(mobiusServers, defaultMobiusUrl) {
|
|
58
|
-
var _mobiusServers$primar, _mobiusServers$backup;
|
|
59
|
-
var logContext = {
|
|
60
|
-
file: _constants.UTILS_FILE,
|
|
61
|
-
method: filterMobiusUris.name
|
|
62
|
-
};
|
|
63
|
-
var urisArrayPrimary = [];
|
|
64
|
-
var urisArrayBackup = [];
|
|
65
|
-
if (mobiusServers !== null && mobiusServers !== void 0 && (_mobiusServers$primar = mobiusServers.primary) !== null && _mobiusServers$primar !== void 0 && _mobiusServers$primar.uris) {
|
|
66
|
-
_Logger.default.info('Adding Primary uris', logContext);
|
|
67
|
-
var _iterator = _createForOfIteratorHelper(mobiusServers.primary.uris),
|
|
68
|
-
_step;
|
|
69
|
-
try {
|
|
70
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
71
|
-
var uri = _step.value;
|
|
72
|
-
urisArrayPrimary.push("".concat(uri).concat(_constants.URL_ENDPOINT));
|
|
73
|
-
}
|
|
74
|
-
} catch (err) {
|
|
75
|
-
_iterator.e(err);
|
|
76
|
-
} finally {
|
|
77
|
-
_iterator.f();
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
if (mobiusServers !== null && mobiusServers !== void 0 && (_mobiusServers$backup = mobiusServers.backup) !== null && _mobiusServers$backup !== void 0 && _mobiusServers$backup.uris) {
|
|
81
|
-
_Logger.default.info('Adding Backup uris', logContext);
|
|
82
|
-
var _iterator2 = _createForOfIteratorHelper(mobiusServers.backup.uris),
|
|
83
|
-
_step2;
|
|
84
|
-
try {
|
|
85
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
86
|
-
var _uri = _step2.value;
|
|
87
|
-
urisArrayBackup.push("".concat(_uri).concat(_constants.URL_ENDPOINT));
|
|
88
|
-
}
|
|
89
|
-
} catch (err) {
|
|
90
|
-
_iterator2.e(err);
|
|
91
|
-
} finally {
|
|
92
|
-
_iterator2.f();
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/*
|
|
97
|
-
* If there are no entries in both primary and backup arrays then add the default
|
|
98
|
-
* uri in primary array, otherwise in backup.
|
|
99
|
-
*/
|
|
100
|
-
_Logger.default.info('Adding Default uri', logContext);
|
|
101
|
-
if (!urisArrayPrimary.length && !urisArrayBackup.length) {
|
|
102
|
-
urisArrayPrimary.push("".concat(defaultMobiusUrl).concat(_constants.URL_ENDPOINT));
|
|
103
|
-
} else {
|
|
104
|
-
urisArrayBackup.push("".concat(defaultMobiusUrl).concat(_constants.URL_ENDPOINT));
|
|
105
|
-
}
|
|
106
|
-
var primaryUris = [];
|
|
107
|
-
var backupUris = [];
|
|
108
|
-
|
|
109
|
-
/* Remove duplicates from primary by keeping the order intact */
|
|
110
|
-
for (var i = 0; i < urisArrayPrimary.length; i += 1) {
|
|
111
|
-
if (primaryUris.indexOf(urisArrayPrimary[i]) === -1) {
|
|
112
|
-
primaryUris.push(urisArrayPrimary[i]);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/* Remove duplicates from backup by keeping the order intact */
|
|
117
|
-
for (var _i = 0; _i < urisArrayBackup.length; _i += 1) {
|
|
118
|
-
if (backupUris.indexOf(urisArrayBackup[_i]) === -1) {
|
|
119
|
-
backupUris.push(urisArrayBackup[_i]);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
return {
|
|
123
|
-
primary: primaryUris,
|
|
124
|
-
backup: backupUris
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Updates the error context for a particular calling client instance.
|
|
130
|
-
*
|
|
131
|
-
* @param errContext - Error Context as generated by the caller.
|
|
132
|
-
* @param type - Error type based on status code.
|
|
133
|
-
* @param message - Custom message for user.
|
|
134
|
-
* @param correlationId - Unique identifier for a call.
|
|
135
|
-
* @param callError - Call error instance.
|
|
136
|
-
*/
|
|
137
|
-
function updateCallErrorContext(errContext, type, message, correlationId, callError) {
|
|
138
|
-
var errObj = {};
|
|
139
|
-
errObj.context = errContext;
|
|
140
|
-
errObj.type = type;
|
|
141
|
-
errObj.message = message;
|
|
142
|
-
errObj.correlationId = correlationId;
|
|
143
|
-
callError.setCallError(errObj);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Updates the error context for a particular line instance.
|
|
148
|
-
*
|
|
149
|
-
* @param errContext - Error Context.
|
|
150
|
-
* @param type - Error type based on status code.
|
|
151
|
-
* @param message - Custom message for user.
|
|
152
|
-
* @param status - Status of line.
|
|
153
|
-
* @param lineError - Line error instance.
|
|
154
|
-
*/
|
|
155
|
-
function updateLineErrorContext(errContext, type, message, status, lineError) {
|
|
156
|
-
var errObj = {};
|
|
157
|
-
errObj.context = errContext;
|
|
158
|
-
errObj.type = type;
|
|
159
|
-
errObj.message = message;
|
|
160
|
-
errObj.status = status;
|
|
161
|
-
lineError.setError(errObj);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Updates the error context for a particular calling client instance.
|
|
166
|
-
*
|
|
167
|
-
* @param errContext - Error Context as generated by the caller.
|
|
168
|
-
* @param type - Error type based on status code.
|
|
169
|
-
* @param message - Custom message for user.
|
|
170
|
-
* @param clientError - Client Error.
|
|
171
|
-
*/
|
|
172
|
-
function updateErrorContext(errContext, type, message, clientError) {
|
|
173
|
-
var errObj = {};
|
|
174
|
-
errObj.context = errContext;
|
|
175
|
-
errObj.type = type;
|
|
176
|
-
errObj.message = message;
|
|
177
|
-
clientError.setError(errObj);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Emits final failure to the client after it gives up
|
|
182
|
-
* retrying registration and records error metric.
|
|
183
|
-
*
|
|
184
|
-
* @param line - Instance of line.
|
|
185
|
-
* @param caller - Method which called this handler.
|
|
186
|
-
* @param file - File name from where error got reported.
|
|
187
|
-
*/
|
|
188
|
-
function emitFinalFailure(emitterCb, loggerContext) {
|
|
189
|
-
var clientError = (0, _LineError.createLineError)('', {}, _types.ERROR_TYPE.DEFAULT, _types3.LineStatus.INACTIVE);
|
|
190
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.SERVICE_UNAVAILABLE, 'An unknown error occurred. Wait a moment and try again. Please contact the administrator if the problem persists.', _types3.LineStatus.INACTIVE, clientError);
|
|
191
|
-
emitterCb(clientError);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Handle various Registration related Error flows here. Decide whether to emit event or retry.
|
|
196
|
-
* @param err - Error body.
|
|
197
|
-
* @param emitterCb - LineErrorEmitterCallback
|
|
198
|
-
* @param loggerContext - Logging context that has method and file name
|
|
199
|
-
* @param restoreRegCb - Callback which will try restoring resgistration in case of 403
|
|
200
|
-
*
|
|
201
|
-
* In emitterCb,
|
|
202
|
-
* For non final error scenarios in registration flow,
|
|
203
|
-
* send Unregistered event only without any error message
|
|
204
|
-
* in order to have the web client update only the UI
|
|
205
|
-
* state to disconnected and not show any error dialog
|
|
206
|
-
* to the end user as in those scenarios a retry will
|
|
207
|
-
* be scheduled to attempt registration again.
|
|
208
|
-
*
|
|
209
|
-
*/
|
|
210
|
-
function handleRegistrationErrors(_x, _x2, _x3, _x4) {
|
|
211
|
-
return _handleRegistrationErrors.apply(this, arguments);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Handle various Error flows related to calling client here. Decide whether to emit event or retry.
|
|
215
|
-
* @param err - Error body.
|
|
216
|
-
* @param emitterCb - CallingClientErrorEmitter
|
|
217
|
-
* @param loggerContext - Logging context that has method and file name
|
|
218
|
-
* @param restoreRegCb - Callback which will try restoring resgistration in case of 403
|
|
219
|
-
*/
|
|
220
|
-
function _handleRegistrationErrors() {
|
|
221
|
-
_handleRegistrationErrors = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(err, emitterCb, loggerContext, restoreRegCb) {
|
|
222
|
-
var lineError, errorCode, finalError, errorBody, code, errorMessage, caller, _errorMessage, _errorMessage2, _errorMessage3;
|
|
223
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
224
|
-
while (1) switch (_context.prev = _context.next) {
|
|
225
|
-
case 0:
|
|
226
|
-
lineError = (0, _LineError.createLineError)('', {}, _types.ERROR_TYPE.DEFAULT, _types3.LineStatus.INACTIVE);
|
|
227
|
-
errorCode = Number(err.statusCode);
|
|
228
|
-
finalError = false;
|
|
229
|
-
_Logger.default.warn("Status code: -> ".concat(errorCode), loggerContext);
|
|
230
|
-
_context.t0 = errorCode;
|
|
231
|
-
_context.next = _context.t0 === _types.ERROR_CODE.UNAUTHORIZED ? 7 : _context.t0 === _types.ERROR_CODE.INTERNAL_SERVER_ERROR ? 12 : _context.t0 === _types.ERROR_CODE.SERVICE_UNAVAILABLE ? 16 : _context.t0 === _types.ERROR_CODE.FORBIDDEN ? 20 : _context.t0 === _types.ERROR_CODE.DEVICE_NOT_FOUND ? 55 : 60;
|
|
232
|
-
break;
|
|
233
|
-
case 7:
|
|
234
|
-
// Return it to the Caller
|
|
235
|
-
finalError = true;
|
|
236
|
-
_Logger.default.warn("401 Unauthorized", loggerContext);
|
|
237
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.TOKEN_ERROR, 'User is unauthorized due to an expired token. Sign out, then sign back in.', _types3.LineStatus.INACTIVE, lineError);
|
|
238
|
-
emitterCb(lineError, finalError);
|
|
239
|
-
return _context.abrupt("break", 63);
|
|
240
|
-
case 12:
|
|
241
|
-
_Logger.default.warn("500 Internal Server Error", loggerContext);
|
|
242
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.SERVER_ERROR, 'An unknown error occurred while placing the request. Wait a moment and try again.', _types3.LineStatus.INACTIVE, lineError);
|
|
243
|
-
emitterCb(lineError, finalError);
|
|
244
|
-
return _context.abrupt("break", 63);
|
|
245
|
-
case 16:
|
|
246
|
-
_Logger.default.warn("503 Service Unavailable", loggerContext);
|
|
247
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.SERVICE_UNAVAILABLE, 'An error occurred on the server while processing the request. Wait a moment and try again.', _types3.LineStatus.INACTIVE, lineError);
|
|
248
|
-
emitterCb(lineError, finalError);
|
|
249
|
-
return _context.abrupt("break", 63);
|
|
250
|
-
case 20:
|
|
251
|
-
_Logger.default.warn("403 Forbidden", loggerContext);
|
|
252
|
-
errorBody = err.body;
|
|
253
|
-
if (errorBody) {
|
|
254
|
-
_context.next = 27;
|
|
255
|
-
break;
|
|
256
|
-
}
|
|
257
|
-
_Logger.default.warn('Error response has no body, throwing default error', loggerContext);
|
|
258
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, 'An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.', _types3.LineStatus.INACTIVE, lineError);
|
|
259
|
-
emitterCb(lineError, finalError);
|
|
260
|
-
return _context.abrupt("return", finalError);
|
|
261
|
-
case 27:
|
|
262
|
-
code = Number(errorBody.errorCode);
|
|
263
|
-
_Logger.default.warn("Error code found : ".concat(code), loggerContext);
|
|
264
|
-
_context.t1 = code;
|
|
265
|
-
_context.next = _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_LIMIT_EXCEEDED ? 32 : _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_CREATION_DISABLED ? 39 : _context.t1 === _types.DEVICE_ERROR_CODE.DEVICE_CREATION_FAILED ? 45 : 50;
|
|
266
|
-
break;
|
|
267
|
-
case 32:
|
|
268
|
-
errorMessage = 'User device limit exceeded';
|
|
269
|
-
_Logger.default.warn(errorMessage, loggerContext);
|
|
270
|
-
if (!restoreRegCb) {
|
|
271
|
-
_context.next = 38;
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
caller = loggerContext.method || 'handleErrors';
|
|
275
|
-
_context.next = 38;
|
|
276
|
-
return restoreRegCb(errorBody, caller);
|
|
277
|
-
case 38:
|
|
278
|
-
return _context.abrupt("break", 54);
|
|
279
|
-
case 39:
|
|
280
|
-
_errorMessage = 'User is not configured for WebRTC calling. Please contact the administrator to resolve this issue.';
|
|
281
|
-
finalError = true;
|
|
282
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage, _types3.LineStatus.INACTIVE, lineError);
|
|
283
|
-
_Logger.default.warn(_errorMessage, loggerContext);
|
|
284
|
-
emitterCb(lineError, true);
|
|
285
|
-
return _context.abrupt("break", 54);
|
|
286
|
-
case 45:
|
|
287
|
-
_errorMessage2 = 'An unknown error occurred while provisioning the device. Wait a moment and try again.';
|
|
288
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage2, _types3.LineStatus.INACTIVE, lineError);
|
|
289
|
-
_Logger.default.warn(_errorMessage2, loggerContext);
|
|
290
|
-
emitterCb(lineError, finalError);
|
|
291
|
-
return _context.abrupt("break", 54);
|
|
292
|
-
case 50:
|
|
293
|
-
_errorMessage3 = 'An unknown error occurred. Wait a moment and try again. Please contact the administrator if the problem persists.';
|
|
294
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.FORBIDDEN_ERROR, _errorMessage3, _types3.LineStatus.INACTIVE, lineError);
|
|
295
|
-
_Logger.default.warn(_errorMessage3, loggerContext);
|
|
296
|
-
emitterCb(lineError, finalError);
|
|
297
|
-
case 54:
|
|
298
|
-
return _context.abrupt("break", 63);
|
|
299
|
-
case 55:
|
|
300
|
-
finalError = true;
|
|
301
|
-
_Logger.default.warn("404 Device Not Found", loggerContext);
|
|
302
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.NOT_FOUND, 'The client has unregistered. Please wait for the client to register before attempting the call. If error persists, sign out, sign back in and attempt the call.', _types3.LineStatus.INACTIVE, lineError);
|
|
303
|
-
emitterCb(lineError, finalError);
|
|
304
|
-
return _context.abrupt("break", 63);
|
|
305
|
-
case 60:
|
|
306
|
-
updateLineErrorContext(loggerContext, _types.ERROR_TYPE.DEFAULT, 'Unknown error', _types3.LineStatus.INACTIVE, lineError);
|
|
307
|
-
_Logger.default.warn("Unknown Error", loggerContext);
|
|
308
|
-
emitterCb(lineError, finalError);
|
|
309
|
-
case 63:
|
|
310
|
-
return _context.abrupt("return", finalError);
|
|
311
|
-
case 64:
|
|
312
|
-
case "end":
|
|
313
|
-
return _context.stop();
|
|
314
|
-
}
|
|
315
|
-
}, _callee);
|
|
316
|
-
}));
|
|
317
|
-
return _handleRegistrationErrors.apply(this, arguments);
|
|
318
|
-
}
|
|
319
|
-
function handleCallingClientErrors(_x5, _x6, _x7) {
|
|
320
|
-
return _handleCallingClientErrors.apply(this, arguments);
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Handler for call related errors.
|
|
324
|
-
*
|
|
325
|
-
* @param emitterCb - Event emitter function.
|
|
326
|
-
* @param errorType - Type of error experienced.
|
|
327
|
-
* @param errorLayer - Call control or media layer.
|
|
328
|
-
* @param retryCb - Failure retry function.
|
|
329
|
-
* @param correlationId - CorrelationId of the call.
|
|
330
|
-
* @param err - Error Response.
|
|
331
|
-
* @param caller - Caller function.
|
|
332
|
-
* @param file - File name.
|
|
333
|
-
*/
|
|
334
|
-
function _handleCallingClientErrors() {
|
|
335
|
-
_handleCallingClientErrors = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(err, emitterCb, loggerContext) {
|
|
336
|
-
var clientError, errorCode, finalError;
|
|
337
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
338
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
339
|
-
case 0:
|
|
340
|
-
clientError = (0, _CallingDeviceError.createClientError)('', {}, _types.ERROR_TYPE.DEFAULT, _types2.MobiusStatus.DEFAULT);
|
|
341
|
-
errorCode = Number(err.statusCode);
|
|
342
|
-
finalError = false;
|
|
343
|
-
_Logger.default.warn("Status code: -> ".concat(errorCode), loggerContext);
|
|
344
|
-
_context2.t0 = errorCode;
|
|
345
|
-
_context2.next = _context2.t0 === _types.ERROR_CODE.INTERNAL_SERVER_ERROR ? 7 : 11;
|
|
346
|
-
break;
|
|
347
|
-
case 7:
|
|
348
|
-
_Logger.default.warn("500 Internal Server Error", loggerContext);
|
|
349
|
-
updateErrorContext(loggerContext, _types.ERROR_TYPE.SERVER_ERROR, 'An unknown error occurred while placing the request. Wait a moment and try again.', clientError);
|
|
350
|
-
emitterCb(clientError, finalError);
|
|
351
|
-
return _context2.abrupt("break", 14);
|
|
352
|
-
case 11:
|
|
353
|
-
updateErrorContext(loggerContext, _types.ERROR_TYPE.DEFAULT, 'Unknown error', clientError);
|
|
354
|
-
_Logger.default.warn("Unknown Error", loggerContext);
|
|
355
|
-
emitterCb(clientError, finalError);
|
|
356
|
-
case 14:
|
|
357
|
-
return _context2.abrupt("return", finalError);
|
|
358
|
-
case 15:
|
|
359
|
-
case "end":
|
|
360
|
-
return _context2.stop();
|
|
361
|
-
}
|
|
362
|
-
}, _callee2);
|
|
363
|
-
}));
|
|
364
|
-
return _handleCallingClientErrors.apply(this, arguments);
|
|
365
|
-
}
|
|
366
|
-
function handleCallErrors(_x8, _x9, _x10, _x11, _x12, _x13, _x14) {
|
|
367
|
-
return _handleCallErrors.apply(this, arguments);
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
*Function to return error details.
|
|
371
|
-
*
|
|
372
|
-
* @param errorCode - WebexRequestPayload // Error status code for failed cases.
|
|
373
|
-
* @param err -.
|
|
374
|
-
* @param loggerContext -.
|
|
375
|
-
* @returns Error response (status code and error message).
|
|
376
|
-
*/
|
|
377
|
-
function _handleCallErrors() {
|
|
378
|
-
_handleCallErrors = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(emitterCb, errorLayer, retryCb, correlationId, err, caller, file) {
|
|
379
|
-
var loggerContext, callError, errorCode, errorBody, retryInterval, code, message;
|
|
380
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
381
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
382
|
-
case 0:
|
|
383
|
-
loggerContext = {
|
|
384
|
-
file: file,
|
|
385
|
-
method: caller
|
|
386
|
-
};
|
|
387
|
-
callError = (0, _CallError.createCallError)('', loggerContext, _types.ERROR_TYPE.DEFAULT, '', errorLayer);
|
|
388
|
-
errorCode = Number(err.statusCode);
|
|
389
|
-
_Logger.default.warn("Status code: ->".concat(errorCode), loggerContext);
|
|
390
|
-
_context3.t0 = errorCode;
|
|
391
|
-
_context3.next = _context3.t0 === _types.ERROR_CODE.UNAUTHORIZED ? 7 : _context3.t0 === _types.ERROR_CODE.FORBIDDEN ? 11 : _context3.t0 === _types.ERROR_CODE.SERVICE_UNAVAILABLE ? 11 : _context3.t0 === _types.ERROR_CODE.DEVICE_NOT_FOUND ? 48 : _context3.t0 === _types.ERROR_CODE.INTERNAL_SERVER_ERROR ? 52 : 56;
|
|
392
|
-
break;
|
|
393
|
-
case 7:
|
|
394
|
-
_Logger.default.warn("401 Unauthorized", loggerContext);
|
|
395
|
-
updateCallErrorContext(loggerContext, _types.ERROR_TYPE.TOKEN_ERROR, 'User is unauthorized due to an expired token. Sign out, then sign back in.', correlationId, callError);
|
|
396
|
-
emitterCb(callError);
|
|
397
|
-
return _context3.abrupt("break", 57);
|
|
398
|
-
case 11:
|
|
399
|
-
errorBody = err.body;
|
|
400
|
-
if (errorBody) {
|
|
401
|
-
_context3.next = 17;
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
_Logger.default.warn('Error response has no body, throwing default error', loggerContext);
|
|
405
|
-
updateCallErrorContext(loggerContext, err.statusCode === 403 ? _types.ERROR_TYPE.FORBIDDEN_ERROR : _types.ERROR_TYPE.SERVICE_UNAVAILABLE, err.statusCode === 403 ? 'An unauthorized action has been received. This action has been blocked. Please contact the administrator if this persists.' : 'An error occurred on the server while processing the request. Wait a moment and try again.', correlationId, callError);
|
|
406
|
-
emitterCb(callError);
|
|
407
|
-
return _context3.abrupt("return");
|
|
408
|
-
case 17:
|
|
409
|
-
if (!(err.headers && 'retry-after' in err.headers && retryCb)) {
|
|
410
|
-
_context3.next = 22;
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
retryInterval = Number(err.headers['retry-after']);
|
|
414
|
-
_Logger.default.warn("Retry Interval received: ".concat(retryInterval), loggerContext);
|
|
415
|
-
retryCb(retryInterval);
|
|
416
|
-
return _context3.abrupt("return");
|
|
417
|
-
case 22:
|
|
418
|
-
/* Handling various Error codes */
|
|
419
|
-
code = Number(errorBody.errorCode);
|
|
420
|
-
_context3.t1 = code;
|
|
421
|
-
_context3.next = _context3.t1 === _types.CALL_ERROR_CODE.INVALID_STATUS_UPDATE ? 26 : _context3.t1 === _types.CALL_ERROR_CODE.DEVICE_NOT_REGISTERED ? 28 : _context3.t1 === _types.CALL_ERROR_CODE.CALL_NOT_FOUND ? 30 : _context3.t1 === _types.CALL_ERROR_CODE.ERROR_PROCESSING ? 32 : _context3.t1 === _types.CALL_ERROR_CODE.USER_BUSY ? 34 : _context3.t1 === _types.CALL_ERROR_CODE.PARSING_ERROR ? 36 : _context3.t1 === _types.CALL_ERROR_CODE.NOT_ACCEPTABLE ? 38 : _context3.t1 === _types.CALL_ERROR_CODE.CALL_REJECTED ? 40 : _context3.t1 === _types.CALL_ERROR_CODE.NOT_AVAILABLE ? 42 : 44;
|
|
422
|
-
break;
|
|
423
|
-
case 26:
|
|
424
|
-
message = 'An invalid status update has been received for the call. Wait a moment and try again.';
|
|
425
|
-
return _context3.abrupt("break", 45);
|
|
426
|
-
case 28:
|
|
427
|
-
message = 'The client has unregistered. Please wait for the client to register before attempting the call. If error persists, sign out, sign back in and attempt the call.';
|
|
428
|
-
return _context3.abrupt("break", 45);
|
|
429
|
-
case 30:
|
|
430
|
-
message = 'Call is not found on the server. Wait a moment and try again.';
|
|
431
|
-
return _context3.abrupt("break", 45);
|
|
432
|
-
case 32:
|
|
433
|
-
message = 'An error occurred while processing the call on the server. Wait a moment and try again.';
|
|
434
|
-
return _context3.abrupt("break", 45);
|
|
435
|
-
case 34:
|
|
436
|
-
message = 'Called user is busy.';
|
|
437
|
-
return _context3.abrupt("break", 45);
|
|
438
|
-
case 36:
|
|
439
|
-
message = 'An error occurred while parsing the provided information. Wait a moment and try again.';
|
|
440
|
-
return _context3.abrupt("break", 45);
|
|
441
|
-
case 38:
|
|
442
|
-
message = 'An error occurred on the server while accepting the call. Wait a moment and try again. Please contact the administrator if this persists.';
|
|
443
|
-
return _context3.abrupt("break", 45);
|
|
444
|
-
case 40:
|
|
445
|
-
message = 'Call rejected by the server. Wait a moment and try again. Please contact the administrator if this persists.';
|
|
446
|
-
return _context3.abrupt("break", 45);
|
|
447
|
-
case 42:
|
|
448
|
-
message = 'Calling services not available. Wait a moment and try again. Please contact the administrator if this persists.';
|
|
449
|
-
return _context3.abrupt("break", 45);
|
|
450
|
-
case 44:
|
|
451
|
-
message = 'An unknown error occurred. Wait a moment and try again.';
|
|
452
|
-
case 45:
|
|
453
|
-
/* We just emit the errors to the app */
|
|
454
|
-
|
|
455
|
-
updateCallErrorContext(loggerContext, err.statusCode === 403 ? _types.ERROR_TYPE.FORBIDDEN_ERROR : _types.ERROR_TYPE.SERVICE_UNAVAILABLE, message, correlationId, callError);
|
|
456
|
-
emitterCb(callError);
|
|
457
|
-
return _context3.abrupt("break", 57);
|
|
458
|
-
case 48:
|
|
459
|
-
_Logger.default.warn("404 Call Not Found", loggerContext);
|
|
460
|
-
updateCallErrorContext(loggerContext, _types.ERROR_TYPE.NOT_FOUND, 'Call is no longer active. Wait a moment and try again.', correlationId, callError);
|
|
461
|
-
emitterCb(callError);
|
|
462
|
-
return _context3.abrupt("break", 57);
|
|
463
|
-
case 52:
|
|
464
|
-
_Logger.default.warn("500 Internal Server Error", loggerContext);
|
|
465
|
-
updateCallErrorContext(loggerContext, _types.ERROR_TYPE.SERVER_ERROR, 'An unknown error occurred in the call. Wait a moment and try again.', correlationId, callError);
|
|
466
|
-
emitterCb(callError);
|
|
467
|
-
return _context3.abrupt("break", 57);
|
|
468
|
-
case 56:
|
|
469
|
-
_Logger.default.warn("Unknown Error", loggerContext);
|
|
470
|
-
case 57:
|
|
471
|
-
case "end":
|
|
472
|
-
return _context3.stop();
|
|
473
|
-
}
|
|
474
|
-
}, _callee3);
|
|
475
|
-
}));
|
|
476
|
-
return _handleCallErrors.apply(this, arguments);
|
|
477
|
-
}
|
|
478
|
-
function serviceErrorCodeHandler(_x15, _x16) {
|
|
479
|
-
return _serviceErrorCodeHandler.apply(this, arguments);
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* @param stats - RTC peer connection stats.
|
|
483
|
-
* @returns CallRtpStats.
|
|
484
|
-
*/
|
|
485
|
-
function _serviceErrorCodeHandler() {
|
|
486
|
-
_serviceErrorCodeHandler = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(err, loggerContext) {
|
|
487
|
-
var errorCode, failureMessage, errorDetails, _errorDetails, _errorDetails2, _errorDetails3, _errorDetails4, _errorDetails5, _errorDetails6, _errorDetails7, _errorDetails8;
|
|
488
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
489
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
490
|
-
case 0:
|
|
491
|
-
errorCode = Number(err.statusCode);
|
|
492
|
-
failureMessage = 'FAILURE';
|
|
493
|
-
_context4.t0 = errorCode;
|
|
494
|
-
_context4.next = _context4.t0 === _types.ERROR_CODE.BAD_REQUEST ? 5 : _context4.t0 === _types.ERROR_CODE.UNAUTHORIZED ? 8 : _context4.t0 === _types.ERROR_CODE.FORBIDDEN ? 11 : _context4.t0 === _types.ERROR_CODE.DEVICE_NOT_FOUND ? 14 : _context4.t0 === _types.ERROR_CODE.REQUEST_TIMEOUT ? 17 : _context4.t0 === _types.ERROR_CODE.NOT_IMPLEMENTED ? 20 : _context4.t0 === _types.ERROR_CODE.INTERNAL_SERVER_ERROR ? 23 : _context4.t0 === _types.ERROR_CODE.SERVICE_UNAVAILABLE ? 26 : 29;
|
|
495
|
-
break;
|
|
496
|
-
case 5:
|
|
497
|
-
_Logger.default.warn("400 Bad request", loggerContext);
|
|
498
|
-
errorDetails = {
|
|
499
|
-
statusCode: 400,
|
|
500
|
-
data: {
|
|
501
|
-
error: '400 Bad request'
|
|
502
|
-
},
|
|
503
|
-
message: failureMessage
|
|
504
|
-
};
|
|
505
|
-
return _context4.abrupt("return", errorDetails);
|
|
506
|
-
case 8:
|
|
507
|
-
_Logger.default.warn("401 User is unauthorised, possible token expiry", loggerContext);
|
|
508
|
-
_errorDetails = {
|
|
509
|
-
statusCode: 401,
|
|
510
|
-
data: {
|
|
511
|
-
error: 'User is unauthorised, possible token expiry'
|
|
512
|
-
},
|
|
513
|
-
message: failureMessage
|
|
514
|
-
};
|
|
515
|
-
return _context4.abrupt("return", _errorDetails);
|
|
516
|
-
case 11:
|
|
517
|
-
_Logger.default.warn("403 User request is forbidden", loggerContext);
|
|
518
|
-
_errorDetails2 = {
|
|
519
|
-
statusCode: 403,
|
|
520
|
-
data: {
|
|
521
|
-
error: 'User request is forbidden'
|
|
522
|
-
},
|
|
523
|
-
message: failureMessage
|
|
524
|
-
};
|
|
525
|
-
return _context4.abrupt("return", _errorDetails2);
|
|
526
|
-
case 14:
|
|
527
|
-
_Logger.default.warn("404 User info not found", loggerContext);
|
|
528
|
-
_errorDetails3 = {
|
|
529
|
-
statusCode: 404,
|
|
530
|
-
data: {
|
|
531
|
-
error: 'User info not found'
|
|
532
|
-
},
|
|
533
|
-
message: failureMessage
|
|
534
|
-
};
|
|
535
|
-
return _context4.abrupt("return", _errorDetails3);
|
|
536
|
-
case 17:
|
|
537
|
-
_Logger.default.warn("408 Request to the server timedout", loggerContext);
|
|
538
|
-
_errorDetails4 = {
|
|
539
|
-
statusCode: 408,
|
|
540
|
-
data: {
|
|
541
|
-
error: 'Request to the server timedout'
|
|
542
|
-
},
|
|
543
|
-
message: failureMessage
|
|
544
|
-
};
|
|
545
|
-
return _context4.abrupt("return", _errorDetails4);
|
|
546
|
-
case 20:
|
|
547
|
-
_Logger.default.warn("501 Not Implemented error occurred", loggerContext);
|
|
548
|
-
_errorDetails5 = {
|
|
549
|
-
statusCode: 501,
|
|
550
|
-
data: {
|
|
551
|
-
error: 'Method is not implemented at the backend'
|
|
552
|
-
},
|
|
553
|
-
message: failureMessage
|
|
554
|
-
};
|
|
555
|
-
return _context4.abrupt("return", _errorDetails5);
|
|
556
|
-
case 23:
|
|
557
|
-
_Logger.default.warn("500 Internal server error occurred", loggerContext);
|
|
558
|
-
_errorDetails6 = {
|
|
559
|
-
statusCode: 500,
|
|
560
|
-
data: {
|
|
561
|
-
error: 'Internal server error occurred'
|
|
562
|
-
},
|
|
563
|
-
message: failureMessage
|
|
564
|
-
};
|
|
565
|
-
return _context4.abrupt("return", _errorDetails6);
|
|
566
|
-
case 26:
|
|
567
|
-
_Logger.default.warn("503 Unable to establish a connection with the server", loggerContext);
|
|
568
|
-
_errorDetails7 = {
|
|
569
|
-
statusCode: 503,
|
|
570
|
-
data: {
|
|
571
|
-
error: 'Unable to establish a connection with the server'
|
|
572
|
-
},
|
|
573
|
-
message: failureMessage
|
|
574
|
-
};
|
|
575
|
-
return _context4.abrupt("return", _errorDetails7);
|
|
576
|
-
case 29:
|
|
577
|
-
_Logger.default.warn("".concat(errorCode || 422, " Exception has occurred"), loggerContext);
|
|
578
|
-
_errorDetails8 = {
|
|
579
|
-
statusCode: errorCode || 422,
|
|
580
|
-
data: {
|
|
581
|
-
error: "".concat(errorCode || 422, " Exception has occurred")
|
|
582
|
-
},
|
|
583
|
-
message: failureMessage
|
|
584
|
-
};
|
|
585
|
-
return _context4.abrupt("return", _errorDetails8);
|
|
586
|
-
case 32:
|
|
587
|
-
case "end":
|
|
588
|
-
return _context4.stop();
|
|
589
|
-
}
|
|
590
|
-
}, _callee4);
|
|
591
|
-
}));
|
|
592
|
-
return _serviceErrorCodeHandler.apply(this, arguments);
|
|
593
|
-
}
|
|
594
|
-
function parseMediaQualityStatistics(stats) {
|
|
595
|
-
if (!stats || navigator.userAgent.indexOf('Firefox') !== -1) {
|
|
596
|
-
_Logger.default.info('RTCStatsReport is null, adding dummy stats', {
|
|
597
|
-
file: _constants.UTILS_FILE,
|
|
598
|
-
method: parseMediaQualityStatistics.name
|
|
599
|
-
});
|
|
600
|
-
return _constants.DUMMY_METRICS;
|
|
601
|
-
}
|
|
602
|
-
try {
|
|
603
|
-
var type;
|
|
604
|
-
var id;
|
|
605
|
-
var inboundCodec;
|
|
606
|
-
var outboundCodec;
|
|
607
|
-
var localCandidates = {};
|
|
608
|
-
var candidatePairs = {};
|
|
609
|
-
var codecList = {};
|
|
610
|
-
var rxStat = {};
|
|
611
|
-
var txStat = {};
|
|
612
|
-
var vqPayload = {};
|
|
613
|
-
var jitterBufferDelay = 0;
|
|
614
|
-
var jitterBufferEmittedCount = 0;
|
|
615
|
-
var totalRoundTripTime = 0;
|
|
616
|
-
var roundTripTimeMeasurements = 0;
|
|
617
|
-
var selectedPair = '';
|
|
618
|
-
var bitRate = 0;
|
|
619
|
-
|
|
620
|
-
/* Set defaults */
|
|
621
|
-
vqPayload.maxJitter = 0;
|
|
622
|
-
vqPayload.VoPktSizeMs = 20;
|
|
623
|
-
|
|
624
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
625
|
-
stats.forEach(function (report) {
|
|
626
|
-
(0, _keys.default)(report).forEach(function (statName) {
|
|
627
|
-
if (statName !== _constants.TIMESTAMP) {
|
|
628
|
-
if (!type || statName === _constants.TYPE) {
|
|
629
|
-
type = report[statName];
|
|
630
|
-
} else if (!id || statName === _constants.MEDIA_ID) {
|
|
631
|
-
id = report[statName];
|
|
632
|
-
} else if (id && id.indexOf(_constants.RTC_ICE_CANDIDATE_PAIR) !== -1) {
|
|
633
|
-
if (statName === _constants.LOCAL_CANDIDATE_ID) {
|
|
634
|
-
candidatePairs[id] = report[statName];
|
|
635
|
-
}
|
|
636
|
-
} else if (id && id.indexOf(_constants.RTC_ICE_CANDIDATE) !== -1) {
|
|
637
|
-
if (statName === _constants.NETWORK_TYPE) {
|
|
638
|
-
localCandidates[id] = report[statName];
|
|
639
|
-
}
|
|
640
|
-
} else if (id && (id.indexOf(_constants.INBOUND_CODEC_MATCH) !== -1 || id.indexOf(_constants.OUTBOUND_CODEC_MATCH) !== -1 || id.indexOf(_constants.RTC_CODEC) !== -1)) {
|
|
641
|
-
if (statName === _constants.MIME_TYPE) {
|
|
642
|
-
codecList[id] = report[statName];
|
|
643
|
-
}
|
|
644
|
-
} else if (type && type === _constants.REMOTE_INBOUND_RTP) {
|
|
645
|
-
switch (statName) {
|
|
646
|
-
case _constants.TOTAL_ROUND_TRIP_TIME:
|
|
647
|
-
{
|
|
648
|
-
totalRoundTripTime = report[statName];
|
|
649
|
-
break;
|
|
650
|
-
}
|
|
651
|
-
case _constants.ROUND_TRIP_TIME_MEASUREMENTS:
|
|
652
|
-
{
|
|
653
|
-
roundTripTimeMeasurements = report[statName];
|
|
654
|
-
break;
|
|
655
|
-
}
|
|
656
|
-
default:
|
|
657
|
-
{
|
|
658
|
-
// We don't care about the other stats
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
} else if (type && type === _constants.INBOUND_RTP) {
|
|
662
|
-
switch (statName) {
|
|
663
|
-
case _constants.CODEC_ID:
|
|
664
|
-
{
|
|
665
|
-
inboundCodec = report[statName];
|
|
666
|
-
break;
|
|
667
|
-
}
|
|
668
|
-
case _constants.PACKETS_RECEIVED:
|
|
669
|
-
{
|
|
670
|
-
rxStat.Pkt = report[statName];
|
|
671
|
-
break;
|
|
672
|
-
}
|
|
673
|
-
case _constants.BYTES_RECEIVED:
|
|
674
|
-
{
|
|
675
|
-
rxStat.Oct = report[statName];
|
|
676
|
-
break;
|
|
677
|
-
}
|
|
678
|
-
case _constants.PACKETS_DISCARDED:
|
|
679
|
-
{
|
|
680
|
-
rxStat.LatePkt = report[statName];
|
|
681
|
-
break;
|
|
682
|
-
}
|
|
683
|
-
case _constants.PACKETS_LOST:
|
|
684
|
-
{
|
|
685
|
-
rxStat.LostPkt = report[statName];
|
|
686
|
-
break;
|
|
687
|
-
}
|
|
688
|
-
case _constants.JITTER_BUFFER_DELAY:
|
|
689
|
-
{
|
|
690
|
-
jitterBufferDelay = report[statName];
|
|
691
|
-
break;
|
|
692
|
-
}
|
|
693
|
-
case _constants.JITTER_BUFFER_EMITTED_COUNT:
|
|
694
|
-
{
|
|
695
|
-
jitterBufferEmittedCount = report[statName];
|
|
696
|
-
break;
|
|
697
|
-
}
|
|
698
|
-
default:
|
|
699
|
-
{
|
|
700
|
-
// We don't care about the other stats
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
} else if (type && type === _constants.TRANSPORT) {
|
|
704
|
-
switch (statName) {
|
|
705
|
-
case _constants.SELECTED_CANDIDATE_PAIR_ID:
|
|
706
|
-
{
|
|
707
|
-
selectedPair = report[statName];
|
|
708
|
-
break;
|
|
709
|
-
}
|
|
710
|
-
default:
|
|
711
|
-
{
|
|
712
|
-
// We don't care about the other stats
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
} else if (type && type === _constants.OUTBOUND_RTP) {
|
|
716
|
-
switch (statName) {
|
|
717
|
-
case _constants.CODEC_ID:
|
|
718
|
-
{
|
|
719
|
-
outboundCodec = report[statName];
|
|
720
|
-
break;
|
|
721
|
-
}
|
|
722
|
-
case _constants.PACKETS_SENT:
|
|
723
|
-
{
|
|
724
|
-
txStat.Pkt = report[statName];
|
|
725
|
-
break;
|
|
726
|
-
}
|
|
727
|
-
case _constants.BYTES_SENT:
|
|
728
|
-
{
|
|
729
|
-
txStat.Oct = report[statName];
|
|
730
|
-
break;
|
|
731
|
-
}
|
|
732
|
-
case _constants.TARGET_BIT_RATE:
|
|
733
|
-
{
|
|
734
|
-
bitRate = report[statName];
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
default:
|
|
738
|
-
{
|
|
739
|
-
// We don't care about the other stats
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
} else if (type && type === _constants.MEDIA_SOURCE) {
|
|
743
|
-
switch (statName) {
|
|
744
|
-
case _constants.TOTAL_SAMPLES_DURATION:
|
|
745
|
-
{
|
|
746
|
-
rxStat.Dur = report[statName];
|
|
747
|
-
txStat.Dur = report[statName];
|
|
748
|
-
break;
|
|
749
|
-
}
|
|
750
|
-
default:
|
|
751
|
-
{
|
|
752
|
-
// We don't care about the other stats
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
});
|
|
759
|
-
|
|
760
|
-
/* One way Delay */
|
|
761
|
-
if (roundTripTimeMeasurements !== 0) {
|
|
762
|
-
vqPayload.VoOneWayDelayMs = totalRoundTripTime / (2 * roundTripTimeMeasurements);
|
|
763
|
-
} else {
|
|
764
|
-
vqPayload.VoOneWayDelayMs = 0;
|
|
765
|
-
}
|
|
766
|
-
/* Application type */
|
|
767
|
-
vqPayload.hwType = "".concat(platform.os, "/").concat(platform.name, "-").concat(platform.version);
|
|
768
|
-
|
|
769
|
-
/* Network type */
|
|
770
|
-
vqPayload.networkType = localCandidates[candidatePairs[selectedPair]];
|
|
771
|
-
|
|
772
|
-
/* Average Jitter */
|
|
773
|
-
rxStat.AvgJit = jitterBufferDelay / jitterBufferEmittedCount;
|
|
774
|
-
|
|
775
|
-
/* Update codec */
|
|
776
|
-
// eslint-disable-next-line prefer-destructuring
|
|
777
|
-
vqPayload.VoRxCodec = codecList[inboundCodec].split('/')[1];
|
|
778
|
-
var txVqPayload = {};
|
|
779
|
-
|
|
780
|
-
// eslint-disable-next-line prefer-destructuring
|
|
781
|
-
txVqPayload.VoTxCodec = codecList[outboundCodec].split('/')[1];
|
|
782
|
-
txVqPayload.rtpBitRate = bitRate;
|
|
783
|
-
var byeStats = {};
|
|
784
|
-
rxStat.VQMetrics = vqPayload;
|
|
785
|
-
txStat.VQMetrics = txVqPayload;
|
|
786
|
-
byeStats[_constants.RTP_RX_STAT] = rxStat;
|
|
787
|
-
byeStats[_constants.RTP_TX_STAT] = txStat;
|
|
788
|
-
_Logger.default.log((0, _stringify.default)(byeStats), {
|
|
789
|
-
file: _constants.UTILS_FILE,
|
|
790
|
-
method: parseMediaQualityStatistics.name
|
|
791
|
-
});
|
|
792
|
-
return byeStats;
|
|
793
|
-
} catch (err) {
|
|
794
|
-
_Logger.default.warn("Caught error while parsing RTP stats, ".concat(err), {
|
|
795
|
-
file: _constants.UTILS_FILE,
|
|
796
|
-
method: parseMediaQualityStatistics.name
|
|
797
|
-
});
|
|
798
|
-
return _constants.DUMMY_METRICS;
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* To simulate delays.
|
|
804
|
-
*
|
|
805
|
-
* @param msec - Amount of delay.
|
|
806
|
-
* @returns - Promise.
|
|
807
|
-
*/
|
|
808
|
-
var waitForMsecs = function waitForMsecs(msec) {
|
|
809
|
-
return new _promise.default(function (resolve) {
|
|
810
|
-
setTimeout(resolve, msec);
|
|
811
|
-
});
|
|
812
|
-
};
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* Register calling backend.
|
|
816
|
-
*
|
|
817
|
-
* @param webex -.
|
|
818
|
-
* @returns CallingBackEnd.
|
|
819
|
-
*/
|
|
820
|
-
exports.waitForMsecs = waitForMsecs;
|
|
821
|
-
function getCallingBackEnd(webex) {
|
|
822
|
-
var entModels = webex.internal.device.features.entitlement.models;
|
|
823
|
-
var callingBackend;
|
|
824
|
-
if (webex.internal.device.callingBehavior === _constants2.NATIVE_WEBEX_TEAMS_CALLING) {
|
|
825
|
-
for (var i = 0; i < entModels.length; i += 1) {
|
|
826
|
-
if (entModels[i][_constants2.VALUES][_constants2.KEY] === _constants2.ENTITLEMENT_BASIC || entModels[i][_constants2.VALUES][_constants2.KEY] === _constants2.ENTITLEMENT_STANDARD) {
|
|
827
|
-
callingBackend = _types2.CALLING_BACKEND.WXC;
|
|
828
|
-
break;
|
|
829
|
-
} else if (entModels[i][_constants2.VALUES][_constants2.KEY] === _constants2.ENTITLEMENT_BROADWORKS_CONN) {
|
|
830
|
-
callingBackend = _types2.CALLING_BACKEND.BWRKS;
|
|
831
|
-
break;
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
} else if (webex.internal.device.callingBehavior === _constants2.NATIVE_SIP_CALL_TO_UCM) {
|
|
835
|
-
callingBackend = _types2.CALLING_BACKEND.UCM;
|
|
836
|
-
} else {
|
|
837
|
-
callingBackend = _types2.CALLING_BACKEND.INVALID;
|
|
838
|
-
}
|
|
839
|
-
return callingBackend;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* Register XSI endpoint based on calling backend.
|
|
844
|
-
*
|
|
845
|
-
* @param webex -.
|
|
846
|
-
* @param loggerContext -.
|
|
847
|
-
* @param callingBackend -.
|
|
848
|
-
* @returns Promise.
|
|
849
|
-
*/
|
|
850
|
-
function getXsiActionEndpoint(_x17, _x18, _x19) {
|
|
851
|
-
return _getXsiActionEndpoint.apply(this, arguments);
|
|
852
|
-
}
|
|
853
|
-
/**
|
|
854
|
-
* Get sorted VoicemailList based on sort order passed.
|
|
855
|
-
*
|
|
856
|
-
* @param webex - Webex object to get service urls.
|
|
857
|
-
* @param callingBackend - CallingBackend will have info like UCM.
|
|
858
|
-
* @returns VGEndpointUrl.
|
|
859
|
-
*/
|
|
860
|
-
function _getXsiActionEndpoint() {
|
|
861
|
-
_getXsiActionEndpoint = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(webex, loggerContext, callingBackend) {
|
|
862
|
-
var userIdResponse, response, xsiEndpoint, bwTokenResponse, _response, _xsiEndpoint, errorInfo;
|
|
863
|
-
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
864
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
865
|
-
case 0:
|
|
866
|
-
_context5.prev = 0;
|
|
867
|
-
_context5.t0 = callingBackend;
|
|
868
|
-
_context5.next = _context5.t0 === _types2.CALLING_BACKEND.WXC ? 4 : _context5.t0 === _types2.CALLING_BACKEND.BWRKS ? 10 : 17;
|
|
869
|
-
break;
|
|
870
|
-
case 4:
|
|
871
|
-
_context5.next = 6;
|
|
872
|
-
return webex.request({
|
|
873
|
-
uri: "".concat(webex.internal.services._serviceUrls.hydra, "/").concat(_constants2.XSI_ACTION_ENDPOINT_ORG_URL_PARAM),
|
|
874
|
-
method: _types2.HTTP_METHODS.GET
|
|
875
|
-
});
|
|
876
|
-
case 6:
|
|
877
|
-
userIdResponse = _context5.sent;
|
|
878
|
-
response = userIdResponse.body;
|
|
879
|
-
xsiEndpoint = response[_constants2.ITEMS][0][_constants2.XSI_ACTION_ENDPOINT];
|
|
880
|
-
return _context5.abrupt("return", xsiEndpoint);
|
|
881
|
-
case 10:
|
|
882
|
-
_context5.next = 12;
|
|
883
|
-
return webex.request({
|
|
884
|
-
uri: "".concat(webex.internal.services._serviceUrls.wdm, "/").concat(_constants2.DEVICES),
|
|
885
|
-
method: _types2.HTTP_METHODS.GET
|
|
886
|
-
});
|
|
887
|
-
case 12:
|
|
888
|
-
bwTokenResponse = _context5.sent;
|
|
889
|
-
_response = bwTokenResponse.body;
|
|
890
|
-
_xsiEndpoint = _response[_constants2.DEVICES][0][_constants2.SETTINGS][_constants2.BW_XSI_URL];
|
|
891
|
-
if (_response[_constants2.DEVICES][0][_constants2.SETTINGS][_constants2.BW_XSI_URL].endsWith(_constants2.BW_XSI_ENDPOINT_VERSION)) {
|
|
892
|
-
_xsiEndpoint = _response[_constants2.DEVICES][0][_constants2.SETTINGS][_constants2.BW_XSI_URL].slice(0, -5);
|
|
893
|
-
}
|
|
894
|
-
return _context5.abrupt("return", _xsiEndpoint);
|
|
895
|
-
case 17:
|
|
896
|
-
throw new Error('Calling backend is not identified, exiting....');
|
|
897
|
-
case 18:
|
|
898
|
-
_context5.next = 25;
|
|
899
|
-
break;
|
|
900
|
-
case 20:
|
|
901
|
-
_context5.prev = 20;
|
|
902
|
-
_context5.t1 = _context5["catch"](0);
|
|
903
|
-
errorInfo = _context5.t1;
|
|
904
|
-
serviceErrorCodeHandler(errorInfo, loggerContext);
|
|
905
|
-
return _context5.abrupt("return", errorInfo);
|
|
906
|
-
case 25:
|
|
907
|
-
case "end":
|
|
908
|
-
return _context5.stop();
|
|
909
|
-
}
|
|
910
|
-
}, _callee5, null, [[0, 20]]);
|
|
911
|
-
}));
|
|
912
|
-
return _getXsiActionEndpoint.apply(this, arguments);
|
|
913
|
-
}
|
|
914
|
-
function getVgActionEndpoint(webex, callingBackend) {
|
|
915
|
-
try {
|
|
916
|
-
if (callingBackend && callingBackend === _types2.CALLING_BACKEND.UCM) {
|
|
917
|
-
return webex.internal.services._serviceUrls['ucmgmt-gateway'];
|
|
918
|
-
}
|
|
919
|
-
throw new Error('Calling backend is not identified, exiting....');
|
|
920
|
-
} catch (err) {
|
|
921
|
-
var errorInfo = err;
|
|
922
|
-
return errorInfo;
|
|
923
|
-
}
|
|
924
|
-
}
|
|
925
|
-
|
|
926
|
-
/**
|
|
927
|
-
* Get sorted VoiceMailList based on sort order passed.
|
|
928
|
-
*
|
|
929
|
-
* @param voiceMessageList - List of voicemessage.
|
|
930
|
-
* @param sortOrder - Type of sort either ascending or descending.
|
|
931
|
-
* @returns Sorted voicemessageList .
|
|
932
|
-
*/
|
|
933
|
-
function getSortedVoicemailList(voiceMessageList, sortOrder) {
|
|
934
|
-
/* istanbul ignore else */
|
|
935
|
-
if (sortOrder === _types2.SORT.DESC) {
|
|
936
|
-
voiceMessageList.sort(function (voiceMail, nextVoiceMail) {
|
|
937
|
-
return nextVoiceMail[_constants2.TIME][_constants2.PLACEHOLDER_KEY] - voiceMail[_constants2.TIME][_constants2.PLACEHOLDER_KEY];
|
|
938
|
-
});
|
|
939
|
-
} else if (sortOrder === _types2.SORT.ASC) {
|
|
940
|
-
voiceMessageList.sort(function (voiceMail, nextVoiceMail) {
|
|
941
|
-
return voiceMail[_constants2.TIME][_constants2.PLACEHOLDER_KEY] - nextVoiceMail[_constants2.TIME][_constants2.PLACEHOLDER_KEY];
|
|
942
|
-
});
|
|
943
|
-
}
|
|
944
|
-
return voiceMessageList;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
|
-
/**
|
|
948
|
-
* Handler to perform a SCIM Query.
|
|
949
|
-
*
|
|
950
|
-
* @param filter - A filter for the query.
|
|
951
|
-
* @returns - Promise.
|
|
952
|
-
*/
|
|
953
|
-
function scimQuery(_x20) {
|
|
954
|
-
return _scimQuery.apply(this, arguments);
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Resolve Caller Id display information using SCIM query.
|
|
958
|
-
*
|
|
959
|
-
* @param filter - CI userId.
|
|
960
|
-
*/
|
|
961
|
-
function _scimQuery() {
|
|
962
|
-
_scimQuery = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(filter) {
|
|
963
|
-
var _headers;
|
|
964
|
-
var sdkConnector, webex, scimUrl, query;
|
|
965
|
-
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
966
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
967
|
-
case 0:
|
|
968
|
-
_Logger.default.info("Starting resolution for filter:- ".concat(filter), {
|
|
969
|
-
file: _constants.UTILS_FILE,
|
|
970
|
-
method: 'scimQuery'
|
|
971
|
-
});
|
|
972
|
-
sdkConnector = _SDKConnector.default;
|
|
973
|
-
webex = sdkConnector.getWebex();
|
|
974
|
-
scimUrl = "".concat(webex.internal.services._serviceUrls.identity, "/").concat(_constants.IDENTITY_ENDPOINT_RESOURCE, "/").concat(_constants.SCIM_ENDPOINT_RESOURCE, "/").concat(webex.internal.device.orgId, "/").concat(_constants.SCIM_USER_FILTER);
|
|
975
|
-
query = scimUrl + encodeURIComponent(filter);
|
|
976
|
-
return _context6.abrupt("return", webex.request({
|
|
977
|
-
uri: query,
|
|
978
|
-
method: _types2.HTTP_METHODS.GET,
|
|
979
|
-
headers: (_headers = {}, (0, _defineProperty2.default)(_headers, _constants.CISCO_DEVICE_URL, webex.internal.device.url), (0, _defineProperty2.default)(_headers, _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT), _headers),
|
|
980
|
-
service: _types2.ALLOWED_SERVICES.MOBIUS
|
|
981
|
-
}));
|
|
982
|
-
case 6:
|
|
983
|
-
case "end":
|
|
984
|
-
return _context6.stop();
|
|
985
|
-
}
|
|
986
|
-
}, _callee6);
|
|
987
|
-
}));
|
|
988
|
-
return _scimQuery.apply(this, arguments);
|
|
989
|
-
}
|
|
990
|
-
function resolveCallerIdDisplay(_x21) {
|
|
991
|
-
return _resolveCallerIdDisplay.apply(this, arguments);
|
|
992
|
-
}
|
|
993
|
-
/**
|
|
994
|
-
* Resolve contact info from display name, using people search API.
|
|
995
|
-
*
|
|
996
|
-
* @param name - Display name.
|
|
997
|
-
*/
|
|
998
|
-
function _resolveCallerIdDisplay() {
|
|
999
|
-
_resolveCallerIdDisplay = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(filter) {
|
|
1000
|
-
var _resolution;
|
|
1001
|
-
var resolution, displayResult, response, res, _scimResource$photos, scimResource, numberObj, photo;
|
|
1002
|
-
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
1003
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
1004
|
-
case 0:
|
|
1005
|
-
displayResult = {};
|
|
1006
|
-
_context7.prev = 1;
|
|
1007
|
-
_context7.next = 4;
|
|
1008
|
-
return scimQuery(filter);
|
|
1009
|
-
case 4:
|
|
1010
|
-
response = _context7.sent;
|
|
1011
|
-
resolution = response.body;
|
|
1012
|
-
_Logger.default.info("Number of records found for this user :- ".concat(resolution.totalResults), {
|
|
1013
|
-
file: _constants.UTILS_FILE,
|
|
1014
|
-
method: 'resolveCallerIdDisplay'
|
|
1015
|
-
});
|
|
1016
|
-
_context7.next = 13;
|
|
1017
|
-
break;
|
|
1018
|
-
case 9:
|
|
1019
|
-
_context7.prev = 9;
|
|
1020
|
-
_context7.t0 = _context7["catch"](1);
|
|
1021
|
-
res = _context7.t0;
|
|
1022
|
-
_Logger.default.warn("Error response: - ".concat(res.statusCode), {
|
|
1023
|
-
file: _constants.UTILS_FILE,
|
|
1024
|
-
method: 'resolveCallerIdDisplay'
|
|
1025
|
-
});
|
|
1026
|
-
case 13:
|
|
1027
|
-
if ((_resolution = resolution) !== null && _resolution !== void 0 && _resolution.totalResults && resolution.totalResults > 0) {
|
|
1028
|
-
/* Every user has single resource from what we have discussed. May need to revisit this later
|
|
1029
|
-
* for shared-line use-cases.
|
|
1030
|
-
*/
|
|
1031
|
-
scimResource = resolution.Resources[0];
|
|
1032
|
-
displayResult.name = scimResource.displayName;
|
|
1033
|
-
|
|
1034
|
-
/* Pick only the primary number OR 2nd preference Work */
|
|
1035
|
-
numberObj = scimResource.phoneNumbers.find(function (num) {
|
|
1036
|
-
return num.primary;
|
|
1037
|
-
}) || scimResource.phoneNumbers.find(function (num) {
|
|
1038
|
-
return num.type.toLowerCase() === 'work';
|
|
1039
|
-
});
|
|
1040
|
-
if (numberObj) {
|
|
1041
|
-
displayResult.num = numberObj.value;
|
|
1042
|
-
} else if (scimResource.phoneNumbers.length > 0) {
|
|
1043
|
-
/* When no primary number exists OR PA-ID/From failed to populate, we take the first number */
|
|
1044
|
-
_Logger.default.info('Failure to resolve caller information. Setting number as caller ID', {
|
|
1045
|
-
file: _constants.UTILS_FILE,
|
|
1046
|
-
method: 'resolveCallerIdDisplay'
|
|
1047
|
-
});
|
|
1048
|
-
displayResult.num = scimResource.phoneNumbers[0].value;
|
|
1049
|
-
}
|
|
1050
|
-
|
|
1051
|
-
/* For Webapp, we are only picking thumbnail photo */
|
|
1052
|
-
photo = (_scimResource$photos = scimResource.photos) === null || _scimResource$photos === void 0 ? void 0 : _scimResource$photos.find(function (photo) {
|
|
1053
|
-
return photo.type === 'thumbnail';
|
|
1054
|
-
});
|
|
1055
|
-
displayResult.avatarSrc = photo ? photo.value : 'unknown';
|
|
1056
|
-
displayResult.id = scimResource.id;
|
|
1057
|
-
_Logger.default.info("Extracted details:- name: ".concat(displayResult.name, " , number: ").concat(displayResult.num, ", photo: ").concat(displayResult.avatarSrc, ", id: ").concat(displayResult.id), {
|
|
1058
|
-
file: _constants.UTILS_FILE,
|
|
1059
|
-
method: 'resolveCallerIdDisplay'
|
|
1060
|
-
});
|
|
1061
|
-
}
|
|
1062
|
-
return _context7.abrupt("return", displayResult);
|
|
1063
|
-
case 15:
|
|
1064
|
-
case "end":
|
|
1065
|
-
return _context7.stop();
|
|
1066
|
-
}
|
|
1067
|
-
}, _callee7, null, [[1, 9]]);
|
|
1068
|
-
}));
|
|
1069
|
-
return _resolveCallerIdDisplay.apply(this, arguments);
|
|
1070
|
-
}
|
|
1071
|
-
function resolveCallerIdByName(_x22) {
|
|
1072
|
-
return _resolveCallerIdByName.apply(this, arguments);
|
|
1073
|
-
}
|
|
1074
|
-
/**
|
|
1075
|
-
* Resolve the contact information.
|
|
1076
|
-
*
|
|
1077
|
-
* @param callingPartyInfo - Calling Party Info.
|
|
1078
|
-
*/
|
|
1079
|
-
function _resolveCallerIdByName() {
|
|
1080
|
-
_resolveCallerIdByName = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(name) {
|
|
1081
|
-
var displayResult, sdkConnector, webex, searchDirectory;
|
|
1082
|
-
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
1083
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
1084
|
-
case 0:
|
|
1085
|
-
displayResult = {};
|
|
1086
|
-
sdkConnector = _SDKConnector.default;
|
|
1087
|
-
webex = sdkConnector.getWebex();
|
|
1088
|
-
/**
|
|
1089
|
-
* @param query - Display name.
|
|
1090
|
-
*/
|
|
1091
|
-
searchDirectory = function searchDirectory(query) {
|
|
1092
|
-
return webex.people.list({
|
|
1093
|
-
displayName: query
|
|
1094
|
-
});
|
|
1095
|
-
};
|
|
1096
|
-
_context8.next = 6;
|
|
1097
|
-
return searchDirectory(name).then(function (results) {
|
|
1098
|
-
_Logger.default.info("DS Result: ".concat(results), {
|
|
1099
|
-
file: _constants.UTILS_FILE,
|
|
1100
|
-
method: 'resolveCallerIdByName'
|
|
1101
|
-
});
|
|
1102
|
-
if (results && results.items && results.items.length > 0) {
|
|
1103
|
-
var resolution = results.items[0];
|
|
1104
|
-
displayResult.name = resolution.displayName;
|
|
1105
|
-
|
|
1106
|
-
/* id is like cisco spark://us/PEOPLE/b853bbd1-1136-4d25-938d-0c37541b1234
|
|
1107
|
-
* We need to extract UUID portion. */
|
|
1108
|
-
var id = Buffer.from(resolution.id, 'base64').toString('binary');
|
|
1109
|
-
displayResult.id = id.split('/').pop();
|
|
1110
|
-
var numObj = resolution.phoneNumbers.find(function (num) {
|
|
1111
|
-
return num.type === 'work';
|
|
1112
|
-
});
|
|
1113
|
-
if (numObj) {
|
|
1114
|
-
displayResult.num = numObj.value;
|
|
1115
|
-
} else if (resolution.phoneNumbers.length > 0) {
|
|
1116
|
-
displayResult.num = resolution.phoneNumbers[0].value;
|
|
1117
|
-
}
|
|
1118
|
-
displayResult.avatarSrc = resolution.avatar;
|
|
1119
|
-
_Logger.default.info("Extracted details:- name: ".concat(displayResult.name, " , number: ").concat(displayResult.num, ", photo: ").concat(displayResult.avatarSrc, ", id: ").concat(displayResult.id), {
|
|
1120
|
-
file: _constants.UTILS_FILE,
|
|
1121
|
-
method: 'resolveCallerIdByName'
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
});
|
|
1125
|
-
case 6:
|
|
1126
|
-
return _context8.abrupt("return", displayResult);
|
|
1127
|
-
case 7:
|
|
1128
|
-
case "end":
|
|
1129
|
-
return _context8.stop();
|
|
1130
|
-
}
|
|
1131
|
-
}, _callee8);
|
|
1132
|
-
}));
|
|
1133
|
-
return _resolveCallerIdByName.apply(this, arguments);
|
|
1134
|
-
}
|
|
1135
|
-
function resolveContact(_x23) {
|
|
1136
|
-
return _resolveContact.apply(this, arguments);
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Store encrypted voicemailList in SessionStorage.
|
|
1140
|
-
*
|
|
1141
|
-
* @param context - Context for storage.
|
|
1142
|
-
* @param voiceMessageList - List of voicemessage.
|
|
1143
|
-
*/
|
|
1144
|
-
function _resolveContact() {
|
|
1145
|
-
_resolveContact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(callingPartyInfo) {
|
|
1146
|
-
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
1147
|
-
while (1) switch (_context9.prev = _context9.next) {
|
|
1148
|
-
case 0:
|
|
1149
|
-
if (!(callingPartyInfo.userExternalId && callingPartyInfo.userExternalId.$)) {
|
|
1150
|
-
_context9.next = 2;
|
|
1151
|
-
break;
|
|
1152
|
-
}
|
|
1153
|
-
return _context9.abrupt("return", resolveCallerIdDisplay("id eq \"".concat(callingPartyInfo.userExternalId.$, "\"")));
|
|
1154
|
-
case 2:
|
|
1155
|
-
if (!(callingPartyInfo.name && callingPartyInfo.name.$)) {
|
|
1156
|
-
_context9.next = 4;
|
|
1157
|
-
break;
|
|
1158
|
-
}
|
|
1159
|
-
return _context9.abrupt("return", resolveCallerIdByName(callingPartyInfo.name.$));
|
|
1160
|
-
case 4:
|
|
1161
|
-
return _context9.abrupt("return", null);
|
|
1162
|
-
case 5:
|
|
1163
|
-
case "end":
|
|
1164
|
-
return _context9.stop();
|
|
1165
|
-
}
|
|
1166
|
-
}, _callee9);
|
|
1167
|
-
}));
|
|
1168
|
-
return _resolveContact.apply(this, arguments);
|
|
1169
|
-
}
|
|
1170
|
-
function storeVoicemailList(context, voiceMessageList) {
|
|
1171
|
-
var vmEncodedList = Buffer.from((0, _stringify.default)(voiceMessageList), 'utf8').toString('base64');
|
|
1172
|
-
sessionStorage.setItem(context, vmEncodedList.toString());
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
/**
|
|
1176
|
-
* Fetch decrypted voicemailList from SessionStorage.
|
|
1177
|
-
*
|
|
1178
|
-
* @param context - Context for the storage.
|
|
1179
|
-
* @param offset - Number of voicemail records to skip.
|
|
1180
|
-
* @param offsetLimit - Number of voicemail list to fetch from the offset.
|
|
1181
|
-
* @param loggerContext - File, method name object.
|
|
1182
|
-
* @returns - Array containing voicemails and flag to indicate availability of more voicemails.
|
|
1183
|
-
*/
|
|
1184
|
-
function fetchVoicemailList(context, offset, offsetLimit, loggerContext) {
|
|
1185
|
-
var moreVoicemails = false;
|
|
1186
|
-
var requiredVoicemailList = [];
|
|
1187
|
-
try {
|
|
1188
|
-
var voicemailList = JSON.parse(Buffer.from(sessionStorage.getItem(context), 'base64').toString('utf8'));
|
|
1189
|
-
_Logger.default.info("Length of voicemail list: ".concat(voicemailList.length), loggerContext);
|
|
1190
|
-
if (voicemailList.length > offset + offsetLimit) {
|
|
1191
|
-
moreVoicemails = true;
|
|
1192
|
-
}
|
|
1193
|
-
requiredVoicemailList = voicemailList.slice(offset, offset + offsetLimit);
|
|
1194
|
-
} catch (err) {
|
|
1195
|
-
_Logger.default.warn("Caught exception while fetching voicemail from storage. ".concat(err), loggerContext);
|
|
1196
|
-
var errorInfo = err;
|
|
1197
|
-
serviceErrorCodeHandler(errorInfo, {});
|
|
1198
|
-
}
|
|
1199
|
-
return {
|
|
1200
|
-
messages: requiredVoicemailList,
|
|
1201
|
-
moreVMAvailable: moreVoicemails
|
|
1202
|
-
};
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
/**
|
|
1206
|
-
* Converts a uuid to a hydra id without a network dip.
|
|
1207
|
-
*
|
|
1208
|
-
* @param id - ID to be encoded to base64.
|
|
1209
|
-
* @param decodeType - DecodeType.
|
|
1210
|
-
* @returns - Encoded string value.
|
|
1211
|
-
*/
|
|
1212
|
-
function inferIdFromUuid(id, decodeType) {
|
|
1213
|
-
return Buffer.from("".concat(_constants2.INFER_ID_CONSTANT, "/").concat(decodeType, "/").concat(id), 'binary').toString('base64');
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
/**
|
|
1217
|
-
* Validates service indicator.
|
|
1218
|
-
*
|
|
1219
|
-
* @param indicator - Must match with one of the values in ServiceIndicator enum.
|
|
1220
|
-
* @returns True if validation is successful else false.
|
|
1221
|
-
*/
|
|
1222
|
-
function isValidServiceIndicator(indicator) {
|
|
1223
|
-
return (0, _values.default)(_types2.ServiceIndicator).some(function (v) {
|
|
1224
|
-
return v === indicator;
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
/**
|
|
1229
|
-
* Validates domain field in input service data object.
|
|
1230
|
-
* Domain value must be in valid domain format for service
|
|
1231
|
-
* type contactcenter.
|
|
1232
|
-
* But for service type calling it's allowed to be empty or
|
|
1233
|
-
* undefined however if it's not empty/undefined for service
|
|
1234
|
-
* type calling then even that will be validated to see if it
|
|
1235
|
-
* is in valid domain format.
|
|
1236
|
-
*
|
|
1237
|
-
* @param serviceData - .
|
|
1238
|
-
* @returns True if validation is successful else false.
|
|
1239
|
-
*/
|
|
1240
|
-
function isValidServiceDomain(serviceData) {
|
|
1241
|
-
var regexp = /^[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,6}$/i;
|
|
1242
|
-
var domain = serviceData.domain;
|
|
1243
|
-
if (!domain) {
|
|
1244
|
-
return serviceData.indicator === _types2.ServiceIndicator.CALLING;
|
|
1245
|
-
}
|
|
1246
|
-
return regexp.test(domain);
|
|
1247
|
-
}
|
|
1248
|
-
|
|
1249
|
-
/**
|
|
1250
|
-
* Validates service data object(indicator & domain) and throws
|
|
1251
|
-
* exception with a message indicating the reason for validation
|
|
1252
|
-
* failure.
|
|
1253
|
-
*
|
|
1254
|
-
* @param serviceData - Input service data to be validated.
|
|
1255
|
-
*/
|
|
1256
|
-
function validateServiceData(serviceData) {
|
|
1257
|
-
if (!isValidServiceIndicator(serviceData.indicator)) {
|
|
1258
|
-
throw new Error("Invalid service indicator, Allowed values are: ".concat((0, _values.default)(_types2.ServiceIndicator)));
|
|
1259
|
-
}
|
|
1260
|
-
if (!isValidServiceDomain(serviceData)) {
|
|
1261
|
-
throw new Error('Invalid service domain.');
|
|
1262
|
-
}
|
|
1263
|
-
}
|
|
1264
|
-
//# sourceMappingURL=Utils.js.map
|