Skip to navigation

VICallDelegate

VoximplantCalls · iOS SDK v3

View as Markdown

Delegate that may be used to handle call events.

@objc protocol VICallDelegate

Methods

call(_:didAddRemoteVideoStream:)

@objc optional func call(_ call: VICall, didAddRemoteVideoStream videoStream: VIRemoteVideoStream)

Triggered when another call participant has added a video stream to a call.

Parameters

call VICall

Call instance

videoStream VIRemoteVideoStream

Remote video stream added to the call

call(_:didChangeRemoteVideoStreamSource:)

@objc optional func call(
    _ call: VICall,
    didChangeRemoteVideoStreamSource videoStream: VIRemoteVideoStream
)

Triggered when another call participant replaces a video stream with a video stream of a different type.

Parameters

call VICall

Call instance

videoStream VIRemoteVideoStream

Remote video stream with a new source type

Another call participant may replace a video stream with a screen sharing or vice verse. It is recommended to change the call layout according to the new remote video stream source type.

call(_:didConnectWithVideo:headers:)

@objc func call(_ call: VICall, didConnectWithVideo video: Bool, headers: [String : String]?)

Triggered when a call successfully connects.

Parameters

call VICall

Call instance

video Bool

Whether the video is being sent to the remote participant. Reflects negotiated media flow, not just local configuration.

headers [String : String]?

Optional headers passed with the event

For outgoing calls, the user and userDisplayName properties are updated before this method is called.

Because video reflects the negotiated media flow, it is false if the remote participant disables video receiving—even if a local video stream is configured. Use this parameter to ensure your call UI accurately matches the established media flow.

For an incoming call answered with video while the application is in the background, video is true even though actual local video sending does not begin until the application enters the foreground.

call(_:didDisconnectWithReason:headers:)

@objc func call(
    _ call: VICall,
    didDisconnectWithReason reason: VICallDisconnectReason,
    headers: [String : String]?
)

Triggered when the call ends.

Parameters

call VICall

Call instance

reason VICallDisconnectReason

Reason the call has ended

headers [String : String]?

Optional headers passed with the event

After this event, state is VICallState.disconnected and the current call’s features are no longer available.

For outgoing calls, the event is triggered after hangup(withHeaders:), or when the remote participant ends the call.

For incoming calls, the event is triggered after hangup(withHeaders:), when the caller cancels the call, or when the call is answered on another device.

After reject(with:headers:), this event is triggered on the callee side. The caller receives call(_:didFailWithError:headers:) instead.

If a network issue occurs after the call has connected and reconnect does not succeed, this event is reported as well.

If the call fails to connect, call(_:didFailWithError:headers:) is triggered instead.

call(_:didFailWithError:headers:)

@objc func call(
    _ call: VICall,
    didFailWithError error: VICallConnectionError,
    headers: [String : String]?
)

Triggered when the call fails to connect.

Parameters

call VICall

Call instance

error VICallConnectionError

Error object with code and description

headers [String : String]?

Optional headers passed with the event

After this event, state is VICallState.failed and the current call’s features are no longer available.

The event is triggered if setup after start() or answer(with:) fails, or when the Voximplant Cloud does not establish the connection.

After reject(with:headers:), this event is triggered on the caller side. The callee receives call(_:didDisconnectWithReason:headers:) instead.

If a network issue occurs while the call is connecting and reconnect does not succeed, this event is reported as well.

After the call has connected, later termination is reported via call(_:didDisconnectWithReason:headers:).

call(_:didReceiveInfo:type:headers:)

@objc optional func call(
    _ call: VICall,
    didReceiveInfo body: String,
    type: String,
    headers: [String : String]?
)

Triggered when an INFO message is received within the call.

Parameters

call VICall

Call instance

body String

Body of INFO message

type String

MIME type of INFO message

headers [String : String]?

Optional headers passed with the event

call(_:didReceiveMessage:headers:)

@objc optional func call(
    _ call: VICall,
    didReceiveMessage message: String,
    headers: [String : String]?
)

Triggered when a message is received within a call.

Parameters

call VICall

Call instance

message String

Content of the message

headers [String : String]?

Optional headers passed with the event

Implemented atop of SIP INFO for communication between the call endpoint and the Voximplant Cloud.

call(_:didReceiveStatistics:)

@objc optional func call(_ call: VICall, didReceiveStatistics stats: VICallStats)

Triggered when call statistics are available for a call.

Parameters

call VICall

Call instance

stats VICallStats

Call statistics

call(_:didRemoveRemoteVideoStream:)

@objc optional func call(
    _ call: VICall,
    didRemoveRemoteVideoStream videoStream: VIRemoteVideoStream
)

Triggered when another call participant has removed a video stream from a call.

Parameters

call VICall

Call instance

videoStream VIRemoteVideoStream

Remote video stream removed from the call

call(_:didStartRingingWithHeaders:)

@objc func call(_ call: VICall, didStartRingingWithHeaders headers: [String : String]?)

Triggered when the Call.ring method is called on the scenario side.

Parameters

call VICall

Call instance

headers [String : String]?

Optional headers passed with the event

Usually, this event is triggered when the call is arrived to its destination. After receiving this event, the application should start playing progress tones.

callDidReconnect(_:)

@objc optional func callDidReconnect(_ call: VICall)

Triggered if the connection to the Voximplant Cloud is restored and media stream are active in the call.

Parameters

call VICall

Call instance

callDidStartReconnecting(_:)

@objc optional func callDidStartReconnecting(_ call: VICall)

Triggered if the connection to the Voximplant Cloud is lost due to a network issue and media streams may be interrupted in the call.

Parameters

call VICall

Call instance

Once the connection to the Voximplant Cloud is restored and the media streams are active, the callDidReconnect(_:) event is triggered.

Until callDidReconnect(_:) event is triggered, the following API calls fail with a VICallErrorType.invalidCallState error:

callDidStopRinging(_:)

@objc func callDidStopRinging(_ call: VICall)

Triggered when the Call.answer or Call.startEarlyMedia method is called on the scenario side.

Parameters

call VICall

Call instance

After receiving this event, the application should stop playing progress tones if they have been playing after the call(_:didStartRingingWithHeaders:) event.