fix: route call accept/reject through delivering WS, not host URL
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.
This commit is contained in:
@@ -782,6 +782,10 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
|||||||
// Batch ALL call state into a single set() to prevent:
|
// Batch ALL call state into a single set() to prevent:
|
||||||
// 1. Ringtone multiplication (multiple subscription triggers from separate set() calls)
|
// 1. Ringtone multiplication (multiple subscription triggers from separate set() calls)
|
||||||
// 2. Stale callOrigin/federatedCallId from previous calls (always overwritten)
|
// 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({
|
useVoiceStore.setState({
|
||||||
incomingCall: {
|
incomingCall: {
|
||||||
dmChannelId: event.dmChannelId ?? null,
|
dmChannelId: event.dmChannelId ?? null,
|
||||||
@@ -791,7 +795,7 @@ function handleEvent(origin: string, event: ServerEvent): void {
|
|||||||
federatedCallToken: event.livekitToken ?? null,
|
federatedCallToken: event.livekitToken ?? null,
|
||||||
federatedCallUrl: event.livekitUrl ?? null,
|
federatedCallUrl: event.livekitUrl ?? null,
|
||||||
federatedCallId: event.federatedCallId ?? null,
|
federatedCallId: event.federatedCallId ?? null,
|
||||||
callOrigin: event.callOrigin ?? null,
|
callOrigin: origin,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user