@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { v4 as uuid } from 'uuid';
|
|
2
1
|
import { METHOD_START_MESSAGE } from '../../common/constants';
|
|
3
2
|
import { emitFinalFailure, handleRegistrationErrors, uploadLogs } from '../../common';
|
|
4
3
|
import webWorkerStr from './webWorkerStr';
|
|
@@ -6,10 +5,12 @@ import { METRIC_EVENT, METRIC_TYPE, REG_ACTION, } from '../../Metrics/types';
|
|
|
6
5
|
import { getMetricManager } from '../../Metrics';
|
|
7
6
|
import { getCallManager } from '../calling';
|
|
8
7
|
import log from '../../Logger';
|
|
8
|
+
import { HARD_STOP_REASON } from './types';
|
|
9
9
|
import SDKConnector from '../../SDKConnector';
|
|
10
10
|
import { ALLOWED_SERVICES, HTTP_METHODS, RegistrationStatus, ServiceIndicator, WorkerMessageType, } from '../../common/types';
|
|
11
|
-
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT,
|
|
11
|
+
import { CALLING_USER_AGENT, CISCO_DEVICE_URL, DEVICES_ENDPOINT_RESOURCE, SPARK_USER_AGENT, BASE_REG_RETRY_TIMER_VAL_IN_SEC, BASE_REG_TIMER_MFACTOR, SEC_TO_MSEC_MFACTOR, REG_RANDOM_T_FACTOR_UPPER_LIMIT, REG_TRY_BACKUP_TIMER_VAL_IN_SEC, MINUTES_TO_SEC_MFACTOR, REG_429_RETRY_UTIL, REG_FAILBACK_429_MAX_RETRIES, FAILBACK_UTIL, REGISTRATION_FILE, DEFAULT_REHOMING_INTERVAL_MIN, DEFAULT_REHOMING_INTERVAL_MAX, DEFAULT_KEEPALIVE_INTERVAL, FAILOVER_UTIL, REGISTER_UTIL, RETRY_TIMER_UPPER_LIMIT, KEEPALIVE_UTIL, REGISTRATION_UTIL, METHODS, URL_ENDPOINT, RECONNECT_ON_FAILURE_UTIL, FAILOVER_CACHE_PREFIX, } from '../constants';
|
|
12
12
|
import { LINE_EVENTS } from '../line/types';
|
|
13
|
+
import { APIRequest } from '../utils/request';
|
|
13
14
|
export class Registration {
|
|
14
15
|
sdkConnector;
|
|
15
16
|
webex;
|
|
@@ -36,6 +37,7 @@ export class Registration {
|
|
|
36
37
|
retryAfter;
|
|
37
38
|
scheduled429Retry = false;
|
|
38
39
|
webWorker;
|
|
40
|
+
apiRequest;
|
|
39
41
|
constructor(webex, serviceData, mutex, lineEmitter, logLevel, jwe) {
|
|
40
42
|
this.jwe = jwe;
|
|
41
43
|
this.sdkConnector = SDKConnector;
|
|
@@ -57,6 +59,12 @@ export class Registration {
|
|
|
57
59
|
this.lineEmitter = lineEmitter;
|
|
58
60
|
this.primaryMobiusUris = [];
|
|
59
61
|
this.backupMobiusUris = [];
|
|
62
|
+
this.apiRequest = APIRequest.getInstance({ webex: this.webex });
|
|
63
|
+
}
|
|
64
|
+
getServerType(url) {
|
|
65
|
+
return ((this.primaryMobiusUris.includes(url) && 'PRIMARY') ||
|
|
66
|
+
(this.backupMobiusUris?.includes(url) && 'BACKUP') ||
|
|
67
|
+
'UNKNOWN');
|
|
60
68
|
}
|
|
61
69
|
getFailoverCacheKey() {
|
|
62
70
|
return `${FAILOVER_CACHE_PREFIX}.${this.userId || 'unknown'}`;
|
|
@@ -116,6 +124,14 @@ export class Registration {
|
|
|
116
124
|
this.activeMobiusUrl = url;
|
|
117
125
|
this.callManager.updateActiveMobius(url);
|
|
118
126
|
}
|
|
127
|
+
setDeviceInfo(devicesInfo) {
|
|
128
|
+
const [device] = devicesInfo.devices;
|
|
129
|
+
this.deviceInfo = {
|
|
130
|
+
userId: devicesInfo.userId,
|
|
131
|
+
device,
|
|
132
|
+
devices: devicesInfo.devices,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
119
135
|
setMobiusServers(primaryMobiusUris, backupMobiusUris) {
|
|
120
136
|
log.log(METHOD_START_MESSAGE, { method: METHODS.SET_MOBIUS_SERVERS, file: REGISTRATION_FILE });
|
|
121
137
|
this.primaryMobiusUris = primaryMobiusUris;
|
|
@@ -123,16 +139,22 @@ export class Registration {
|
|
|
123
139
|
}
|
|
124
140
|
async deleteRegistration(url, deviceId, deviceUrl) {
|
|
125
141
|
let response;
|
|
142
|
+
const requestObj = {
|
|
143
|
+
uri: `${url}${DEVICES_ENDPOINT_RESOURCE}/${deviceId}`,
|
|
144
|
+
method: HTTP_METHODS.DELETE,
|
|
145
|
+
headers: {
|
|
146
|
+
[CISCO_DEVICE_URL]: deviceUrl,
|
|
147
|
+
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
148
|
+
},
|
|
149
|
+
service: ALLOWED_SERVICES.MOBIUS,
|
|
150
|
+
};
|
|
151
|
+
if (this.apiRequest.isSocketEnabled()) {
|
|
152
|
+
requestObj.body = {
|
|
153
|
+
deviceId,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
126
156
|
try {
|
|
127
|
-
response = await
|
|
128
|
-
method: HTTP_METHODS.DELETE,
|
|
129
|
-
headers: {
|
|
130
|
-
[CISCO_DEVICE_URL]: deviceUrl,
|
|
131
|
-
Authorization: await this.webex.credentials.getUserToken(),
|
|
132
|
-
trackingId: `${WEBEX_WEB_CLIENT}_${uuid()}`,
|
|
133
|
-
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
134
|
-
},
|
|
135
|
-
});
|
|
157
|
+
response = await this.apiRequest.makeRequest(requestObj);
|
|
136
158
|
}
|
|
137
159
|
catch (error) {
|
|
138
160
|
log.warn(`Delete failed with Mobius: ${JSON.stringify(error)}`, {
|
|
@@ -143,7 +165,7 @@ export class Registration {
|
|
|
143
165
|
}
|
|
144
166
|
this.setStatus(RegistrationStatus.INACTIVE);
|
|
145
167
|
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
146
|
-
return response
|
|
168
|
+
return response;
|
|
147
169
|
}
|
|
148
170
|
async postRegistration(url) {
|
|
149
171
|
const deviceInfo = {
|
|
@@ -151,7 +173,7 @@ export class Registration {
|
|
|
151
173
|
clientDeviceUri: this.webex.internal.device.url,
|
|
152
174
|
serviceData: this.jwe ? { ...this.serviceData, jwe: this.jwe } : this.serviceData,
|
|
153
175
|
};
|
|
154
|
-
return this.
|
|
176
|
+
return this.apiRequest.makeRequest({
|
|
155
177
|
uri: `${url}device`,
|
|
156
178
|
method: HTTP_METHODS.POST,
|
|
157
179
|
headers: {
|
|
@@ -163,7 +185,23 @@ export class Registration {
|
|
|
163
185
|
});
|
|
164
186
|
}
|
|
165
187
|
async restorePreviousRegistration(caller) {
|
|
188
|
+
const loggerContext = {
|
|
189
|
+
file: REGISTRATION_FILE,
|
|
190
|
+
method: METHODS.RESTORE_PREVIOUS_REGISTRATION,
|
|
191
|
+
};
|
|
192
|
+
log.info(`${METHOD_START_MESSAGE} - caller: ${caller}, activeMobiusUrl: ${this.activeMobiusUrl}`, loggerContext);
|
|
166
193
|
let abort = false;
|
|
194
|
+
if (this.apiRequest.isSocketEnabled() &&
|
|
195
|
+
`${this.apiRequest.getConnectedWebSocketUrl()}/` !== this.activeMobiusUrl) {
|
|
196
|
+
log.info(`Disconnecting from Mobius socket to restore previous registration.`, {
|
|
197
|
+
file: REGISTRATION_FILE,
|
|
198
|
+
method: 'restorePreviousRegistration',
|
|
199
|
+
});
|
|
200
|
+
await this.apiRequest.disconnectFromMobiusSocket({
|
|
201
|
+
code: 3050,
|
|
202
|
+
reason: 'done (permanent)',
|
|
203
|
+
});
|
|
204
|
+
}
|
|
167
205
|
if (this.activeMobiusUrl) {
|
|
168
206
|
abort = await this.attemptRegistrationWithServers(caller, [this.activeMobiusUrl]);
|
|
169
207
|
if (this.retryAfter) {
|
|
@@ -177,22 +215,47 @@ export class Registration {
|
|
|
177
215
|
abort = await this.attemptRegistrationWithServers(caller, this.backupMobiusUris);
|
|
178
216
|
}
|
|
179
217
|
else {
|
|
180
|
-
this.restartRegistration(caller);
|
|
218
|
+
await this.restartRegistration(caller);
|
|
181
219
|
}
|
|
182
220
|
this.retryAfter = undefined;
|
|
221
|
+
log.log(`restorePreviousRegistration completed via 429 retry-after path - caller: ${caller}`, loggerContext);
|
|
183
222
|
return true;
|
|
184
223
|
}
|
|
185
224
|
}
|
|
225
|
+
log.log(`restorePreviousRegistration completed - caller: ${caller}, deviceRegistered: ${this.isDeviceRegistered()}, abort: ${abort}`, loggerContext);
|
|
186
226
|
return abort;
|
|
187
227
|
}
|
|
188
228
|
async handle404KeepaliveFailure(caller) {
|
|
229
|
+
const loggerContext = {
|
|
230
|
+
file: REGISTRATION_FILE,
|
|
231
|
+
method: METHODS.HANDLE_404_KEEPALIVE_FAILURE,
|
|
232
|
+
};
|
|
233
|
+
log.info(`${METHOD_START_MESSAGE} - caller: ${caller}`, loggerContext);
|
|
189
234
|
if (caller === KEEPALIVE_UTIL) {
|
|
190
235
|
const abort = await this.attemptRegistrationWithServers(caller);
|
|
191
236
|
if (!abort && !this.isDeviceRegistered()) {
|
|
237
|
+
log.warn('Keepalive 404 recovery: re-registration did not complete, starting failover timer', loggerContext);
|
|
192
238
|
await this.startFailoverTimer();
|
|
193
239
|
}
|
|
240
|
+
else {
|
|
241
|
+
log.log(`Keepalive 404 recovery handled - deviceRegistered: ${this.isDeviceRegistered()}, abort: ${abort}`, loggerContext);
|
|
242
|
+
}
|
|
194
243
|
}
|
|
195
244
|
}
|
|
245
|
+
async handle409KeepaliveFailure(lineError, error, serverType, keepaliveRetryCount) {
|
|
246
|
+
const loggerContext = {
|
|
247
|
+
file: REGISTRATION_FILE,
|
|
248
|
+
method: METHODS.HANDLE_409_KEEPALIVE_FAILURE,
|
|
249
|
+
};
|
|
250
|
+
log.warn(`Stopping keepalive without re-registration, session superseded by another device for this user - keepaliveRetryCount: ${keepaliveRetryCount}`, loggerContext);
|
|
251
|
+
this.clearKeepaliveTimer();
|
|
252
|
+
this.metricManager.submitRegistrationMetric(METRIC_EVENT.KEEPALIVE_ERROR, REG_ACTION.KEEPALIVE_FAILURE, METRIC_TYPE.BEHAVIORAL, METHODS.HANDLE_409_KEEPALIVE_FAILURE, serverType, error.headers?.trackingid ?? '', keepaliveRetryCount, lineError);
|
|
253
|
+
await this.registrationCleanup(METHODS.HANDLE_409_KEEPALIVE_FAILURE, {
|
|
254
|
+
reason: HARD_STOP_REASON.SESSION_SUPERSEDED,
|
|
255
|
+
error: lineError,
|
|
256
|
+
});
|
|
257
|
+
await uploadLogs();
|
|
258
|
+
}
|
|
196
259
|
async handle429Retry(retryAfter, caller) {
|
|
197
260
|
if (caller === FAILBACK_UTIL) {
|
|
198
261
|
if (this.failback429RetryAttempts >= REG_FAILBACK_429_MAX_RETRIES) {
|
|
@@ -220,7 +283,7 @@ export class Registration {
|
|
|
220
283
|
method: REG_429_RETRY_UTIL,
|
|
221
284
|
});
|
|
222
285
|
await this.startKeepaliveTimer(this.deviceInfo.device?.uri, this.deviceInfo.keepaliveInterval, 'UNKNOWN');
|
|
223
|
-
}, retryAfter * 1000);
|
|
286
|
+
}, (retryAfter - Number(this.deviceInfo.keepaliveInterval || 0)) * 1000);
|
|
224
287
|
}
|
|
225
288
|
else {
|
|
226
289
|
this.retryAfter = retryAfter;
|
|
@@ -271,6 +334,14 @@ export class Registration {
|
|
|
271
334
|
log.log(`Scheduled retry with primary in ${interval} seconds, number of attempts : ${attempt}`, loggerContext);
|
|
272
335
|
}
|
|
273
336
|
else if (this.backupMobiusUris.length) {
|
|
337
|
+
if (this.apiRequest.isSocketEnabled()) {
|
|
338
|
+
log.info('Disconnecting from primary Mobius socket for failover to backup servers', loggerContext);
|
|
339
|
+
await this.apiRequest.disconnectFromMobiusSocket({
|
|
340
|
+
code: 3050,
|
|
341
|
+
reason: 'done (permanent)',
|
|
342
|
+
});
|
|
343
|
+
log.log('Mobius socket disconnect complete prior to backup failover', loggerContext);
|
|
344
|
+
}
|
|
274
345
|
this.saveFailoverState({
|
|
275
346
|
attempt,
|
|
276
347
|
timeElapsed,
|
|
@@ -303,7 +374,7 @@ export class Registration {
|
|
|
303
374
|
await uploadLogs();
|
|
304
375
|
emitFinalFailure((clientError) => {
|
|
305
376
|
this.lineEmitter(LINE_EVENTS.ERROR, undefined, clientError);
|
|
306
|
-
}, loggerContext);
|
|
377
|
+
}, loggerContext, interval < 0 ? 'Timer threshold exceeded during failover' : undefined);
|
|
307
378
|
}
|
|
308
379
|
}
|
|
309
380
|
clearFailbackTimer() {
|
|
@@ -312,11 +383,25 @@ export class Registration {
|
|
|
312
383
|
this.failbackTimer = undefined;
|
|
313
384
|
}
|
|
314
385
|
}
|
|
386
|
+
async postKeepAlive(deviceUrl, url) {
|
|
387
|
+
return this.apiRequest.makeRequest({
|
|
388
|
+
uri: `${url}/status`,
|
|
389
|
+
method: HTTP_METHODS.POST,
|
|
390
|
+
headers: {
|
|
391
|
+
[CISCO_DEVICE_URL]: deviceUrl,
|
|
392
|
+
[SPARK_USER_AGENT]: CALLING_USER_AGENT,
|
|
393
|
+
},
|
|
394
|
+
body: {
|
|
395
|
+
deviceId: this.deviceInfo.device?.deviceId,
|
|
396
|
+
},
|
|
397
|
+
service: ALLOWED_SERVICES.MOBIUS,
|
|
398
|
+
});
|
|
399
|
+
}
|
|
315
400
|
async isPrimaryActive() {
|
|
316
401
|
let status;
|
|
317
402
|
for (const mobiusUrl of this.primaryMobiusUris) {
|
|
318
403
|
try {
|
|
319
|
-
const baseUri = mobiusUrl.replace(URL_ENDPOINT, '/');
|
|
404
|
+
const baseUri = mobiusUrl.replace(URL_ENDPOINT, '/').replace('wss://', 'https://');
|
|
320
405
|
const response = await this.webex.request({
|
|
321
406
|
uri: `${baseUri}ping`,
|
|
322
407
|
method: HTTP_METHODS.GET,
|
|
@@ -354,14 +439,23 @@ export class Registration {
|
|
|
354
439
|
this.rehomingIntervalMin);
|
|
355
440
|
}
|
|
356
441
|
initiateFailback() {
|
|
442
|
+
const loggerContext = {
|
|
443
|
+
file: REGISTRATION_FILE,
|
|
444
|
+
method: METHODS.INITIATE_FAILBACK,
|
|
445
|
+
};
|
|
357
446
|
if (this.isFailbackRequired()) {
|
|
358
447
|
if (!this.failbackTimer) {
|
|
359
448
|
this.failback429RetryAttempts = 0;
|
|
360
449
|
const intervalInMinutes = this.getFailbackInterval();
|
|
450
|
+
log.info(`Scheduling failback to primary - intervalMinutes: ${intervalInMinutes}`, loggerContext);
|
|
361
451
|
this.startFailbackTimer(intervalInMinutes * MINUTES_TO_SEC_MFACTOR);
|
|
362
452
|
}
|
|
453
|
+
else {
|
|
454
|
+
log.info('Failback timer already scheduled, skipping', loggerContext);
|
|
455
|
+
}
|
|
363
456
|
}
|
|
364
457
|
else {
|
|
458
|
+
log.info('Failback not required, clearing any pending failback timer', loggerContext);
|
|
365
459
|
this.failback429RetryAttempts = 0;
|
|
366
460
|
this.clearFailbackTimer();
|
|
367
461
|
}
|
|
@@ -374,15 +468,25 @@ export class Registration {
|
|
|
374
468
|
});
|
|
375
469
|
}
|
|
376
470
|
async executeFailback() {
|
|
471
|
+
const loggerContext = {
|
|
472
|
+
file: REGISTRATION_FILE,
|
|
473
|
+
method: METHODS.EXECUTE_FAILBACK,
|
|
474
|
+
};
|
|
475
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
377
476
|
await this.mutex.runExclusive(async () => {
|
|
378
477
|
if (this.isFailbackRequired()) {
|
|
379
478
|
const primaryServerStatus = await this.isPrimaryActive();
|
|
380
479
|
if (Object.keys(this.callManager.getActiveCalls()).length === 0 && primaryServerStatus) {
|
|
381
|
-
log.info(`Attempting failback to primary.`,
|
|
382
|
-
file: REGISTRATION_FILE,
|
|
383
|
-
method: this.executeFailback.name,
|
|
384
|
-
});
|
|
480
|
+
log.info(`Attempting failback to primary.`, loggerContext);
|
|
385
481
|
await this.deregister();
|
|
482
|
+
if (this.apiRequest.isSocketEnabled()) {
|
|
483
|
+
log.info('Disconnecting from backup Mobius socket for failback to primary', loggerContext);
|
|
484
|
+
await this.apiRequest.disconnectFromMobiusSocket({
|
|
485
|
+
code: 3050,
|
|
486
|
+
reason: 'done (permanent)',
|
|
487
|
+
});
|
|
488
|
+
log.log('Mobius socket disconnect complete prior to primary failback', loggerContext);
|
|
489
|
+
}
|
|
386
490
|
const abort = await this.attemptRegistrationWithServers(FAILBACK_UTIL);
|
|
387
491
|
if (this.scheduled429Retry || abort || this.isDeviceRegistered()) {
|
|
388
492
|
return;
|
|
@@ -393,7 +497,7 @@ export class Registration {
|
|
|
393
497
|
return;
|
|
394
498
|
}
|
|
395
499
|
if (!this.isDeviceRegistered()) {
|
|
396
|
-
await this.restartRegistration(
|
|
500
|
+
await this.restartRegistration(loggerContext.method);
|
|
397
501
|
}
|
|
398
502
|
else {
|
|
399
503
|
this.failbackTimer = undefined;
|
|
@@ -401,10 +505,7 @@ export class Registration {
|
|
|
401
505
|
}
|
|
402
506
|
}
|
|
403
507
|
else {
|
|
404
|
-
log.info('Active calls present or primary Mobius is down, deferring failback to next cycle.',
|
|
405
|
-
file: REGISTRATION_FILE,
|
|
406
|
-
method: this.executeFailback.name,
|
|
407
|
-
});
|
|
508
|
+
log.info('Active calls present or primary Mobius is down, deferring failback to next cycle.', loggerContext);
|
|
408
509
|
this.failbackTimer = undefined;
|
|
409
510
|
this.initiateFailback();
|
|
410
511
|
}
|
|
@@ -434,12 +535,18 @@ export class Registration {
|
|
|
434
535
|
this.registrationStatus = value;
|
|
435
536
|
}
|
|
436
537
|
async restartRegistration(caller) {
|
|
538
|
+
const loggerContext = {
|
|
539
|
+
file: REGISTRATION_FILE,
|
|
540
|
+
method: METHODS.RESTART_REGISTRATION,
|
|
541
|
+
};
|
|
542
|
+
log.info(`${METHOD_START_MESSAGE} - caller: ${caller}`, loggerContext);
|
|
437
543
|
this.clearFailbackTimer();
|
|
438
544
|
this.failback429RetryAttempts = 0;
|
|
439
545
|
const abort = await this.attemptRegistrationWithServers(caller, this.primaryMobiusUris);
|
|
440
546
|
if (!abort && !this.isDeviceRegistered()) {
|
|
441
547
|
await this.startFailoverTimer();
|
|
442
548
|
}
|
|
549
|
+
log.log(`restartRegistration completed - caller: ${caller}, deviceRegistered: ${this.isDeviceRegistered()}, abort: ${abort}`, loggerContext);
|
|
443
550
|
}
|
|
444
551
|
async handleConnectionRestoration(retry) {
|
|
445
552
|
log.info(METHOD_START_MESSAGE, {
|
|
@@ -492,7 +599,13 @@ export class Registration {
|
|
|
492
599
|
};
|
|
493
600
|
}
|
|
494
601
|
async triggerRegistration() {
|
|
602
|
+
const loggerContext = {
|
|
603
|
+
file: REGISTRATION_FILE,
|
|
604
|
+
method: METHODS.TRIGGER_REGISTRATION,
|
|
605
|
+
};
|
|
606
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
495
607
|
if (await this.resumeFailover()) {
|
|
608
|
+
log.info('Registration trigger handled by resumeFailover path', loggerContext);
|
|
496
609
|
return;
|
|
497
610
|
}
|
|
498
611
|
if (this.primaryMobiusUris.length > 0) {
|
|
@@ -500,43 +613,51 @@ export class Registration {
|
|
|
500
613
|
if (!this.isDeviceRegistered() && !abort) {
|
|
501
614
|
await this.startFailoverTimer();
|
|
502
615
|
}
|
|
616
|
+
log.log(`triggerRegistration completed - deviceRegistered: ${this.isDeviceRegistered()}, abort: ${abort}`, loggerContext);
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
log.warn('triggerRegistration skipped: no primary Mobius URIs available', loggerContext);
|
|
503
620
|
}
|
|
504
621
|
}
|
|
505
622
|
async attemptRegistrationWithServers(caller, servers = this.primaryMobiusUris) {
|
|
623
|
+
const loggerContext = {
|
|
624
|
+
file: REGISTRATION_FILE,
|
|
625
|
+
method: REGISTER_UTIL,
|
|
626
|
+
};
|
|
506
627
|
let abort = false;
|
|
507
628
|
this.retryAfter = undefined;
|
|
629
|
+
let connectedWebSocketUrl;
|
|
508
630
|
if (this.failoverImmediately) {
|
|
509
631
|
return abort;
|
|
510
632
|
}
|
|
511
633
|
if (this.isDeviceRegistered()) {
|
|
512
|
-
log.info(`[${caller}] : Device already registered with : ${this.activeMobiusUrl}`,
|
|
513
|
-
file: REGISTRATION_FILE,
|
|
514
|
-
method: REGISTER_UTIL,
|
|
515
|
-
});
|
|
634
|
+
log.info(`[${caller}] : Device already registered with : ${this.activeMobiusUrl}`, loggerContext);
|
|
516
635
|
return abort;
|
|
517
636
|
}
|
|
637
|
+
if (servers.length) {
|
|
638
|
+
this.apiRequest.setSocketEnabled(servers[0].startsWith('wss://'));
|
|
639
|
+
}
|
|
518
640
|
for (const url of servers) {
|
|
519
|
-
const serverType =
|
|
520
|
-
(this.backupMobiusUris?.includes(url) && 'BACKUP') ||
|
|
521
|
-
'UNKNOWN';
|
|
641
|
+
const serverType = this.getServerType(url);
|
|
522
642
|
try {
|
|
523
643
|
abort = false;
|
|
524
644
|
this.registrationStatus = RegistrationStatus.INACTIVE;
|
|
525
645
|
this.lineEmitter(LINE_EVENTS.CONNECTING);
|
|
526
|
-
log.info(`[${caller}] : Mobius url to contact: ${url}`,
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
646
|
+
log.info(`[${caller}] : Mobius url to contact: ${url}`, loggerContext);
|
|
647
|
+
if (this.apiRequest.isSocketEnabled()) {
|
|
648
|
+
const wssNormalizedUrl = url.endsWith('/') ? url.slice(0, -1) : url;
|
|
649
|
+
log.info(`[${caller}] : Connecting to Mobius WebSocket - serverType: ${serverType}, wssUrl: ${wssNormalizedUrl}`, loggerContext);
|
|
650
|
+
connectedWebSocketUrl = await this.apiRequest.connectToMobiusSocket(wssNormalizedUrl);
|
|
651
|
+
connectedWebSocketUrl = connectedWebSocketUrl ? `${connectedWebSocketUrl}/` : undefined;
|
|
652
|
+
log.log(`[${caller}] : Mobius WebSocket connected - serverType: ${serverType}, connectedWebSocketUrl: ${connectedWebSocketUrl}`, loggerContext);
|
|
653
|
+
}
|
|
530
654
|
const resp = await this.postRegistration(url);
|
|
531
655
|
this.clearFailoverState();
|
|
532
656
|
this.deviceInfo = resp.body;
|
|
533
657
|
this.registrationStatus = RegistrationStatus.ACTIVE;
|
|
534
|
-
this.setActiveMobiusUrl(url);
|
|
658
|
+
this.setActiveMobiusUrl(connectedWebSocketUrl || url);
|
|
535
659
|
this.lineEmitter(LINE_EVENTS.REGISTERED, resp.body);
|
|
536
|
-
log.log(`Registration successful for deviceId: ${this.deviceInfo.device?.deviceId} userId: ${this.userId} responseTrackingId: ${resp.headers?.trackingid}`,
|
|
537
|
-
file: REGISTRATION_FILE,
|
|
538
|
-
method: METHODS.REGISTER,
|
|
539
|
-
});
|
|
660
|
+
log.log(`Registration successful for deviceId: ${this.deviceInfo.device?.deviceId} userId: ${this.userId} responseTrackingId: ${resp.headers?.trackingid}`, loggerContext);
|
|
540
661
|
this.setIntervalValues(this.deviceInfo);
|
|
541
662
|
this.metricManager.setDeviceInfo(this.deviceInfo);
|
|
542
663
|
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, caller, serverType, resp.headers?.trackingid ?? '', undefined, undefined);
|
|
@@ -546,22 +667,32 @@ export class Registration {
|
|
|
546
667
|
}
|
|
547
668
|
catch (err) {
|
|
548
669
|
const body = err;
|
|
549
|
-
|
|
550
|
-
if (
|
|
670
|
+
const { finalError, shouldDisconnect } = await handleRegistrationErrors(body, (clientError, isFinalError) => {
|
|
671
|
+
if (isFinalError) {
|
|
551
672
|
this.lineEmitter(LINE_EVENTS.ERROR, undefined, clientError);
|
|
552
673
|
}
|
|
553
674
|
else {
|
|
554
675
|
this.lineEmitter(LINE_EVENTS.UNREGISTERED);
|
|
555
676
|
}
|
|
556
677
|
this.metricManager.submitRegistrationMetric(METRIC_EVENT.REGISTRATION_ERROR, REG_ACTION.REGISTER, METRIC_TYPE.BEHAVIORAL, caller, serverType, body.headers?.trackingid ?? '', undefined, clientError);
|
|
557
|
-
}, { method: caller, file: REGISTRATION_FILE },
|
|
678
|
+
}, { method: caller, file: REGISTRATION_FILE }, {
|
|
679
|
+
retry429Cb: (retryAfter, retryCaller) => this.handle429Retry(retryAfter, retryCaller),
|
|
680
|
+
restoreRegCb: this.restoreRegistrationCallBack(),
|
|
681
|
+
}, servers.length);
|
|
682
|
+
abort = finalError;
|
|
558
683
|
if (this.registrationStatus === RegistrationStatus.ACTIVE) {
|
|
559
|
-
log.info(`[${caller}] : Device is already restored, active mobius url: ${this.activeMobiusUrl}`,
|
|
560
|
-
file: REGISTRATION_FILE,
|
|
561
|
-
method: this.attemptRegistrationWithServers.name,
|
|
562
|
-
});
|
|
684
|
+
log.info(`[${caller}] : Device is already restored, active mobius url: ${this.activeMobiusUrl}`, loggerContext);
|
|
563
685
|
break;
|
|
564
686
|
}
|
|
687
|
+
if (shouldDisconnect && this.apiRequest.isSocketEnabled()) {
|
|
688
|
+
connectedWebSocketUrl = undefined;
|
|
689
|
+
log.info(`[${caller}] : Tearing down Mobius WebSocket after registration error - serverType: ${serverType}`, loggerContext);
|
|
690
|
+
await this.apiRequest.disconnectFromMobiusSocket({
|
|
691
|
+
code: 3050,
|
|
692
|
+
reason: 'done (permanent)',
|
|
693
|
+
});
|
|
694
|
+
log.log(`[${caller}] : Mobius WebSocket disconnect complete after registration error - serverType: ${serverType}`, loggerContext);
|
|
695
|
+
}
|
|
565
696
|
if (abort) {
|
|
566
697
|
this.setStatus(RegistrationStatus.INACTIVE);
|
|
567
698
|
await uploadLogs();
|
|
@@ -576,7 +707,6 @@ export class Registration {
|
|
|
576
707
|
const RETRY_COUNT_THRESHOLD = this.isCCFlow ? 4 : 5;
|
|
577
708
|
await this.mutex.runExclusive(async () => {
|
|
578
709
|
if (this.isDeviceRegistered()) {
|
|
579
|
-
const accessToken = await this.webex.credentials.getUserToken();
|
|
580
710
|
if (!this.webWorker) {
|
|
581
711
|
const blob = new Blob([webWorkerStr], { type: 'application/javascript' });
|
|
582
712
|
const blobUrl = URL.createObjectURL(blob);
|
|
@@ -584,17 +714,38 @@ export class Registration {
|
|
|
584
714
|
URL.revokeObjectURL(blobUrl);
|
|
585
715
|
this.webWorker.postMessage({
|
|
586
716
|
type: WorkerMessageType.START_KEEPALIVE,
|
|
587
|
-
accessToken: String(accessToken),
|
|
588
|
-
deviceUrl: String(this.webex.internal.device.url),
|
|
589
717
|
interval,
|
|
590
718
|
retryCountThreshold: RETRY_COUNT_THRESHOLD,
|
|
591
|
-
url,
|
|
592
719
|
});
|
|
593
720
|
this.webWorker.onmessage = async (event) => {
|
|
594
721
|
const logContext = {
|
|
595
722
|
file: REGISTRATION_FILE,
|
|
596
723
|
method: KEEPALIVE_UTIL,
|
|
597
724
|
};
|
|
725
|
+
if (event.data.type === WorkerMessageType.SEND_KEEPALIVE) {
|
|
726
|
+
try {
|
|
727
|
+
const res = await this.postKeepAlive(String(this.webex.internal.device.url), url);
|
|
728
|
+
this.webWorker?.postMessage({
|
|
729
|
+
type: WorkerMessageType.KEEPALIVE_RESULT,
|
|
730
|
+
statusCode: res.statusCode,
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
catch (err) {
|
|
734
|
+
const error = {
|
|
735
|
+
headers: {
|
|
736
|
+
trackingid: err.headers?.trackingid,
|
|
737
|
+
'retry-after': err.headers['retry-after'],
|
|
738
|
+
},
|
|
739
|
+
statusCode: err.statusCode,
|
|
740
|
+
statusText: err.statusText,
|
|
741
|
+
type: err.type,
|
|
742
|
+
};
|
|
743
|
+
this.webWorker?.postMessage({
|
|
744
|
+
type: WorkerMessageType.KEEPALIVE_RESULT,
|
|
745
|
+
err: error,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
598
749
|
if (event.data.type === WorkerMessageType.KEEPALIVE_SUCCESS) {
|
|
599
750
|
log.info(`Sent Keepalive, status: ${event.data.statusCode}`, logContext);
|
|
600
751
|
this.lineEmitter(LINE_EVENTS.RECONNECTED);
|
|
@@ -602,12 +753,18 @@ export class Registration {
|
|
|
602
753
|
if (event.data.type === WorkerMessageType.KEEPALIVE_FAILURE) {
|
|
603
754
|
const error = event.data.err;
|
|
604
755
|
log.warn(`Keep-alive missed ${event.data.keepAliveRetryCount} times. Status -> ${error.statusCode} `, logContext);
|
|
605
|
-
const abort = await handleRegistrationErrors(error, (clientError, finalError) => {
|
|
756
|
+
const { finalError: abort, handledByCallback } = await handleRegistrationErrors(error, (clientError, finalError) => {
|
|
606
757
|
if (finalError) {
|
|
607
758
|
this.lineEmitter(LINE_EVENTS.ERROR, undefined, clientError);
|
|
608
759
|
}
|
|
609
760
|
this.metricManager.submitRegistrationMetric(METRIC_EVENT.KEEPALIVE_ERROR, REG_ACTION.KEEPALIVE_FAILURE, METRIC_TYPE.BEHAVIORAL, KEEPALIVE_UTIL, serverType, error.headers?.trackingid ?? '', event.data.keepAliveRetryCount, clientError);
|
|
610
|
-
}, { method: KEEPALIVE_UTIL, file: REGISTRATION_FILE },
|
|
761
|
+
}, { method: KEEPALIVE_UTIL, file: REGISTRATION_FILE }, {
|
|
762
|
+
retry429Cb: (retryAfter, retryCaller) => this.handle429Retry(retryAfter, retryCaller),
|
|
763
|
+
sessionSupersededCb: (clientError) => this.handle409KeepaliveFailure(clientError, error, serverType, event.data.keepAliveRetryCount),
|
|
764
|
+
});
|
|
765
|
+
if (handledByCallback) {
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
611
768
|
if (abort || event.data.keepAliveRetryCount >= RETRY_COUNT_THRESHOLD) {
|
|
612
769
|
this.failoverImmediately = this.isCCFlow;
|
|
613
770
|
this.setStatus(RegistrationStatus.INACTIVE);
|
|
@@ -641,19 +798,25 @@ export class Registration {
|
|
|
641
798
|
isReconnectPending() {
|
|
642
799
|
return this.reconnectPending;
|
|
643
800
|
}
|
|
644
|
-
async deregister() {
|
|
801
|
+
async deregister(closeMobiusWss = false) {
|
|
802
|
+
const loggerContext = {
|
|
803
|
+
file: REGISTRATION_FILE,
|
|
804
|
+
method: METHODS.DEREGISTER,
|
|
805
|
+
};
|
|
806
|
+
log.info(METHOD_START_MESSAGE, loggerContext);
|
|
645
807
|
try {
|
|
646
808
|
await this.deleteRegistration(this.activeMobiusUrl, this.deviceInfo.device?.deviceId, this.deviceInfo.device?.clientDeviceUri);
|
|
647
|
-
log.log('Registration successfully deregistered',
|
|
648
|
-
file: REGISTRATION_FILE,
|
|
649
|
-
method: METHODS.DEREGISTER,
|
|
650
|
-
});
|
|
809
|
+
log.log('Registration successfully deregistered', loggerContext);
|
|
651
810
|
}
|
|
652
811
|
catch (err) {
|
|
653
|
-
log.warn(`Delete failed with Mobius: ${JSON.stringify(err)}`,
|
|
654
|
-
|
|
655
|
-
|
|
812
|
+
log.warn(`Delete failed with Mobius: ${JSON.stringify(err)}`, loggerContext);
|
|
813
|
+
}
|
|
814
|
+
if (closeMobiusWss) {
|
|
815
|
+
await this.apiRequest.disconnectFromMobiusSocket({
|
|
816
|
+
code: 3050,
|
|
817
|
+
reason: 'done (permanent)',
|
|
656
818
|
});
|
|
819
|
+
log.log('Mobius socket disconnect complete after deregistration', loggerContext);
|
|
657
820
|
}
|
|
658
821
|
this.clearKeepaliveTimer();
|
|
659
822
|
this.setStatus(RegistrationStatus.INACTIVE);
|
|
@@ -675,7 +838,11 @@ export class Registration {
|
|
|
675
838
|
rehomingIntervalMin: DEFAULT_REHOMING_INTERVAL_MIN,
|
|
676
839
|
};
|
|
677
840
|
const stringToReplace = `${DEVICES_ENDPOINT_RESOURCE}/${restoreData.devices[0].deviceId}`;
|
|
678
|
-
|
|
841
|
+
let uri = restoreData.devices[0].uri.replace(stringToReplace, '');
|
|
842
|
+
if (this.apiRequest.isSocketEnabled()) {
|
|
843
|
+
uri = uri.replace('https://', 'wss://');
|
|
844
|
+
uri = !uri.endsWith('/') ? `${uri}/` : uri;
|
|
845
|
+
}
|
|
679
846
|
this.setActiveMobiusUrl(uri);
|
|
680
847
|
this.registrationStatus = RegistrationStatus.ACTIVE;
|
|
681
848
|
return true;
|
|
@@ -701,5 +868,48 @@ export class Registration {
|
|
|
701
868
|
}
|
|
702
869
|
}
|
|
703
870
|
}
|
|
871
|
+
async handleRegistrationDownEvent(event) {
|
|
872
|
+
const loggerContext = {
|
|
873
|
+
file: REGISTRATION_FILE,
|
|
874
|
+
method: METHODS.HANDLE_REGISTRATION_DOWN_EVENT,
|
|
875
|
+
};
|
|
876
|
+
log.info(`Registration down received - trackingId: ${event?.trackingId ?? 'unknown'}, eventId: ${event?.eventId ?? 'unknown'}`, loggerContext);
|
|
877
|
+
const [activeCall] = Object.values(this.callManager.getActiveCalls());
|
|
878
|
+
activeCall?.end();
|
|
879
|
+
await this.registrationCleanup(METHODS.HANDLE_REGISTRATION_DOWN_EVENT, {
|
|
880
|
+
reason: HARD_STOP_REASON.REGISTRATION_DOWN,
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
async registrationCleanup(caller, hardStop) {
|
|
884
|
+
const loggerContext = {
|
|
885
|
+
file: REGISTRATION_FILE,
|
|
886
|
+
method: caller,
|
|
887
|
+
};
|
|
888
|
+
log.info(`[${caller}] : Running ${hardStop.reason} cleanup`, loggerContext);
|
|
889
|
+
await this.mutex.runExclusive(async () => {
|
|
890
|
+
this.clearFailbackTimer();
|
|
891
|
+
this.clearKeepaliveTimer();
|
|
892
|
+
this.reconnectPending = false;
|
|
893
|
+
this.scheduled429Retry = false;
|
|
894
|
+
this.failoverImmediately = false;
|
|
895
|
+
this.retryAfter = undefined;
|
|
896
|
+
this.registerRetry = false;
|
|
897
|
+
this.clearFailoverState();
|
|
898
|
+
this.setStatus(RegistrationStatus.INACTIVE);
|
|
899
|
+
if (this.apiRequest.isSocketEnabled()) {
|
|
900
|
+
try {
|
|
901
|
+
await this.apiRequest.disconnectFromMobiusSocket({
|
|
902
|
+
code: 3050,
|
|
903
|
+
reason: 'done (permanent)',
|
|
904
|
+
});
|
|
905
|
+
log.log(`Mobius socket disconnect complete after ${hardStop.reason}`, loggerContext);
|
|
906
|
+
}
|
|
907
|
+
catch (err) {
|
|
908
|
+
log.warn(`Mobius socket disconnect failed after ${hardStop.reason}: ${String(err)}`, loggerContext);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
this.lineEmitter(LINE_EVENTS.UNREGISTERED, undefined, hardStop.error);
|
|
912
|
+
});
|
|
913
|
+
}
|
|
704
914
|
}
|
|
705
915
|
export const createRegistration = (webex, serviceData, mutex, lineEmitter, logLevel, jwe) => new Registration(webex, serviceData, mutex, lineEmitter, logLevel, jwe);
|