diff --git a/lib/src/voip/README.md b/lib/src/voip/README.md index f47911a3..7b864d8b 100644 --- a/lib/src/voip/README.md +++ b/lib/src/voip/README.md @@ -133,6 +133,8 @@ newCall.answer(); newCall.reject(); ``` +To reject a call locally but not send a event, use `newCall.reject(shouldEmit: false)` + ### 5.Render media stream The basic process of rendering a video stream is as follow code. diff --git a/lib/src/voip/call.dart b/lib/src/voip/call.dart index 2155dee7..5f01a432 100644 --- a/lib/src/voip/call.dart +++ b/lib/src/voip/call.dart @@ -1022,8 +1022,10 @@ class CallSession { } Logs().d('[VOIP] Rejecting call: $callId'); await terminate(CallParty.kLocal, CallErrorCode.UserHangup, shouldEmit); - await sendCallReject( - room, callId, Timeouts.lifetimeMs, localPartyId, reason); + if (shouldEmit) { + await sendCallReject( + room, callId, Timeouts.lifetimeMs, localPartyId, reason); + } } Future hangup([String? reason, bool suppressEvent = false]) async { diff --git a/lib/src/voip/voip.dart b/lib/src/voip/voip.dart index ed0b03cc..4a319ff0 100644 --- a/lib/src/voip/voip.dart +++ b/lib/src/voip/voip.dart @@ -224,8 +224,8 @@ class VoIP { if (!delegate.canHandleNewCall && (confId == null || confId != currentGroupCID)) { Logs().v( - '[glare] [VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.'); - await newCall.reject(reason: 'busy', shouldEmit: false); + '[VOIP] onCallInvite: Unable to handle new calls, maybe user is busy.'); + await newCall.reject(reason: CallErrorCode.UserBusy, shouldEmit: false); delegate.handleMissedCall(newCall); return; }