Skip to content

ApplicationCall

Lejla Solak edited this page Aug 5, 2024 · 13 revisions



applicationCallEventListener

Description

Writable property representing the call event listener which will receive application call events.

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

// Set the application call event listener to be handled by 'self'
applicationCall?.applicationCallEventListener = self

// Get the application call event listener
let applicationCallEventListener = applicationCall?.applicationCallEventListener



networkQualityEventListener

Description

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

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

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

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



participantNetworkQualityEventListener

Description

Writable property representing the event listener for other participant's network quality events.

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

// Set the participant network quality event listener to be handled by 'self'
applicationCall?.participantNetworkQualityEventListener = self

// Get the participant network quality event listener
let participantNetworkQualityEventListener = applicationCall?.participantNetworkQualityEventListener



reconnectHandler

Description

Writable property representing the ReconnectHandler. If you want to receive CallReconnectingEvent and CallReconnectedEvent, you must set this property with your custom implementation of the ReconnectHandler.

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

// Set the reconnect handler to be handled by 'self'
applicationCall?.reconnectHandler = self

// Get the reconnect handler
let reconnectHandler = applicationCall?.reconnectHandler



audioDeviceManager

Description

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

Example

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



options

Description

Read-only property representing the call options which the call was started with.

// Retrieve the active application call and get the call options
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let options = applicationCall?.options



status

Description

Read-only property representing the status of the call.

Example

// Retrieve the active application call and get the status
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let status = applicationCall?.status



id()

Description

Returns a unique call identifier.

Arguments

  • none

Returns

Example

// Retrieve the active application call and get the call ID
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let applicationCallId = applicationCall?.id()



customData()

Description

Read-only property containing custom data. The value is defined as an object of key-value string pairs.

Example

// Retrieve the active application call and get the custom data
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let customData = applicationCall?.customData()



duration()

Description

Returns call duration in seconds calculated from the time call was established. Initially, duration is 0.

Arguments

  • none

Returns

  • Int - Call duration

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

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



startTime()

Description

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

Arguments

  • none

Returns

  • Date? - Time when the call was initiated

Example

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



establishTime()

Description

Returns time when the call was established. Initially, establishTime is nil.

Arguments

  • none

Returns

  • Date? - Time when the call was established

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

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



endTime()

Description

Returns time when the call finished. Initially, endTime is nil.

Arguments

  • none

Returns

  • Date? - Time when the call finished

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

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



callsConfigurationId()

Description

Returns a unique Calls Configuration identifier associated with your Calls Configuration logical entity created through our Calls API.

Arguments

  • none

Returns

Example

// Retrieve the active application call and get the calls configuration id
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let callsConfigurationId = applicationCall?.callsConfigurationId()



participants()

Description

Returns the list of participants currently connected with this application call.

Arguments

  • none

Returns

Example

// Retrieve the active application call and get the list of participants
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let participants = applicationCall?.participants()



remoteVideos()

Description

Returns a map of other participants' videos who currently have their video(s) enabled in the application call.

Arguments

  • none

Returns

  • [String:RemoteVideo] - Map that contains remote videos as values and participants' identifiers as keys.

Example

// Retrieve the active application call and get the map of remote videos for every participant that has video(s) enabled
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let remoteVideos = applicationCall?.remoteVideos()



mute(shouldMute)

Description

Toggles mute option.

Arguments

  • shouldMute: Bool - Whether call should be muted after action or not.

Returns

  • N/A

Example

// Mute the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.mute(true)



muted()

Description

Returns information whether audio is muted or not.

Arguments

  • none

Returns

  • Bool - Is audio muted

Example

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



speakerphone(speakerphone, completionHandler)

Description

Toggles whether sound should be played on the speakerphone or not. When call is started, it is 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

  • N/A

Example

// Enable speakerphone for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.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 or not.

Arguments

  • none

Returns

  • Bool - Is speakerphone on

Example

// Retrieve the active application call and check if speakerphone is enabled
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let speakerphoneEnabled = applicationCall?.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

  • N/A

Throws

  • DTMFError - Error explaining why sending DTMF failed.

Example

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



cameraVideo(cameraVideo)

Description

Toggles whether camera video should be enabled or not. For video calls it is enabled by default.

Arguments

  • cameraVideo: Bool - Whether camera video should be enabled or not.

Returns

  • N/A

Throws

Example

// Enable camera video for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.cameraVideo(true)

Note

When your application goes into background, due to iOS limitations of needing a UI to continue capturing video frames, the video capture will stop until the application is back in foreground. To mitigate this, when your application is in background, you should either have a floating video component in order to continue capturing the video or stop the video completely. Below is an example of detecting when your application is in background and turning off the video.

