TelnyxClient

class TelnyxClient(var context: Context) : TxSocketListener

The TelnyxClient class that can be used to control the SDK. Create / Answer calls, change audio device, etc.

Parameters

context

the Context that the application is using

Constructors

Link copied to clipboard
constructor(context: Context)

Types

Link copied to clipboard
object Companion

Companion object containing constant values used throughout the client.

Link copied to clipboard

Enum class that defines the type of ringtone resource.

Link copied to clipboard

Enum class that defines the current audio output mode.

Properties

Link copied to clipboard
val call: Call?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun acceptCall(callId: UUID, destinationNumber: String, customHeaders: Map<String, String>? = null): Call

Accepts an incoming call invitation.

Link copied to clipboard
fun connect(providedServerConfig: TxServerConfiguration = TxServerConfiguration(), txPushMetaData: String? = null)
fun connect(providedServerConfig: TxServerConfiguration = TxServerConfiguration(), credentialConfig: CredentialConfig, txPushMetaData: String? = null, autoLogin: Boolean = true)

Connects to the socket using this client as the listener Will respond with 'No Network Connection' if there is no network available

fun connect(providedServerConfig: TxServerConfiguration = TxServerConfiguration(), tokenConfig: TokenConfig, txPushMetaData: String? = null, autoLogin: Boolean = true)
Link copied to clipboard

Logs the user in with credentials provided via CredentialConfig

Link copied to clipboard
fun disablePushNotification(sipUserName: String?, loginToken: String?, fcmToken: String)

Disables push notifications for current user

Link copied to clipboard
fun endCall(callId: UUID)

Ends an active call.

Link copied to clipboard

Returns all active calls that have been stored in our calls MutableMap The MutableMap is converted into a Map - preventing any changes by the SDK User

Link copied to clipboard

Gets the currently configured ringback tone resource.

Link copied to clipboard

Gets the currently configured ringtone resource.

Link copied to clipboard

Returns the socket response in the form of LiveData The format of each message is provided in SocketResponse and ReceivedMessageBody

Link copied to clipboard
fun getWsMessageResponse(): LiveData<JsonObject>

Returns the json messages from socket in the form of LiveData used for debugging purposes

Link copied to clipboard
Link copied to clipboard
fun newInvite(callerName: String, callerNumber: String, destinationNumber: String, clientState: String, customHeaders: Map<String, String>? = null): Call

Creates a new outgoing call invitation.

Link copied to clipboard
open override fun onAnswerReceived(jsonObject: JsonObject)

Fires when a user has provided an answer to a call attempt

Link copied to clipboard
open override fun onAttachReceived(jsonObject: JsonObject)

Fires once a connection has been reestablished during an ongoing call and a session is being reattached

Link copied to clipboard
open override fun onByeReceived(callId: UUID)

Fires when the TxSocket has received an indication the a call has ended or been rejected

Link copied to clipboard
open override fun onClientReady(jsonObject: JsonObject)

Fires once the client is ready and gateway status updates can be received

Link copied to clipboard
open override fun onConnectionEstablished()

Fires when a socket connection is established

Link copied to clipboard
open override fun onDisablePushReceived(jsonObject: JsonObject)

Fires when a disablePush response is recieved

Link copied to clipboard
open override fun onDisconnect()

Disconnect from the TxSocket and unregister the provided network callback

Link copied to clipboard
open override fun onErrorReceived(jsonObject: JsonObject)

Fires when an error has occurred with the TxSocket

Link copied to clipboard
open override fun onGatewayStateReceived(gatewayState: String, receivedSessionId: String?)

Fires once a Gateway state has been received. These are used to find a verified registration

Link copied to clipboard
open override fun onIceCandidateReceived(iceCandidate: IceCandidate)

Fires when a usable IceCandidate has been received

Link copied to clipboard
open override fun onMediaReceived(jsonObject: JsonObject)

Fires when an answer has been provided with additional media

Link copied to clipboard
open override fun onOfferReceived(jsonObject: JsonObject)

Fires when the TxSocket has received an invitation to communicate

Link copied to clipboard
open override fun onRingingReceived(jsonObject: JsonObject)

Fires once we receive a ringing socket response, containing Telnyx information

Link copied to clipboard
open override fun pingPong()

Fires when a ping message is received from the server, requiring a pong response

Link copied to clipboard

Sets the audio device that the SDK should use

Link copied to clipboard
open override fun setCallRecovering()

Fires when network has dropped during an ongoing call. Signifies that the SDK will attempt to recover once network has returned

Link copied to clipboard
fun tokenLogin(config: TokenConfig)

Logs the user in with credentials provided via TokenConfig