Skip to content
Eldar Babić edited this page Feb 10, 2025 · 10 revisions



status

Description

Read-only property representing the status of the call.

Example

// Retrieve the active call and get the status
let call = getInfobipRTCInstance().getActiveCall()
let status = call?.status



networkQualityEventListener

Description

Writable property representing the event listener for local network quality events.

Example

// Retrieve the active call
let call = getInfobipRTCInstance().getActiveCall()

// Set the network quality event listener to be handled by 'self'
call?.networkQualityEventListener = self

// Get the network quality event listener
let networkQualityEventListener = call?.networkQualityEventListener



audioDeviceManager

Description

Read-only property representing the audio device manager which is responsible for handling audio devices during the call.

Example

// Retrieve the active call and get the audio device manager
let call = getInfobipRTCInstance().getActiveCall()
let audioDeviceManager = call?.audioDeviceManager



id()

Description

Returns a unique call identifier on Infobip RTC platform.

Arguments

  • none

Returns

Example

// Retrieve the active call and get the call ID
let call = getInfobipRTCInstance().getActiveCall()
let callId = call?.id()



duration()

Description

Returns call duration in seconds calculated from the time call was established. 0 if the call has not been established yet.

Arguments

  • none

Returns

  • Int - Call duration in seconds

Example

// Retrieve the active call
let call = getInfobipRTCInstance().getActiveCall()

// Define a function to handle the hangup event
func onHangup(_ callHangupEvent: CallHangupEvent) {
    // Get the duration of the active call
    let duration = call?.duration()
}



startTime()

Description

Returns time when the call started (but has not been established yet).

Arguments

  • none

Returns

  • Date? - Time when the call has been initiated

Example

// Retrieve the active call and get the start time
let call = getInfobipRTCInstance().getActiveCall()
let startTime = call?.startTime()



establishTime()

Description

Returns time when the call was established. nil if the call has not been established yet.

Arguments

  • none

Returns

Example

// Retrieve the active call
let call = getInfobipRTCInstance().getActiveCall()

// Define a function to handle the call established event
func onEstablished(_ callEstablishedEvent: CallEstablishedEvent) {
    // Get the establish time of the active call
    let establishTime = call?.establishTime()
}



endTime()

Description

Returns time when the call finished. nil if the call has not finished yet.

Arguments

  • none

Returns

Example

// Retrieve the active call
let call = getInfobipRTCInstance().getActiveCall()

// Define a function to handle the hangup event
func onHangup(_ callHangupEvent: CallHangupEvent) {
    // Get the end time of the active call
    let endTime = call?.endTime()
}



source()

Description

Returns the endpoint from which the call originated.

Arguments

  • none

Returns

  • Endpoint - Endpoint which initiated the call.

Example

// Retrieve the active call and get the source endpoint
let call = getInfobipRTCInstance().getActiveCall()
let source = call?.source()



destination()

Description

Returns the endpoint which received the call.

Arguments

  • none

Returns

  • Endpoint - Endpoint which received the call.

Example

// Retrieve the active call and get the destination endpoint
let call = getInfobipRTCInstance().getActiveCall()
let destination = call?.destination()



counterpart()

Description

Returns the remote endpoint which is participating in the call.

Arguments

  • none

Returns

  • Endpoint - Remote endpoint which is participating in the call.

Example

// Retrieve the active call and get the counterpart endpoint
let call = getInfobipRTCInstance().getActiveCall()
let counterpart = call?.counterpart()



mute(shouldMute)

Description

Controls whether the user's audio in the call should be muted after this action. Disabled by default.

Arguments

  • shouldMute: Bool - true if the audio should be muted, otherwise false.

Returns

  • none

Example

// Mute the active call
let call = getInfobipRTCInstance().getActiveCall()
call?.mute(true)



muted()

Description

Returns information whether the user's audio in the call is muted.

Arguments

  • none

Returns

  • Bool - true if the audio is muted, otherwise false.

Example

// Retrieve the active call and check if it's muted
let call = getInfobipRTCInstance().getActiveCall()
let muted = call?.muted()



speakerphone(speakerphone, completionHandler)

Description

Controls whether the audio should be played on the speakerphone. Disabled by default.

Arguments

  • speakerphone: Bool - true if the audio should be played on speakerphone, otherwise false.
  • completionHandler: (Error?) -> Void - Completion handler receiving error if setting speakerphone fails

Returns

  • none

Example

// Enable speakerphone for the active call
let call = getInfobipRTCInstance().getActiveCall()
call?.speakerphone(true) { error in
    // Handle any errors that may occur
    if let error = error {
        print("An error has occurred: \(e.description)")
    }
}



speakerphone()

Description

Returns information whether speakerphone is enabled.

Arguments

  • none

Returns

  • Bool - true if the speakerphone is enabled, otherwise false.

Example

// Retrieve the active call and check if speakerphone is enabled
let call = getInfobipRTCInstance().getActiveCall()
let speakerphoneEnabled = call?.speakerphone()



sendDTMF(dtmf)

Description

Simulates key-press by sending DTMF (Dual-Tone Multi-Frequency) entry.

Arguments

  • dtmf: String - One of the allowed DTMF characters:
    • digits: 0 to 9
    • letters: A to D
    • symbols: * and #

Returns

  • none

Throws

  • DTMFError - Error explaining why sending DTMF failed.

Example

// Send DTMF tone "9" through the active call
let call = getInfobipRTCInstance().getActiveCall()
call?.sendDTMF("9")



audioQualityMode(mode)

Description

Sets the audio quality mode to a given enum value.

Arguments

  • mode: AudioQualityMode - Enum value that corresponds to the audio quality mode.

Returns

  • N/A

Example

// Set the audio quality mode to low data for the active call
let call = getInfobipRTCInstance().getActiveCall()
call?.audioQualityMode(.lowData)



audioQualityMode()

Description

Returns the audio quality mode that is used during the call.

Arguments

  • none

Returns

Example

// Retrieve the active call audio quality mode
let call = getInfobipRTCInstance().getActiveCall()
if let audioQualityMode = call?.audioQualityMode() {
    print("Audio quality mode: \(audioQualityMode)")
}



hangup()

Description

Hangs up the call, which ends up in both parties receiving the CallHangupEvent, after the hangup is processed by Infobip WebRTC platform.

Arguments

  • none

Returns

  • none

Example

// Hang up the active call
let call = getInfobipRTCInstance().getActiveCall()
call?.hangup()

Tutorials

Migration guides

Reference documentation

Clone this wiki locally