CallManager class

Manages multi-call state within the Telnyx WebRTC SDK.

CallManager tracks which call is currently active (currentCall) and which calls are on hold (heldCalls). It mirrors the role that TelnyxCommon plays in the Android SDK, providing a centralised source of truth for call-related decisions such as "hold current and accept incoming" or "end current and unhold last".

Typical flow when a second call arrives:

  1. The app receives an invite event via TelnyxClient.onSocketMessageReceived.
  2. The app checks currentCall – if it is non-null, a call is already active.
  3. The app decides how to handle the incoming call:
  4. When the active call ends (endCurrentAndUnholdLast), any held call is automatically restored as the new active call.

Constructors

CallManager()

Properties

currentCall Call?
The call that is currently active (not on hold).
no setter
currentCallStream Stream<Call?>
A broadcast stream that emits whenever currentCall changes.
no setter
hasActiveCall bool
Whether there is an active (non-held) call.
no setter
hashCode int
The hash code for this object.
no setterinherited
heldCalls List<Call>
An unmodifiable view of the calls currently on hold.
no setter
heldCallsStream Stream<List<Call>>
A broadcast stream that emits whenever heldCalls changes.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Dispose all stream controllers. Call this when the TelnyxClient is disconnected and will no longer be used.
endCurrentAndAcceptIncoming(String incomingCallId, {required void endCall(String callId), required Call acceptCall(String callId)}) Call
Ends the current active call and accepts an incoming call.
endCurrentAndUnholdLast(String callId) → void
Ends the specified call and, if there is a held call, unholds the last one and makes it the new currentCall.
getLastHeldCall() Call?
Returns the last held call, or null if there are no held calls.
holdCurrentAndAcceptIncoming(String incomingCallId, Call acceptCall(String callId)) Call
Holds the current active call (if any) and accepts an incoming call.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onByeReceived(String callId) → void
Handles a remote BYE for the given callId.
onIncomingCallRejected(String callId) → void
Rejects an incoming call by sending BYE with USER_BUSY cause.
registerCall(Call call) → void
Registers a call so that its hold-status is observed.
setCurrentCall(Call? call) → void
Sets call as the current active call.
toString() String
A string representation of this object.
inherited
unregisterCall(String? callId) → void
Unregisters a call, removing it from held-calls tracking.

Operators

operator ==(Object other) bool
The equality operator.
inherited