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.
Parameter
leg_idstringID of the call leg to retrieve, as returned by the leg list or webhook events.
Antwort-Payload
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_iddirectionWhether the call was placed from your side, by your PBX, the API, the browser or Bird dialing onward for you (outbound), or arrived from a remote party (inbound).
Possible values: inbound, outbound
fromCalling 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.
statusCall status.
A call that has ended carries one of:
answeredmeans it connected and the far end picked up.no_answermeans nobody picked up before the call timed out.rejectedmeans it was refused rather than attempted. Either we turned it away before dialing a carrier, in which caserejection_reasonnames the check it failed where there was one, or the far end declined it.failedmeans it was attempted and did not work, andsip_response_codeis what came back.unknownmeans the outcome could not be determined. Contact support with the callidif you see one.
An active call carries ringing before it is picked up and in_progress
afterward. The call list's status filter takes any mix of the two sets.
busy and canceled are reserved for incoming calls delivered to your own
numbers: busy for a called party that rejected the call as busy, canceled
for a caller who hung up before it was picked up. Neither is emitted yet and
both outcomes are reported as failed today.
Possible values: answered, no_answer, busy, canceled, failed, rejected, unknown, ringing, in_progress
sip_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.
Possible values: source_not_allowed, caller_id_not_verified, routing_not_configured, no_route_found, destination_blocked, destination_not_enabled, insufficient_balance, daily_spend_exceeded, concurrent_calls_exceeded, calls_per_second_exceeded, call_not_permitted, number_ownership_not_verified
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.
Verwandte Ressourcen
Weiter mit der Dokumentation, Anleitungen und Beispielen zu diesem Thema.