What's fixed
#5347: Voice call broken after random disconnect
Three separate bugs in the voice rejoin path were combining to produce the reported symptoms: users invisible to each other after a network blip, audio silent in both directions, the voice bar still showing "Voice Connected" while the panel showed "No one in voice", needing two or three leave/rejoin cycles before voice recovered.
Server: voice-rejoin handler silently overwrote the voiceUsers entry
When a socket reconnected and sent voice-rejoin, the server clobbered the user's slot without first telling the rest of the room. Everyone else kept their stale RTCPeerConnection from the previous session, and the rejoiner's fresh offer was applied on top of dead ICE, so audio never recovered. The handler now mirrors voice-join's cleanup: kicks the previous socket cleanly, broadcasts voice-user-left so all peers tear down, then re-adds the user and triggers a fresh offer/answer round. Also preserves isMuted/isDeafened on rejoin, refreshes voiceLastActivity (AFK timer), and includes voiceBitrate in the response (matching voice-join).
Client: voice-offer accepted onto a failed/closed peer connection
Even with the server fix, if a peer connection's connectionState or iceConnectionState was already failed/closed, the client was applying the new offer on top of it instead of rebuilding. It now tears down and recreates the peer in that state.
Client: voice-leave retry race silently kicked users after rejoin
The 2-second ack-retry on voice-leave had no guard against the user having already rejoined. It would fire a stale leave for a channel the user was back in, kicking them out server-side while their client still showed connected. That is the exact symptom in the screenshot: voice bar says "Voice Connected #ANC", panel says "No one in voice". The retry now bails if the user has rejoined any voice channel.
Defensive: _createPeer now closes pre-existing peers before creating
Prevents a stale RTCPeerConnection from leaking a second audio element and analyser for the same userId.