From 9ecc0f5d957ee2f6f75b48e3b038421fff148aaa Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 26 Mar 2021 13:52:23 +0000 Subject: [PATCH] Terminate calls once we've replaced them --- src/webrtc/call.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index c5d370499..4f8290a85 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -1547,7 +1547,9 @@ export class MatrixCall extends EventEmitter { create_call: replacementId, } as MCallReplacesEvent; - return this.sendVoipEvent(EventType.CallReplaces, body); + await this.sendVoipEvent(EventType.CallReplaces, body); + + await this.terminate(CallParty.Local, CallErrorCode.Replaced, true); } /* @@ -1585,6 +1587,8 @@ export class MatrixCall extends EventEmitter { } as MCallReplacesEvent; await this.sendVoipEvent(EventType.CallReplaces, bodyToTransferee); + + await this.terminate(CallParty.Local, CallErrorCode.Replaced, true); } private async terminate(hangupParty: CallParty, hangupReason: CallErrorCode, shouldEmit: boolean) {