@webex/calling 3.0.0-next.4 → 3.0.0-next.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1403 -1403
- package/README.md +74 -74
- package/dist/CallHistory/CallHistory.js +201 -0
- package/dist/CallHistory/CallHistory.js.map +1 -0
- package/dist/CallHistory/CallHistory.test.js +142 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -0
- package/dist/CallHistory/callHistoryFixtures.js +366 -0
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -0
- package/dist/CallHistory/constants.js +17 -0
- package/dist/CallHistory/constants.js.map +1 -0
- package/dist/CallHistory/types.js +7 -0
- package/dist/CallHistory/types.js.map +1 -0
- package/dist/CallSettings/CallSettings.js +279 -0
- package/dist/CallSettings/CallSettings.js.map +1 -0
- package/dist/CallSettings/CallSettings.test.js +122 -0
- package/dist/CallSettings/CallSettings.test.js.map +1 -0
- package/dist/CallSettings/UcmBackendConnector.js +216 -0
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -0
- package/dist/CallSettings/UcmBackendConnector.test.js +259 -0
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -0
- package/dist/CallSettings/WxCallBackendConnector.js +547 -0
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -0
- package/dist/CallSettings/WxCallBackendConnector.test.js +802 -0
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -0
- package/dist/CallSettings/constants.js +19 -0
- package/dist/CallSettings/constants.js.map +1 -0
- package/dist/CallSettings/testFixtures.js +68 -0
- package/dist/CallSettings/testFixtures.js.map +1 -0
- package/dist/CallSettings/types.js +7 -0
- package/dist/CallSettings/types.js.map +1 -0
- package/dist/CallingClient/CallingClient.js +631 -0
- package/dist/CallingClient/CallingClient.js.map +1 -0
- package/dist/CallingClient/CallingClient.test.js +992 -0
- package/dist/CallingClient/CallingClient.test.js.map +1 -0
- package/dist/CallingClient/callRecordFixtures.js +101 -0
- package/dist/CallingClient/callRecordFixtures.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/index.js +267 -0
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/index.test.js +274 -0
- package/dist/CallingClient/calling/CallerId/index.test.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/types.js +7 -0
- package/dist/CallingClient/calling/CallerId/types.js.map +1 -0
- package/dist/CallingClient/calling/call.js +3055 -0
- package/dist/CallingClient/calling/call.js.map +1 -0
- package/dist/CallingClient/calling/call.test.js +2858 -0
- package/dist/CallingClient/calling/call.test.js.map +1 -0
- package/dist/CallingClient/calling/callManager.js +432 -0
- package/dist/CallingClient/calling/callManager.js.map +1 -0
- package/dist/CallingClient/calling/callManager.test.js +683 -0
- package/dist/CallingClient/calling/callManager.test.js.map +1 -0
- package/dist/CallingClient/calling/index.js +30 -0
- package/dist/CallingClient/calling/index.js.map +1 -0
- package/dist/CallingClient/calling/types.js +69 -0
- package/dist/CallingClient/calling/types.js.map +1 -0
- package/dist/CallingClient/callingClientFixtures.js +143 -0
- package/dist/CallingClient/callingClientFixtures.js.map +1 -0
- package/dist/CallingClient/constants.js +134 -0
- package/dist/CallingClient/constants.js.map +1 -0
- package/dist/CallingClient/line/index.js +314 -0
- package/dist/CallingClient/line/index.js.map +1 -0
- package/dist/CallingClient/line/line.test.js +270 -0
- package/dist/CallingClient/line/line.test.js.map +1 -0
- package/dist/CallingClient/line/types.js +21 -0
- package/dist/CallingClient/line/types.js.map +1 -0
- package/dist/CallingClient/registration/index.js +19 -0
- package/dist/CallingClient/registration/index.js.map +1 -0
- package/dist/CallingClient/registration/register.js +1286 -0
- package/dist/CallingClient/registration/register.js.map +1 -0
- package/dist/CallingClient/registration/register.test.js +839 -0
- package/dist/CallingClient/registration/register.test.js.map +1 -0
- package/dist/CallingClient/registration/registerFixtures.js +36 -0
- package/dist/CallingClient/registration/registerFixtures.js.map +1 -0
- package/dist/CallingClient/registration/types.js +7 -0
- package/dist/CallingClient/registration/types.js.map +1 -0
- package/dist/CallingClient/types.js +7 -0
- package/dist/CallingClient/types.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +1156 -0
- package/dist/Contacts/ContactsClient.js.map +1 -0
- package/dist/Contacts/ContactsClient.test.js +725 -0
- package/dist/Contacts/ContactsClient.test.js.map +1 -0
- package/dist/Contacts/constants.js +28 -0
- package/dist/Contacts/constants.js.map +1 -0
- package/dist/Contacts/contactFixtures.js +314 -0
- package/dist/Contacts/contactFixtures.js.map +1 -0
- package/dist/Contacts/types.js +43 -0
- package/dist/Contacts/types.js.map +1 -0
- package/dist/Errors/catalog/CallError.js +92 -0
- package/dist/Errors/catalog/CallError.js.map +1 -0
- package/dist/Errors/catalog/CallingDeviceError.js +86 -0
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -0
- package/dist/Errors/catalog/ExtendedError.js +44 -0
- package/dist/Errors/catalog/ExtendedError.js.map +1 -0
- package/dist/Errors/catalog/LineError.js +88 -0
- package/dist/Errors/catalog/LineError.js.map +1 -0
- package/dist/Errors/index.js +28 -0
- package/dist/Errors/index.js.map +1 -0
- package/dist/Errors/types.js +57 -0
- package/dist/Errors/types.js.map +1 -0
- package/dist/Events/impl/index.js +81 -0
- package/dist/Events/impl/index.js.map +1 -0
- package/dist/Events/types.js +103 -0
- package/dist/Events/types.js.map +1 -0
- package/dist/Logger/index.js +220 -0
- package/dist/Logger/index.js.map +1 -0
- package/dist/Logger/index.test.js +62 -0
- package/dist/Logger/index.test.js.map +1 -0
- package/dist/Logger/types.js +34 -0
- package/dist/Logger/types.js.map +1 -0
- package/dist/Metrics/index.js +327 -0
- package/dist/Metrics/index.js.map +1 -0
- package/dist/Metrics/index.test.js +291 -0
- package/dist/Metrics/index.test.js.map +1 -0
- package/dist/Metrics/types.js +45 -0
- package/dist/Metrics/types.js.map +1 -0
- package/dist/SDKConnector/index.js +104 -0
- package/dist/SDKConnector/index.js.map +1 -0
- package/dist/SDKConnector/index.test.js +9 -0
- package/dist/SDKConnector/index.test.js.map +1 -0
- package/dist/SDKConnector/types.js +7 -0
- package/dist/SDKConnector/types.js.map +1 -0
- package/dist/SDKConnector/utils.js +39 -0
- package/dist/SDKConnector/utils.js.map +1 -0
- package/dist/SDKConnector/utils.test.js +9 -0
- package/dist/SDKConnector/utils.test.js.map +1 -0
- package/dist/Voicemail/BroadworksBackendConnector.js +641 -0
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -0
- package/dist/Voicemail/BroadworksBackendConnector.test.js +733 -0
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/UcmBackendConnector.js +574 -0
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -0
- package/dist/Voicemail/UcmBackendConnector.test.js +629 -0
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/Voicemail.js +380 -0
- package/dist/Voicemail/Voicemail.js.map +1 -0
- package/dist/Voicemail/Voicemail.test.js +226 -0
- package/dist/Voicemail/Voicemail.test.js.map +1 -0
- package/dist/Voicemail/WxCallBackendConnector.js +547 -0
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -0
- package/dist/Voicemail/WxCallBackendConnector.test.js +942 -0
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/constants.js +37 -0
- package/dist/Voicemail/constants.js.map +1 -0
- package/dist/Voicemail/types.js +7 -0
- package/dist/Voicemail/types.js.map +1 -0
- package/dist/Voicemail/voicemailFixture.js +524 -0
- package/dist/Voicemail/voicemailFixture.js.map +1 -0
- package/dist/api.js +157 -0
- package/dist/api.js.map +1 -0
- package/dist/common/Utils.js +1257 -0
- package/dist/common/Utils.js.map +1 -0
- package/dist/common/Utils.test.js +1227 -0
- package/dist/common/Utils.test.js.map +1 -0
- package/dist/common/constants.js +49 -0
- package/dist/common/constants.js.map +1 -0
- package/dist/common/index.js +19 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/testUtil.js +959 -0
- package/dist/common/testUtil.js.map +1 -0
- package/dist/common/types.js +66 -0
- package/dist/common/types.js.map +1 -0
- package/dist/index.js +309 -0
- package/dist/index.js.map +1 -0
- package/dist/module/CallHistory/CallHistory.js +83 -81
- package/dist/module/CallHistory/callHistoryFixtures.js +366 -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 +265 -248
- package/dist/module/CallingClient/callRecordFixtures.js +93 -93
- package/dist/module/CallingClient/calling/CallerId/index.js +149 -169
- package/dist/module/CallingClient/calling/CallerId/types.js +1 -1
- package/dist/module/CallingClient/calling/call.js +1701 -1658
- package/dist/module/CallingClient/calling/callManager.js +278 -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 +156 -38
- package/dist/module/CallingClient/constants.js +126 -122
- package/dist/module/CallingClient/line/index.js +155 -158
- package/dist/module/CallingClient/line/types.js +10 -15
- package/dist/module/CallingClient/registration/index.js +1 -1
- package/dist/module/CallingClient/registration/register.js +515 -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 +487 -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 +3 -2
- package/dist/module/Errors/types.js +48 -48
- package/dist/module/Events/impl/index.js +19 -19
- package/dist/module/Events/types.js +85 -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 +7 -6
- package/dist/module/common/Utils.js +797 -802
- package/dist/module/common/constants.js +41 -41
- package/dist/module/common/index.js +1 -1
- package/dist/module/common/testUtil.js +939 -938
- package/dist/module/common/types.js +58 -57
- package/dist/module/index.js +17 -8
- package/dist/types/CallHistory/CallHistory.d.ts +18 -17
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallHistory/callHistoryFixtures.d.ts +95 -94
- package/dist/types/CallHistory/callHistoryFixtures.d.ts.map +1 -1
- 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/CallSettings.d.ts.map +1 -1
- package/dist/types/CallSettings/UcmBackendConnector.d.ts +19 -19
- package/dist/types/CallSettings/UcmBackendConnector.d.ts.map +1 -1
- 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 +108 -107
- package/dist/types/CallSettings/types.d.ts.map +1 -1
- package/dist/types/CallingClient/CallingClient.d.ts +37 -35
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- 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/index.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/CallerId/types.d.ts +41 -41
- package/dist/types/CallingClient/calling/CallerId/types.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +98 -96
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +24 -25
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/index.d.ts +2 -2
- package/dist/types/CallingClient/calling/types.d.ts +206 -206
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/callingClientFixtures.d.ts +86 -18
- package/dist/types/CallingClient/callingClientFixtures.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +126 -122
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +43 -43
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/line/types.d.ts +43 -55
- package/dist/types/CallingClient/line/types.d.ts.map +1 -1
- 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/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/registerFixtures.d.ts +28 -28
- package/dist/types/CallingClient/registration/types.d.ts +20 -20
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +31 -29
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/Contacts/ContactsClient.d.ts +27 -26
- package/dist/types/Contacts/ContactsClient.d.ts.map +1 -1
- 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 +74 -72
- package/dist/types/Contacts/types.d.ts.map +1 -1
- 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/CallingDeviceError.d.ts.map +1 -1
- package/dist/types/Errors/catalog/ExtendedError.d.ts +6 -6
- package/dist/types/Errors/catalog/LineError.d.ts +10 -10
- package/dist/types/Errors/catalog/LineError.d.ts.map +1 -1
- package/dist/types/Errors/index.d.ts +3 -2
- package/dist/types/Errors/index.d.ts.map +1 -1
- package/dist/types/Errors/types.d.ts +59 -60
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/impl/index.d.ts +8 -8
- package/dist/types/Events/types.d.ts +311 -288
- package/dist/types/Events/types.d.ts.map +1 -1
- 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 +129 -128
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- 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/Voicemail.d.ts.map +1 -1
- 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/types.d.ts.map +1 -1
- package/dist/types/Voicemail/voicemailFixture.d.ts +417 -417
- package/dist/types/api.d.ts +16 -16
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +34 -34
- package/dist/types/common/Utils.d.ts.map +1 -1
- 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 +3612 -3611
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +192 -191
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +21 -8
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,992 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs2/helpers/typeof");
|
|
4
|
+
var _Object$keys2 = require("@babel/runtime-corejs2/core-js/object/keys");
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs2/core-js/object/get-own-property-symbols");
|
|
6
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptor");
|
|
7
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs2/core-js/object/get-own-property-descriptors");
|
|
8
|
+
var _Object$defineProperties = require("@babel/runtime-corejs2/core-js/object/define-properties");
|
|
9
|
+
var _Object$defineProperty = require("@babel/runtime-corejs2/core-js/object/define-property");
|
|
10
|
+
var _WeakMap = require("@babel/runtime-corejs2/core-js/weak-map");
|
|
11
|
+
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs2/regenerator"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
15
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
16
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
17
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
18
|
+
var _asyncMutex = require("async-mutex");
|
|
19
|
+
var _types = require("../Logger/types");
|
|
20
|
+
var _testUtil = require("../common/testUtil");
|
|
21
|
+
var _types2 = require("../common/types");
|
|
22
|
+
var _types3 = require("../Events/types");
|
|
23
|
+
var _Logger = _interopRequireDefault(require("../Logger"));
|
|
24
|
+
var _CallingClient = require("./CallingClient");
|
|
25
|
+
var _Utils = _interopRequireWildcard(require("../common/Utils"));
|
|
26
|
+
var utils = _Utils;
|
|
27
|
+
var _callManager = require("./calling/callManager");
|
|
28
|
+
var _constants = require("./constants");
|
|
29
|
+
var _callRecordFixtures = require("./callRecordFixtures");
|
|
30
|
+
var _callingClientFixtures = require("./callingClientFixtures");
|
|
31
|
+
var _line = _interopRequireDefault(require("./line"));
|
|
32
|
+
var _registerFixtures = require("./registration/registerFixtures");
|
|
33
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof _WeakMap) return null; var r = new _WeakMap(), t = new _WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
34
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? _Object$getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? _Object$defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
35
|
+
function ownKeys(e, r) { var t = _Object$keys2(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
36
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; } /* eslint-disable dot-notation */
|
|
37
|
+
describe('CallingClient Tests', function () {
|
|
38
|
+
// Common initializers
|
|
39
|
+
|
|
40
|
+
var handleErrorSpy = jest.spyOn(utils, 'handleCallingClientErrors');
|
|
41
|
+
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
42
|
+
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
43
|
+
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
44
|
+
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
45
|
+
var logSpy = jest.spyOn(_Logger.default, 'info');
|
|
46
|
+
var warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
47
|
+
var originalProcessNextTick = process.nextTick;
|
|
48
|
+
function flushPromises() {
|
|
49
|
+
return new _promise.default(function (resolve) {
|
|
50
|
+
originalProcessNextTick(resolve);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
describe('ServiceData tests', function () {
|
|
54
|
+
var callingClient;
|
|
55
|
+
afterEach(function () {
|
|
56
|
+
callManager.removeAllListeners();
|
|
57
|
+
callingClient = undefined;
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* No input sdk config to callingClient, it should default to service type
|
|
62
|
+
* calling and empty domain value.
|
|
63
|
+
*/
|
|
64
|
+
it('Verify valid calling serviceData with no input sdk config', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
65
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
66
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
67
|
+
case 0:
|
|
68
|
+
expect( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
69
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
70
|
+
while (1) switch (_context.prev = _context.next) {
|
|
71
|
+
case 0:
|
|
72
|
+
_context.next = 2;
|
|
73
|
+
return (0, _CallingClient.createClient)(webex);
|
|
74
|
+
case 2:
|
|
75
|
+
callingClient = _context.sent;
|
|
76
|
+
expect(callingClient).toBeTruthy();
|
|
77
|
+
case 4:
|
|
78
|
+
case "end":
|
|
79
|
+
return _context.stop();
|
|
80
|
+
}
|
|
81
|
+
}, _callee);
|
|
82
|
+
}))).not.toThrow(Error);
|
|
83
|
+
case 1:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context2.stop();
|
|
86
|
+
}
|
|
87
|
+
}, _callee2);
|
|
88
|
+
})));
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Input sdk config to callingClient with serviceData carrying empty string for
|
|
92
|
+
* both indicator and domain in it.
|
|
93
|
+
*
|
|
94
|
+
* It should default to service type calling and empty domain value.
|
|
95
|
+
*
|
|
96
|
+
*/
|
|
97
|
+
it('Verify invalid empty service indicator, empty domain', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
98
|
+
var serviceDataObj;
|
|
99
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
100
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
103
|
+
serviceDataObj = {
|
|
104
|
+
indicator: '',
|
|
105
|
+
domain: ''
|
|
106
|
+
};
|
|
107
|
+
expect( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
108
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
109
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
_context3.next = 2;
|
|
112
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
113
|
+
serviceData: serviceDataObj
|
|
114
|
+
});
|
|
115
|
+
case 2:
|
|
116
|
+
callingClient = _context3.sent;
|
|
117
|
+
expect(callingClient).toBeTruthy();
|
|
118
|
+
case 4:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context3.stop();
|
|
121
|
+
}
|
|
122
|
+
}, _callee3);
|
|
123
|
+
}))).not.toThrow(Error);
|
|
124
|
+
case 2:
|
|
125
|
+
case "end":
|
|
126
|
+
return _context4.stop();
|
|
127
|
+
}
|
|
128
|
+
}, _callee4);
|
|
129
|
+
})));
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Input sdk config to callingClient with serviceData carrying invalid value for indicator
|
|
133
|
+
* and valid domain type string for domain field in it.
|
|
134
|
+
*
|
|
135
|
+
* It should throw error and abort execution as indicator value is invalid.
|
|
136
|
+
*
|
|
137
|
+
* INDICATOR value MUST MATCH with one of the values in ServiceIndicator enum.
|
|
138
|
+
*/
|
|
139
|
+
it('Verify invalid service indicator, valid domain', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
140
|
+
var serviceDataObj;
|
|
141
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
142
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
143
|
+
case 0:
|
|
144
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
145
|
+
serviceDataObj = {
|
|
146
|
+
indicator: 'test',
|
|
147
|
+
domain: 'test.example.com'
|
|
148
|
+
};
|
|
149
|
+
_context5.prev = 1;
|
|
150
|
+
_context5.next = 4;
|
|
151
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
152
|
+
serviceData: serviceDataObj
|
|
153
|
+
});
|
|
154
|
+
case 4:
|
|
155
|
+
callingClient = _context5.sent;
|
|
156
|
+
_context5.next = 10;
|
|
157
|
+
break;
|
|
158
|
+
case 7:
|
|
159
|
+
_context5.prev = 7;
|
|
160
|
+
_context5.t0 = _context5["catch"](1);
|
|
161
|
+
expect(_context5.t0.message).toEqual('Invalid service indicator, Allowed values are: calling,contactcenter');
|
|
162
|
+
case 10:
|
|
163
|
+
expect.assertions(1);
|
|
164
|
+
case 11:
|
|
165
|
+
case "end":
|
|
166
|
+
return _context5.stop();
|
|
167
|
+
}
|
|
168
|
+
}, _callee5, null, [[1, 7]]);
|
|
169
|
+
})));
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
173
|
+
* 'calling', but an invalid domain type string for domain field in it.
|
|
174
|
+
*
|
|
175
|
+
* It should throw error and abort execution as domain value is invalid.
|
|
176
|
+
*
|
|
177
|
+
* DOMAIN field for service type calling is allowed to be empty but if it carries a non-empty
|
|
178
|
+
* string then it must be of valid domain type.
|
|
179
|
+
*/
|
|
180
|
+
it('CALLING: verify invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
181
|
+
var serviceDataObj;
|
|
182
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
183
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
184
|
+
case 0:
|
|
185
|
+
serviceDataObj = {
|
|
186
|
+
indicator: _types2.ServiceIndicator.CALLING,
|
|
187
|
+
domain: 'test'
|
|
188
|
+
};
|
|
189
|
+
_context6.prev = 1;
|
|
190
|
+
_context6.next = 4;
|
|
191
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
192
|
+
serviceData: serviceDataObj
|
|
193
|
+
});
|
|
194
|
+
case 4:
|
|
195
|
+
callingClient = _context6.sent;
|
|
196
|
+
_context6.next = 10;
|
|
197
|
+
break;
|
|
198
|
+
case 7:
|
|
199
|
+
_context6.prev = 7;
|
|
200
|
+
_context6.t0 = _context6["catch"](1);
|
|
201
|
+
expect(_context6.t0.message).toEqual('Invalid service domain.');
|
|
202
|
+
case 10:
|
|
203
|
+
expect.assertions(1);
|
|
204
|
+
case 11:
|
|
205
|
+
case "end":
|
|
206
|
+
return _context6.stop();
|
|
207
|
+
}
|
|
208
|
+
}, _callee6, null, [[1, 7]]);
|
|
209
|
+
})));
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
213
|
+
* 'calling', and an empty string for domain field in it.
|
|
214
|
+
*
|
|
215
|
+
* Execution should proceed properly and createRegistration should be called with same serviceData.
|
|
216
|
+
*
|
|
217
|
+
* DOMAIN field for service type 'calling' is allowed to be empty.
|
|
218
|
+
*/
|
|
219
|
+
it('CALLING: verify valid empty service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
220
|
+
var serviceDataObj;
|
|
221
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
222
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
serviceDataObj = {
|
|
225
|
+
indicator: _types2.ServiceIndicator.CALLING,
|
|
226
|
+
domain: ''
|
|
227
|
+
};
|
|
228
|
+
expect( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
229
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
230
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
231
|
+
case 0:
|
|
232
|
+
_context7.next = 2;
|
|
233
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
234
|
+
serviceData: serviceDataObj
|
|
235
|
+
});
|
|
236
|
+
case 2:
|
|
237
|
+
callingClient = _context7.sent;
|
|
238
|
+
expect(callingClient).toBeTruthy();
|
|
239
|
+
case 4:
|
|
240
|
+
case "end":
|
|
241
|
+
return _context7.stop();
|
|
242
|
+
}
|
|
243
|
+
}, _callee7);
|
|
244
|
+
}))).not.toThrow(Error);
|
|
245
|
+
case 2:
|
|
246
|
+
case "end":
|
|
247
|
+
return _context8.stop();
|
|
248
|
+
}
|
|
249
|
+
}, _callee8);
|
|
250
|
+
})));
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
254
|
+
* 'contactcenter', but an empty string for domain field in it.
|
|
255
|
+
*
|
|
256
|
+
* It should throw error and abort execution as domain value is invalid.
|
|
257
|
+
*
|
|
258
|
+
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
259
|
+
*/
|
|
260
|
+
it('ContactCenter: verify empty invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
261
|
+
var serviceDataObj;
|
|
262
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
263
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
264
|
+
case 0:
|
|
265
|
+
serviceDataObj = {
|
|
266
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
267
|
+
domain: ''
|
|
268
|
+
};
|
|
269
|
+
_context9.prev = 1;
|
|
270
|
+
_context9.next = 4;
|
|
271
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
272
|
+
serviceData: serviceDataObj
|
|
273
|
+
});
|
|
274
|
+
case 4:
|
|
275
|
+
callingClient = _context9.sent;
|
|
276
|
+
_context9.next = 10;
|
|
277
|
+
break;
|
|
278
|
+
case 7:
|
|
279
|
+
_context9.prev = 7;
|
|
280
|
+
_context9.t0 = _context9["catch"](1);
|
|
281
|
+
expect(_context9.t0.message).toEqual('Invalid service domain.');
|
|
282
|
+
case 10:
|
|
283
|
+
expect.assertions(1);
|
|
284
|
+
case 11:
|
|
285
|
+
case "end":
|
|
286
|
+
return _context9.stop();
|
|
287
|
+
}
|
|
288
|
+
}, _callee9, null, [[1, 7]]);
|
|
289
|
+
})));
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
293
|
+
* 'contactcenter', and a valid domain type string for domain field in it.
|
|
294
|
+
*
|
|
295
|
+
* Execution should proceed properly and createRegistration should be called with same serviceData.
|
|
296
|
+
*
|
|
297
|
+
* DOMAIN field for service type 'contactcenter' must carry a non-empty valid domain type string.
|
|
298
|
+
*/
|
|
299
|
+
it('ContactCenter: verify valid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
300
|
+
var serviceDataObj;
|
|
301
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
302
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
303
|
+
case 0:
|
|
304
|
+
serviceDataObj = {
|
|
305
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
306
|
+
domain: 'test.example.com'
|
|
307
|
+
};
|
|
308
|
+
expect( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
309
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
310
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
311
|
+
case 0:
|
|
312
|
+
_context10.next = 2;
|
|
313
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
314
|
+
serviceData: serviceDataObj
|
|
315
|
+
});
|
|
316
|
+
case 2:
|
|
317
|
+
callingClient = _context10.sent;
|
|
318
|
+
expect(callingClient).toBeTruthy();
|
|
319
|
+
case 4:
|
|
320
|
+
case "end":
|
|
321
|
+
return _context10.stop();
|
|
322
|
+
}
|
|
323
|
+
}, _callee10);
|
|
324
|
+
}))).not.toThrow(Error);
|
|
325
|
+
case 2:
|
|
326
|
+
case "end":
|
|
327
|
+
return _context11.stop();
|
|
328
|
+
}
|
|
329
|
+
}, _callee11);
|
|
330
|
+
})));
|
|
331
|
+
it('Get current log level', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
332
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
333
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
334
|
+
case 0:
|
|
335
|
+
_context12.next = 2;
|
|
336
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
337
|
+
logger: {
|
|
338
|
+
level: _types.LOGGER.INFO
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
case 2:
|
|
342
|
+
callingClient = _context12.sent;
|
|
343
|
+
expect(callingClient).toBeTruthy();
|
|
344
|
+
expect(callingClient.getLoggingLevel).toBeTruthy();
|
|
345
|
+
expect(callingClient.getLoggingLevel()).toEqual(_types.LOGGER.INFO);
|
|
346
|
+
case 6:
|
|
347
|
+
case "end":
|
|
348
|
+
return _context12.stop();
|
|
349
|
+
}
|
|
350
|
+
}, _callee12);
|
|
351
|
+
})));
|
|
352
|
+
});
|
|
353
|
+
describe('Mobius Server discovery tests', function () {
|
|
354
|
+
var callingClient;
|
|
355
|
+
afterEach(function () {
|
|
356
|
+
jest.clearAllTimers();
|
|
357
|
+
jest.clearAllMocks();
|
|
358
|
+
callingClient.removeAllListeners();
|
|
359
|
+
callManager.removeAllListeners();
|
|
360
|
+
callingClient = undefined;
|
|
361
|
+
jest.useRealTimers();
|
|
362
|
+
});
|
|
363
|
+
it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
364
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
365
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
366
|
+
case 0:
|
|
367
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
368
|
+
_context13.next = 3;
|
|
369
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
370
|
+
logger: {
|
|
371
|
+
level: _types.LOGGER.INFO
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
case 3:
|
|
375
|
+
callingClient = _context13.sent;
|
|
376
|
+
expect(webex.request).toBeCalledTimes(3);
|
|
377
|
+
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
378
|
+
expect(handleErrorSpy).not.toBeCalled();
|
|
379
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({
|
|
380
|
+
method: 'GET'
|
|
381
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
382
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT)
|
|
383
|
+
}));
|
|
384
|
+
expect(webex.request).nthCalledWith(2, {
|
|
385
|
+
method: 'GET',
|
|
386
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
387
|
+
addAuthHeader: false,
|
|
388
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
389
|
+
});
|
|
390
|
+
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({
|
|
391
|
+
method: 'GET'
|
|
392
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
393
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode)
|
|
394
|
+
}));
|
|
395
|
+
case 10:
|
|
396
|
+
case "end":
|
|
397
|
+
return _context13.stop();
|
|
398
|
+
}
|
|
399
|
+
}, _callee13);
|
|
400
|
+
})));
|
|
401
|
+
it('case when region discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
402
|
+
var failurePayload;
|
|
403
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
404
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
405
|
+
case 0:
|
|
406
|
+
failurePayload = {
|
|
407
|
+
statusCode: 500
|
|
408
|
+
};
|
|
409
|
+
webex.request.mockRejectedValueOnce(failurePayload);
|
|
410
|
+
_context14.next = 4;
|
|
411
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
412
|
+
logger: {
|
|
413
|
+
level: _types.LOGGER.INFO
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
case 4:
|
|
417
|
+
callingClient = _context14.sent;
|
|
418
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
419
|
+
uri: 'https://mobius-us-east-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
420
|
+
method: 'GET'
|
|
421
|
+
}));
|
|
422
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
423
|
+
uri: 'https://mobius-ca-central-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
424
|
+
method: 'GET'
|
|
425
|
+
}));
|
|
426
|
+
expect(webex.request).nthCalledWith(3, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
427
|
+
uri: 'https://mobius-eu-central-1.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
428
|
+
method: 'GET'
|
|
429
|
+
}));
|
|
430
|
+
expect(webex.request).nthCalledWith(4, _objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
431
|
+
uri: 'https://mobius-ap-southeast-2.prod.infra.webex.com/api/v1/calling/web/myip',
|
|
432
|
+
method: 'GET'
|
|
433
|
+
}));
|
|
434
|
+
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
435
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
436
|
+
method: 'getMobiusServers'
|
|
437
|
+
});
|
|
438
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
439
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
440
|
+
case 12:
|
|
441
|
+
case "end":
|
|
442
|
+
return _context14.stop();
|
|
443
|
+
}
|
|
444
|
+
}, _callee14);
|
|
445
|
+
})));
|
|
446
|
+
it('when region discovery succeeds but region based mobius url discovery fails', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
447
|
+
var failurePayload;
|
|
448
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
449
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
450
|
+
case 0:
|
|
451
|
+
failurePayload = {
|
|
452
|
+
statusCode: 500
|
|
453
|
+
};
|
|
454
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
455
|
+
_context15.next = 4;
|
|
456
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
457
|
+
logger: {
|
|
458
|
+
level: _types.LOGGER.INFO
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
case 4:
|
|
462
|
+
callingClient = _context15.sent;
|
|
463
|
+
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
464
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
465
|
+
method: 'getMobiusServers'
|
|
466
|
+
});
|
|
467
|
+
expect(webex.request).toBeCalledTimes(3);
|
|
468
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
469
|
+
expect(webex.request).nthCalledWith(1, _objectSpread(_objectSpread({
|
|
470
|
+
method: 'GET'
|
|
471
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
472
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT).concat(_constants.IP_ENDPOINT)
|
|
473
|
+
}));
|
|
474
|
+
expect(webex.request).nthCalledWith(2, {
|
|
475
|
+
method: 'GET',
|
|
476
|
+
uri: "".concat(_constants.DISCOVERY_URL, "/").concat(_callingClientFixtures.myIP),
|
|
477
|
+
addAuthHeader: false,
|
|
478
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
479
|
+
});
|
|
480
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", '');
|
|
481
|
+
case 11:
|
|
482
|
+
case "end":
|
|
483
|
+
return _context15.stop();
|
|
484
|
+
}
|
|
485
|
+
}, _callee15);
|
|
486
|
+
})));
|
|
487
|
+
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
488
|
+
var infoSpy;
|
|
489
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
490
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
491
|
+
case 0:
|
|
492
|
+
infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
493
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
494
|
+
_context16.next = 4;
|
|
495
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
496
|
+
discovery: {
|
|
497
|
+
region: 'AP-SOUTHEAST',
|
|
498
|
+
country: 'IN'
|
|
499
|
+
},
|
|
500
|
+
logger: {
|
|
501
|
+
level: _types.LOGGER.INFO
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
case 4:
|
|
505
|
+
callingClient = _context16.sent;
|
|
506
|
+
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
507
|
+
expect(infoSpy).toBeCalledWith('Updating region and country from the SDK config', {
|
|
508
|
+
file: 'CallingClient',
|
|
509
|
+
method: 'getMobiusServers'
|
|
510
|
+
});
|
|
511
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
512
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode),
|
|
513
|
+
method: 'GET'
|
|
514
|
+
}));
|
|
515
|
+
expect(handleErrorSpy).not.toBeCalled();
|
|
516
|
+
case 9:
|
|
517
|
+
case "end":
|
|
518
|
+
return _context16.stop();
|
|
519
|
+
}
|
|
520
|
+
}, _callee16);
|
|
521
|
+
})));
|
|
522
|
+
});
|
|
523
|
+
describe('Testing each cluster present withing host catalog', function () {
|
|
524
|
+
var mobiusCluster = ['mobius-eu-central-1.prod.infra.webex.com', 'mobius-us-east-1.int.infra.webex.com', 'mobius-eu-central-1.int.infra.webex.com'];
|
|
525
|
+
var checkCluster = /*#__PURE__*/function () {
|
|
526
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17(mockServiceHosts, mockCatalog) {
|
|
527
|
+
var callingClient;
|
|
528
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
529
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
530
|
+
case 0:
|
|
531
|
+
webex.internal.services._hostCatalog = mockCatalog;
|
|
532
|
+
_context17.next = 3;
|
|
533
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
534
|
+
logger: {
|
|
535
|
+
level: _types.LOGGER.INFO
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
case 3:
|
|
539
|
+
callingClient = _context17.sent;
|
|
540
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
541
|
+
case 5:
|
|
542
|
+
case "end":
|
|
543
|
+
return _context17.stop();
|
|
544
|
+
}
|
|
545
|
+
}, _callee17);
|
|
546
|
+
}));
|
|
547
|
+
return function checkCluster(_x, _x2) {
|
|
548
|
+
return _ref17.apply(this, arguments);
|
|
549
|
+
};
|
|
550
|
+
}();
|
|
551
|
+
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
552
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(clusterName) {
|
|
553
|
+
return _regenerator.default.wrap(function _callee18$(_context18) {
|
|
554
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
555
|
+
case 0:
|
|
556
|
+
_context18.t0 = clusterName;
|
|
557
|
+
_context18.next = _context18.t0 === 'mobius-eu-central-1.prod.infra.webex.com' ? 3 : _context18.t0 === 'mobius-us-east-1.int.infra.webex.com' ? 5 : _context18.t0 === 'mobius-eu-central-1.int.infra.webex.com' ? 7 : 9;
|
|
558
|
+
break;
|
|
559
|
+
case 3:
|
|
560
|
+
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
561
|
+
return _context18.abrupt("break", 10);
|
|
562
|
+
case 5:
|
|
563
|
+
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
564
|
+
return _context18.abrupt("break", 10);
|
|
565
|
+
case 7:
|
|
566
|
+
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
567
|
+
return _context18.abrupt("break", 10);
|
|
568
|
+
case 9:
|
|
569
|
+
return _context18.abrupt("break", 10);
|
|
570
|
+
case 10:
|
|
571
|
+
case "end":
|
|
572
|
+
return _context18.stop();
|
|
573
|
+
}
|
|
574
|
+
}, _callee18);
|
|
575
|
+
}));
|
|
576
|
+
return function (_x3) {
|
|
577
|
+
return _ref18.apply(this, arguments);
|
|
578
|
+
};
|
|
579
|
+
}());
|
|
580
|
+
});
|
|
581
|
+
describe('Network activity detection tests', function () {
|
|
582
|
+
var callingClient;
|
|
583
|
+
var line;
|
|
584
|
+
var reg;
|
|
585
|
+
var restoreSpy;
|
|
586
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
587
|
+
var deRegSpy;
|
|
588
|
+
var restartRegisterSpy;
|
|
589
|
+
var registerSpy;
|
|
590
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
591
|
+
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
592
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
593
|
+
case 0:
|
|
594
|
+
jest.useFakeTimers();
|
|
595
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.ipPayload).mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
596
|
+
_context19.next = 4;
|
|
597
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
598
|
+
logger: {
|
|
599
|
+
level: _types.LOGGER.INFO
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
case 4:
|
|
603
|
+
callingClient = _context19.sent;
|
|
604
|
+
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
605
|
+
reg = line.registration;
|
|
606
|
+
_context19.next = 9;
|
|
607
|
+
return line.register();
|
|
608
|
+
case 9:
|
|
609
|
+
deRegSpy = jest.spyOn(line.registration, 'deregister');
|
|
610
|
+
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
611
|
+
restartRegisterSpy = jest.spyOn(reg, 'restartRegistration');
|
|
612
|
+
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
613
|
+
case 13:
|
|
614
|
+
case "end":
|
|
615
|
+
return _context19.stop();
|
|
616
|
+
}
|
|
617
|
+
}, _callee19);
|
|
618
|
+
})));
|
|
619
|
+
afterEach(function () {
|
|
620
|
+
jest.clearAllTimers();
|
|
621
|
+
jest.clearAllMocks();
|
|
622
|
+
callingClient.removeAllListeners();
|
|
623
|
+
callManager.removeAllListeners();
|
|
624
|
+
callingClient = undefined;
|
|
625
|
+
jest.useRealTimers();
|
|
626
|
+
});
|
|
627
|
+
it('detect a network flap in mercury connection', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
628
|
+
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
629
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
630
|
+
case 0:
|
|
631
|
+
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
632
|
+
|
|
633
|
+
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
634
|
+
webex.internal.mercury.connected = false;
|
|
635
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
636
|
+
|
|
637
|
+
/* We should be detecting the network flap */
|
|
638
|
+
expect(warnSpy).toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
639
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
640
|
+
method: _constants.NETWORK_CHANGE_DETECTION_UTIL
|
|
641
|
+
});
|
|
642
|
+
|
|
643
|
+
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
644
|
+
webex.internal.mercury.connected = true;
|
|
645
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
646
|
+
_context20.next = 8;
|
|
647
|
+
return flushPromises();
|
|
648
|
+
case 8:
|
|
649
|
+
/* We should be detecting the network recovery */
|
|
650
|
+
expect(logSpy).toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
651
|
+
file: _constants.REGISTRATION_FILE,
|
|
652
|
+
method: 'handleConnectionRestoration'
|
|
653
|
+
});
|
|
654
|
+
expect(restoreSpy).toBeCalledWith('handleConnectionRestoration');
|
|
655
|
+
expect(restartRegisterSpy).toBeCalledWith('handleConnectionRestoration');
|
|
656
|
+
expect(webex.request).toBeCalledTimes(6);
|
|
657
|
+
expect(registerSpy).toBeCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
658
|
+
expect(registerSpy).lastCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
659
|
+
case 14:
|
|
660
|
+
case "end":
|
|
661
|
+
return _context20.stop();
|
|
662
|
+
}
|
|
663
|
+
}, _callee20);
|
|
664
|
+
})));
|
|
665
|
+
it('Simulate a network flap with no active calls and re-verify registration: Restore Failure', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
666
|
+
var failurePayload, mockRegistrationBody, successPayload;
|
|
667
|
+
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
668
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
669
|
+
case 0:
|
|
670
|
+
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
671
|
+
failurePayload = {
|
|
672
|
+
statusCode: 500,
|
|
673
|
+
body: ''
|
|
674
|
+
};
|
|
675
|
+
mockRegistrationBody = (0, _testUtil.getMockDeviceInfo)();
|
|
676
|
+
successPayload = {
|
|
677
|
+
statusCode: 200,
|
|
678
|
+
body: mockRegistrationBody
|
|
679
|
+
};
|
|
680
|
+
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(successPayload);
|
|
681
|
+
|
|
682
|
+
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
683
|
+
webex.internal.mercury.connected = false;
|
|
684
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
685
|
+
|
|
686
|
+
/* We should be detecting the network flap */
|
|
687
|
+
expect(warnSpy).toBeCalledWith('Network has flapped, waiting for mercury connection to be up', {
|
|
688
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
689
|
+
method: _constants.NETWORK_CHANGE_DETECTION_UTIL
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
693
|
+
webex.internal.mercury.connected = true;
|
|
694
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
695
|
+
_context21.next = 12;
|
|
696
|
+
return flushPromises();
|
|
697
|
+
case 12:
|
|
698
|
+
/* We should be detecting the network recovery */
|
|
699
|
+
expect(logSpy).toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
700
|
+
file: _constants.REGISTRATION_FILE,
|
|
701
|
+
method: 'handleConnectionRestoration'
|
|
702
|
+
});
|
|
703
|
+
expect(restoreSpy).toBeCalledOnceWith('handleConnectionRestoration');
|
|
704
|
+
expect(restartRegisterSpy).toBeCalledOnceWith('handleConnectionRestoration');
|
|
705
|
+
expect(webex.request).toBeCalledTimes(6);
|
|
706
|
+
expect(registerSpy).toBeCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
707
|
+
expect(registerSpy).lastCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
708
|
+
case 18:
|
|
709
|
+
case "end":
|
|
710
|
+
return _context21.stop();
|
|
711
|
+
}
|
|
712
|
+
}, _callee21);
|
|
713
|
+
})));
|
|
714
|
+
it('Simulate a network flap before initial registration is done', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
715
|
+
var handleConnectionRestoreSpy;
|
|
716
|
+
return _regenerator.default.wrap(function _callee22$(_context22) {
|
|
717
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
718
|
+
case 0:
|
|
719
|
+
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
720
|
+
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
721
|
+
|
|
722
|
+
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
723
|
+
webex.internal.mercury.connected = false;
|
|
724
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
725
|
+
|
|
726
|
+
/* We should be detecting the network flap */
|
|
727
|
+
expect(warnSpy).toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
728
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
729
|
+
method: _constants.NETWORK_CHANGE_DETECTION_UTIL
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
733
|
+
webex.internal.mercury.connected = true;
|
|
734
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
735
|
+
_context22.next = 9;
|
|
736
|
+
return flushPromises();
|
|
737
|
+
case 9:
|
|
738
|
+
/* We should be detecting the network recovery */
|
|
739
|
+
expect(logSpy).not.toBeCalledWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
740
|
+
file: _constants.REGISTRATION_FILE,
|
|
741
|
+
method: 'handleConnectionRestoration'
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
/*
|
|
745
|
+
* When initial registration is not done, network flap
|
|
746
|
+
* will not trigger de-registration/registration
|
|
747
|
+
*/
|
|
748
|
+
expect(handleConnectionRestoreSpy).not.toBeCalledOnceWith();
|
|
749
|
+
case 11:
|
|
750
|
+
case "end":
|
|
751
|
+
return _context22.stop();
|
|
752
|
+
}
|
|
753
|
+
}, _callee22);
|
|
754
|
+
})));
|
|
755
|
+
it('Simulate a network flap with 1 active call', /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
756
|
+
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
757
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
758
|
+
case 0:
|
|
759
|
+
expect(line.getStatus()).toEqual(_types2.RegistrationStatus.ACTIVE);
|
|
760
|
+
|
|
761
|
+
/** create a new call */
|
|
762
|
+
reg.callManager.createCall();
|
|
763
|
+
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(1);
|
|
764
|
+
|
|
765
|
+
/* Set mercury connection to be down and execute a delay of 2.5 seconds */
|
|
766
|
+
webex.internal.mercury.connected = false;
|
|
767
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
768
|
+
_context23.next = 7;
|
|
769
|
+
return flushPromises();
|
|
770
|
+
case 7:
|
|
771
|
+
/* We should be detecting the network flap */
|
|
772
|
+
expect(warnSpy).not.toBeCalledOnceWith('Network has flapped, waiting for mercury connection to be up', {
|
|
773
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
774
|
+
method: 'handleConnectionRestoration'
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
/* Set mercury connection to be up and execute a delay of 2.5 seconds */
|
|
778
|
+
webex.internal.mercury.connected = true;
|
|
779
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 500);
|
|
780
|
+
_context23.next = 12;
|
|
781
|
+
return flushPromises();
|
|
782
|
+
case 12:
|
|
783
|
+
/* We should be detecting the network recovery */
|
|
784
|
+
expect(logSpy).not.toBeCalledOnceWith('Mercury connection is up again, re-registering with Webex Calling if needed', {
|
|
785
|
+
file: _constants.REGISTRATION_FILE,
|
|
786
|
+
method: 'handleConnectionRestoration'
|
|
787
|
+
});
|
|
788
|
+
expect(registerSpy).not.toBeCalledWith(true);
|
|
789
|
+
case 14:
|
|
790
|
+
case "end":
|
|
791
|
+
return _context23.stop();
|
|
792
|
+
}
|
|
793
|
+
}, _callee23);
|
|
794
|
+
})));
|
|
795
|
+
});
|
|
796
|
+
describe('Line creation tests', function () {
|
|
797
|
+
var callingClient;
|
|
798
|
+
var line;
|
|
799
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
800
|
+
return _regenerator.default.wrap(function _callee24$(_context24) {
|
|
801
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
802
|
+
case 0:
|
|
803
|
+
_context24.next = 2;
|
|
804
|
+
return (0, _CallingClient.createClient)(webex);
|
|
805
|
+
case 2:
|
|
806
|
+
callingClient = _context24.sent;
|
|
807
|
+
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
808
|
+
case 4:
|
|
809
|
+
case "end":
|
|
810
|
+
return _context24.stop();
|
|
811
|
+
}
|
|
812
|
+
}, _callee24);
|
|
813
|
+
})));
|
|
814
|
+
afterEach(function () {
|
|
815
|
+
jest.clearAllTimers();
|
|
816
|
+
jest.clearAllMocks();
|
|
817
|
+
callingClient.removeAllListeners();
|
|
818
|
+
callManager.removeAllListeners();
|
|
819
|
+
callingClient = undefined;
|
|
820
|
+
jest.useRealTimers();
|
|
821
|
+
});
|
|
822
|
+
it('verify line dict successfully created', function () {
|
|
823
|
+
expect(callingClient.lineDict).toBeTruthy();
|
|
824
|
+
expect(line).toBeTruthy();
|
|
825
|
+
expect((0, _keys.default)(callingClient.lineDict).length).toEqual(1);
|
|
826
|
+
});
|
|
827
|
+
it('verify getLines response', function () {
|
|
828
|
+
expect(callingClient.getLines).toBeTruthy();
|
|
829
|
+
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
830
|
+
});
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
// Calling related test cases
|
|
834
|
+
describe('Calling tests', function () {
|
|
835
|
+
var mutex = new _asyncMutex.Mutex();
|
|
836
|
+
var userId = webex.internal.device.userId;
|
|
837
|
+
var clientDeviceUri = webex.internal.device.url;
|
|
838
|
+
var mobiusUris = (0, _Utils.filterMobiusUris)((0, _testUtil.getMobiusDiscoveryResponse)(), _registerFixtures.URL);
|
|
839
|
+
var primaryMobiusUris = jest.fn(function () {
|
|
840
|
+
return mobiusUris.primary;
|
|
841
|
+
});
|
|
842
|
+
var backupMobiusUris = jest.fn(function () {
|
|
843
|
+
return mobiusUris.backup;
|
|
844
|
+
});
|
|
845
|
+
var callingClient;
|
|
846
|
+
var line;
|
|
847
|
+
beforeAll( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
848
|
+
var calls;
|
|
849
|
+
return _regenerator.default.wrap(function _callee25$(_context25) {
|
|
850
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
851
|
+
case 0:
|
|
852
|
+
_context25.next = 2;
|
|
853
|
+
return (0, _CallingClient.createClient)(webex);
|
|
854
|
+
case 2:
|
|
855
|
+
callingClient = _context25.sent;
|
|
856
|
+
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
857
|
+
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
858
|
+
calls.forEach(function (call) {
|
|
859
|
+
call.end();
|
|
860
|
+
});
|
|
861
|
+
case 6:
|
|
862
|
+
case "end":
|
|
863
|
+
return _context25.stop();
|
|
864
|
+
}
|
|
865
|
+
}, _callee25);
|
|
866
|
+
})));
|
|
867
|
+
afterAll(function () {
|
|
868
|
+
callingClient.removeAllListeners();
|
|
869
|
+
callManager.removeAllListeners();
|
|
870
|
+
});
|
|
871
|
+
it('verify calling client object', function () {
|
|
872
|
+
expect(callingClient.getSDKConnector().getWebex().internal.device.userId).toBe('8a67806f-fc4d-446b-a131-31e71ea5b0e9');
|
|
873
|
+
});
|
|
874
|
+
it('returns undefined when there is no connected call', function () {
|
|
875
|
+
line.register();
|
|
876
|
+
line.makeCall({
|
|
877
|
+
address: '123456',
|
|
878
|
+
type: _types2.CallType.URI
|
|
879
|
+
});
|
|
880
|
+
expect(callingClient.getConnectedCall()).toEqual(undefined);
|
|
881
|
+
});
|
|
882
|
+
it('returns the connected call', function () {
|
|
883
|
+
line.register();
|
|
884
|
+
var mockCall = line.makeCall({
|
|
885
|
+
address: '1234',
|
|
886
|
+
type: _types2.CallType.URI
|
|
887
|
+
});
|
|
888
|
+
var mockCall2 = line.makeCall({
|
|
889
|
+
address: '5678',
|
|
890
|
+
type: _types2.CallType.URI
|
|
891
|
+
});
|
|
892
|
+
// Connected call
|
|
893
|
+
mockCall['connected'] = true;
|
|
894
|
+
mockCall['earlyMedia'] = false;
|
|
895
|
+
mockCall['callStateMachine'].state.value = 'S_CALL_ESTABLISHED';
|
|
896
|
+
|
|
897
|
+
// Held call
|
|
898
|
+
mockCall2['connected'] = true;
|
|
899
|
+
mockCall2['held'] = true;
|
|
900
|
+
mockCall2['earlyMedia'] = false;
|
|
901
|
+
mockCall2['callStateMachine'].state.value = 'S_CALL_HOLD';
|
|
902
|
+
var mockActiveCalls = {
|
|
903
|
+
mockCorrelationId: mockCall,
|
|
904
|
+
mockCorrelationId2: mockCall2
|
|
905
|
+
};
|
|
906
|
+
jest.spyOn(callManager, 'getActiveCalls').mockReturnValue(mockActiveCalls);
|
|
907
|
+
expect(callingClient.getConnectedCall()).toEqual(mockCall);
|
|
908
|
+
});
|
|
909
|
+
it('returns all active calls', function () {
|
|
910
|
+
callingClient.lineDict = {
|
|
911
|
+
mockDeviceId: {
|
|
912
|
+
lineId: 'mockLineId'
|
|
913
|
+
},
|
|
914
|
+
mockDeviceId2: {
|
|
915
|
+
lineId: 'mockLineId2'
|
|
916
|
+
}
|
|
917
|
+
};
|
|
918
|
+
var mockCall = line.makeCall({
|
|
919
|
+
address: '1234',
|
|
920
|
+
type: _types2.CallType.URI
|
|
921
|
+
});
|
|
922
|
+
var mockCall2 = line.makeCall({
|
|
923
|
+
address: '5678',
|
|
924
|
+
type: _types2.CallType.URI
|
|
925
|
+
});
|
|
926
|
+
var mockCall3 = line.makeCall({
|
|
927
|
+
address: '9101',
|
|
928
|
+
type: _types2.CallType.URI
|
|
929
|
+
});
|
|
930
|
+
mockCall.lineId = 'mockLineId';
|
|
931
|
+
mockCall2.lineId = 'mockLineId2';
|
|
932
|
+
mockCall3.lineId = 'mockLineId2';
|
|
933
|
+
var mockActiveCalls = {
|
|
934
|
+
mockCorrelationId: mockCall,
|
|
935
|
+
mockCorrelationId2: mockCall2,
|
|
936
|
+
mockCorrelationId3: mockCall3
|
|
937
|
+
};
|
|
938
|
+
jest.spyOn(callManager, 'getActiveCalls').mockReturnValue(mockActiveCalls);
|
|
939
|
+
expect(callingClient.getActiveCalls()).toEqual({
|
|
940
|
+
mockLineId: [mockCall],
|
|
941
|
+
mockLineId2: [mockCall2, mockCall3]
|
|
942
|
+
});
|
|
943
|
+
});
|
|
944
|
+
});
|
|
945
|
+
describe('Call Session Event test', function () {
|
|
946
|
+
var mockOn = webex.internal.mercury.on;
|
|
947
|
+
var callingClient;
|
|
948
|
+
beforeEach( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
949
|
+
return _regenerator.default.wrap(function _callee26$(_context26) {
|
|
950
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
951
|
+
case 0:
|
|
952
|
+
_context26.next = 2;
|
|
953
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
954
|
+
logger: {
|
|
955
|
+
level: _types.LOGGER.INFO
|
|
956
|
+
}
|
|
957
|
+
});
|
|
958
|
+
case 2:
|
|
959
|
+
callingClient = _context26.sent;
|
|
960
|
+
case 3:
|
|
961
|
+
case "end":
|
|
962
|
+
return _context26.stop();
|
|
963
|
+
}
|
|
964
|
+
}, _callee26);
|
|
965
|
+
})));
|
|
966
|
+
afterEach(function () {
|
|
967
|
+
callingClient.removeAllListeners();
|
|
968
|
+
callManager.removeAllListeners();
|
|
969
|
+
});
|
|
970
|
+
it('verify the recent user session event ', function (done) {
|
|
971
|
+
expect.assertions(2);
|
|
972
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, function (event) {
|
|
973
|
+
expect(event.data).toEqual(_callRecordFixtures.MOCK_SESSION_EVENT.data);
|
|
974
|
+
done();
|
|
975
|
+
});
|
|
976
|
+
expect(mockOn.mock.calls[0][0]).toEqual(_types3.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE);
|
|
977
|
+
var callSessionCallback = mockOn.mock.calls[0][1];
|
|
978
|
+
callSessionCallback(_callRecordFixtures.MOCK_SESSION_EVENT);
|
|
979
|
+
});
|
|
980
|
+
it('drop the recent user session if there is no webex calling type', function (done) {
|
|
981
|
+
expect.assertions(2);
|
|
982
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, function (event) {
|
|
983
|
+
expect(event.data.userSessions.userSessions.length).toEqual(1);
|
|
984
|
+
done();
|
|
985
|
+
});
|
|
986
|
+
expect(mockOn.mock.calls[0][0]).toEqual(_types3.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE);
|
|
987
|
+
var callSessionCallback = mockOn.mock.calls[0][1];
|
|
988
|
+
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
989
|
+
});
|
|
990
|
+
});
|
|
991
|
+
});
|
|
992
|
+
//# sourceMappingURL=CallingClient.test.js.map
|