Example

// Observe application background notifications
NotificationCenter.default.addObserver(self, selector:#selector(appMovedToBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)

@objc func appMovedToBackground() throws {
    if let applicationCall = self.getActiveApplicationCall(), applicationCall.hasCameraVideo() == true {
        try applicationCall.cameraVideo(cameraVideo: false)
    }
}



hasCameraVideo()

Description

Returns information whether the current application call has camera video or not.

Arguments

  • none

Returns

  • Bool - Represents whether the application call has camera video. true if it does, otherwise false.

Example

// Retrieve the active application call and check if camera video is enabled
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let hasCameraVideo = applicationCall?.hasCameraVideo()



screenShare(screenShare)

Description

Enables or disables sharing screen with the remote peer. Needs to be called after CallEstablishedEvent is received.

Arguments

  • screenShare: Bool - Represents if screen sharing is turned on or off.

Returns

  • N/A

Example

// Enable screen sharing for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.screenShare(true)



hasScreenShare()

Description

Returns true if screen is being shared, otherwise else false.

Arguments

  • none

Returns

  • Bool - Whether screen is being shared or not

Example

// Retrieve the active application call and check if screen sharing is enabled
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let hasScreenShare = applicationCall?.hasScreenShare()

localCameraTrack()

Description

Returns local camera track.

Arguments

  • none

Returns

  • VideoTrack? - Video track representing local camera stream. nil if there is no local camera video.

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

// Check if there is a local camera track
if let localCameraTrack = applicationCall?.localCameraTrack() {
    // If there is a local view available, add the camera track renderer to it
    if let localView = self.localView {
        localCameraTrack.addRenderer(localView)
    }
}

localScreenShareTrack()

Description

Returns local screen share track.

Arguments

  • none

Returns

  • VideoTrack? - Video track representing local screen share stream. nil if there is no local screen share video.

Example

// Retrieve the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()

// Check if there is a local screen share track
if let localScreenShareTrack = applicationCall?.localScreenShareTrack() {
    // If there is a local view available, add the screen share track renderer to it
    if let localView = self.localView {
        localScreenShareTrack.addRenderer(localView)
    }
}



cameraOrientation(cameraOrientation)

Description

Change local camera orientation.

Arguments

Returns

  • N/A

Example

// Set the camera orientation to front for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.cameraOrientation(CameraOrientation.front)



cameraOrientation()

Description

Get current camera orientation.

Arguments

  • none

Returns

Example

// Retrieve the active application call and get the camera orientation
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let cameraOrientation = applicationCall?.cameraOrientation()



pauseIncomingVideo()

Description

Pauses incoming video media.

Arguments

  • none

Returns

  • N/A

Example

// Pause the incoming video for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.pauseIncomingVideo()



resumeIncomingVideo()

Description

Resumes incoming video media.

Arguments

  • none

Returns

  • N/A

Example

// Resume the incoming video for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.resumeIncomingVideo()



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 application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.audioQualityMode(.lowData)



dataChannel()

Description

Returns an instance of the data channel used to send data.

Arguments

  • none

Returns

  • DataChannel? - Instance of the data channel. nil if the data channel usage is not enabled.

Example

// Retrieve the active application call and get the data channel
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
if let dataChannel = applicationCall?.dataChannel() {
  // Send text using the data channel
}



videoFilter(videoFilter?)

Description

This method sets the video filter to be used during the video call. Passing nil will remove and release any already existing video filter.

Arguments

Returns

  • N/A

Example

// Create a video filter
let videoFilter = createVideoFilter()

// Set the video filter for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.videoFilter(videoFilter)



videoFilter()

Description

This method returns the instance of VideoFilter currently in use or nil if no video filter is set.

Arguments

  • none

Returns

Example

// Retrieve the active application call and get the video filter
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let videoFilter = applicationCall?.videoFilter()



clearVideoFilter()

Description

This convenience method removes the video filter if it is present.

Arguments

  • none

Returns

  • N/A

Example

// Clear the video filter for the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.clearVideoFilter()



hangup()

Description

Hangs up call.

Arguments

  • none

Returns

  • N/A

Example

// Hang up the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
applicationCall?.hangup()



recordingState()

Description

Returns the instance of the current RecordingState.

Arguments

  • none

Returns

Example

// Retrieve the recording state of the active application call
let applicationCall = getInfobipRTCInstance().getActiveApplicationCall()
let recordingState = applicationCall?.recordingState()

Tutorials

Migration guides

Reference documentation

Clone this wiki locally