On Call Invite Cancel
Fired when an inbound call invite is canceled before it is answered.
Event Registration
fun setCallInviteCancelListener(
fn: (callId: String, reason: VoiceInviteCancelReason) -> Unit
): Subscription
Usage Example
// Answer Call
client.setCallInviteListener {inviteId, from, channelType ->
println("Incoming Call from $from by channel $channelType")
client.answer(inviteId) {
it?.let {err ->
// Handle Error in answering call
println("Error in answering call: $err")
}
}
}
// Or reject the call:
// client.setCallInviteListener { inviteId, from, channelType ->
// client.reject(inviteId) {
// it?.let {err ->
// println("Error in rejecting call: $err")
// }
// }
// }
// Invite Cancelled
client.setCallInviteCancelListener { inviteId, reason ->
when (reason) {
VoiceInviteCancelReason.RemoteCancel -> println("Call Invite for call $inviteId was cancelled by the caller")
VoiceInviteCancelReason.AnsweredElsewhere -> println("Call Invite for call $inviteId was answered on another device")
VoiceInviteCancelReason.RejectedElsewhere -> println("Call Invite for call $inviteId was rejected on another device")
VoiceInviteCancelReason.RemoteTimeout -> println("Call Invite for call $inviteId timed out")
}
}
Event Data
| Parameter | Type | Description |
|---|---|---|
callId | string | Invite/call identifier |
reason | CancelReason | Cancellation reason — see below |
CancelReason
| Android / Web value | iOS value | Description |
|---|---|---|
AnsweredElsewhere | VGVoiceInviteCancelReasonAnsweredElsewhere | Invite was answered on another device |
RejectedElsewhere | VGVoiceInviteCancelReasonRejectedElsewhere | Invite was rejected on another device |
RemoteCancel | VGVoiceInviteCancelReasonRemoteCancel | Caller canceled the invite |
RemoteTimeout | VGVoiceInviteCancelReasonRemoteTimeout | Invite timed out without being answered |
Notes
- Use this event to dismiss incoming call UI if it is still visible
- Invite cancellation can happen due to remote actions or timeout
Related Events
onCallInvite- Fired when inbound invite is received