TxClient
Methods
getCall(callId:)
- Parameter callId: The unique identifier of a call.
- Returns: The
Callobject that matches the requestedcallId. Returnsnilif no call was found.
Parameters
| Name | Description |
|---|---|
| callId | The unique identifier of a call. |
newCall(callerName:callerNumber:destinationNumber:callId:clientState:customHeaders:preferredCodecs:debug:)
Examples:
- Parameters:
- callerName: The caller name. This will be displayed as the caller name in the remote’s client.
- callerNumber: The caller Number. The phone number of the current user.
- destinationNumber: The destination
SIP user address(sip:[email protected]) orphone number. - callId: The current call UUID.
- clientState: (optional) Custom state in string format encoded in base64
- customHeaders: (optional) Custom Headers to be passed over webRTC Messages.
Headers should be in the format
X-key:ValuewhereX-prefix is required for custom headers. When calling AI Agents, headers with theX-prefix will be mapped to dynamic variables (e.g.,X-Account-Numberbecomes{{account_number}}). Hyphens in header names are converted to underscores in variable names. - preferredCodecs: (optional) Array of preferred audio codecs in priority order.
The SDK will attempt to use these codecs in the specified order during negotiation.
If none of the preferred codecs are available, WebRTC will fall back to its default codec selection.
Use
getSupportedAudioCodecs()to retrieve available codecs before setting preferences. See the Preferred Audio Codecs Guide for more information. - debug: (optional) Enable debug mode for call quality metrics and WebRTC statistics.
When enabled, real-time call quality metrics will be available through the call’s
onCallQualityChangecallback.
- Throws:
- sessionId is required if user is not logged in
- socket connection error if socket is not connected
- destination number is required to start a call.
- Returns: The call that has been created
Parameters
| Name | Description |
|---|---|
| callerName | The caller name. This will be displayed as the caller name in the remote’s client. |
| callerNumber | The caller Number. The phone number of the current user. |
| destinationNumber | The destination SIP user address (sip:[email protected]) or phone number. |
| callId | The current call UUID. |
| clientState | (optional) Custom state in string format encoded in base64 |
| customHeaders | (optional) Custom Headers to be passed over webRTC Messages. Headers should be in the format X-key:Value where X- prefix is required for custom headers. When calling AI Agents, headers with the X- prefix will be mapped to dynamic variables (e.g., X-Account-Number becomes {{account_number}}). Hyphens in header names are converted to underscores in variable names. |
| preferredCodecs | (optional) Array of preferred audio codecs in priority order. The SDK will attempt to use these codecs in the specified order during negotiation. If none of the preferred codecs are available, WebRTC will fall back to its default codec selection. Use getSupportedAudioCodecs() to retrieve available codecs before setting preferences. See the for more information. |
| debug | (optional) Enable debug mode for call quality metrics and WebRTC statistics. When enabled, real-time call quality metrics will be available through the call’s onCallQualityChange callback. |
getSupportedAudioCodecs()
- Returns: Array of TxCodecCapability objects representing available audio codecs
Example:
processVoIPNotification(txConfig:serverConfiguration:pushMetaData:)
- Parameters:
- txConfig: The desired configuration to login to B2B2UA. User credentials must be the same as the
- serverConfiguration : required to setup from VoIP push notification metadata.
- pushMetaData : meta data payload from VOIP Push notification (this should be gotten from payload.dictionaryPayload[“metadata”] as? [String: Any])
- Throws: Error during the connection process
Parameters
| Name | Description |
|---|---|
| txConfig | The desired configuration to login to B2B2UA. User credentials must be the same as the |
| serverConfiguration | required to setup from VoIP push notification metadata. |
| pushMetaData | meta data payload from VOIP Push notification (this should be gotten from payload.dictionaryPayload[“metadata”] as? [String: Any]) |