fix: prevent group call participants from disconnecting when another member answers/rejects

In group calls (e.g. Alice calls Bob and Charlie), when Bob accepts the
call, a CallAnswerEvent is gift-wrapped to all group members including
Charlie. Charlie's CallManager, still in IncomingCall state, was treating
ANY CallAnswerEvent as "answered elsewhere" (intended for multi-device
scenarios) and ending the call prematurely.

The fix checks whether the answering/rejecting peer is actually the
current user (signer.pubKey) before treating it as an "answered/rejected
elsewhere" event. If it's a different group member, we simply ignore it
and keep ringing.

https://claude.ai/code/session_01EYzWB93PZRqw15QuQadCf4
This commit is contained in:
Claude
2026-04-03 14:37:29 +00:00
parent d7eabf0f80
commit 4a529a304c
@@ -215,9 +215,12 @@ class CallManager(
}
is CallState.IncomingCall -> {
// Another device of this user answered the call — stop ringing.
if (callId != current.callId) return
transitionToEnded(current.callId, current.peerPubKeys(), EndReason.ANSWERED_ELSEWHERE)
if (answeringPeer == signer.pubKey) {
// Another device of this user answered the call — stop ringing.
transitionToEnded(current.callId, current.peerPubKeys(), EndReason.ANSWERED_ELSEWHERE)
}
// Otherwise another group member answered — we keep ringing.
}
is CallState.Connected -> {
@@ -273,9 +276,12 @@ class CallManager(
}
is CallState.IncomingCall -> {
// Another device of this user rejected the call — stop ringing.
if (callId != current.callId) return
transitionToEnded(current.callId, current.peerPubKeys(), EndReason.REJECTED)
if (rejectingPeer == signer.pubKey) {
// Another device of this user rejected the call — stop ringing.
transitionToEnded(current.callId, current.peerPubKeys(), EndReason.REJECTED)
}
// Otherwise another group member rejected — we keep ringing.
}
else -> {