Sign inGet Started

Get a leg

GET
/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" | …
Respons200
{
  "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_idstring

Payload Respons

id
string
wajib

Unique identifier for this leg record.

call_id
nullable string

Call 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_id
string
wajib
direction
string
wajib
from
string
wajib

Calling party number in E.164 format.

to
string
wajib

Called party number in E.164 format.

actor
object

Who 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.

Tampilkan atribut turunan
sip_trunk_id
nullable string

Identifier of the SIP trunk that originated this leg. null when no trunk is associated.

sip_call_id
string

The 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.

status
string
wajib
sip_response_code
nullable integer

Final SIP response code received from the carrier. null when no SIP response was received, for example on timeout or DNS failure.

rejection_reason
string

Why 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.

route
object

Which 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.

Tampilkan atribut turunan
route.type
string
wajib

The number turned the leg away, either because its own route is reject or because it has none and the workspace default inbound route is reject.

Value: reject

tags
array of object

Your 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.

Tampilkan atribut turunan
started_at
string
wajib

When the leg was initiated.

answered_at
nullable string

When the leg was answered (200 OK received). null for unanswered legs.

ended_at
nullable string

When the leg ended (BYE or final non-2xx response). null for legs that ended abnormally without a recorded end event.

duration_ms
nullable integer

Total 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_ms
integer

Post-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_ms
nullable integer

Billable duration in milliseconds, measured from answer to leg end. Zero for unanswered legs, and null while the leg is still in progress.

media_quality
object

How 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.

Tampilkan atribut turunan
cost
object

What 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.

Tampilkan atribut turunan

Lanjutkan dengan dokumentasi, panduan, dan contoh untuk topik ini.