Skip to main content
CLASS

Call

A Call represents an audio or video communication session between two endpoints: WebRTC Clients, SIP clients, or phone numbers. The Call object manages the entire lifecycle of a call, from initiation to termination, handling both outbound and inbound calls. A Call object is created in two scenarios:
  1. When you initiate a new outbound call using TxClient’s newCall method
  2. When you receive an inbound call through the TxClientDelegate’s onIncomingCall callback

Key Features

  • Audio and video call support
  • Call state management (NEW, CONNECTING, RINGING, ACTIVE, HELD, DONE)
  • Mute/unmute functionality
  • DTMF tone sending
  • Custom headers support for both INVITE and ANSWER messages
  • Call statistics reporting when debug mode is enabled

Examples

Creating an Outbound Call:

Handling an Incoming Call:

Properties

onCallQualityChange

Callback for real-time call quality metrics This is triggered whenever new WebRTC statistics are available

inviteCustomHeaders

Custom headers received from the WebRTC INVITE message. These headers are passed during call initiation and can contain application-specific information. Format should be [“X-Header-Name”: “Value”] where header names must start with “X-”.

answerCustomHeaders

Custom headers received from the WebRTC ANSWER message. These headers are passed during call acceptance and can contain application-specific information. Format should be [“X-Header-Name”: “Value”] where header names must start with “X-”.

sessionId

The unique session identifier for the current WebRTC connection. This ID is established during client connection and remains constant for the session duration.

telnyxSessionId

The unique Telnyx session identifier for this call. This ID can be used to track the call in Telnyx’s systems and logs.

telnyxLegId

The unique Telnyx leg identifier for this call. A call can have multiple legs (e.g., in call transfers). This ID identifies this specific leg.

debug

Enables WebRTC statistics reporting for debugging purposes. When true, the SDK will collect and send WebRTC statistics to Telnyx servers. This is useful for troubleshooting call quality issues.

enableQualityMetrics

Enables CallQuality Metrics for Call

sendWebRTCStatsViaSocket

Controls whether the SDK should send WebRTC statistics via socket to Telnyx servers. When enabled, collected WebRTC stats will be sent to Telnyx servers for monitoring and debugging. This is independent of stats collection - stats can be collected without being sent via socket.

useTrickleIce

Controls whether the SDK should use trickle ICE for WebRTC signaling. When enabled, ICE candidates are sent individually as they are discovered, rather than waiting for all candidates to be gathered before sending the offer/answer.

forceRelayCandidate

Controls whether the SDK should force TURN relay for peer connections. When enabled, the SDK will only use TURN relay candidates for ICE gathering, which prevents the “local network access” permission popup from appearing.

enableCallReports

Enable automatic call quality reporting to voice-sdk-proxy. When enabled, WebRTC stats are collected periodically during calls and posted to the voice-sdk-proxy /call_report endpoint when the call ends.

callReportInterval

Interval in seconds for collecting call statistics. Stats are aggregated over each interval and stored locally until call end.

callReportLogLevel

Minimum log level to capture for call reports (“debug”, “info”, “warn”, “error”).

callReportMaxLogEntries

Maximum number of log entries to buffer per call.

callInfo

Contains essential information about the current call including:
  • callId: Unique identifier for this call
  • callerName: Display name of the caller
  • callerNumber: Phone number or SIP URI of the caller See TxCallInfo for complete details.

callState

The current state of the call. Possible values:
  • NEW: Call object created but not yet initiated
  • CONNECTING: Outbound call is being established
  • RINGING: Incoming call waiting to be answered
  • ACTIVE: Call is connected and media is flowing
  • HELD: Call is temporarily suspended
  • DONE: Call has ended
The state changes are notified through the CallProtocol delegate.

isMuted

Indicates whether the local audio is currently muted.
  • Returns: true if the call is muted (audio track disabled)
  • Returns: false if the call is not muted (audio track enabled)
Use muteAudio() and unmuteAudio() to change the mute state.

localStream

The local media stream containing audio and/or video tracks being sent to the remote party. This stream represents the media captured from the local device (microphone, camera). Can be used for audio visualization, local video preview, or other media processing.

Examples

remoteStream

The remote media stream containing audio and/or video tracks received from the remote party. This stream represents the media being received from the other participant in the call. Can be used for audio visualization, remote video display, or other media processing.

Examples