Call

public class Call

A Call is the representation of an audio or video call between two WebRTC Clients, SIP clients or phone numbers. The call object is created whenever a new call is initiated, either by you or the remote caller. You can access and act upon calls initiated by a remote caller by registering to TxClientDelegate of the TxClient

Examples:

Create a call:

   // Create a client instance
   self.telnyxClient = TxClient()

   // Asign the delegate to get SDK events
   self.telnyxClient?.delegate = self

   // Connect the client (Check TxClient class for more info)
   self.telnyxClient?.connect(....)

   // Create the call and start calling
   self.currentCall = try self.telnyxClient?.newCall(callerName: "Caller name",
                                                     callerNumber: "155531234567",
                                                     // Destination is required and can be a phone number or SIP URI
                                                     destinationNumber: "18004377950",
                                                     callId: UUID.init())

Answer an incoming call:

//Init your client
func initTelnyxClient() {
   //
   self.telnyxClient = TxClient()

   // Asign the delegate to get SDK events
   self.telnyxClient?.delegate = self

   // Connect the client (Check TxClient class for more info)
   self.telnyxClient?.connect(....)
}

extension ViewController: TxClientDelegate {
    //....
    func onIncomingCall(call: Call) {
        //We are automatically answering any incoming call as an example, but
        //maybe you want to store a reference of the call, and answer the call after a button press.
        self.myCall = call.answer()
    }
}
  • Custum headers pased /from webrtc telnyx_rtc.INVITE Messages

    Declaration

    Swift

    public internal(set) var inviteCustomHeaders: [String : String]? { get }
  • Custum headers pased tfrom telnyx_rtc.ANSWER webrtcMessages

    Declaration

    Swift

    public internal(set) var answerCustomHeaders: [String : String]? { get }
  • The Session ID of the current connection

    Declaration

    Swift

    public internal(set) var sessionId: String? { get }
  • Telnyx call session ID.

    Declaration

    Swift

    public internal(set) var telnyxSessionId: UUID? { get }
  • Telnyx call leg ID

    Declaration

    Swift

    public internal(set) var telnyxLegId: UUID? { get }

Properties

Initializers

Call handling

  • Hangup or reject an incoming call.

    Example:

    call.hangup()
    

    Declaration

    Swift

    public func hangup()
  • Starts the process to answer the incoming call.

    Example:

    call.answer()
    

    Declaration

    Swift

    public func answer(customHeaders: [String : String] = [:])

DTMF

  • Sends dual-tone multi-frequency (DTMF) signal

       currentCall?.dtmf("0")
       currentCall?.dtmf("1")
       currentCall?.dtmf("*")
       currentCall?.dtmf("#")
    

    Declaration

    Swift

    public func dtmf(dtmf: String)

    Parameters

    dtmf

    Single DTMF key ## Examples: ### Send DTMF signals:

Audio handling

  • Turns off audio output, i.e. makes it so other call participants cannot hear your audio.

    Example:

    call.muteAudio()
    

    Declaration

    Swift

    public func muteAudio()
  • Turns on audio output, i.e. makes it so other call participants can hear your audio.

    Example:

    call.unmuteAudio()
    

    Declaration

    Swift

    public func unmuteAudio()

Hold / Unhold handling

  • Holds the call.

    Example:

    call.hold()
    

    Declaration

    Swift

    public func hold()
  • Removes hold from the call.

    Example:

    call.unhold()
    

    Declaration

    Swift

    public func unhold()
  • Toggles between active and held state of the call.

    Example:

    call.toggleHold()
    

    Declaration

    Swift

    public func toggleHold()