@webex/calling 3.11.0 → 3.12.0-llmrefactor.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHistory/CallHistory.js +596 -0
- package/dist/CallHistory/CallHistory.js.map +1 -0
- package/dist/CallHistory/CallHistory.test.js +916 -0
- package/dist/CallHistory/CallHistory.test.js.map +1 -0
- package/dist/CallHistory/callHistoryFixtures.js +650 -0
- package/dist/CallHistory/callHistoryFixtures.js.map +1 -0
- package/dist/CallHistory/constants.js +38 -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/CallRecording/CallRecording.js +160 -0
- package/dist/CallRecording/CallRecording.js.map +1 -0
- package/dist/CallRecording/CallRecording.test.js +257 -0
- package/dist/CallRecording/CallRecording.test.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js +577 -0
- package/dist/CallRecording/WxcCallRecordingConnector.js.map +1 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js +652 -0
- package/dist/CallRecording/WxcCallRecordingConnector.test.js.map +1 -0
- package/dist/CallRecording/callRecordingFixtures.js +235 -0
- package/dist/CallRecording/callRecordingFixtures.js.map +1 -0
- package/dist/CallRecording/constants.js +50 -0
- package/dist/CallRecording/constants.js.map +1 -0
- package/dist/CallRecording/types.js +137 -0
- package/dist/CallRecording/types.js.map +1 -0
- package/dist/CallRecording/utils.js +42 -0
- package/dist/CallRecording/utils.js.map +1 -0
- package/dist/CallRecording/utils.test.js +97 -0
- package/dist/CallRecording/utils.test.js.map +1 -0
- package/dist/CallSettings/CallSettings.js +311 -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 +308 -0
- package/dist/CallSettings/UcmBackendConnector.js.map +1 -0
- package/dist/CallSettings/UcmBackendConnector.test.js +411 -0
- package/dist/CallSettings/UcmBackendConnector.test.js.map +1 -0
- package/dist/CallSettings/WxCallBackendConnector.js +597 -0
- package/dist/CallSettings/WxCallBackendConnector.js.map +1 -0
- package/dist/CallSettings/WxCallBackendConnector.test.js +904 -0
- package/dist/CallSettings/WxCallBackendConnector.test.js.map +1 -0
- package/dist/CallSettings/constants.js +31 -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 +1349 -0
- package/dist/CallingClient/CallingClient.js.map +1 -0
- package/dist/CallingClient/CallingClient.test.js +1625 -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 +275 -0
- package/dist/CallingClient/calling/CallerId/index.js.map +1 -0
- package/dist/CallingClient/calling/CallerId/index.test.js +275 -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 +3666 -0
- package/dist/CallingClient/calling/call.js.map +1 -0
- package/dist/CallingClient/calling/call.test.js +3970 -0
- package/dist/CallingClient/calling/call.test.js.map +1 -0
- package/dist/CallingClient/calling/callManager.js +531 -0
- package/dist/CallingClient/calling/callManager.js.map +1 -0
- package/dist/CallingClient/calling/callManager.test.js +881 -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 +79 -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 +272 -0
- package/dist/CallingClient/constants.js.map +1 -0
- package/dist/CallingClient/line/index.js +339 -0
- package/dist/CallingClient/line/index.js.map +1 -0
- package/dist/CallingClient/line/line.test.js +379 -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 +2079 -0
- package/dist/CallingClient/registration/register.js.map +1 -0
- package/dist/CallingClient/registration/register.test.js +2476 -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 +33 -0
- package/dist/CallingClient/registration/types.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.js +67 -0
- package/dist/CallingClient/registration/webWorker.js.map +1 -0
- package/dist/CallingClient/registration/webWorker.test.js +189 -0
- package/dist/CallingClient/registration/webWorker.test.js.map +1 -0
- package/dist/CallingClient/registration/webWorkerStr.js +15 -0
- package/dist/CallingClient/registration/webWorkerStr.js.map +1 -0
- package/dist/CallingClient/types.js +14 -0
- package/dist/CallingClient/types.js.map +1 -0
- package/dist/CallingClient/utils/constants.js +58 -0
- package/dist/CallingClient/utils/constants.js.map +1 -0
- package/dist/CallingClient/utils/index.js +63 -0
- package/dist/CallingClient/utils/index.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js +122 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.js.map +1 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.test.js +221 -0
- package/dist/CallingClient/utils/mobiusSocketMapper.test.js.map +1 -0
- package/dist/CallingClient/utils/request.js +435 -0
- package/dist/CallingClient/utils/request.js.map +1 -0
- package/dist/CallingClient/utils/request.test.js +999 -0
- package/dist/CallingClient/utils/request.test.js.map +1 -0
- package/dist/CallingClient/utils/types.js +7 -0
- package/dist/CallingClient/utils/types.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js +70 -0
- package/dist/CallingClient/utils/wsFeatureFlag.js.map +1 -0
- package/dist/CallingClient/utils/wsFeatureFlag.test.js +139 -0
- package/dist/CallingClient/utils/wsFeatureFlag.test.js.map +1 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js +142 -0
- package/dist/CallingClient/windowsChromiumIceWarmupUtils.js.map +1 -0
- package/dist/Contacts/ContactsClient.js +1208 -0
- package/dist/Contacts/ContactsClient.js.map +1 -0
- package/dist/Contacts/ContactsClient.test.js +999 -0
- package/dist/Contacts/ContactsClient.test.js.map +1 -0
- package/dist/Contacts/constants.js +40 -0
- package/dist/Contacts/constants.js.map +1 -0
- package/dist/Contacts/contactFixtures.js +430 -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 +89 -0
- package/dist/Errors/catalog/CallError.js.map +1 -0
- package/dist/Errors/catalog/CallingDeviceError.js +83 -0
- package/dist/Errors/catalog/CallingDeviceError.js.map +1 -0
- package/dist/Errors/catalog/ExtendedError.js +42 -0
- package/dist/Errors/catalog/ExtendedError.js.map +1 -0
- package/dist/Errors/catalog/LineError.js +85 -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 +61 -0
- package/dist/Errors/types.js.map +1 -0
- package/dist/Events/impl/index.js +79 -0
- package/dist/Events/impl/index.js.map +1 -0
- package/dist/Events/types.js +134 -0
- package/dist/Events/types.js.map +1 -0
- package/dist/Logger/index.js +228 -0
- package/dist/Logger/index.js.map +1 -0
- package/dist/Logger/index.test.js +87 -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 +595 -0
- package/dist/Metrics/index.js.map +1 -0
- package/dist/Metrics/index.test.js +819 -0
- package/dist/Metrics/index.test.js.map +1 -0
- package/dist/Metrics/types.js +82 -0
- package/dist/Metrics/types.js.map +1 -0
- package/dist/SDKConnector/index.js +102 -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 +699 -0
- package/dist/Voicemail/BroadworksBackendConnector.js.map +1 -0
- package/dist/Voicemail/BroadworksBackendConnector.test.js +820 -0
- package/dist/Voicemail/BroadworksBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/UcmBackendConnector.js +628 -0
- package/dist/Voicemail/UcmBackendConnector.js.map +1 -0
- package/dist/Voicemail/UcmBackendConnector.test.js +738 -0
- package/dist/Voicemail/UcmBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/Voicemail.js +472 -0
- package/dist/Voicemail/Voicemail.js.map +1 -0
- package/dist/Voicemail/Voicemail.test.js +391 -0
- package/dist/Voicemail/Voicemail.test.js.map +1 -0
- package/dist/Voicemail/WxCallBackendConnector.js +657 -0
- package/dist/Voicemail/WxCallBackendConnector.js.map +1 -0
- package/dist/Voicemail/WxCallBackendConnector.test.js +1225 -0
- package/dist/Voicemail/WxCallBackendConnector.test.js.map +1 -0
- package/dist/Voicemail/constants.js +61 -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 +213 -0
- package/dist/api.js.map +1 -0
- package/dist/common/Utils.js +1624 -0
- package/dist/common/Utils.js.map +1 -0
- package/dist/common/Utils.test.js +2225 -0
- package/dist/common/Utils.test.js.map +1 -0
- package/dist/common/constants.js +62 -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 +988 -0
- package/dist/common/testUtil.js.map +1 -0
- package/dist/common/types.js +78 -0
- package/dist/common/types.js.map +1 -0
- package/dist/index.js +452 -0
- package/dist/index.js.map +1 -0
- package/dist/mobius-socket/config.js +24 -0
- package/dist/mobius-socket/config.js.map +1 -0
- package/dist/mobius-socket/errors.js +143 -0
- package/dist/mobius-socket/errors.js.map +1 -0
- package/dist/mobius-socket/errors.test.js +20 -0
- package/dist/mobius-socket/errors.test.js.map +1 -0
- package/dist/mobius-socket/index.js +57 -0
- package/dist/mobius-socket/index.js.map +1 -0
- package/dist/mobius-socket/mobius-socket-events.test.js +492 -0
- package/dist/mobius-socket/mobius-socket-events.test.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.js +849 -0
- package/dist/mobius-socket/mobius-socket.js.map +1 -0
- package/dist/mobius-socket/mobius-socket.test.js +1898 -0
- package/dist/mobius-socket/mobius-socket.test.js.map +1 -0
- package/dist/mobius-socket/socket/constants.js +55 -0
- package/dist/mobius-socket/socket/constants.js.map +1 -0
- package/dist/mobius-socket/socket/index.js +15 -0
- package/dist/mobius-socket/socket/index.js.map +1 -0
- package/dist/mobius-socket/socket/socket-base.js +604 -0
- package/dist/mobius-socket/socket/socket-base.js.map +1 -0
- package/dist/mobius-socket/socket/socket.js +19 -0
- package/dist/mobius-socket/socket/socket.js.map +1 -0
- package/dist/mobius-socket/socket/socket.shim.js +26 -0
- package/dist/mobius-socket/socket/socket.shim.js.map +1 -0
- package/dist/mobius-socket/socket/types.js +7 -0
- package/dist/mobius-socket/socket/types.js.map +1 -0
- package/dist/mobius-socket/socket.test.js +727 -0
- package/dist/mobius-socket/socket.test.js.map +1 -0
- package/dist/mobius-socket/test/mocha-helpers.js +23 -0
- package/dist/mobius-socket/test/mocha-helpers.js.map +1 -0
- package/dist/mobius-socket/test/promise-tick.js +28 -0
- package/dist/mobius-socket/test/promise-tick.js.map +1 -0
- package/dist/mobius-socket/types.js +7 -0
- package/dist/mobius-socket/types.js.map +1 -0
- package/dist/module/CallHistory/CallHistory.js +28 -17
- package/dist/module/CallRecording/CallRecording.js +56 -0
- package/dist/module/CallRecording/WxcCallRecordingConnector.js +257 -0
- package/dist/module/CallRecording/callRecordingFixtures.js +201 -0
- package/dist/module/CallRecording/constants.js +28 -0
- package/dist/module/CallRecording/types.js +19 -0
- package/dist/module/CallRecording/utils.js +14 -0
- package/dist/module/CallingClient/CallingClient.js +166 -8
- package/dist/module/CallingClient/calling/call.js +201 -68
- package/dist/module/CallingClient/calling/callManager.js +51 -11
- package/dist/module/CallingClient/calling/types.js +2 -0
- package/dist/module/CallingClient/constants.js +29 -0
- package/dist/module/CallingClient/line/index.js +4 -2
- package/dist/module/CallingClient/registration/register.js +274 -64
- package/dist/module/CallingClient/registration/types.js +5 -1
- package/dist/module/CallingClient/registration/webWorker.js +42 -61
- package/dist/module/CallingClient/registration/webWorkerStr.js +47 -82
- package/dist/module/CallingClient/utils/constants.js +36 -0
- package/dist/module/CallingClient/utils/index.js +5 -0
- package/dist/module/CallingClient/utils/mobiusSocketMapper.js +72 -0
- package/dist/module/CallingClient/utils/request.js +211 -0
- package/dist/module/CallingClient/utils/types.js +1 -0
- package/dist/module/CallingClient/utils/wsFeatureFlag.js +41 -0
- package/dist/module/Contacts/ContactsClient.js +1 -1
- package/dist/module/Errors/types.js +2 -0
- package/dist/module/Events/types.js +23 -10
- package/dist/module/Metrics/index.js +48 -1
- package/dist/module/Metrics/types.js +18 -0
- package/dist/module/api.js +3 -2
- package/dist/module/common/Utils.js +85 -22
- package/dist/module/common/testUtil.js +6 -1
- package/dist/module/common/types.js +3 -0
- package/dist/module/index.js +7 -3
- package/dist/module/mobius-socket/config.js +15 -0
- package/dist/module/mobius-socket/errors.js +58 -0
- package/dist/module/mobius-socket/index.js +24 -0
- package/dist/module/mobius-socket/mobius-socket.js +593 -0
- package/dist/module/mobius-socket/socket/constants.js +26 -0
- package/dist/module/mobius-socket/socket/index.js +4 -0
- package/dist/module/mobius-socket/socket/socket-base.js +368 -0
- package/dist/module/mobius-socket/socket/socket.js +9 -0
- package/dist/module/mobius-socket/socket/socket.shim.js +12 -0
- package/dist/module/mobius-socket/socket/types.js +1 -0
- package/dist/module/mobius-socket/types.js +1 -0
- package/dist/types/CallHistory/CallHistory.d.ts.map +1 -1
- package/dist/types/CallRecording/CallRecording.d.ts +18 -0
- package/dist/types/CallRecording/CallRecording.d.ts.map +1 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts +23 -0
- package/dist/types/CallRecording/WxcCallRecordingConnector.d.ts.map +1 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts +61 -0
- package/dist/types/CallRecording/callRecordingFixtures.d.ts.map +1 -0
- package/dist/types/CallRecording/constants.d.ts +29 -0
- package/dist/types/CallRecording/constants.d.ts.map +1 -0
- package/dist/types/CallRecording/types.d.ts +176 -0
- package/dist/types/CallRecording/types.d.ts.map +1 -0
- package/dist/types/CallRecording/utils.d.ts +3 -0
- package/dist/types/CallRecording/utils.d.ts.map +1 -0
- package/dist/types/CallingClient/CallingClient.d.ts +10 -1
- package/dist/types/CallingClient/CallingClient.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/call.d.ts +17 -3
- package/dist/types/CallingClient/calling/call.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/callManager.d.ts +8 -4
- package/dist/types/CallingClient/calling/callManager.d.ts.map +1 -1
- package/dist/types/CallingClient/calling/types.d.ts +38 -9
- package/dist/types/CallingClient/calling/types.d.ts.map +1 -1
- package/dist/types/CallingClient/constants.d.ts +29 -0
- package/dist/types/CallingClient/constants.d.ts.map +1 -1
- package/dist/types/CallingClient/line/index.d.ts +1 -1
- package/dist/types/CallingClient/line/index.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/register.d.ts +10 -2
- package/dist/types/CallingClient/registration/register.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/types.d.ts +29 -3
- package/dist/types/CallingClient/registration/types.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorker.d.ts.map +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts +1 -1
- package/dist/types/CallingClient/registration/webWorkerStr.d.ts.map +1 -1
- package/dist/types/CallingClient/types.d.ts +6 -3
- package/dist/types/CallingClient/types.d.ts.map +1 -1
- package/dist/types/CallingClient/utils/constants.d.ts +35 -0
- package/dist/types/CallingClient/utils/constants.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/index.d.ts +6 -0
- package/dist/types/CallingClient/utils/index.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts +5 -0
- package/dist/types/CallingClient/utils/mobiusSocketMapper.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/request.d.ts +28 -0
- package/dist/types/CallingClient/utils/request.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/types.d.ts +34 -0
- package/dist/types/CallingClient/utils/types.d.ts.map +1 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts +4 -0
- package/dist/types/CallingClient/utils/wsFeatureFlag.d.ts.map +1 -0
- package/dist/types/Errors/types.d.ts +2 -0
- package/dist/types/Errors/types.d.ts.map +1 -1
- package/dist/types/Events/types.d.ts +80 -16
- package/dist/types/Events/types.d.ts.map +1 -1
- package/dist/types/Metrics/index.d.ts.map +1 -1
- package/dist/types/Metrics/types.d.ts +19 -2
- package/dist/types/Metrics/types.d.ts.map +1 -1
- package/dist/types/SDKConnector/types.d.ts +39 -12
- package/dist/types/SDKConnector/types.d.ts.map +1 -1
- package/dist/types/api.d.ts +6 -4
- package/dist/types/api.d.ts.map +1 -1
- package/dist/types/common/Utils.d.ts +9 -4
- package/dist/types/common/Utils.d.ts.map +1 -1
- package/dist/types/common/testUtil.d.ts +5 -1
- package/dist/types/common/testUtil.d.ts.map +1 -1
- package/dist/types/common/types.d.ts +9 -1
- package/dist/types/common/types.d.ts.map +1 -1
- package/dist/types/index.d.ts +9 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mobius-socket/config.d.ts +17 -0
- package/dist/types/mobius-socket/config.d.ts.map +1 -0
- package/dist/types/mobius-socket/errors.d.ts +32 -0
- package/dist/types/mobius-socket/errors.d.ts.map +1 -0
- package/dist/types/mobius-socket/index.d.ts +14 -0
- package/dist/types/mobius-socket/index.d.ts.map +1 -0
- package/dist/types/mobius-socket/mobius-socket.d.ts +48 -0
- package/dist/types/mobius-socket/mobius-socket.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/constants.d.ts +27 -0
- package/dist/types/mobius-socket/socket/constants.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/index.d.ts +5 -0
- package/dist/types/mobius-socket/socket/index.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket-base.d.ts +43 -0
- package/dist/types/mobius-socket/socket/socket-base.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket.d.ts +6 -0
- package/dist/types/mobius-socket/socket/socket.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/socket.shim.d.ts +6 -0
- package/dist/types/mobius-socket/socket/socket.shim.d.ts.map +1 -0
- package/dist/types/mobius-socket/socket/types.d.ts +61 -0
- package/dist/types/mobius-socket/socket/types.d.ts.map +1 -0
- package/dist/types/mobius-socket/types.d.ts +21 -0
- package/dist/types/mobius-socket/types.d.ts.map +1 -0
- package/package.json +21 -5
- package/src/mobius-socket/socket/socket.shim.ts +22 -0
- package/src/mobius-socket/socket/socket.ts +14 -0
|
@@ -0,0 +1,1625 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/classCallCheck"));
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/createClass"));
|
|
15
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/defineProperty"));
|
|
16
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs2/helpers/asyncToGenerator"));
|
|
17
|
+
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
18
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/values"));
|
|
19
|
+
var _keys = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/object/keys"));
|
|
20
|
+
var _asyncMutex = require("async-mutex");
|
|
21
|
+
var Media = _interopRequireWildcard(require("@webex/internal-media-core"));
|
|
22
|
+
var _types = require("../Logger/types");
|
|
23
|
+
var _testUtil = require("../common/testUtil");
|
|
24
|
+
var _types2 = require("../common/types");
|
|
25
|
+
var _types3 = require("../Events/types");
|
|
26
|
+
var _Logger = _interopRequireDefault(require("../Logger"));
|
|
27
|
+
var _CallingClient = require("./CallingClient");
|
|
28
|
+
var _Utils = _interopRequireWildcard(require("../common/Utils"));
|
|
29
|
+
var utils = _Utils;
|
|
30
|
+
var _callManager = require("./calling/callManager");
|
|
31
|
+
var _constants = require("./constants");
|
|
32
|
+
var _callRecordFixtures = require("./callRecordFixtures");
|
|
33
|
+
var _callingClientFixtures = require("./callingClientFixtures");
|
|
34
|
+
var _line = _interopRequireWildcard(require("./line"));
|
|
35
|
+
var LineModule = _line;
|
|
36
|
+
var _registerFixtures = require("./registration/registerFixtures");
|
|
37
|
+
var _constants2 = require("../common/constants");
|
|
38
|
+
var _types4 = require("../Metrics/types");
|
|
39
|
+
var _windowsChromiumIceWarmupUtils = _interopRequireDefault(require("./windowsChromiumIceWarmupUtils"));
|
|
40
|
+
var _request = require("./utils/request");
|
|
41
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof _WeakMap) var r = new _WeakMap(), n = new _WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t4 in e) "default" !== _t4 && {}.hasOwnProperty.call(e, _t4) && ((i = (o = _Object$defineProperty) && _Object$getOwnPropertyDescriptor(e, _t4)) && (i.get || i.set) ? o(f, _t4, i) : f[_t4] = e[_t4]); return f; })(e, t); }
|
|
42
|
+
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; }
|
|
43
|
+
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 */
|
|
44
|
+
jest.mock('../mobius-socket', function () {
|
|
45
|
+
return {
|
|
46
|
+
getMobiusSocketInstance: jest.fn().mockReturnValue({
|
|
47
|
+
sendWssRequest: jest.fn(),
|
|
48
|
+
connect: jest.fn(),
|
|
49
|
+
isConnected: jest.fn().mockReturnValue(false),
|
|
50
|
+
on: jest.fn(),
|
|
51
|
+
off: jest.fn()
|
|
52
|
+
})
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
global.crypto = {
|
|
56
|
+
randomUUID: function randomUUID() {
|
|
57
|
+
return '12345678-1234-5678-1234-567812345678';
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
jest.spyOn(utils, 'uploadLogs').mockResolvedValue(undefined);
|
|
61
|
+
describe('CallingClient Tests', function () {
|
|
62
|
+
// Common initializers
|
|
63
|
+
|
|
64
|
+
var handleErrorSpy = jest.spyOn(utils, 'handleCallingClientErrors');
|
|
65
|
+
var setLoggerSpy = jest.spyOn(Media, 'setLogger');
|
|
66
|
+
var webex = (0, _testUtil.getTestUtilsWebex)();
|
|
67
|
+
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
68
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockUSServiceHosts);
|
|
69
|
+
var defaultServiceIndicator = _types2.ServiceIndicator.CALLING;
|
|
70
|
+
var callManager = (0, _callManager.getCallManager)(webex, defaultServiceIndicator);
|
|
71
|
+
var infoSpy = jest.spyOn(_Logger.default, 'info');
|
|
72
|
+
var logSpy = jest.spyOn(_Logger.default, 'log');
|
|
73
|
+
var warnSpy = jest.spyOn(_Logger.default, 'warn');
|
|
74
|
+
var originalProcessNextTick = process.nextTick;
|
|
75
|
+
function flushPromises() {
|
|
76
|
+
return new _promise.default(function (resolve) {
|
|
77
|
+
originalProcessNextTick(resolve);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
beforeEach(function () {
|
|
81
|
+
_request.APIRequest.resetInstance();
|
|
82
|
+
_request.APIRequest.getInstance({
|
|
83
|
+
webex: webex
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe('CallingClient pick Mobius cluster using Service Host Tests', function () {
|
|
87
|
+
afterAll(function () {
|
|
88
|
+
callManager.removeAllListeners();
|
|
89
|
+
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius.aintgen-a-1.int.infra.webex.com/api/v1';
|
|
90
|
+
webex.internal.services['_hostCatalog'] = _callingClientFixtures.mockCatalogUS;
|
|
91
|
+
});
|
|
92
|
+
it('should use default mobius service host when Service URL is invalid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
93
|
+
var callingClient;
|
|
94
|
+
return _regenerator.default.wrap(function (_context) {
|
|
95
|
+
while (1) switch (_context.prev = _context.next) {
|
|
96
|
+
case 0:
|
|
97
|
+
webex.internal.services._hostCatalog = _callingClientFixtures.mockCatalogUS;
|
|
98
|
+
webex.internal.services._serviceUrls.mobius = 'invalid-url';
|
|
99
|
+
_context.next = 1;
|
|
100
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
101
|
+
logger: {
|
|
102
|
+
level: _types.LOGGER.INFO
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
case 1:
|
|
106
|
+
callingClient = _context.sent;
|
|
107
|
+
expect(setLoggerSpy).toHaveBeenCalledTimes(1);
|
|
108
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.mockUSServiceHosts);
|
|
109
|
+
case 2:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context.stop();
|
|
112
|
+
}
|
|
113
|
+
}, _callee);
|
|
114
|
+
})));
|
|
115
|
+
it('should set mobiusServiceHost correctly when URL is valid', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
116
|
+
var callingClient;
|
|
117
|
+
return _regenerator.default.wrap(function (_context2) {
|
|
118
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
119
|
+
case 0:
|
|
120
|
+
webex.internal.services._hostCatalog = _callingClientFixtures.mockCatalogEU;
|
|
121
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(_callingClientFixtures.mockEUServiceHosts);
|
|
122
|
+
webex.internal.services['_serviceUrls']['mobius'] = 'https://mobius-eu-central-1.prod.infra.webex.com/api/v1';
|
|
123
|
+
_context2.next = 1;
|
|
124
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
125
|
+
logger: {
|
|
126
|
+
level: _types.LOGGER.INFO
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
case 1:
|
|
130
|
+
callingClient = _context2.sent;
|
|
131
|
+
expect(callingClient['mobiusHost']).toBe('https://mobius-eu-central-1.prod.infra.webex.com/api/v1');
|
|
132
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(_callingClientFixtures.mockEUServiceHosts);
|
|
133
|
+
case 2:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context2.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee2);
|
|
138
|
+
})));
|
|
139
|
+
});
|
|
140
|
+
describe('ServiceData tests', function () {
|
|
141
|
+
var callingClient;
|
|
142
|
+
afterEach(function () {
|
|
143
|
+
callManager.removeAllListeners();
|
|
144
|
+
callingClient = undefined;
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* No input sdk config to callingClient, it should default to service type
|
|
149
|
+
* calling and empty domain value.
|
|
150
|
+
*/
|
|
151
|
+
it('Verify valid calling serviceData with no input sdk config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
152
|
+
return _regenerator.default.wrap(function (_context4) {
|
|
153
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
154
|
+
case 0:
|
|
155
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
156
|
+
return _regenerator.default.wrap(function (_context3) {
|
|
157
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
_context3.next = 1;
|
|
160
|
+
return (0, _CallingClient.createClient)(webex);
|
|
161
|
+
case 1:
|
|
162
|
+
callingClient = _context3.sent;
|
|
163
|
+
expect(callingClient).toBeTruthy();
|
|
164
|
+
case 2:
|
|
165
|
+
case "end":
|
|
166
|
+
return _context3.stop();
|
|
167
|
+
}
|
|
168
|
+
}, _callee3);
|
|
169
|
+
}))).not.toThrow(Error);
|
|
170
|
+
case 1:
|
|
171
|
+
case "end":
|
|
172
|
+
return _context4.stop();
|
|
173
|
+
}
|
|
174
|
+
}, _callee4);
|
|
175
|
+
})));
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Input sdk config to callingClient with serviceData carrying empty string for
|
|
179
|
+
* both indicator and domain in it.
|
|
180
|
+
*
|
|
181
|
+
* It should default to service type calling and empty domain value.
|
|
182
|
+
*
|
|
183
|
+
*/
|
|
184
|
+
it('Verify invalid empty service indicator, empty domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
185
|
+
var serviceDataObj;
|
|
186
|
+
return _regenerator.default.wrap(function (_context6) {
|
|
187
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
188
|
+
case 0:
|
|
189
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
190
|
+
serviceDataObj = {
|
|
191
|
+
indicator: '',
|
|
192
|
+
domain: ''
|
|
193
|
+
};
|
|
194
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
195
|
+
return _regenerator.default.wrap(function (_context5) {
|
|
196
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
197
|
+
case 0:
|
|
198
|
+
_context5.next = 1;
|
|
199
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
200
|
+
serviceData: serviceDataObj
|
|
201
|
+
});
|
|
202
|
+
case 1:
|
|
203
|
+
callingClient = _context5.sent;
|
|
204
|
+
expect(callingClient).toBeTruthy();
|
|
205
|
+
case 2:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context5.stop();
|
|
208
|
+
}
|
|
209
|
+
}, _callee5);
|
|
210
|
+
}))).not.toThrow(Error);
|
|
211
|
+
case 1:
|
|
212
|
+
case "end":
|
|
213
|
+
return _context6.stop();
|
|
214
|
+
}
|
|
215
|
+
}, _callee6);
|
|
216
|
+
})));
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Input sdk config to callingClient with serviceData carrying invalid value for indicator
|
|
220
|
+
* and valid domain type string for domain field in it.
|
|
221
|
+
*
|
|
222
|
+
* It should throw error and abort execution as indicator value is invalid.
|
|
223
|
+
*
|
|
224
|
+
* INDICATOR value MUST MATCH with one of the values in ServiceIndicator enum.
|
|
225
|
+
*/
|
|
226
|
+
it('Verify invalid service indicator, valid domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
227
|
+
var serviceDataObj, _t;
|
|
228
|
+
return _regenerator.default.wrap(function (_context7) {
|
|
229
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
230
|
+
case 0:
|
|
231
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
232
|
+
serviceDataObj = {
|
|
233
|
+
indicator: 'test',
|
|
234
|
+
domain: 'test.example.com'
|
|
235
|
+
};
|
|
236
|
+
_context7.prev = 1;
|
|
237
|
+
_context7.next = 2;
|
|
238
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
239
|
+
serviceData: serviceDataObj
|
|
240
|
+
});
|
|
241
|
+
case 2:
|
|
242
|
+
callingClient = _context7.sent;
|
|
243
|
+
_context7.next = 4;
|
|
244
|
+
break;
|
|
245
|
+
case 3:
|
|
246
|
+
_context7.prev = 3;
|
|
247
|
+
_t = _context7["catch"](1);
|
|
248
|
+
expect(_t.message).toEqual('Invalid service indicator, Allowed values are: calling, contactcenter and guestcalling');
|
|
249
|
+
case 4:
|
|
250
|
+
expect.assertions(1);
|
|
251
|
+
case 5:
|
|
252
|
+
case "end":
|
|
253
|
+
return _context7.stop();
|
|
254
|
+
}
|
|
255
|
+
}, _callee7, null, [[1, 3]]);
|
|
256
|
+
})));
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
260
|
+
* 'calling', but an invalid domain type string for domain field in it.
|
|
261
|
+
*
|
|
262
|
+
* It should throw error and abort execution as domain value is invalid.
|
|
263
|
+
*
|
|
264
|
+
* DOMAIN field for service type calling is allowed to be empty but if it carries a non-empty
|
|
265
|
+
* string then it must be of valid domain type.
|
|
266
|
+
*/
|
|
267
|
+
it('CALLING: verify invalid service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
268
|
+
var serviceDataObj, _t2;
|
|
269
|
+
return _regenerator.default.wrap(function (_context8) {
|
|
270
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
271
|
+
case 0:
|
|
272
|
+
serviceDataObj = {
|
|
273
|
+
indicator: _types2.ServiceIndicator.CALLING,
|
|
274
|
+
domain: 'test'
|
|
275
|
+
};
|
|
276
|
+
_context8.prev = 1;
|
|
277
|
+
_context8.next = 2;
|
|
278
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
279
|
+
serviceData: serviceDataObj
|
|
280
|
+
});
|
|
281
|
+
case 2:
|
|
282
|
+
callingClient = _context8.sent;
|
|
283
|
+
_context8.next = 4;
|
|
284
|
+
break;
|
|
285
|
+
case 3:
|
|
286
|
+
_context8.prev = 3;
|
|
287
|
+
_t2 = _context8["catch"](1);
|
|
288
|
+
expect(_t2.message).toEqual('Invalid service domain.');
|
|
289
|
+
case 4:
|
|
290
|
+
expect.assertions(1);
|
|
291
|
+
case 5:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context8.stop();
|
|
294
|
+
}
|
|
295
|
+
}, _callee8, null, [[1, 3]]);
|
|
296
|
+
})));
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
300
|
+
* 'calling', and an empty string for domain field in it.
|
|
301
|
+
*
|
|
302
|
+
* Execution should proceed properly and createRegistration should be called with same serviceData.
|
|
303
|
+
*
|
|
304
|
+
* DOMAIN field for service type 'calling' is allowed to be empty.
|
|
305
|
+
*/
|
|
306
|
+
it('CALLING: verify valid empty service domain', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee0() {
|
|
307
|
+
var serviceDataObj;
|
|
308
|
+
return _regenerator.default.wrap(function (_context0) {
|
|
309
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
310
|
+
case 0:
|
|
311
|
+
serviceDataObj = {
|
|
312
|
+
indicator: _types2.ServiceIndicator.CALLING,
|
|
313
|
+
domain: ''
|
|
314
|
+
};
|
|
315
|
+
expect(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
316
|
+
return _regenerator.default.wrap(function (_context9) {
|
|
317
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
318
|
+
case 0:
|
|
319
|
+
_context9.next = 1;
|
|
320
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
321
|
+
serviceData: serviceDataObj
|
|
322
|
+
});
|
|
323
|
+
case 1:
|
|
324
|
+
callingClient = _context9.sent;
|
|
325
|
+
expect(callingClient).toBeTruthy();
|
|
326
|
+
case 2:
|
|
327
|
+
case "end":
|
|
328
|
+
return _context9.stop();
|
|
329
|
+
}
|
|
330
|
+
}, _callee9);
|
|
331
|
+
}))).not.toThrow(Error);
|
|
332
|
+
case 1:
|
|
333
|
+
case "end":
|
|
334
|
+
return _context0.stop();
|
|
335
|
+
}
|
|
336
|
+
}, _callee0);
|
|
337
|
+
})));
|
|
338
|
+
it('ContactCenter: uses config domain and does not fetch RTMS domain from catalog', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee1() {
|
|
339
|
+
var serviceDataObj;
|
|
340
|
+
return _regenerator.default.wrap(function (_context1) {
|
|
341
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
342
|
+
case 0:
|
|
343
|
+
serviceDataObj = {
|
|
344
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
345
|
+
domain: 'test.example.com'
|
|
346
|
+
};
|
|
347
|
+
webex.internal.services.get = jest.fn();
|
|
348
|
+
_context1.next = 1;
|
|
349
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
350
|
+
serviceData: serviceDataObj
|
|
351
|
+
});
|
|
352
|
+
case 1:
|
|
353
|
+
callingClient = _context1.sent;
|
|
354
|
+
expect(callingClient).toBeTruthy();
|
|
355
|
+
expect(webex.internal.services.get).not.toHaveBeenCalled();
|
|
356
|
+
case 2:
|
|
357
|
+
case "end":
|
|
358
|
+
return _context1.stop();
|
|
359
|
+
}
|
|
360
|
+
}, _callee1);
|
|
361
|
+
})));
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Input sdk config to callingClient with serviceData carrying valid value for indicator
|
|
365
|
+
* 'contactcenter' , and a valid domain type string for domain field in it.
|
|
366
|
+
*/
|
|
367
|
+
it('ContactCenter: fetches RTMS domain from catalog when config domain is empty', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
368
|
+
var serviceDataObj;
|
|
369
|
+
return _regenerator.default.wrap(function (_context10) {
|
|
370
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
371
|
+
case 0:
|
|
372
|
+
serviceDataObj = {
|
|
373
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
374
|
+
domain: ''
|
|
375
|
+
};
|
|
376
|
+
webex.internal.services.get = jest.fn().mockReturnValue('https://cc-rtms.example.com/calling/web/rtms');
|
|
377
|
+
_context10.next = 1;
|
|
378
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
379
|
+
serviceData: serviceDataObj
|
|
380
|
+
});
|
|
381
|
+
case 1:
|
|
382
|
+
callingClient = _context10.sent;
|
|
383
|
+
expect(callingClient).toBeTruthy();
|
|
384
|
+
expect(webex.internal.services.get).toHaveBeenCalledWith('wcc-calling-rtms-domain');
|
|
385
|
+
case 2:
|
|
386
|
+
case "end":
|
|
387
|
+
return _context10.stop();
|
|
388
|
+
}
|
|
389
|
+
}, _callee10);
|
|
390
|
+
})));
|
|
391
|
+
it('ContactCenter: init fails when config domain is empty and catalog fetch fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
392
|
+
var serviceDataObj, createLineSpy;
|
|
393
|
+
return _regenerator.default.wrap(function (_context11) {
|
|
394
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
395
|
+
case 0:
|
|
396
|
+
serviceDataObj = {
|
|
397
|
+
indicator: _types2.ServiceIndicator.CONTACT_CENTER,
|
|
398
|
+
domain: ''
|
|
399
|
+
};
|
|
400
|
+
createLineSpy = jest.spyOn(_CallingClient.CallingClient.prototype, 'createLine');
|
|
401
|
+
webex.internal.services.get = jest.fn(function () {
|
|
402
|
+
throw new Error('catalog unavailable');
|
|
403
|
+
});
|
|
404
|
+
_context11.next = 1;
|
|
405
|
+
return expect((0, _CallingClient.createClient)(webex, {
|
|
406
|
+
serviceData: serviceDataObj
|
|
407
|
+
})).rejects.toThrow('Invalid service domain.');
|
|
408
|
+
case 1:
|
|
409
|
+
expect(createLineSpy).not.toHaveBeenCalled();
|
|
410
|
+
createLineSpy.mockRestore();
|
|
411
|
+
case 2:
|
|
412
|
+
case "end":
|
|
413
|
+
return _context11.stop();
|
|
414
|
+
}
|
|
415
|
+
}, _callee11);
|
|
416
|
+
})));
|
|
417
|
+
it('Get current log level', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
418
|
+
return _regenerator.default.wrap(function (_context12) {
|
|
419
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
420
|
+
case 0:
|
|
421
|
+
_context12.next = 1;
|
|
422
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
423
|
+
logger: {
|
|
424
|
+
level: _types.LOGGER.INFO
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
case 1:
|
|
428
|
+
callingClient = _context12.sent;
|
|
429
|
+
expect(callingClient).toBeTruthy();
|
|
430
|
+
expect(callingClient.getLoggingLevel).toBeTruthy();
|
|
431
|
+
expect(callingClient.getLoggingLevel()).toEqual(_types.LOGGER.INFO);
|
|
432
|
+
case 2:
|
|
433
|
+
case "end":
|
|
434
|
+
return _context12.stop();
|
|
435
|
+
}
|
|
436
|
+
}, _callee12);
|
|
437
|
+
})));
|
|
438
|
+
});
|
|
439
|
+
describe('Mobius Server discovery tests', function () {
|
|
440
|
+
var callingClient;
|
|
441
|
+
afterEach(function () {
|
|
442
|
+
jest.clearAllTimers();
|
|
443
|
+
jest.clearAllMocks();
|
|
444
|
+
callingClient.removeAllListeners();
|
|
445
|
+
callManager.removeAllListeners();
|
|
446
|
+
callingClient = undefined;
|
|
447
|
+
jest.useRealTimers();
|
|
448
|
+
});
|
|
449
|
+
it('verify successful mobius server url discovery', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
450
|
+
return _regenerator.default.wrap(function (_context13) {
|
|
451
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
452
|
+
case 0:
|
|
453
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
454
|
+
_context13.next = 1;
|
|
455
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
456
|
+
logger: {
|
|
457
|
+
level: _types.LOGGER.INFO
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
case 1:
|
|
461
|
+
callingClient = _context13.sent;
|
|
462
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
463
|
+
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
464
|
+
expect(handleErrorSpy).not.toBeCalled();
|
|
465
|
+
expect(webex.request).nthCalledWith(1, {
|
|
466
|
+
method: 'GET',
|
|
467
|
+
uri: "".concat(_constants.DISCOVERY_URL),
|
|
468
|
+
addAuthHeader: false,
|
|
469
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
470
|
+
});
|
|
471
|
+
expect(webex.request).nthCalledWith(2, _objectSpread(_objectSpread({
|
|
472
|
+
method: 'GET'
|
|
473
|
+
}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
474
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode)
|
|
475
|
+
}));
|
|
476
|
+
case 2:
|
|
477
|
+
case "end":
|
|
478
|
+
return _context13.stop();
|
|
479
|
+
}
|
|
480
|
+
}, _callee13);
|
|
481
|
+
})));
|
|
482
|
+
it('when region discovery succeeds but region based mobius url discovery fails with final error', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee14() {
|
|
483
|
+
var failurePayload;
|
|
484
|
+
return _regenerator.default.wrap(function (_context14) {
|
|
485
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
486
|
+
case 0:
|
|
487
|
+
failurePayload = {
|
|
488
|
+
statusCode: 401
|
|
489
|
+
};
|
|
490
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockRejectedValueOnce(failurePayload);
|
|
491
|
+
_context14.next = 1;
|
|
492
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
493
|
+
logger: {
|
|
494
|
+
level: _types.LOGGER.INFO
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
case 1:
|
|
498
|
+
callingClient = _context14.sent;
|
|
499
|
+
expect(handleErrorSpy).toBeCalledWith(failurePayload, expect.anything(), {
|
|
500
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
501
|
+
method: 'getMobiusServers'
|
|
502
|
+
});
|
|
503
|
+
expect(webex.request).toBeCalledTimes(2);
|
|
504
|
+
expect(callingClient.primaryMobiusUris).toEqual(["".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT)]);
|
|
505
|
+
expect(webex.request).nthCalledWith(1, {
|
|
506
|
+
method: 'GET',
|
|
507
|
+
uri: "".concat(_constants.DISCOVERY_URL),
|
|
508
|
+
addAuthHeader: false,
|
|
509
|
+
headers: (0, _defineProperty2.default)({}, _constants.SPARK_USER_AGENT, null)
|
|
510
|
+
});
|
|
511
|
+
expect(warnSpy).toBeCalledWith("Couldn't resolve the region and country code. Defaulting to the catalog entries to discover mobius servers", expect.objectContaining({
|
|
512
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
513
|
+
method: 'getMobiusServers'
|
|
514
|
+
}));
|
|
515
|
+
case 2:
|
|
516
|
+
case "end":
|
|
517
|
+
return _context14.stop();
|
|
518
|
+
}
|
|
519
|
+
}, _callee14);
|
|
520
|
+
})));
|
|
521
|
+
it('Verify successful mobius server url discovery after initializing callingClient through a config', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
522
|
+
return _regenerator.default.wrap(function (_context15) {
|
|
523
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
524
|
+
case 0:
|
|
525
|
+
infoSpy.mockReset();
|
|
526
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.discoveryPayload);
|
|
527
|
+
_context15.next = 1;
|
|
528
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
529
|
+
discovery: {
|
|
530
|
+
region: 'AP-SOUTHEAST',
|
|
531
|
+
country: 'IN'
|
|
532
|
+
},
|
|
533
|
+
logger: {
|
|
534
|
+
level: _types.LOGGER.INFO
|
|
535
|
+
}
|
|
536
|
+
});
|
|
537
|
+
case 1:
|
|
538
|
+
callingClient = _context15.sent;
|
|
539
|
+
expect(callingClient.primaryMobiusUris).toEqual([_callingClientFixtures.primaryUrl]);
|
|
540
|
+
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
541
|
+
file: 'CallingClient',
|
|
542
|
+
method: 'getMobiusServers'
|
|
543
|
+
});
|
|
544
|
+
expect(webex.request).toBeCalledOnceWith(_objectSpread(_objectSpread({}, (0, _testUtil.getMockRequestTemplate)()), {}, {
|
|
545
|
+
uri: "".concat(callingClient['mobiusHost']).concat(_constants.URL_ENDPOINT, "?regionCode=").concat(_callingClientFixtures.regionBody.clientRegion, "&countryCode=").concat(_callingClientFixtures.regionBody.countryCode),
|
|
546
|
+
method: 'GET'
|
|
547
|
+
}));
|
|
548
|
+
expect(handleErrorSpy).not.toHaveBeenCalled();
|
|
549
|
+
case 2:
|
|
550
|
+
case "end":
|
|
551
|
+
return _context15.stop();
|
|
552
|
+
}
|
|
553
|
+
}, _callee15);
|
|
554
|
+
})));
|
|
555
|
+
});
|
|
556
|
+
describe('Testing each cluster present withing host catalog', function () {
|
|
557
|
+
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'];
|
|
558
|
+
var checkCluster = /*#__PURE__*/function () {
|
|
559
|
+
var _ref16 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee16(mockServiceHosts, mockCatalog) {
|
|
560
|
+
var callingClient;
|
|
561
|
+
return _regenerator.default.wrap(function (_context16) {
|
|
562
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
563
|
+
case 0:
|
|
564
|
+
webex.internal.services._hostCatalog = mockCatalog;
|
|
565
|
+
webex.internal.services.getMobiusClusters = jest.fn().mockReturnValue(mockServiceHosts);
|
|
566
|
+
_context16.next = 1;
|
|
567
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
568
|
+
logger: {
|
|
569
|
+
level: _types.LOGGER.INFO
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
case 1:
|
|
573
|
+
callingClient = _context16.sent;
|
|
574
|
+
expect(callingClient['mobiusClusters']).toStrictEqual(mockServiceHosts);
|
|
575
|
+
case 2:
|
|
576
|
+
case "end":
|
|
577
|
+
return _context16.stop();
|
|
578
|
+
}
|
|
579
|
+
}, _callee16);
|
|
580
|
+
}));
|
|
581
|
+
return function checkCluster(_x, _x2) {
|
|
582
|
+
return _ref16.apply(this, arguments);
|
|
583
|
+
};
|
|
584
|
+
}();
|
|
585
|
+
it.each(mobiusCluster)('%s', /*#__PURE__*/function () {
|
|
586
|
+
var _ref17 = (0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee17(clusterName) {
|
|
587
|
+
var _t3;
|
|
588
|
+
return _regenerator.default.wrap(function (_context17) {
|
|
589
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
590
|
+
case 0:
|
|
591
|
+
_t3 = clusterName;
|
|
592
|
+
_context17.next = _t3 === 'mobius-eu-central-1.prod.infra.webex.com' ? 1 : _t3 === 'mobius-us-east-1.int.infra.webex.com' ? 2 : _t3 === 'mobius-eu-central-1.int.infra.webex.com' ? 3 : 4;
|
|
593
|
+
break;
|
|
594
|
+
case 1:
|
|
595
|
+
checkCluster(_callingClientFixtures.mockEUServiceHosts, _callingClientFixtures.mockCatalogEU);
|
|
596
|
+
return _context17.abrupt("continue", 5);
|
|
597
|
+
case 2:
|
|
598
|
+
checkCluster(_callingClientFixtures.mockIntServiceHosts, _callingClientFixtures.mockCatalogUSInt);
|
|
599
|
+
return _context17.abrupt("continue", 5);
|
|
600
|
+
case 3:
|
|
601
|
+
checkCluster(_callingClientFixtures.mockEUIntServiceHosts, _callingClientFixtures.mockCatalogEUInt);
|
|
602
|
+
return _context17.abrupt("continue", 5);
|
|
603
|
+
case 4:
|
|
604
|
+
return _context17.abrupt("continue", 5);
|
|
605
|
+
case 5:
|
|
606
|
+
case "end":
|
|
607
|
+
return _context17.stop();
|
|
608
|
+
}
|
|
609
|
+
}, _callee17);
|
|
610
|
+
}));
|
|
611
|
+
return function (_x3) {
|
|
612
|
+
return _ref17.apply(this, arguments);
|
|
613
|
+
};
|
|
614
|
+
}());
|
|
615
|
+
});
|
|
616
|
+
describe('Line creation tests', function () {
|
|
617
|
+
var callingClient;
|
|
618
|
+
var line;
|
|
619
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee18() {
|
|
620
|
+
return _regenerator.default.wrap(function (_context18) {
|
|
621
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
622
|
+
case 0:
|
|
623
|
+
_context18.next = 1;
|
|
624
|
+
return (0, _CallingClient.createClient)(webex);
|
|
625
|
+
case 1:
|
|
626
|
+
callingClient = _context18.sent;
|
|
627
|
+
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
628
|
+
case 2:
|
|
629
|
+
case "end":
|
|
630
|
+
return _context18.stop();
|
|
631
|
+
}
|
|
632
|
+
}, _callee18);
|
|
633
|
+
})));
|
|
634
|
+
afterEach(function () {
|
|
635
|
+
jest.clearAllTimers();
|
|
636
|
+
jest.clearAllMocks();
|
|
637
|
+
callingClient.removeAllListeners();
|
|
638
|
+
callManager.removeAllListeners();
|
|
639
|
+
callingClient = undefined;
|
|
640
|
+
jest.useRealTimers();
|
|
641
|
+
});
|
|
642
|
+
it('verify line dict successfully created', function () {
|
|
643
|
+
expect(callingClient.lineDict).toBeTruthy();
|
|
644
|
+
expect(line).toBeTruthy();
|
|
645
|
+
expect((0, _keys.default)(callingClient.lineDict).length).toEqual(1);
|
|
646
|
+
});
|
|
647
|
+
it('verify getLines response', function () {
|
|
648
|
+
expect(callingClient.getLines).toBeTruthy();
|
|
649
|
+
expect(callingClient.getLines()).toEqual(callingClient.lineDict);
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
describe('createLine transport URI selection', function () {
|
|
653
|
+
var callingClient;
|
|
654
|
+
var lineCtorSpy;
|
|
655
|
+
var primaryHttp = ['https://primary.example.com/api/v1/calling/web/'];
|
|
656
|
+
var backupHttp = ['https://backup.example.com/api/v1/calling/web/'];
|
|
657
|
+
var primaryWss = ['wss://primary.example.com/api/v1/calling/web/'];
|
|
658
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
659
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
660
|
+
return _regenerator.default.wrap(function (_context19) {
|
|
661
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
662
|
+
case 0:
|
|
663
|
+
_context19.next = 1;
|
|
664
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
665
|
+
logger: {
|
|
666
|
+
level: _types.LOGGER.INFO
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
case 1:
|
|
670
|
+
callingClient = _context19.sent;
|
|
671
|
+
callingClient.primaryMobiusUris = primaryHttp;
|
|
672
|
+
callingClient.backupMobiusUris = backupHttp;
|
|
673
|
+
lineCtorSpy = jest.spyOn(LineModule, 'default').mockImplementation(function () {
|
|
674
|
+
return {
|
|
675
|
+
lineId: 'mock-line-id'
|
|
676
|
+
};
|
|
677
|
+
});
|
|
678
|
+
case 2:
|
|
679
|
+
case "end":
|
|
680
|
+
return _context19.stop();
|
|
681
|
+
}
|
|
682
|
+
}, _callee19);
|
|
683
|
+
})));
|
|
684
|
+
afterEach(function () {
|
|
685
|
+
lineCtorSpy.mockRestore();
|
|
686
|
+
jest.clearAllMocks();
|
|
687
|
+
callingClient.removeAllListeners();
|
|
688
|
+
callManager.removeAllListeners();
|
|
689
|
+
callingClient = undefined;
|
|
690
|
+
});
|
|
691
|
+
var getLineUris = function getLineUris() {
|
|
692
|
+
var ctorArgs = lineCtorSpy.mock.calls[0];
|
|
693
|
+
return {
|
|
694
|
+
primary: ctorArgs[3],
|
|
695
|
+
backup: ctorArgs[4]
|
|
696
|
+
};
|
|
697
|
+
};
|
|
698
|
+
it('uses normalized WSS URIs for both groups when socket is enabled and WSS URIs are present', function () {
|
|
699
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
700
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
701
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
702
|
+
callingClient['createLine']();
|
|
703
|
+
var _getLineUris = getLineUris(),
|
|
704
|
+
primary = _getLineUris.primary,
|
|
705
|
+
backup = _getLineUris.backup;
|
|
706
|
+
expect(primary).toEqual((0, _Utils.normalizeMobiusUris)(primaryWss));
|
|
707
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
708
|
+
});
|
|
709
|
+
it('falls back to HTTP URIs for a group with no WSS URL even when the socket is enabled', function () {
|
|
710
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
711
|
+
// Primary has no WSS URL (HTTP fallback expected) while backup does.
|
|
712
|
+
callingClient.primaryWssMobiusUris = [];
|
|
713
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
714
|
+
callingClient['createLine']();
|
|
715
|
+
var _getLineUris2 = getLineUris(),
|
|
716
|
+
primary = _getLineUris2.primary,
|
|
717
|
+
backup = _getLineUris2.backup;
|
|
718
|
+
expect(primary).toEqual(primaryHttp);
|
|
719
|
+
expect(backup).toEqual((0, _Utils.normalizeMobiusUris)(backupWss));
|
|
720
|
+
});
|
|
721
|
+
it('uses HTTP URIs for both groups when the socket is enabled but no WSS URLs are present', function () {
|
|
722
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(true);
|
|
723
|
+
callingClient.primaryWssMobiusUris = [];
|
|
724
|
+
callingClient.backupWssMobiusUris = [];
|
|
725
|
+
callingClient['createLine']();
|
|
726
|
+
var _getLineUris3 = getLineUris(),
|
|
727
|
+
primary = _getLineUris3.primary,
|
|
728
|
+
backup = _getLineUris3.backup;
|
|
729
|
+
expect(primary).toEqual(primaryHttp);
|
|
730
|
+
expect(backup).toEqual(backupHttp);
|
|
731
|
+
});
|
|
732
|
+
it('uses HTTP URIs for both groups when the socket is disabled', function () {
|
|
733
|
+
jest.spyOn(callingClient['apiRequest'], 'isSocketEnabled').mockReturnValue(false);
|
|
734
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
735
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
736
|
+
callingClient['createLine']();
|
|
737
|
+
var _getLineUris4 = getLineUris(),
|
|
738
|
+
primary = _getLineUris4.primary,
|
|
739
|
+
backup = _getLineUris4.backup;
|
|
740
|
+
expect(primary).toEqual(primaryHttp);
|
|
741
|
+
expect(backup).toEqual(backupHttp);
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
describe('connectToMobiusSocket', function () {
|
|
745
|
+
var callingClient;
|
|
746
|
+
var connectSpy;
|
|
747
|
+
var primaryWss = ['wss://primary-1.example.com/api/v1/calling/web/', 'wss://primary-2.example.com/api/v1/calling/web/'];
|
|
748
|
+
var backupWss = ['wss://backup.example.com/api/v1/calling/web/'];
|
|
749
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee20() {
|
|
750
|
+
return _regenerator.default.wrap(function (_context20) {
|
|
751
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
752
|
+
case 0:
|
|
753
|
+
_context20.next = 1;
|
|
754
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
755
|
+
logger: {
|
|
756
|
+
level: _types.LOGGER.INFO
|
|
757
|
+
}
|
|
758
|
+
});
|
|
759
|
+
case 1:
|
|
760
|
+
callingClient = _context20.sent;
|
|
761
|
+
connectSpy = jest.spyOn(callingClient['apiRequest'], 'connectToMobiusSocket');
|
|
762
|
+
warnSpy.mockClear();
|
|
763
|
+
case 2:
|
|
764
|
+
case "end":
|
|
765
|
+
return _context20.stop();
|
|
766
|
+
}
|
|
767
|
+
}, _callee20);
|
|
768
|
+
})));
|
|
769
|
+
afterEach(function () {
|
|
770
|
+
jest.clearAllMocks();
|
|
771
|
+
callingClient.removeAllListeners();
|
|
772
|
+
callManager.removeAllListeners();
|
|
773
|
+
callingClient = undefined;
|
|
774
|
+
});
|
|
775
|
+
it('skips the socket connection and warns when no primary WSS URIs are available', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
776
|
+
return _regenerator.default.wrap(function (_context21) {
|
|
777
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
778
|
+
case 0:
|
|
779
|
+
callingClient.primaryWssMobiusUris = [];
|
|
780
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
781
|
+
_context21.next = 1;
|
|
782
|
+
return callingClient['connectToMobiusSocket']();
|
|
783
|
+
case 1:
|
|
784
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
785
|
+
expect(warnSpy).toHaveBeenCalledWith('No WSS URIs available from Mobius discovery for primary, skipping socket connection', {
|
|
786
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
787
|
+
method: 'connectToMobiusSocket'
|
|
788
|
+
});
|
|
789
|
+
case 2:
|
|
790
|
+
case "end":
|
|
791
|
+
return _context21.stop();
|
|
792
|
+
}
|
|
793
|
+
}, _callee21);
|
|
794
|
+
})));
|
|
795
|
+
it('connects using the first reachable primary WSS URI and stops on success', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee22() {
|
|
796
|
+
return _regenerator.default.wrap(function (_context22) {
|
|
797
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
798
|
+
case 0:
|
|
799
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
800
|
+
connectSpy.mockResolvedValue(undefined);
|
|
801
|
+
_context22.next = 1;
|
|
802
|
+
return callingClient['connectToMobiusSocket']();
|
|
803
|
+
case 1:
|
|
804
|
+
expect(connectSpy).toHaveBeenCalledTimes(1);
|
|
805
|
+
expect(connectSpy).toHaveBeenCalledWith(primaryWss[0]);
|
|
806
|
+
case 2:
|
|
807
|
+
case "end":
|
|
808
|
+
return _context22.stop();
|
|
809
|
+
}
|
|
810
|
+
}, _callee22);
|
|
811
|
+
})));
|
|
812
|
+
it('tries each primary WSS URI and warns when all attempts fail', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee23() {
|
|
813
|
+
return _regenerator.default.wrap(function (_context23) {
|
|
814
|
+
while (1) switch (_context23.prev = _context23.next) {
|
|
815
|
+
case 0:
|
|
816
|
+
callingClient.primaryWssMobiusUris = primaryWss;
|
|
817
|
+
connectSpy.mockRejectedValue(new Error('connect failed'));
|
|
818
|
+
_context23.next = 1;
|
|
819
|
+
return callingClient['connectToMobiusSocket']();
|
|
820
|
+
case 1:
|
|
821
|
+
expect(connectSpy).toHaveBeenCalledTimes(primaryWss.length);
|
|
822
|
+
expect(connectSpy).toHaveBeenNthCalledWith(1, primaryWss[0]);
|
|
823
|
+
expect(connectSpy).toHaveBeenNthCalledWith(2, primaryWss[1]);
|
|
824
|
+
expect(warnSpy).toHaveBeenCalledWith('All primary WSS URI connection attempts failed', {
|
|
825
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
826
|
+
method: 'connectToMobiusSocket'
|
|
827
|
+
});
|
|
828
|
+
case 2:
|
|
829
|
+
case "end":
|
|
830
|
+
return _context23.stop();
|
|
831
|
+
}
|
|
832
|
+
}, _callee23);
|
|
833
|
+
})));
|
|
834
|
+
it('does not attempt backup WSS URIs when primary WSS URIs are absent', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee24() {
|
|
835
|
+
return _regenerator.default.wrap(function (_context24) {
|
|
836
|
+
while (1) switch (_context24.prev = _context24.next) {
|
|
837
|
+
case 0:
|
|
838
|
+
callingClient.primaryWssMobiusUris = [];
|
|
839
|
+
callingClient.backupWssMobiusUris = backupWss;
|
|
840
|
+
_context24.next = 1;
|
|
841
|
+
return callingClient['connectToMobiusSocket']();
|
|
842
|
+
case 1:
|
|
843
|
+
expect(connectSpy).not.toHaveBeenCalled();
|
|
844
|
+
case 2:
|
|
845
|
+
case "end":
|
|
846
|
+
return _context24.stop();
|
|
847
|
+
}
|
|
848
|
+
}, _callee24);
|
|
849
|
+
})));
|
|
850
|
+
});
|
|
851
|
+
describe('Connectivity and Mercury event handlers', function () {
|
|
852
|
+
var callingClient;
|
|
853
|
+
var line;
|
|
854
|
+
var reg;
|
|
855
|
+
var windowEventSpy;
|
|
856
|
+
var deRegSpy;
|
|
857
|
+
var restoreSpy;
|
|
858
|
+
var restartRegisterSpy;
|
|
859
|
+
var registerSpy;
|
|
860
|
+
var metricSpy;
|
|
861
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee25() {
|
|
862
|
+
return _regenerator.default.wrap(function (_context25) {
|
|
863
|
+
while (1) switch (_context25.prev = _context25.next) {
|
|
864
|
+
case 0:
|
|
865
|
+
jest.useFakeTimers();
|
|
866
|
+
webex.request.mockResolvedValueOnce(_callingClientFixtures.regionPayload).mockResolvedValueOnce(_callingClientFixtures.discoveryPayload).mockResolvedValueOnce(_callingClientFixtures.registrationPayload);
|
|
867
|
+
windowEventSpy = jest.spyOn(window, 'addEventListener');
|
|
868
|
+
_context25.next = 1;
|
|
869
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
870
|
+
logger: {
|
|
871
|
+
level: _types.LOGGER.INFO
|
|
872
|
+
}
|
|
873
|
+
});
|
|
874
|
+
case 1:
|
|
875
|
+
callingClient = _context25.sent;
|
|
876
|
+
line = (0, _values.default)(callingClient.lineDict)[0];
|
|
877
|
+
reg = line.registration;
|
|
878
|
+
_context25.next = 2;
|
|
879
|
+
return line.register();
|
|
880
|
+
case 2:
|
|
881
|
+
deRegSpy = jest.spyOn(reg, 'deregister');
|
|
882
|
+
restoreSpy = jest.spyOn(reg, 'restorePreviousRegistration');
|
|
883
|
+
restartRegisterSpy = jest.spyOn(reg, 'restartRegistration');
|
|
884
|
+
registerSpy = jest.spyOn(reg, 'attemptRegistrationWithServers');
|
|
885
|
+
metricSpy = jest.spyOn(callingClient['metricManager'], 'submitConnectionMetrics');
|
|
886
|
+
case 3:
|
|
887
|
+
case "end":
|
|
888
|
+
return _context25.stop();
|
|
889
|
+
}
|
|
890
|
+
}, _callee25);
|
|
891
|
+
})));
|
|
892
|
+
afterEach(function () {
|
|
893
|
+
jest.clearAllTimers();
|
|
894
|
+
jest.clearAllMocks();
|
|
895
|
+
callingClient.removeAllListeners();
|
|
896
|
+
callingClient['callManager'].callCollection = {};
|
|
897
|
+
callManager.removeAllListeners();
|
|
898
|
+
callingClient = undefined;
|
|
899
|
+
jest.useRealTimers();
|
|
900
|
+
});
|
|
901
|
+
it('window offline handler sets networkDown and clears keepalive when network is unreachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee26() {
|
|
902
|
+
var g, clearKeepaliveSpy, offlineCb;
|
|
903
|
+
return _regenerator.default.wrap(function (_context26) {
|
|
904
|
+
while (1) switch (_context26.prev = _context26.next) {
|
|
905
|
+
case 0:
|
|
906
|
+
g = global;
|
|
907
|
+
g.fetch = jest.fn().mockRejectedValueOnce(new Error('network fail'));
|
|
908
|
+
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
909
|
+
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
910
|
+
_context26.next = 1;
|
|
911
|
+
return offlineCb();
|
|
912
|
+
case 1:
|
|
913
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Network connectivity probe failed'), {
|
|
914
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
915
|
+
method: 'pingExternal'
|
|
916
|
+
});
|
|
917
|
+
expect(callingClient['isNetworkDown']).toBe(true);
|
|
918
|
+
expect(clearKeepaliveSpy).toHaveBeenCalled();
|
|
919
|
+
case 2:
|
|
920
|
+
case "end":
|
|
921
|
+
return _context26.stop();
|
|
922
|
+
}
|
|
923
|
+
}, _callee26);
|
|
924
|
+
})));
|
|
925
|
+
it('window offline handler does not clear keepalive when network is reachable', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee27() {
|
|
926
|
+
var g, clearKeepaliveSpy, offlineCb;
|
|
927
|
+
return _regenerator.default.wrap(function (_context27) {
|
|
928
|
+
while (1) switch (_context27.prev = _context27.next) {
|
|
929
|
+
case 0:
|
|
930
|
+
g = global;
|
|
931
|
+
g.fetch = jest.fn().mockResolvedValueOnce({});
|
|
932
|
+
clearKeepaliveSpy = jest.spyOn(reg, 'clearKeepaliveTimer');
|
|
933
|
+
offlineCb = windowEventSpy.mock.calls[1][1];
|
|
934
|
+
_context27.next = 1;
|
|
935
|
+
return offlineCb();
|
|
936
|
+
case 1:
|
|
937
|
+
expect(g.fetch).toHaveBeenCalledWith('https://www.google.com/generate_204', expect.any(Object));
|
|
938
|
+
expect(callingClient['isNetworkDown']).toBe(false);
|
|
939
|
+
expect(clearKeepaliveSpy).not.toHaveBeenCalled();
|
|
940
|
+
case 2:
|
|
941
|
+
case "end":
|
|
942
|
+
return _context27.stop();
|
|
943
|
+
}
|
|
944
|
+
}, _callee27);
|
|
945
|
+
})));
|
|
946
|
+
it('window online handler sets networkUpTimestamp and logs', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee28() {
|
|
947
|
+
var onlineCb;
|
|
948
|
+
return _regenerator.default.wrap(function (_context28) {
|
|
949
|
+
while (1) switch (_context28.prev = _context28.next) {
|
|
950
|
+
case 0:
|
|
951
|
+
onlineCb = windowEventSpy.mock.calls[0][1];
|
|
952
|
+
_context28.next = 1;
|
|
953
|
+
return onlineCb();
|
|
954
|
+
case 1:
|
|
955
|
+
expect(callingClient['networkUpTimestamp']).toEqual(expect.any(String));
|
|
956
|
+
expect(infoSpy).toHaveBeenCalledWith(_constants2.METHOD_START_MESSAGE, {
|
|
957
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
958
|
+
method: 'handleNetworkOnline'
|
|
959
|
+
});
|
|
960
|
+
case 2:
|
|
961
|
+
case "end":
|
|
962
|
+
return _context28.stop();
|
|
963
|
+
}
|
|
964
|
+
}, _callee28);
|
|
965
|
+
})));
|
|
966
|
+
it('mercury offline submits metrics and sets timestamp', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee29() {
|
|
967
|
+
var mercuryOfflineCb;
|
|
968
|
+
return _regenerator.default.wrap(function (_context29) {
|
|
969
|
+
while (1) switch (_context29.prev = _context29.next) {
|
|
970
|
+
case 0:
|
|
971
|
+
mercuryOfflineCb = webex.internal.mercury.on.mock.calls[1][1];
|
|
972
|
+
_context29.next = 1;
|
|
973
|
+
return mercuryOfflineCb();
|
|
974
|
+
case 1:
|
|
975
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Mercury down, waiting for connection to be up'), {
|
|
976
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
977
|
+
method: 'handleMercuryOffline'
|
|
978
|
+
});
|
|
979
|
+
expect(callingClient['mercuryDownTimestamp']).toEqual(expect.any(String));
|
|
980
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_DOWN, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), '');
|
|
981
|
+
case 2:
|
|
982
|
+
case "end":
|
|
983
|
+
return _context29.stop();
|
|
984
|
+
}
|
|
985
|
+
}, _callee29);
|
|
986
|
+
})));
|
|
987
|
+
it('handles reconnection with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee30() {
|
|
988
|
+
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
989
|
+
return _regenerator.default.wrap(function (_context30) {
|
|
990
|
+
while (1) switch (_context30.prev = _context30.next) {
|
|
991
|
+
case 0:
|
|
992
|
+
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
993
|
+
callingClient['isNetworkDown'] = true;
|
|
994
|
+
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
995
|
+
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
996
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
997
|
+
_context30.next = 1;
|
|
998
|
+
return mercuryOnlineCb();
|
|
999
|
+
case 1:
|
|
1000
|
+
// Run the interval once
|
|
1001
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
1002
|
+
_context30.next = 2;
|
|
1003
|
+
return flushPromises();
|
|
1004
|
+
case 2:
|
|
1005
|
+
expect(handleConnectionRestoreSpy).toHaveBeenCalledWith(true);
|
|
1006
|
+
expect(logSpy).toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
1007
|
+
file: _constants.REGISTRATION_FILE,
|
|
1008
|
+
method: 'handleConnectionRestoration'
|
|
1009
|
+
});
|
|
1010
|
+
expect(deRegSpy).toHaveBeenCalledWith();
|
|
1011
|
+
expect(restoreSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
1012
|
+
expect(restartRegisterSpy).toHaveBeenCalledWith('handleConnectionRestoration');
|
|
1013
|
+
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
1014
|
+
expect(registerSpy).toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
1015
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
1016
|
+
case 3:
|
|
1017
|
+
case "end":
|
|
1018
|
+
return _context30.stop();
|
|
1019
|
+
}
|
|
1020
|
+
}, _callee30);
|
|
1021
|
+
})));
|
|
1022
|
+
it('no reconnection for idle registration with no active calls after network flap, once mercury comes back up', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee31() {
|
|
1023
|
+
var handleConnectionRestoreSpy, mercuryOnlineCb;
|
|
1024
|
+
return _regenerator.default.wrap(function (_context31) {
|
|
1025
|
+
while (1) switch (_context31.prev = _context31.next) {
|
|
1026
|
+
case 0:
|
|
1027
|
+
handleConnectionRestoreSpy = jest.spyOn(reg, 'handleConnectionRestoration');
|
|
1028
|
+
callingClient['isNetworkDown'] = true;
|
|
1029
|
+
callingClient['networkDownTimestamp'] = '2023-01-01T00:00:00.000Z';
|
|
1030
|
+
callingClient['networkUpTimestamp'] = '2023-01-01T00:01:00.000Z';
|
|
1031
|
+
reg.setStatus(_types2.RegistrationStatus.IDLE);
|
|
1032
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
1033
|
+
_context31.next = 1;
|
|
1034
|
+
return mercuryOnlineCb();
|
|
1035
|
+
case 1:
|
|
1036
|
+
// Run the interval once
|
|
1037
|
+
jest.advanceTimersByTime(_constants.NETWORK_FLAP_TIMEOUT + 100);
|
|
1038
|
+
_context31.next = 2;
|
|
1039
|
+
return flushPromises();
|
|
1040
|
+
case 2:
|
|
1041
|
+
expect(handleConnectionRestoreSpy).not.toHaveBeenCalledWith(true);
|
|
1042
|
+
expect(logSpy).not.toHaveBeenCalledWith('Network is up again, re-registering with Webex Calling if needed', {
|
|
1043
|
+
file: _constants.REGISTRATION_FILE,
|
|
1044
|
+
method: 'handleConnectionRestoration'
|
|
1045
|
+
});
|
|
1046
|
+
expect(deRegSpy).not.toHaveBeenCalledWith();
|
|
1047
|
+
expect(restoreSpy).not.toHaveBeenCalledWith('handleConnectionRestoration');
|
|
1048
|
+
expect(restartRegisterSpy).not.toHaveBeenCalledWith('handleConnectionRestoration');
|
|
1049
|
+
expect(registerSpy).not.toHaveBeenCalledWith('handleConnectionRestoration', [reg.getActiveMobiusUrl()]);
|
|
1050
|
+
expect(registerSpy).not.toHaveBeenCalledWith('handleConnectionRestoration', [_callingClientFixtures.primaryUrl]);
|
|
1051
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, '2023-01-01T00:00:00.000Z', '2023-01-01T00:01:00.000Z');
|
|
1052
|
+
case 3:
|
|
1053
|
+
case "end":
|
|
1054
|
+
return _context31.stop();
|
|
1055
|
+
}
|
|
1056
|
+
}, _callee31);
|
|
1057
|
+
})));
|
|
1058
|
+
it('handle calls status check once mercury comes back up after a network flap', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee32() {
|
|
1059
|
+
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
1060
|
+
return _regenerator.default.wrap(function (_context32) {
|
|
1061
|
+
while (1) switch (_context32.prev = _context32.next) {
|
|
1062
|
+
case 0:
|
|
1063
|
+
callingClient['isNetworkDown'] = true;
|
|
1064
|
+
call = callingClient['callManager'].createCall();
|
|
1065
|
+
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
1066
|
+
deleteSpy = jest.spyOn(call, 'delete');
|
|
1067
|
+
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
1068
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
1069
|
+
_context32.next = 1;
|
|
1070
|
+
return mercuryOnlineCb();
|
|
1071
|
+
case 1:
|
|
1072
|
+
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
1073
|
+
_context32.next = 2;
|
|
1074
|
+
return flushPromises();
|
|
1075
|
+
case 2:
|
|
1076
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
1077
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
1078
|
+
method: 'checkCallStatus'
|
|
1079
|
+
});
|
|
1080
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1081
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
1082
|
+
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
1083
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.NETWORK_FLAP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
1084
|
+
case 3:
|
|
1085
|
+
case "end":
|
|
1086
|
+
return _context32.stop();
|
|
1087
|
+
}
|
|
1088
|
+
}, _callee32);
|
|
1089
|
+
})));
|
|
1090
|
+
it('handle calls status check once mercury comes back up with stable network', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee33() {
|
|
1091
|
+
var call, callKeepaliveSpy, deleteSpy, mercuryOnlineCb;
|
|
1092
|
+
return _regenerator.default.wrap(function (_context33) {
|
|
1093
|
+
while (1) switch (_context33.prev = _context33.next) {
|
|
1094
|
+
case 0:
|
|
1095
|
+
call = callingClient['callManager'].createCall();
|
|
1096
|
+
callKeepaliveSpy = jest.spyOn(call, 'postStatus').mockRejectedValueOnce(new Error('keepalive fail'));
|
|
1097
|
+
deleteSpy = jest.spyOn(call, 'delete');
|
|
1098
|
+
expect((0, _keys.default)(callingClient['callManager'].getActiveCalls()).length).toBe(1);
|
|
1099
|
+
mercuryOnlineCb = webex.internal.mercury.on.mock.calls[2][1];
|
|
1100
|
+
_context33.next = 1;
|
|
1101
|
+
return mercuryOnlineCb();
|
|
1102
|
+
case 1:
|
|
1103
|
+
expect(callKeepaliveSpy).toHaveBeenCalled();
|
|
1104
|
+
_context33.next = 2;
|
|
1105
|
+
return flushPromises();
|
|
1106
|
+
case 2:
|
|
1107
|
+
expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Call Keepalive failed'), {
|
|
1108
|
+
file: _constants.CALLING_CLIENT_FILE,
|
|
1109
|
+
method: 'checkCallStatus'
|
|
1110
|
+
});
|
|
1111
|
+
expect(call['callStateMachine'].state.value).toBe('S_CALL_CLEARED');
|
|
1112
|
+
expect(deleteSpy).toHaveBeenCalled();
|
|
1113
|
+
expect((0, _keys.default)(reg.callManager.getActiveCalls()).length).toBe(0);
|
|
1114
|
+
expect(metricSpy).toHaveBeenCalledWith(_types4.METRIC_EVENT.CONNECTION_ERROR, _types4.CONNECTION_ACTION.MERCURY_UP, _types4.METRIC_TYPE.BEHAVIORAL, expect.any(String), expect.any(String));
|
|
1115
|
+
case 3:
|
|
1116
|
+
case "end":
|
|
1117
|
+
return _context33.stop();
|
|
1118
|
+
}
|
|
1119
|
+
}, _callee33);
|
|
1120
|
+
})));
|
|
1121
|
+
});
|
|
1122
|
+
|
|
1123
|
+
// Calling related test cases
|
|
1124
|
+
describe('Calling tests', function () {
|
|
1125
|
+
var mutex = new _asyncMutex.Mutex();
|
|
1126
|
+
var userId = webex.internal.device.userId;
|
|
1127
|
+
var clientDeviceUri = webex.internal.device.url;
|
|
1128
|
+
var mobiusUris = (0, _Utils.filterMobiusUris)((0, _testUtil.getMobiusDiscoveryResponse)(), _registerFixtures.URL);
|
|
1129
|
+
var primaryMobiusUris = jest.fn(function () {
|
|
1130
|
+
return mobiusUris.primary;
|
|
1131
|
+
});
|
|
1132
|
+
var backupMobiusUris = jest.fn(function () {
|
|
1133
|
+
return mobiusUris.backup;
|
|
1134
|
+
});
|
|
1135
|
+
var callingClient;
|
|
1136
|
+
var line;
|
|
1137
|
+
beforeAll(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee34() {
|
|
1138
|
+
var calls;
|
|
1139
|
+
return _regenerator.default.wrap(function (_context34) {
|
|
1140
|
+
while (1) switch (_context34.prev = _context34.next) {
|
|
1141
|
+
case 0:
|
|
1142
|
+
_context34.next = 1;
|
|
1143
|
+
return (0, _CallingClient.createClient)(webex);
|
|
1144
|
+
case 1:
|
|
1145
|
+
callingClient = _context34.sent;
|
|
1146
|
+
line = new _line.default(userId, clientDeviceUri, mutex, primaryMobiusUris(), backupMobiusUris(), _types.LOGGER.INFO);
|
|
1147
|
+
calls = (0, _values.default)(callManager.getActiveCalls());
|
|
1148
|
+
calls.forEach(function (call) {
|
|
1149
|
+
call.end();
|
|
1150
|
+
});
|
|
1151
|
+
case 2:
|
|
1152
|
+
case "end":
|
|
1153
|
+
return _context34.stop();
|
|
1154
|
+
}
|
|
1155
|
+
}, _callee34);
|
|
1156
|
+
})));
|
|
1157
|
+
afterAll(function () {
|
|
1158
|
+
callingClient.removeAllListeners();
|
|
1159
|
+
callManager.removeAllListeners();
|
|
1160
|
+
});
|
|
1161
|
+
it('verify calling client object', function () {
|
|
1162
|
+
expect(callingClient.getSDKConnector().getWebex().internal.device.userId).toBe('8a67806f-fc4d-446b-a131-31e71ea5b0e9');
|
|
1163
|
+
});
|
|
1164
|
+
it('returns undefined when there is no connected call', function () {
|
|
1165
|
+
line.register();
|
|
1166
|
+
line.makeCall({
|
|
1167
|
+
address: '123456',
|
|
1168
|
+
type: _types2.CallType.URI
|
|
1169
|
+
});
|
|
1170
|
+
expect(callingClient.getConnectedCall()).toEqual(undefined);
|
|
1171
|
+
});
|
|
1172
|
+
it('returns the connected call', function () {
|
|
1173
|
+
line.register();
|
|
1174
|
+
var mockCall = line.makeCall({
|
|
1175
|
+
address: '1234',
|
|
1176
|
+
type: _types2.CallType.URI
|
|
1177
|
+
});
|
|
1178
|
+
var mockCall2 = line.makeCall({
|
|
1179
|
+
address: '5678',
|
|
1180
|
+
type: _types2.CallType.URI
|
|
1181
|
+
});
|
|
1182
|
+
// Connected call
|
|
1183
|
+
mockCall['connected'] = true;
|
|
1184
|
+
mockCall['earlyMedia'] = false;
|
|
1185
|
+
mockCall['callStateMachine'].state.value = 'S_CALL_ESTABLISHED';
|
|
1186
|
+
|
|
1187
|
+
// Held call
|
|
1188
|
+
mockCall2['connected'] = true;
|
|
1189
|
+
mockCall2['held'] = true;
|
|
1190
|
+
mockCall2['earlyMedia'] = false;
|
|
1191
|
+
mockCall2['callStateMachine'].state.value = 'S_CALL_HOLD';
|
|
1192
|
+
var mockActiveCalls = {
|
|
1193
|
+
mockCorrelationId: mockCall,
|
|
1194
|
+
mockCorrelationId2: mockCall2
|
|
1195
|
+
};
|
|
1196
|
+
jest.spyOn(callManager, 'getActiveCalls').mockReturnValue(mockActiveCalls);
|
|
1197
|
+
expect(callingClient.getConnectedCall()).toEqual(mockCall);
|
|
1198
|
+
});
|
|
1199
|
+
it('returns all active calls', function () {
|
|
1200
|
+
callingClient.lineDict = {
|
|
1201
|
+
mockDeviceId: {
|
|
1202
|
+
lineId: 'mockLineId'
|
|
1203
|
+
},
|
|
1204
|
+
mockDeviceId2: {
|
|
1205
|
+
lineId: 'mockLineId2'
|
|
1206
|
+
}
|
|
1207
|
+
};
|
|
1208
|
+
var mockCall = line.makeCall({
|
|
1209
|
+
address: '1234',
|
|
1210
|
+
type: _types2.CallType.URI
|
|
1211
|
+
});
|
|
1212
|
+
var mockCall2 = line.makeCall({
|
|
1213
|
+
address: '5678',
|
|
1214
|
+
type: _types2.CallType.URI
|
|
1215
|
+
});
|
|
1216
|
+
var mockCall3 = line.makeCall({
|
|
1217
|
+
address: '9101',
|
|
1218
|
+
type: _types2.CallType.URI
|
|
1219
|
+
});
|
|
1220
|
+
mockCall.lineId = 'mockLineId';
|
|
1221
|
+
mockCall2.lineId = 'mockLineId2';
|
|
1222
|
+
mockCall3.lineId = 'mockLineId2';
|
|
1223
|
+
var mockActiveCalls = {
|
|
1224
|
+
mockCorrelationId: mockCall,
|
|
1225
|
+
mockCorrelationId2: mockCall2,
|
|
1226
|
+
mockCorrelationId3: mockCall3
|
|
1227
|
+
};
|
|
1228
|
+
jest.spyOn(callManager, 'getActiveCalls').mockReturnValue(mockActiveCalls);
|
|
1229
|
+
expect(callingClient.getActiveCalls()).toEqual({
|
|
1230
|
+
mockLineId: [mockCall],
|
|
1231
|
+
mockLineId2: [mockCall2, mockCall3]
|
|
1232
|
+
});
|
|
1233
|
+
});
|
|
1234
|
+
});
|
|
1235
|
+
describe('Call Session Event test', function () {
|
|
1236
|
+
var mockOn = webex.internal.mercury.on;
|
|
1237
|
+
var callingClient;
|
|
1238
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee35() {
|
|
1239
|
+
return _regenerator.default.wrap(function (_context35) {
|
|
1240
|
+
while (1) switch (_context35.prev = _context35.next) {
|
|
1241
|
+
case 0:
|
|
1242
|
+
_context35.next = 1;
|
|
1243
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1244
|
+
logger: {
|
|
1245
|
+
level: _types.LOGGER.INFO
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
case 1:
|
|
1249
|
+
callingClient = _context35.sent;
|
|
1250
|
+
case 2:
|
|
1251
|
+
case "end":
|
|
1252
|
+
return _context35.stop();
|
|
1253
|
+
}
|
|
1254
|
+
}, _callee35);
|
|
1255
|
+
})));
|
|
1256
|
+
afterEach(function () {
|
|
1257
|
+
callingClient.removeAllListeners();
|
|
1258
|
+
callManager.removeAllListeners();
|
|
1259
|
+
});
|
|
1260
|
+
it('verify the recent user session event ', function (done) {
|
|
1261
|
+
expect.assertions(2);
|
|
1262
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, function (event) {
|
|
1263
|
+
expect(event.data).toEqual(_callRecordFixtures.MOCK_SESSION_EVENT.data);
|
|
1264
|
+
done();
|
|
1265
|
+
});
|
|
1266
|
+
expect(mockOn.mock.calls[0][0]).toEqual(_types3.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE);
|
|
1267
|
+
var callSessionCallback = mockOn.mock.calls[0][1];
|
|
1268
|
+
callSessionCallback(_callRecordFixtures.MOCK_SESSION_EVENT);
|
|
1269
|
+
});
|
|
1270
|
+
it('drop the recent user session if there is no webex calling type', function (done) {
|
|
1271
|
+
expect.assertions(2);
|
|
1272
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.USER_SESSION_INFO, function (event) {
|
|
1273
|
+
expect(event.data.userSessions.userSessions.length).toEqual(1);
|
|
1274
|
+
done();
|
|
1275
|
+
});
|
|
1276
|
+
expect(mockOn.mock.calls[0][0]).toEqual(_types3.MOBIUS_EVENT_KEYS.CALL_SESSION_EVENT_INCLUSIVE);
|
|
1277
|
+
var callSessionCallback = mockOn.mock.calls[0][1];
|
|
1278
|
+
callSessionCallback(_callRecordFixtures.MOCK_MULTIPLE_SESSIONS_EVENT);
|
|
1279
|
+
});
|
|
1280
|
+
});
|
|
1281
|
+
describe('Mobius async_event routing', function () {
|
|
1282
|
+
var callingClient;
|
|
1283
|
+
var asyncEventCallback;
|
|
1284
|
+
var mobiusSocketMock;
|
|
1285
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee36() {
|
|
1286
|
+
var asyncEventOnCall;
|
|
1287
|
+
return _regenerator.default.wrap(function (_context36) {
|
|
1288
|
+
while (1) switch (_context36.prev = _context36.next) {
|
|
1289
|
+
case 0:
|
|
1290
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1291
|
+
value: true
|
|
1292
|
+
});
|
|
1293
|
+
_request.APIRequest.resetInstance();
|
|
1294
|
+
_request.APIRequest.getInstance({
|
|
1295
|
+
webex: webex
|
|
1296
|
+
});
|
|
1297
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1298
|
+
mobiusSocketMock.on.mockClear();
|
|
1299
|
+
mobiusSocketMock.off.mockClear();
|
|
1300
|
+
_context36.next = 1;
|
|
1301
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1302
|
+
logger: {
|
|
1303
|
+
level: _types.LOGGER.INFO
|
|
1304
|
+
}
|
|
1305
|
+
});
|
|
1306
|
+
case 1:
|
|
1307
|
+
callingClient = _context36.sent;
|
|
1308
|
+
asyncEventOnCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1309
|
+
return call[0] === 'event:async_event';
|
|
1310
|
+
});
|
|
1311
|
+
asyncEventCallback = asyncEventOnCall[1];
|
|
1312
|
+
case 2:
|
|
1313
|
+
case "end":
|
|
1314
|
+
return _context36.stop();
|
|
1315
|
+
}
|
|
1316
|
+
}, _callee36);
|
|
1317
|
+
})));
|
|
1318
|
+
afterEach(function () {
|
|
1319
|
+
callingClient.removeAllListeners();
|
|
1320
|
+
callManager.removeAllListeners();
|
|
1321
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1322
|
+
value: false
|
|
1323
|
+
});
|
|
1324
|
+
});
|
|
1325
|
+
it('routes mobius.* async events to callManager', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee37() {
|
|
1326
|
+
var callEventSpy;
|
|
1327
|
+
return _regenerator.default.wrap(function (_context37) {
|
|
1328
|
+
while (1) switch (_context37.prev = _context37.next) {
|
|
1329
|
+
case 0:
|
|
1330
|
+
callEventSpy = jest.spyOn(callingClient['callManager'], 'dequeueWsEvents').mockImplementation(function () {
|
|
1331
|
+
return undefined;
|
|
1332
|
+
});
|
|
1333
|
+
_context37.next = 1;
|
|
1334
|
+
return asyncEventCallback({
|
|
1335
|
+
type: 'async_event',
|
|
1336
|
+
data: {
|
|
1337
|
+
eventType: 'mobius.call',
|
|
1338
|
+
callId: 'fcf86aa5-5539-4c9f-8b72-667786ae9b6c',
|
|
1339
|
+
callUrl: 'https://mobius-a.wbx2.com/api/v1/calling/web/devices/d1/calls/c1',
|
|
1340
|
+
deviceId: 'd1',
|
|
1341
|
+
correlationId: 'corr-1'
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
case 1:
|
|
1345
|
+
expect(callEventSpy).toHaveBeenCalledWith(expect.objectContaining({
|
|
1346
|
+
type: 'async_event',
|
|
1347
|
+
data: expect.objectContaining({
|
|
1348
|
+
eventType: 'mobius.call'
|
|
1349
|
+
})
|
|
1350
|
+
}));
|
|
1351
|
+
case 2:
|
|
1352
|
+
case "end":
|
|
1353
|
+
return _context37.stop();
|
|
1354
|
+
}
|
|
1355
|
+
}, _callee37);
|
|
1356
|
+
})));
|
|
1357
|
+
});
|
|
1358
|
+
describe('Mobius socket connection events', function () {
|
|
1359
|
+
var callingClient;
|
|
1360
|
+
var mobiusSocketMock;
|
|
1361
|
+
var getSocketHandlerFor = function getSocketHandlerFor(eventName) {
|
|
1362
|
+
var onCall = mobiusSocketMock.on.mock.calls.find(function (call) {
|
|
1363
|
+
return call[0] === eventName;
|
|
1364
|
+
});
|
|
1365
|
+
return onCall[1];
|
|
1366
|
+
};
|
|
1367
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee38() {
|
|
1368
|
+
return _regenerator.default.wrap(function (_context38) {
|
|
1369
|
+
while (1) switch (_context38.prev = _context38.next) {
|
|
1370
|
+
case 0:
|
|
1371
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1372
|
+
value: true
|
|
1373
|
+
});
|
|
1374
|
+
_request.APIRequest.resetInstance();
|
|
1375
|
+
_request.APIRequest.getInstance({
|
|
1376
|
+
webex: webex
|
|
1377
|
+
});
|
|
1378
|
+
mobiusSocketMock = jest.requireMock('../mobius-socket').getMobiusSocketInstance(webex);
|
|
1379
|
+
mobiusSocketMock.on.mockClear();
|
|
1380
|
+
mobiusSocketMock.off.mockClear();
|
|
1381
|
+
mobiusSocketMock.isConnected.mockReturnValue(false);
|
|
1382
|
+
_context38.next = 1;
|
|
1383
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1384
|
+
logger: {
|
|
1385
|
+
level: _types.LOGGER.INFO
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
case 1:
|
|
1389
|
+
callingClient = _context38.sent;
|
|
1390
|
+
case 2:
|
|
1391
|
+
case "end":
|
|
1392
|
+
return _context38.stop();
|
|
1393
|
+
}
|
|
1394
|
+
}, _callee38);
|
|
1395
|
+
})));
|
|
1396
|
+
afterEach(function () {
|
|
1397
|
+
callingClient.removeAllListeners();
|
|
1398
|
+
callManager.removeAllListeners();
|
|
1399
|
+
webex.internal.device.features.developer.get = jest.fn().mockReturnValue({
|
|
1400
|
+
value: false
|
|
1401
|
+
});
|
|
1402
|
+
});
|
|
1403
|
+
it('emits MOBIUS_SOCKET_CONNECTED when the socket comes online', function () {
|
|
1404
|
+
var listener = jest.fn();
|
|
1405
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_CONNECTED, listener);
|
|
1406
|
+
getSocketHandlerFor('online')();
|
|
1407
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1408
|
+
});
|
|
1409
|
+
it.each([['offline.permanent', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.PERMANENT], ['offline.transient', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.TRANSIENT], ['offline.replaced', _types3.MOBIUS_SOCKET_DISCONNECT_REASON.REPLACED]])('emits MOBIUS_SOCKET_DISCONNECTED with the matching reason when %s fires', function (eventName, reason) {
|
|
1410
|
+
var listener = jest.fn();
|
|
1411
|
+
callingClient.on(_types3.CALLING_CLIENT_EVENT_KEYS.MOBIUS_SOCKET_DISCONNECTED, listener);
|
|
1412
|
+
getSocketHandlerFor(eventName)();
|
|
1413
|
+
expect(listener).toHaveBeenCalledTimes(1);
|
|
1414
|
+
expect(listener).toHaveBeenCalledWith({
|
|
1415
|
+
reason: reason
|
|
1416
|
+
});
|
|
1417
|
+
});
|
|
1418
|
+
it.each([true, false])('isMobiusSocketConnected() reflects the underlying socket state (%s) when WSS is enabled', function (connected) {
|
|
1419
|
+
mobiusSocketMock.isConnected.mockReturnValue(connected);
|
|
1420
|
+
expect(callingClient.isMobiusSocketConnected()).toBe(connected);
|
|
1421
|
+
});
|
|
1422
|
+
});
|
|
1423
|
+
describe('getDevices', function () {
|
|
1424
|
+
var callingClient;
|
|
1425
|
+
var primaryMobius = 'https://mobius.primary/api/v1/calling/web/';
|
|
1426
|
+
var backupMobius = 'https://mobius.backup/api/v1/calling/web/';
|
|
1427
|
+
beforeEach(/*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee39() {
|
|
1428
|
+
return _regenerator.default.wrap(function (_context39) {
|
|
1429
|
+
while (1) switch (_context39.prev = _context39.next) {
|
|
1430
|
+
case 0:
|
|
1431
|
+
_context39.next = 1;
|
|
1432
|
+
return (0, _CallingClient.createClient)(webex, {
|
|
1433
|
+
logger: {
|
|
1434
|
+
level: _types.LOGGER.INFO
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
case 1:
|
|
1438
|
+
callingClient = _context39.sent;
|
|
1439
|
+
callingClient.primaryMobiusUris = [primaryMobius];
|
|
1440
|
+
callingClient.backupMobiusUris = [backupMobius];
|
|
1441
|
+
webex.request.mockClear();
|
|
1442
|
+
case 2:
|
|
1443
|
+
case "end":
|
|
1444
|
+
return _context39.stop();
|
|
1445
|
+
}
|
|
1446
|
+
}, _callee39);
|
|
1447
|
+
})));
|
|
1448
|
+
afterEach(function () {
|
|
1449
|
+
callingClient.removeAllListeners();
|
|
1450
|
+
});
|
|
1451
|
+
it('fetches devices for the provided userId', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee40() {
|
|
1452
|
+
var devices, responsePayload, response;
|
|
1453
|
+
return _regenerator.default.wrap(function (_context40) {
|
|
1454
|
+
while (1) switch (_context40.prev = _context40.next) {
|
|
1455
|
+
case 0:
|
|
1456
|
+
devices = [{
|
|
1457
|
+
deviceId: 'device-1',
|
|
1458
|
+
uri: 'https://mobius.test/api/v1/calling/web/devices/device-1',
|
|
1459
|
+
status: 'ACTIVE',
|
|
1460
|
+
lastSeen: '2024-01-01T00:00:00Z',
|
|
1461
|
+
addresses: [],
|
|
1462
|
+
clientDeviceUri: 'client-device-uri'
|
|
1463
|
+
}];
|
|
1464
|
+
responsePayload = {
|
|
1465
|
+
statusCode: 200,
|
|
1466
|
+
body: {
|
|
1467
|
+
userId: 'user-123',
|
|
1468
|
+
devices: devices
|
|
1469
|
+
}
|
|
1470
|
+
};
|
|
1471
|
+
webex.request.mockResolvedValue(responsePayload);
|
|
1472
|
+
_context40.next = 1;
|
|
1473
|
+
return callingClient.getDevices('user-123');
|
|
1474
|
+
case 1:
|
|
1475
|
+
response = _context40.sent;
|
|
1476
|
+
expect(webex.request).toHaveBeenCalledWith({
|
|
1477
|
+
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1478
|
+
method: _types2.HTTP_METHODS.GET,
|
|
1479
|
+
service: _types2.ALLOWED_SERVICES.MOBIUS,
|
|
1480
|
+
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT)
|
|
1481
|
+
});
|
|
1482
|
+
expect(response).toEqual(devices);
|
|
1483
|
+
case 2:
|
|
1484
|
+
case "end":
|
|
1485
|
+
return _context40.stop();
|
|
1486
|
+
}
|
|
1487
|
+
}, _callee40);
|
|
1488
|
+
})));
|
|
1489
|
+
it('falls back to backup Mobius when primary fails', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee41() {
|
|
1490
|
+
var devices, failurePayload, responsePayload, response, requestCalls;
|
|
1491
|
+
return _regenerator.default.wrap(function (_context41) {
|
|
1492
|
+
while (1) switch (_context41.prev = _context41.next) {
|
|
1493
|
+
case 0:
|
|
1494
|
+
devices = [{
|
|
1495
|
+
deviceId: 'device-2',
|
|
1496
|
+
uri: 'https://mobius.backup/api/v1/calling/web/devices/device-2',
|
|
1497
|
+
status: 'ACTIVE',
|
|
1498
|
+
lastSeen: '2024-01-01T00:00:00Z',
|
|
1499
|
+
addresses: [],
|
|
1500
|
+
clientDeviceUri: 'client-device-uri'
|
|
1501
|
+
}];
|
|
1502
|
+
failurePayload = {
|
|
1503
|
+
statusCode: 404
|
|
1504
|
+
};
|
|
1505
|
+
responsePayload = {
|
|
1506
|
+
statusCode: 200,
|
|
1507
|
+
body: {
|
|
1508
|
+
userId: 'user-123',
|
|
1509
|
+
devices: devices
|
|
1510
|
+
}
|
|
1511
|
+
};
|
|
1512
|
+
webex.request.mockRejectedValueOnce(failurePayload).mockResolvedValueOnce(responsePayload);
|
|
1513
|
+
_context41.next = 1;
|
|
1514
|
+
return callingClient.getDevices('user-123');
|
|
1515
|
+
case 1:
|
|
1516
|
+
response = _context41.sent;
|
|
1517
|
+
requestCalls = webex.request.mock.calls;
|
|
1518
|
+
expect(requestCalls[0][0]).toEqual({
|
|
1519
|
+
uri: 'https://mobius.primary/api/v1/calling/web/devices?userid=user-123',
|
|
1520
|
+
method: _types2.HTTP_METHODS.GET,
|
|
1521
|
+
service: _types2.ALLOWED_SERVICES.MOBIUS,
|
|
1522
|
+
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT)
|
|
1523
|
+
});
|
|
1524
|
+
expect(requestCalls[1][0]).toEqual({
|
|
1525
|
+
uri: 'https://mobius.backup/api/v1/calling/web/devices?userid=user-123',
|
|
1526
|
+
method: _types2.HTTP_METHODS.GET,
|
|
1527
|
+
service: _types2.ALLOWED_SERVICES.MOBIUS,
|
|
1528
|
+
headers: (0, _defineProperty2.default)((0, _defineProperty2.default)({}, _constants.CISCO_DEVICE_URL, webex.internal.device.url), _constants.SPARK_USER_AGENT, _constants.CALLING_USER_AGENT)
|
|
1529
|
+
});
|
|
1530
|
+
expect(response).toEqual(devices);
|
|
1531
|
+
case 2:
|
|
1532
|
+
case "end":
|
|
1533
|
+
return _context41.stop();
|
|
1534
|
+
}
|
|
1535
|
+
}, _callee41);
|
|
1536
|
+
})));
|
|
1537
|
+
});
|
|
1538
|
+
describe('windowsChromiumIceWarmup', function () {
|
|
1539
|
+
var origRTCPeerConnection;
|
|
1540
|
+
beforeAll(function () {
|
|
1541
|
+
var _Class;
|
|
1542
|
+
origRTCPeerConnection = global.RTCPeerConnection;
|
|
1543
|
+
// Minimal mock for RTCPeerConnection
|
|
1544
|
+
global.RTCPeerConnection = (_Class = /*#__PURE__*/function () {
|
|
1545
|
+
function _Class() {
|
|
1546
|
+
(0, _classCallCheck2.default)(this, _Class);
|
|
1547
|
+
(0, _defineProperty2.default)(this, "iceGatheringState", 'complete');
|
|
1548
|
+
(0, _defineProperty2.default)(this, "localDescription", null);
|
|
1549
|
+
(0, _defineProperty2.default)(this, "remoteDescription", null);
|
|
1550
|
+
(0, _defineProperty2.default)(this, "onicecandidate", null);
|
|
1551
|
+
this.constructor.instances.push(this);
|
|
1552
|
+
}
|
|
1553
|
+
return (0, _createClass2.default)(_Class, [{
|
|
1554
|
+
key: "createDataChannel",
|
|
1555
|
+
value: function createDataChannel() {
|
|
1556
|
+
return {};
|
|
1557
|
+
}
|
|
1558
|
+
}, {
|
|
1559
|
+
key: "addTransceiver",
|
|
1560
|
+
value: function addTransceiver() {
|
|
1561
|
+
return {};
|
|
1562
|
+
}
|
|
1563
|
+
}, {
|
|
1564
|
+
key: "createOffer",
|
|
1565
|
+
value: function createOffer() {
|
|
1566
|
+
return _promise.default.resolve({
|
|
1567
|
+
sdp: 'offer',
|
|
1568
|
+
type: 'offer'
|
|
1569
|
+
});
|
|
1570
|
+
}
|
|
1571
|
+
}, {
|
|
1572
|
+
key: "setLocalDescription",
|
|
1573
|
+
value: function setLocalDescription(desc) {
|
|
1574
|
+
this.localDescription = desc;
|
|
1575
|
+
return _promise.default.resolve();
|
|
1576
|
+
}
|
|
1577
|
+
}, {
|
|
1578
|
+
key: "setRemoteDescription",
|
|
1579
|
+
value: function setRemoteDescription(desc) {
|
|
1580
|
+
this.remoteDescription = desc;
|
|
1581
|
+
return _promise.default.resolve();
|
|
1582
|
+
}
|
|
1583
|
+
}, {
|
|
1584
|
+
key: "createAnswer",
|
|
1585
|
+
value: function createAnswer() {
|
|
1586
|
+
return _promise.default.resolve({
|
|
1587
|
+
sdp: 'answer',
|
|
1588
|
+
type: 'answer'
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
}, {
|
|
1592
|
+
key: "addIceCandidate",
|
|
1593
|
+
value: function addIceCandidate() {
|
|
1594
|
+
return _promise.default.resolve();
|
|
1595
|
+
}
|
|
1596
|
+
}, {
|
|
1597
|
+
key: "close",
|
|
1598
|
+
value: function close() {}
|
|
1599
|
+
}, {
|
|
1600
|
+
key: "addEventListener",
|
|
1601
|
+
value: function addEventListener() {}
|
|
1602
|
+
}, {
|
|
1603
|
+
key: "removeEventListener",
|
|
1604
|
+
value: function removeEventListener() {}
|
|
1605
|
+
}]);
|
|
1606
|
+
}(), (0, _defineProperty2.default)(_Class, "instances", []), _Class);
|
|
1607
|
+
});
|
|
1608
|
+
afterAll(function () {
|
|
1609
|
+
global.RTCPeerConnection = origRTCPeerConnection;
|
|
1610
|
+
});
|
|
1611
|
+
it('should complete without throwing', /*#__PURE__*/(0, _asyncToGenerator2.default)(/*#__PURE__*/_regenerator.default.mark(function _callee42() {
|
|
1612
|
+
return _regenerator.default.wrap(function (_context42) {
|
|
1613
|
+
while (1) switch (_context42.prev = _context42.next) {
|
|
1614
|
+
case 0:
|
|
1615
|
+
_context42.next = 1;
|
|
1616
|
+
return expect((0, _windowsChromiumIceWarmupUtils.default)({})).resolves.not.toThrow();
|
|
1617
|
+
case 1:
|
|
1618
|
+
case "end":
|
|
1619
|
+
return _context42.stop();
|
|
1620
|
+
}
|
|
1621
|
+
}, _callee42);
|
|
1622
|
+
})));
|
|
1623
|
+
});
|
|
1624
|
+
});
|
|
1625
|
+
//# sourceMappingURL=CallingClient.test.js.map
|