Call class

The Call class which is used for call related methods such as hold/mute or creating invitations, declining calls, etc.

Constructors

Call(TxSocket txSocket, TelnyxClient _txClient, String sessid, String ringToneFile, String ringBackFile, CallHandler callHandler, Function callEnded, bool debug, {AudioService? audioService})
Creates a call instance.

Properties

audioService → AudioService
AudioService instance to handle audio playback (lazy initialized)
no setter
callEnded → Function
Callback function that gets invoked when the call ends
final
callHandler ↔ CallHandler
CallHandler Instance - Single Source of Truth for State Management
getter/setter pair
callId ↔ String?
The unique identifier for the call, used to track the call session
getter/setter pair
callState ↔ CallState
Current Call State - Managed by CallHandler
getter/setter pair
customHeaders ↔ Map<String, String>
Custom SIP headers to be sent with the call
getter/setter pair
debug → bool
Debug mode flag to enable call quality metrics
final
hasAudioService → bool
Whether this call has allocated audio playback resources.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isReconnection ↔ bool
Indicates whether this call is a reconnection (attach) or initial connection
getter/setter pair
onCallQualityChange ↔ CallQualityChangeCallback?
Callback for call quality metrics updates. This will be called periodically with updated metrics when debug mode is enabled.
getter/setter pair
onHold ↔ bool
Indicates whether the call is currently on hold
getter/setter pair
peerConnection ↔ Peer?
The Peer connection instance used for WebRTC communication
getter/setter pair
recoveredCallId ↔ String?
The call ID of a previous (pre-restart) call that this call was recovered from, used to correlate a restored call with the one that was persisted in the active-calls recovery marker (VSDK-418). Null for fresh calls.
getter/setter pair
resolvedDatacenter ↔ String?
Authoritative signaling datacenter retained across ATTACH recovery.
getter/setter pair
ringBackFile → String
The file path for the ringback audio file (audio played when calling)
final
ringToneFile → String
The file path for the ringtone audio file (audio played when receiving a call)
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessid → String
Session ID for the current call
final
sessionCallerName ↔ String
The caller's name for the current session
getter/setter pair
sessionCallerNumber ↔ String
The caller's number for the current session
getter/setter pair
sessionClientState ↔ String
The client state for the current session, used to pass custom data
getter/setter pair
sessionDestinationNumber ↔ String
The destination number for the current session
getter/setter pair
speakerPhone ↔ bool
Indicates whether the call is currently using speaker phone
getter/setter pair
telnyxCallControlId ↔ String?
The Telnyx Call Control ID for this call.
getter/setter pair
telnyxLegId ↔ String?
Telnyx leg identifier received from signaling.
getter/setter pair
telnyxSessionId ↔ String?
Telnyx session identifier received from signaling.
getter/setter pair
txSocket → TxSocket
The TxSocket instance used for sending messages to the Telnyx WebRTC server
final

Methods

acceptCall(IncomingInviteParams invite, String callerName, String callerNumber, String clientState, {bool isAttach = false, Map<String, String> customHeaders = const {}, bool debug = false, bool useTrickleIce = false, String? answeredDeviceToken, bool forceRelayCandidateForRecovery = false}) → Call
Accepts the incoming call specified via the invite parameter, sending your local specified callerName, callerNumber and clientState
callQualityMetricsHandler(CallQualityMetrics metrics) → void
Handles call quality metrics updates.
dtmf(String tone) → void
Sends a DTMF message with the chosen tone to the call specified via the callID
enableSpeakerPhone(bool enable) → void
Enables or disables the speakerphone based on the enable parameter
endCall() → void
Attempts to end the call identified via the callID
initCallMetrics() → void
Initializes call metrics tracking by setting the callback for call quality changes.
newInvite(String callerName, String callerNumber, String destinationNumber, String clientState, {Map<String, String> customHeaders = const {}, List<AudioCodec>? preferredCodecs, bool debug = false}) → void
Creates an invitation to send to a destinationNumber or SIP Destination using the provided callerName, callerNumber and a clientState
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onHoldUnholdPressed() → void
Either places the call on hold, or unholds the call based on the current hold state.
onMuteUnmutePressed() → void
Either mutes or unmutes local audio based on the current mute state
onRemoteSessionReceived(String? sdp) → void
Handles the remote session received from the peer connection.
playAudio(String filePath) → void
Plays an audio file from the assets directory. Example file path for '/assets/audio/sound.wav'
playRingtone(String filePath) → void
Play ringtone for only web, iOS and Android will use native audio player
restartIce() → bool
Triggers a WebRTC ICE restart for this call by starting an ICE renegotiation on the underlying peer connection.
sendConversationMessage(String message, {List<String>? base64Images, String? base64Image}) → void
AI Assistant Conversation Method. Sends a conversation message to an assistant agent with optional image attachments.
setMuteState(bool muted) → void
Sets the microphone mute state to a specific value.
stopAudio() → void
Stops the currently playing audio.
toString() → String
A string representation of this object.
inherited

Operators

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