Skip to content

On Call Hangup ​

Fired when a call is terminated. This includes local or remote hangup and timeout/end scenarios.

Event Registration ​

fun setOnCallHangupListener(
  fn: (callId: String, callQuality: RTCQuality, reason: HangupReason) -> Unit
): Subscription

Usage Example ​


client.setOnCallHangupListener { call, callQuality, reason ->
    println("Received $reason callQuality: $callQuality for Call $call")
}

Event Data ​

ParameterTypeDescription
callIdstringIdentifier of the call that ended
callQualityRTCQualityCall quality metrics summary — see below
reasonHangupReasonReason the call ended — see below

RTCQuality ​

PropertyTypeDescription
mos_scorefloatMean Opinion Score — overall perceived call quality (higher is better)
quality_percentagefloatQuality expressed as a percentage (0–100)
jitter_min_varfloatMinimum jitter variance observed
jitter_max_varfloatMaximum jitter variance observed
jitter_loss_ratefloatPacket loss rate attributable to jitter
jitter_burst_ratefloatBurst loss rate attributable to jitter
flaw_totalintegerTotal number of detected flaws or errors
packet_cntintegerTotal number of packets transmitted
packet_loss_percfloatPacket loss as a percentage

HangupReason ​

Android / Web valueiOS valueDescription
remoteReject / REMOTE_REJECTVGHangupReasonRemoteRejectRemote party rejected the call
remoteHangup / REMOTE_HANGUPVGHangupReasonRemoteHangupRemote party hung up
remoteNoAnswerTimeout / REMOTE_NO_ANSWER_TIMEOUTVGHangupReasonRemoteNoAnswerTimeoutRemote did not answer within the timeout period
localHangup / LOCAL_HANGUPVGHangupReasonLocalHangupLocal party hung up
mediaTimeout / MEDIA_TIMEOUTVGHangupReasonMediaTimeoutVonage received no audio from this device, so the media server ended the call
remoteBusy / REMOTE_BUSYVGHangupReasonRemoteBusyThe called number was busy (SIP 486)
remoteNotFound / REMOTE_NOT_FOUNDVGHangupReasonRemoteNotFoundThe called number does not exist (SIP 404)
remoteFailure / REMOTE_FAILUREVGHangupReasonRemoteFailureThe carrier or destination failed the call (SIP 5xx)

Busy, not found, rejected, failure and no answer are outcomes of a call Vonage did place: they are reported here, not as serverCall errors. A switch or when over HangupReason should handle every value.

When the hangup happened while the WebSocket was down, the SDK learns it over REST on reconnect and reports it then. The REST response carries no audio counters, so every callQuality field is 0.

Notes ​

  • Use reason to differentiate user actions from remote termination/timeouts
  • Final call cleanup and UI transitions should be driven from this event

Built with VitePress.