TxClient
TelnyxRTC client connects your application to the Telnyx backend,
enabling you to make outgoing calls and handle incoming calls.
Examples
Connect and login:
Listen TxClient delegate events.
Properties
calls
delegate
isSpeakerEnabled
isAudioDeviceEnabled
- Set to
trueinprovider(_:didActivate:)to enable audio - Set to
falseinprovider(_:didDeactivate:)to disable audio
isRegistered
Methods
enableAudioSession(audioSession:)
- Parameter audioSession: The AVAudioSession instance to configure
- Important: This method MUST be called from the CXProviderDelegate’s
provider(_:didActivate:)callback to properly handle audio routing when using CallKit integration.
Parameters
| Name | Description |
|---|---|
| audioSession | The AVAudioSession instance to configure |
disableAudioSession(audioSession:)
- Parameter audioSession: The AVAudioSession instance to reset
- Important: This method MUST be called from the CXProviderDelegate’s
provider(_:didDeactivate:)callback to properly clean up audio resources when using CallKit integration.
Parameters
| Name | Description |
|---|---|
| audioSession | The AVAudioSession instance to reset |
init()
deinit
connect(txConfig:serverConfiguration:)
- Parameters:
- txConfig: The desired login credentials. See TxConfig docummentation for more information.
- serverConfiguration: (Optional) To define a custom
signaling serverandTURN/ STUN servers. As default we use the internal Telnyx Production servers.
- Throws: TxConfig parameters errors
Parameters
| Name | Description |
|---|---|
| txConfig | The desired login credentials. See TxConfig docummentation for more information. |
| serverConfiguration | (Optional) To define a custom signaling server and TURN/ STUN servers. As default we use the internal Telnyx Production servers. |
disconnect()
isConnected()
- Returns:
trueif TxClient socket is connected,falseotherwise.
answerFromCallkit(answerAction:customHeaders:debug:)
- Parameters:
- answerAction :
CXAnswerCallActionfrom callKit - customHeaders: (Optional)
- debug: (Optional) to enable quality metrics for call
- answerAction :
Parameters
| Name | Description |
|---|---|
| answerAction | CXAnswerCallAction from callKit |
| customHeaders | (Optional) |
| debug | (Optional) to enable quality metrics for call |
endCallFromCallkit(endAction:callId:)
disablePushNotifications()
getSessionId()
- Returns: The current sessionId. If this value is empty, that means that the client is not connected to Telnyx server.