From 40198f95dc385bf4b0c45e4a3a78b685b5d3dd83 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 8 Dec 2020 18:53:11 +0000 Subject: [PATCH] A hangup from another client is still valid if we're in the ringing state Fixes https://github.com/vector-im/element-web/issues/15933 --- src/webrtc/call.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index 4c0cbee22..d3286112f 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -1266,13 +1266,12 @@ export class MatrixCall extends EventEmitter { // party ID must match (our chosen partner hanging up the call) or be undefined (we haven't chosen // a partner yet but we're treating the hangup as a reject as per VoIP v0) - if (!this.partyIdMatches(msg) && this.opponentPartyId !== undefined) { + if (this.partyIdMatches(msg) || this.opponentPartyId === undefined || this.state === CallState.Ringing) { + // default reason is user_hangup + this.terminate(CallParty.Remote, msg.reason || CallErrorCode.UserHangup, true); + } else { logger.info(`Ignoring message from party ID ${msg.party_id}: our partner is ${this.opponentPartyId}`); - return; } - - // default reason is user_hangup - this.terminate(CallParty.Remote, msg.reason || CallErrorCode.UserHangup, true); }; onRejectReceived = (msg) => {