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
| Parameter | Type | Description |
|---|---|---|
callId | string | Identifier of the call that ended |
callQuality | RTCQuality | Call quality metrics summary — see below |
reason | HangupReason | Reason the call ended — see below |
RTCQuality
| Property | Type | Description |
|---|---|---|
mos_score | float | Mean Opinion Score — overall perceived call quality (higher is better) |
quality_percentage | float | Quality expressed as a percentage (0–100) |
jitter_min_var | float | Minimum jitter variance observed |
jitter_max_var | float | Maximum jitter variance observed |
jitter_loss_rate | float | Packet loss rate attributable to jitter |
jitter_burst_rate | float | Burst loss rate attributable to jitter |
flaw_total | integer | Total number of detected flaws or errors |
packet_cnt | integer | Total number of packets transmitted |
packet_loss_perc | float | Packet loss as a percentage |
HangupReason
| Android / Web value | iOS value | Description |
|---|---|---|
remoteReject / REMOTE_REJECT | VGHangupReasonRemoteReject | Remote party rejected the call |
remoteHangup / REMOTE_HANGUP | VGHangupReasonRemoteHangup | Remote party hung up |
remoteNoAnswerTimeout / REMOTE_NO_ANSWER_TIMEOUT | VGHangupReasonRemoteNoAnswerTimeout | Remote did not answer within the timeout period |
localHangup / LOCAL_HANGUP | VGHangupReasonLocalHangup | Local party hung up |
mediaTimeout / MEDIA_TIMEOUT | VGHangupReasonMediaTimeout | Vonage received no audio from this device, so the media server ended the call |
remoteBusy / REMOTE_BUSY | VGHangupReasonRemoteBusy | The called number was busy (SIP 486) |
remoteNotFound / REMOTE_NOT_FOUND | VGHangupReasonRemoteNotFound | The called number does not exist (SIP 404) |
remoteFailure / REMOTE_FAILURE | VGHangupReasonRemoteFailure | The 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
reasonto differentiate user actions from remote termination/timeouts - Final call cleanup and UI transitions should be driven from this event
Related Actions
hangup- End an active call