From df2701b17f6b4b0b5bfeff82523e606723d2bcbe Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Wed, 8 Apr 2026 13:15:38 +0200 Subject: [PATCH] fix: route call accept/reject through delivering WS, not host URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit callOrigin was set to event.callOrigin (the HOST instance URL), which routed accept/reject through the multi-instance WS connection. On mobile hotspot or when the multi-instance WS drops, the accept is silently lost — the host never knows, the call stays ringing forever. Now callOrigin = origin (the WS that delivered dm_call_incoming). This is always connected. The server on that instance finds the FederatedCallEntry and relays to the host via S2S HTTP, which is reliable and independent of client WS state. --- packages/web/src/hooks/useWebSocket.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/web/src/hooks/useWebSocket.ts b/packages/web/src/hooks/useWebSocket.ts index 65e1f211..ddb9aba4 100644 --- a/packages/web/src/hooks/useWebSocket.ts +++ b/packages/web/src/hooks/useWebSocket.ts @@ -782,6 +782,10 @@ function handleEvent(origin: string, event: ServerEvent): void { // Batch ALL call state into a single set() to prevent: // 1. Ringtone multiplication (multiple subscription triggers from separate set() calls) // 2. Stale callOrigin/federatedCallId from previous calls (always overwritten) + // callOrigin = the WS origin that delivered this event, NOT event.callOrigin (the host). + // Routing accept/reject through this WS ensures the message reaches a connected server, + // which then relays to the host via S2S HTTP. Using event.callOrigin (the host URL) + // would route through the multi-instance WS, which may not be connected. useVoiceStore.setState({ incomingCall: { dmChannelId: event.dmChannelId ?? null, @@ -791,7 +795,7 @@ function handleEvent(origin: string, event: ServerEvent): void { federatedCallToken: event.livekitToken ?? null, federatedCallUrl: event.livekitUrl ?? null, federatedCallId: event.federatedCallId ?? null, - callOrigin: event.callOrigin ?? null, + callOrigin: origin, }); break; }