Skip to navigation

CallListener (interface)

Android SDK v3 API reference
View as Markdown

com.voximplant.android.sdk.calls

Interface that handles call events.

Use the Call.setCallListener API to subscribe to the following events.

Events are invoked on the executor specified via VICore.callbackExecutor.

Methods

onCallConnected

fun onCallConnected(call: Call, withVideo: Boolean, headers: Map<String, String>?): Unit

Triggered when the call is connected.

After this event, Call.remoteDisplayName and Call.remoteSipUri are available for outgoing calls.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
withVideoBooleanWhether the local video is sending. See Call.localVideoStream.
headersMap<String, String>?Optional SIP headers received with the event

Returns: Unit

onCallDisconnected

fun onCallDisconnected(call: Call, headers: Map<String, String>?, disconnectReason: CallDisconnectReason): Unit

Triggered when the call ends.

After this event, Call.state is CallState.Disconnected and the current call’s features are no longer available.

For outgoing calls, the event is triggered after Call.hangup, or when the remote participant ends the call.

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

After Call.reject, this event is triggered on the callee side. The caller receives CallListener.onCallFailed 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, CallListener.onCallFailed is triggered instead.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
headersMap<String, String>?Optional SIP headers received with the event
disconnectReasonCallDisconnectReasonReason the call has ended

Returns: Unit

onCallFailed

fun onCallFailed(call: Call, code: Int, description: String?, headers: Map<String, String>?): Unit

Triggered when the call fails to connect.

After this event, Call.state is CallState.Failed and the current call’s features are no longer available.

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

After Call.reject, this event is triggered on the caller side. The callee receives CallListener.onCallDisconnected 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 CallListener.onCallDisconnected.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
codeIntStatus code of the call failure
descriptionString?Status message of the call failure
headersMap<String, String>?Optional SIP headers received with the event

Returns: Unit

onCallReconnected

fun onCallReconnected(call: Call): Unit

Triggered when the connection to the Voximplant Cloud is restored and media streams become active in the call.

The event follows CallListener.onCallReconnecting.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event

Returns: Unit

onCallReconnecting

fun onCallReconnecting(call: Call): Unit

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

Once the connection to the Voximplant Cloud is restored and media streams are active, CallListener.onCallReconnected event is triggered.

Until CallListener.onCallReconnected event is invoked, the following API calls fail with CallError.InvalidCallState error:

  1. Call.startSendingVideo
  2. Call.stopSendingVideo
  3. Call.hold

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event

Returns: Unit

onCallStatsReceived

fun onCallStatsReceived(call: Call, callStats: CallStats): Unit

Triggered periodically with the interval configured via CallSettings.statsCollectionInterval passed to Call.start or Call.answer.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
callStatsCallStatsCallStats with call statistics

Returns: Unit

onCallUpgradeRequested

fun onCallUpgradeRequested(call: Call, decision: CallUpgradeDecision): Unit

Triggered when the remote participant enables video during an audio call.

The provided decision object should be used exactly once to respond to the request by invoking one of the following terminal methods:

Making a second call on the same decision instance fails with CallUpgradeDecision.Error.AlreadyDecided.

If the application does not make a decision before the system timeout occurs, CallListener.onCallUpgradeRequestTimeout is triggered. The request is then automatically rejected.

The default implementation automatically calls CallUpgradeDecision.acceptReceiveOnly.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
decisionCallUpgradeDecisionCallUpgradeDecision object that should be used exactly once to respond to the request

Returns: Unit

onCallUpgradeRequestTimeout

fun onCallUpgradeRequestTimeout(call: Call): Unit

Triggered when a call upgrade request has timed out because no decision has been made via CallUpgradeDecision.

The upgrade request is automatically rejected.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event

Returns: Unit

onInfoReceived

fun onInfoReceived(call: Call, type: String, content: String, headers: Map<String, String>?): Unit

Triggered when an INFO message is received within the call.

Use Call.sendInfo to send an INFO message to the remote participant.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
typeStringMIME type of the INFO message
contentStringBody of the INFO message
headersMap<String, String>?Optional SIP headers received with the event

Returns: Unit

onMessageReceived

fun onMessageReceived(call: Call, text: String): Unit

Triggered when a message is received within the call.

Implemented atop SIP INFO for communication between call endpoint and Voximplant cloud.

Use Call.sendMessage to send a message to the remote participant.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
textStringMessage text

Returns: Unit

onRemoteVideoStreamAdded

fun onRemoteVideoStreamAdded(call: Call, videoStream: RemoteVideoStream): Unit

Triggered when a remote participant starts sending video in the call.

The event is triggered if the remote participant has started sending video via Call.startSendingVideo or after a successful call upgrade via CallUpgradeDecision.

Use RemoteVideoStream.addVideoRenderer to display the video.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
videoStreamRemoteVideoStreamRemoteVideoStream of the remote participant

Returns: Unit

onRemoteVideoStreamRemoved

fun onRemoteVideoStreamRemoved(call: Call, videoStream: RemoteVideoStream): Unit

Triggered when a remote participant stops sending video in the call.

The event is triggered if the remote participant has stopped sending video via Call.stopSendingVideo.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
videoStreamRemoteVideoStreamRemoteVideoStream of the remote participant

Returns: Unit

onRemoteVideoStreamTypeChanged

fun onRemoteVideoStreamTypeChanged(call: Call, videoStream: RemoteVideoStream): Unit

Triggered when a remote participant video type has changed in the call.

Parameters

ParameterTypeRequirementDescription
callCallCall object that invoked the event
videoStreamRemoteVideoStreamVideo stream of a remote participant

Returns: Unit

onStartRinging

fun onStartRinging(call: Call, headers: Map<String, String>?): Unit

Triggered for outgoing calls after Call.start when the remote participant’s device is ringing.

Start playing a call progress tone in this event; stop it in CallListener.onStopRinging.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event
headersMap<String, String>?Optional SIP headers received with the event

Returns: Unit

onStopRinging

fun onStopRinging(call: Call): Unit

Triggered when call media starts.

If you are playing progress tones in CallListener.onStartRinging, stop them in this event.

Parameters

ParameterTypeRequirementDescription
callCallCall instance that invoked the event

Returns: Unit