Skip to content

On Leg Status Update ​

Fired when a remote call leg status changes (for example, ringing, answered, busy, completed).

Event Registration ​

fun setOnLegStatusUpdate(
  fn: (callId: String, legId: String, status: LegStatus) -> Unit
): Subscription

Usage Example ​

client.setOnLegStatusUpdate { call, legId, status ->
    when(status) {
        LegStatus.ringing -> println("Leg $legId for call $call is ringing")
        LegStatus.answered -> println("Leg $legId for call $call was answered")
        LegStatus.completed -> println("Leg $legId for call $call was completed")
        LegStatus.busy, LegStatus.rejected, LegStatus.timeout, LegStatus.failed, LegStatus.cancelled ->
            println("Leg $legId for call $call ended unanswered: $status")
        LegStatus.started, LegStatus.machine -> println("Leg $legId for call $call is $status")
    }
}

Event Data ​

ParameterTypeDescription
callIdstringIdentifier of the call
legIdstringIdentifier of the leg that changed
statusLegStatusUpdated status of the leg — see below

LegStatus ​

Android / Web valueiOS valueDescription
ringing / RINGINGVGLegStatusRingingRemote leg is ringing
answered / ANSWEREDVGLegStatusAnsweredRemote leg has answered the call
completed / COMPLETEDVGLegStatusCompletedRemote leg has ended
started / STARTEDVGLegStatusStartedRemote leg has been created and is being set up
failed / FAILEDVGLegStatusFailedRemote leg could not be connected
busy / BUSYVGLegStatusBusyThe called party was busy
timeout / TIMEOUTVGLegStatusTimeoutThe called party did not answer in time
cancelled / CANCELLEDVGLegStatusCancelledThe leg was cancelled before it was answered
rejected / REJECTEDVGLegStatusRejectedThe called party rejected the call
machine / MACHINEVGLegStatusMachineAn answering machine answered the call

completed, failed, busy, timeout, cancelled and rejected are final: the leg sends no further updates. A switch or when over LegStatus should handle every value; iOS reports a value it does not recognise as VGLegStatusUnknown.

Notes ​

  • This event is especially useful for call progress UI
  • Typically reflects remote leg transitions rather than your own local state

Built with VitePress.