> For a complete documentation index, fetch https://docs.voximplant.ai/llms.txt

# VICallDelegate

Delegate that may be used to handle call events.

@objc protocol VICallDelegate

## Methods

### call(\_:didAddRemoteVideoStream:)

@objc optional func call(\_ call: [VICall](/api-reference/iossdk/calls/vicall), didAddRemoteVideoStream videoStream: [VIRemoteVideoStream](/api-reference/iossdk/calls/viremotevideostream))

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

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

**videoStream** [VIRemoteVideoStream](/api-reference/iossdk/calls/viremotevideostream)

Remote video stream added to the call

### call(\_:didChangeRemoteVideoStreamSource:)

@objc optional func call(\
    \_ call: [VICall](/api-reference/iossdk/calls/vicall),\
    didChangeRemoteVideoStreamSource videoStream: [VIRemoteVideoStream](/api-reference/iossdk/calls/viremotevideostream)\
)

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

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

**videoStream** [VIRemoteVideoStream](/api-reference/iossdk/calls/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](/api-reference/iossdk/calls/vicall), didConnectWithVideo video: Bool, headers: \[String : String]?)

Triggered when a call successfully connects.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/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](/api-reference/iossdk/calls/vicall#symbol-4966c0698c837219) and [userDisplayName](/api-reference/iossdk/calls/vicall#symbol-bc105f0ed43d7fc8) properties are updated before this method is called.

> **Note**
>
> 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.

> **Note**
>
> 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](/api-reference/iossdk/calls/vicall),\
    didDisconnectWithReason reason: [VICallDisconnectReason](/api-reference/iossdk/calls/vicalldisconnectreason),\
    headers: \[String : String]?\
)

Triggered when the call ends.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

**reason** [VICallDisconnectReason](/api-reference/iossdk/calls/vicalldisconnectreason)

Reason the call has ended

**headers** \[String : String]?

Optional headers passed with the event

