Get a leg
/v1/voice/legs/{leg_id}const call = await bird.voice.legs.get("vcl_01k0p3v9wera3v6q6xw3e9y2mh");
// A call still ringing or connected carries no economics yet.
call.status; // "answered" | "no_answer" | "ringing" | …call = client.voice.legs.get("vcl_01k0p3v9wera3v6q6xw3e9y2mh")
# A call still ringing or connected carries no economics yet.
print(call.status, call.duration_ms, call.cost)call, err := client.Voice.Legs.Get(context.Background(), "vcl_01k0p3v9wera3v6q6xw3e9y2mh")
if err != nil {
log.Fatal(err)
}
// A call still ringing or connected carries no economics yet.
fmt.Println(call.Status, call.DurationMs)$call = $bird->voice->legs->get('vcl_01k0p3v9wera3v6q6xw3e9y2mh');
// A call still ringing or connected carries no economics yet.
echo $call->getStatus(), ' ', $call->getDurationMs() ?? 'in flight';bird voice legs get <leg-id>curl -X GET "https://us1.platform.bird.com/v1/voice/legs/{leg_id}" \
-H "Authorization: Bearer $TOKEN"{
"id": "vcl_01krdgeqcxet5s7t44vh8rt9mg",
"call_id": "vcs_01krdgeqcxet5s7t44vh8rt9mg",
"workspace_id": "ws_01krdgeqcxet5s7t44vh8rt9mg",
"direction": "outbound",
"from": "+14155551234",
"to": "+16505559876",
"actor": {
"id": "usr_01krdgeqcxet5s7t44vh8rt9mg",
"type": "user"
},
"sip_trunk_id": "spt_01krdgeqcxet5s7t44vh8rt9mg",
"sip_call_id": "3f9a1c8e7b2d4a5f@sip.example.net",
"status": "answered",
"sip_response_code": 200,
"rejection_reason": "destination_not_enabled",
"route": {
"type": "trunk"
},
"tags": [
{
"name": "category",
"value": "welcome"
}
],
"duration_ms": 65000,
"pdd_ms": 850,
"billable_ms": 60000,
"media_quality": {
"mos": 4.32,
"jitter_ms": 12,
"packet_loss_pct": 1.5,
"round_trip_time_ms": 42
},
"cost": {
"amount": "0.013000",
"currency_code": "USD",
"outbound_amount": "0.013000",
"inbound_amount": null,
"call_handling_amount": null,
"recording_amount": null,
"transcription_amount": null
}
}
Returns a single leg at any point in its lifecycle. A leg that is still ringing or connected answers with its in-flight status and no economics: duration_ms, billable_ms, and ended_at fill in once it ends, at this same URL, and cost does too unless the leg was never rated, as with a verification call Bird places and answers on your behalf. Returns a 404 not_found_error if the leg does not exist in the workspace.
Parámetros
leg_idstringCarga de respuesta
idUnique identifier for this leg record.
call_idCall identifier shared across all legs of a multi-party or transferred call. Use this to correlate related leg records. null when call correlation is not available for the leg.
workspace_iddirectionfromCalling party number in E.164 format.
toCalled party number in E.164 format.
actorWho placed the leg: the API key whose credentials it used, the integration acting for the workspace, or the user who placed it from a browser or the CLI. Absent when the leg was admitted only by its source IP address, or when no actor was recorded.
sip_trunk_idIdentifier of the SIP trunk that originated this leg. null when no trunk is associated.
sip_call_idThe SIP Call-ID of this leg's signalling. We relay it unchanged, so it matches what the carrier and your own equipment logged for the same leg: the carrier's value on an incoming leg, and your system's value on a leg you place through a SIP trunk. Use it to match this leg against a carrier's records or your PBX logs. Legs recorded before this field existed carry it only if they were answered.
statussip_response_codeFinal SIP response code received from the carrier. null when no SIP response was received, for example on timeout or DNS failure.
rejection_reasonWhy we rejected the leg. Absent on connected legs and legs rejected
by the carrier or recipient. For carrier or recipient rejections, see
sip_response_code; a 6xx decline gives the leg a rejected status.
Read alongside route when present. A refusal caused by the number's
configuration has no rejection reason; the route records that
configuration.
routeWhich answer your number gave an incoming leg. Its type selects the shape, and each answer carries its own fields; the variants below are the full set you can receive. Recorded when the leg was handled, so changing the number's setup afterwards does not change what its past legs say. Absent on outbound legs, and on legs recorded before this field existed.
tagsYour own {name, value} labels for this leg, taken from the X-Bird-Call-Tag headers on the INVITE that placed it. Set them to organise legs by a dimension of your own (campaign, queue, agent, cost centre), then filter this list by them with tag. Read-only here: a leg is labelled when it is placed, and never afterwards. What is here may be less than what was sent, and the leg still goes through either way: a tag whose name or value breaks the rules below is dropped, anything past the first five is ignored, and a name sent more than once keeps its first value. Absent when the leg carried none, and on legs recorded before this field existed.
started_atWhen the leg was initiated.
answered_atWhen the leg was answered (200 OK received). null for unanswered legs.
ended_atWhen the leg ended (BYE or final non-2xx response). null for legs that ended abnormally without a recorded end event.
duration_msTotal leg duration in milliseconds, measured from the first INVITE to the BYE or final response. null while the leg is still in progress and has no final duration yet.
pdd_msPost-dial delay in milliseconds: how long the caller heard nothing between dialing and the phone starting to ring at the other end. High values are what callers experience as the leg not going through. Absent when the leg never rang, either because it failed first or because the carrier answered it immediately.
billable_msBillable duration in milliseconds, measured from answer to leg end. Zero for unanswered legs, and null while the leg is still in progress.
media_qualityHow the audio sounded, as opposed to whether the leg connected. Absent when the leg carried no audio, or when the far end reported nothing to measure from.
costWhat the leg cost, net of tax, at full precision, split into the components that make it up. Absent until the leg has been rated; unanswered or unpriced legs have no cost, and neither does a verification call Bird places and answers on your behalf, which is exempt from rating.
Mostrar atributos secundarios
cost.amountTotal charged, as a decimal string: the sum of the components below. Net of tax, which applies to your wallet balance rather than to an individual charge.
cost.currency_codeISO 4217 currency code. Every component is denominated in this currency.
cost.outbound_amountWhat we charged to carry the leg to the destination network, as a decimal string. null until this component is priced.
cost.inbound_amountWhat we charged to receive the leg from the originating network, as a decimal string. Only a leg that arrived at your number can carry it. null until this component is priced.
cost.call_handling_amountWhat we charged for handling the call itself, as a decimal string. A call is charged for handling once, however many legs it has, so only one leg's record carries it. null until this component is priced.
cost.recording_amountWhat we charged to record the leg, as a decimal string, billed per second over the same billable time as the rest of the leg. null until this component is priced.
cost.transcription_amountWhat we charged to transcribe the leg's audio, as a decimal string, billed per second of recorded audio rather than for the length of the leg. A transcript is produced after the leg ends, so this can appear after the rest of the cost. null until this component is priced.
Recursos relacionados
Continúa con la documentación, guías y ejemplos de este tema.