feat(calling): CAI 7842 event listener setup#4876
feat(calling): CAI 7842 event listener setup#4876Kesari3008 merged 6 commits intowebex:mobius-socketfrom
Conversation
💡 Codex Review
webex-js-sdk/packages/calling/src/CallingClient/CallingClient.ts Lines 761 to 765 in d5681cc The webex-js-sdk/packages/calling/src/CallingClient/utils/request.ts Lines 66 to 68 in d5681cc In WS mode, webex-js-sdk/packages/calling/src/common/Utils.ts Lines 222 to 223 in d5681cc The discovery helper unconditionally appends a test WSS host ( ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
…into CAI-7842-Event-Listener-Setup
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc76b74e5e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| file: CALLING_CLIENT_FILE, | ||
| method: METHODS.REGISTER_MOBIUS_SOCKET_LISTENER, | ||
| }); | ||
| this.sdkConnector.registerMobiusSocketListener('async_event', this.handleMobiusAsyncEvent); |
There was a problem hiding this comment.
Subscribe to the correct Mobius socket event key
registerMobiusSocketListener() subscribes to "async_event", but the Mobius socket emits typed messages as "event:${envelope.type}" (see packages/@webex/internal-plugin-mobius-socket/src/mobius-socket.js, _onmessage, lines 1009-1012). In socket-enabled deployments this listener never receives async envelopes, so handleMobiusAsyncEvent() is bypassed and call/registration routing from the Mobius stream does not occur.
Useful? React with 👍 / 👎.
| if (eventType === MobiusEventType.REGISTRATION_DOWN) { | ||
| // TODO: Handle registration down event | ||
| // const line = Object.values(this.lineDict)[0]; | ||
| // line.registration.handleRegistrationDownEvent(event); | ||
|
|
||
| return; |
There was a problem hiding this comment.
Handle registration.down instead of dropping it
The new registration.down branch exits immediately with a TODO, so the client ignores backend notifications that a device registration became inactive. In that scenario no reconnect path is triggered from this event, which can leave the line unregistered and unable to place/receive calls until some unrelated recovery flow runs.
Useful? React with 👍 / 👎.
| /** | ||
| * @param event - TODO. | ||
| * @param cb - TODO. | ||
| */ | ||
| public registerMobiusSocketListener<T>(event: string, cb: (data?: T) => void): void { | ||
| if (!mobiusSocket) { | ||
| mobiusSocket = getMobiusSocketInstance(instance.getWebex()); | ||
| } | ||
| mobiusSocket.on(event, (data: T) => { | ||
| cb(data); | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * @param event - TODO. | ||
| */ | ||
| public unregisterMobiusSocketListener(event: string): void { | ||
| if (!mobiusSocket) { | ||
| mobiusSocket = getMobiusSocketInstance(instance.getWebex()); | ||
| } | ||
| mobiusSocket.off(event); | ||
| } | ||
| } |
There was a problem hiding this comment.
We don't have to make this listener available through sdkConnector. These can be utilized directly inside the CallingClient
SDKConnector we are using because we were consuming internal plugin services through it but for mobius socket we don't need this route
| private listenForWsEvents() { | ||
| this.sdkConnector.registerListener('event:mobius', async (event) => { | ||
| this.dequeueWsEvents(event); | ||
| }); | ||
| log.info('Successfully registered listener for Mobius events', { | ||
| file: CALL_MANAGER_FILE, | ||
| method: METHODS.REGISTER_SESSIONS_LISTENER, | ||
| }); | ||
| } |
There was a problem hiding this comment.
We have to put this method call also behind the feature flag
There was a problem hiding this comment.
This is taken care of
| file: CALLING_CLIENT_FILE, | ||
| method: METHODS.REGISTER_MOBIUS_SOCKET_LISTENER, | ||
| }); | ||
| this.sdkConnector.registerMobiusSocketListener('async_event', this.handleMobiusAsyncEvent); |
There was a problem hiding this comment.
| this.sdkConnector.registerMobiusSocketListener('async_event', this.handleMobiusAsyncEvent); | |
| this.sdkConnector.registerMobiusSocketListener('event:async_event', this.handleMobiusAsyncEvent); |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 167cea1f6c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (this.isMobiusSocketEnabled) { | ||
| this.sdkConnector.registerListener('event:mobius', async (event) => { | ||
| this.dequeueWsEvents(event); |
There was a problem hiding this comment.
Keep Mercury call listener active when socket flag is off
listenForWsEvents() now registers event:mobius only when isMobiusSocketEnabled is true, but the default path (isWsFeatureEnabled(...) === false and no override) sets that flag to false. In that common configuration, CallManager never subscribes to event:mobius, and there is no alternate non-socket listener registration elsewhere, so inbound call setup/progress/disconnect events are never routed through dequeueWsEvents().
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7a53d4ecf1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!this.isMobiusSocketEnabled) { | ||
| this.sdkConnector.registerListener('event:mobius', async (event) => { |
There was a problem hiding this comment.
Preserve Mercury fallback when Mobius socket is disconnected
listenForWsEvents() now skips event:mobius subscription whenever isMobiusSocketEnabled is true, but socket setup is explicitly non-fatal (connectToMobiusSocket() logs and continues when no WSS URI is available or all connects fail). In that scenario the client has neither a live Mobius-socket stream nor a Mercury fallback, so incoming call lifecycle events are never dequeued and call state stops updating. Please keep Mercury routing enabled until a socket connection is actually established (or re-enable it on socket failure).
Useful? React with 👍 / 👎.
rarajes2
left a comment
There was a problem hiding this comment.
Pending comments can be taken care in later PR, we can merge the PR if feature is working partially.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ebfc37af99
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!callManager) { | ||
| callManager = new CallManager(webex, indicator); | ||
| callManager = new CallManager(webex, indicator, isMobiusSocketEnabled); | ||
| } |
There was a problem hiding this comment.
Reinitialize CallManager when socket mode changes
getCallManager() now accepts isMobiusSocketEnabled, but it only applies that flag on first construction (if (!callManager) ...). Any later createClient() call with a different socket mode reuses the stale singleton, so listener wiring can be wrong for that client (e.g., first init without socket, later init with socket can process both Mercury and socket events; first init with socket, later init without socket can miss Mercury routing). This regression is introduced by the new constructor parameter being ignored after the first call.
Useful? React with 👍 / 👎.
COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7842
This pull request addresses
Event listener refactor for Mobius Socket
by making the following changes
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
I certified that
Make sure to have followed the contributing guidelines before submitting.