After this event, [state](/api-reference/iossdk/calls/vicall#symbol-ec358a2c7439f7a2) is [VICallState.disconnected](/api-reference/iossdk/calls/vicallstate#symbol-476096cf3ed1e7e8) and the current call’s features are no longer available.

For outgoing calls, the event is triggered after [hangup(withHeaders:)](/api-reference/iossdk/calls/vicall#symbol-ee9d85b1dbc942a8), or when the remote participant ends the call.

For incoming calls, the event is triggered after [hangup(withHeaders:)](/api-reference/iossdk/calls/vicall#symbol-ee9d85b1dbc942a8), when the caller cancels the call, or when the call is answered on another device.

After [reject(with:headers:)](/api-reference/iossdk/calls/vicall#symbol-7d5565333cb03601), this event is triggered on the callee side. The caller receives [call(\_:didFailWithError:headers:)](/api-reference/iossdk/calls/vicalldelegate#symbol-a291f746b32b1239) 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:)](/api-reference/iossdk/calls/vicalldelegate#symbol-a291f746b32b1239) is triggered instead.

### call(\_:didFailWithError:headers:)

@objc func call(\
    \_ call: [VICall](/api-reference/iossdk/calls/vicall),\
    didFailWithError error: [VICallConnectionError](/api-reference/iossdk/calls/vicallconnectionerror),\
    headers: \[String : String]?\
)

Triggered when the call fails to connect.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

**error** [VICallConnectionError](/api-reference/iossdk/calls/vicallconnectionerror)

Error object with code and description

**headers** \[String : String]?

Optional headers passed with the event

After this event, [state](/api-reference/iossdk/calls/vicall#symbol-ec358a2c7439f7a2) is [VICallState.failed](/api-reference/iossdk/calls/vicallstate#symbol-d2a80ae28aa71927) and the current call’s features are no longer available.

The event is triggered if setup after [start()](/api-reference/iossdk/calls/vicall#symbol-816f51853436756c) or [answer(with:)](/api-reference/iossdk/calls/vicall#symbol-b533c079ec59674c) fails, or when the Voximplant Cloud does not establish the connection.

After [reject(with:headers:)](/api-reference/iossdk/calls/vicall#symbol-7d5565333cb03601), this event is triggered on the caller side. The callee receives [call(\_:didDisconnectWithReason:headers:)](/api-reference/iossdk/calls/vicalldelegate#symbol-1ece00171ff67b73) 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:)](/api-reference/iossdk/calls/vicalldelegate#symbol-1ece00171ff67b73).

### call(\_:didReceiveInfo:type:headers:)

@objc optional func call(\
    \_ call: [VICall](/api-reference/iossdk/calls/vicall),\
    didReceiveInfo body: String,\
    type: String,\
    headers: \[String : String]?\
)

Triggered when an INFO message is received within the call.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/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](/api-reference/iossdk/calls/vicall),\
    didReceiveMessage message: String,\
    headers: \[String : String]?\
)

Triggered when a message is received within a call.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/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](/api-reference/iossdk/calls/vicall), didReceiveStatistics stats: [VICallStats](/api-reference/iossdk/calls/vicallstats))

Triggered when call statistics are available for a call.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

**stats** [VICallStats](/api-reference/iossdk/calls/vicallstats)

Call statistics

### call(\_:didRemoveRemoteVideoStream:)

@objc optional func call(\
    \_ call: [VICall](/api-reference/iossdk/calls/vicall),\
    didRemoveRemoteVideoStream videoStream: [VIRemoteVideoStream](/api-reference/iossdk/calls/viremotevideostream)\
)

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

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

**videoStream** [VIRemoteVideoStream](/api-reference/iossdk/calls/viremotevideostream)

Remote video stream removed from the call

### call(\_:didStartRingingWithHeaders:)

@objc func call(\_ call: [VICall](/api-reference/iossdk/calls/vicall), didStartRingingWithHeaders headers: \[String : String]?)

Triggered when the [Call.ring](https://voximplant.com/docs/references/voxengine/call#ring) method is called on the scenario side.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/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](/api-reference/iossdk/calls/vicall))

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

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

### callDidStartReconnecting(\_:)

@objc optional func callDidStartReconnecting(\_ call: [VICall](/api-reference/iossdk/calls/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](/api-reference/iossdk/calls/vicall)

Call instance

Once the connection to the Voximplant Cloud is restored and the media streams are active, the [callDidReconnect(\_:)](/api-reference/iossdk/calls/vicalldelegate#symbol-cbfa56b33294ddde) event is triggered.

Until [callDidReconnect(\_:)](/api-reference/iossdk/calls/vicalldelegate#symbol-cbfa56b33294ddde) event is triggered, the following API calls fail with a [VICallErrorType.invalidCallState](/api-reference/iossdk/calls/vicallerrortype#symbol-e4b9b62ac9f5fd43) error:

* [startSendingVideo(with:completion:)](/api-reference/iossdk/calls/vicall#symbol-08c162da5f755f17)
* [stopSendingVideo(completion:)](/api-reference/iossdk/calls/vicall#symbol-a222fdc068368063)
* [replaceSendingVideo(with:completion:)](/api-reference/iossdk/calls/vicall#symbol-6f5bbae417fcf757)
* [hold(\_:completion:)](/api-reference/iossdk/calls/vicall#symbol-640b2a5b6fb6e43c)

### callDidStopRinging(\_:)

@objc func callDidStopRinging(\_ call: [VICall](/api-reference/iossdk/calls/vicall))

Triggered when the [Call.answer](https://voximplant.com/docs/references/voxengine/call#answer) or [Call.startEarlyMedia](https://voximplant.com/docs/references/voxengine/call#startearlymedia) method is called on the scenario side.

**Parameters**

**call** [VICall](/api-reference/iossdk/calls/vicall)

Call instance

After receiving this event, the application should stop playing progress tones if they have been playing after the [call(\_:didStartRingingWithHeaders:)](/api-reference/iossdk/calls/vicalldelegate#symbol-34e868e1c43cc8dd) event.