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 {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

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.