fix(call): deliver incoming-call popup from any page and resolve glare server-side #117
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/global-call-popup-and-glare"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Previously the 1:1 call popup only rendered when the callee was already viewing the DM with the caller, because the call UI lived inside the DM template and call.js short-circuited when its per-DM cfg was unset. Two simultaneous invites in the same DM could also leave both peers in separate "calling" states because glare resolution relied on both clients comparing user ids, which only worked when both happened to be on the DM page at the same moment.
Lift the call root (incoming overlay + active overlay) into layout.html so the popup is reachable everywhere, expose window.__lcWS from the layout's wsOpen listener so non-DM pages can send signals, carry room/peer context on the DM-header start buttons, and serve the ICE-server config from a new /call/config endpoint instead of threading it through every page struct. Track per-DM ringing state in the Hub: the first invite wins, a second invite from the peer (glare) is dropped and the winner's invite is replayed back to the loser so their UI flips from outgoing to incoming, and terminating signals (accept/reject/cancel/hangup) plus a 60s TTL release the slot.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com