CallListener (interface)
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
- onCallDisconnected
- onCallFailed
- onCallReconnected
- onCallReconnecting
- onCallStatsReceived
- onCallUpgradeRequested
- onCallUpgradeRequestTimeout
- onInfoReceived
- onMessageReceived
- onRemoteVideoStreamAdded
- onRemoteVideoStreamRemoved
- onRemoteVideoStreamTypeChanged
- onStartRinging
- onStopRinging
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
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
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
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
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:
Parameters
Returns: Unit
onCallStatsReceived
Triggered periodically with the interval configured via CallSettings.statsCollectionInterval passed to Call.start or Call.answer.
Parameters
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:
- CallUpgradeDecision.acceptReceiveAndSend — enables receiving and start sending the provided local video stream.
- CallUpgradeDecision.acceptReceiveOnly — enables receiving the remote video.
- CallUpgradeDecision.reject — keeps the call audio-only and declines the remote video.
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
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
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
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
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
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
Returns: Unit
onRemoteVideoStreamTypeChanged
fun onRemoteVideoStreamTypeChanged(call: Call, videoStream: RemoteVideoStream): Unit
Triggered when a remote participant video type has changed in the call.
Parameters
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
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
Returns: Unit