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
| Parameter | Type | Description |
|---|---|---|
callId | string | Identifier of the call |
legId | string | Identifier of the leg that changed |
status | LegStatus | Updated status of the leg — see below |
LegStatus
| Android / Web value | iOS value | Description |
|---|---|---|
ringing / RINGING | VGLegStatusRinging | Remote leg is ringing |
answered / ANSWERED | VGLegStatusAnswered | Remote leg has answered the call |
completed / COMPLETED | VGLegStatusCompleted | Remote leg has ended |
started / STARTED | VGLegStatusStarted | Remote leg has been created and is being set up |
failed / FAILED | VGLegStatusFailed | Remote leg could not be connected |
busy / BUSY | VGLegStatusBusy | The called party was busy |
timeout / TIMEOUT | VGLegStatusTimeout | The called party did not answer in time |
cancelled / CANCELLED | VGLegStatusCancelled | The leg was cancelled before it was answered |
rejected / REJECTED | VGLegStatusRejected | The called party rejected the call |
machine / MACHINE | VGLegStatusMachine | An 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
Related Actions
serverCall- Start an outbound callgetCallLegs- Retrieve call legs details