Skip to content

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 {callId, from, channelType ->
    println("Incoming Call from $from by channel $channelType")
    client.answer(callId) {
        it?.let {err ->
            // Handle Error in answering call
            println("Error in answering call: $err")
        }
    }
}

// Or reject the call:
// client.setCallInviteListener { callId, from, channelType ->
//     client.reject(callId) {
//         it?.let {err ->
//             println("Error in rejecting call: $err")
//         }
//     }
// }

// Invite Cancelled
client.setCallInviteCancelListener { callId, reason ->
        when (reason) {
            VoiceInviteCancelReason.RemoteCancel -> println("Call Invite for call $callId was cancelled by the caller")
            VoiceInviteCancelReason.AnsweredElsewhere -> println("Call Invite for call $callId was answered on another device")
            VoiceInviteCancelReason.RejectedElsewhere -> println("Call Invite for call $callId was rejected on another device")
            VoiceInviteCancelReason.RemoteTimeout -> println("Call Invite for call $callId timed out")
        }
    }

Event Data ​

ParameterTypeDescription
callIdstringInvite/call identifier
reasonCancelReasonCancellation reason — see below

CancelReason ​

Android / Web valueiOS valueDescription
AnsweredElsewhereVGVoiceInviteCancelReasonAnsweredElsewhereInvite was answered on another device
RejectedElsewhereVGVoiceInviteCancelReasonRejectedElsewhereInvite was rejected on another device
RemoteCancelVGVoiceInviteCancelReasonRemoteCancelCaller canceled the invite
RemoteTimeoutVGVoiceInviteCancelReasonRemoteTimeoutInvite 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

Built with VitePress.