From 9b800db175aa10b6618cd0675e2c6ea8916286f6 Mon Sep 17 00:00:00 2001 From: Karthikeyan S Date: Fri, 6 Dec 2024 12:38:58 +0530 Subject: [PATCH] fix: rejecting a call doesn't send m.call.reject event --- lib/src/voip/call_session.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/voip/call_session.dart b/lib/src/voip/call_session.dart index 852dac8d..c11dbf30 100644 --- a/lib/src/voip/call_session.dart +++ b/lib/src/voip/call_session.dart @@ -937,7 +937,6 @@ class CallSession { /// This used to be done by calling hangup, but is a separate method and protocol /// event as of MSC2746. Future reject({CallErrorCode? reason, bool shouldEmit = true}) async { - setCallState(CallState.kEnding); if (state != CallState.kRinging && state != CallState.kFledgling) { Logs().e( '[VOIP] Call must be in \'ringing|fledgling\' state to reject! (current state was: ${state.toString()}) Calling hangup instead', @@ -946,6 +945,7 @@ class CallSession { return; } Logs().d('[VOIP] Rejecting call: $callId'); + setCallState(CallState.kEnding); await terminate(CallParty.kLocal, CallErrorCode.userHangup, shouldEmit); if (shouldEmit) { await sendCallReject(room, callId, localPartyId);