with Client() as client: with
calls = client.telephony.calls, where call_id is the id create returned. The cURL
examples use your credentials with CALL_ID set to
that id. Every method raises TelephonyAPIError on an error response - see
Errors.
Every request sends
Authorization: Token $UNPOD_PLATFORM_TOKEN and
Org-Handle: $UNPOD_ORG_HANDLE, plus Content-Type: application/json when it has a body.
Options
create and add_participant take the same options. Over HTTP they are body fields of
the same name (from_ is from), and idempotency_key is the Idempotency-Key header.
Play audio and speak
leg_id is the leg_id from create, add_participant or an event (or caller /
callee); omit it to play to everyone on the call. Each leg gets PlayStarted / PlayStopped events with the same
play_id. speak answers 503 tts_unavailable when speech can’t be made (the call
carries on) and 429 rate_limited when your org sends too many at once.
Transfer and DTMF
For DTMF and transfer,
leg_id takes only "caller" or "callee" - not the leg_id
from create or an event - and goes over HTTP as leg. Anything else returns
400 bad_request.
Inspect and end calls
Right after hangup,
get and end can briefly answer 404 not_found - treat it as done.
To get a call’s recording once it ends, see Recording.
For a full production flow - dial an agent, connect the customer, end the call cleanly -
see Number Masking.
Errors
Branch on.code, not the message:
code, or in detail for checks Unpod makes before the call
reaches the SBC (call_api_disabled, from_not_owned).
The SDK raises
ValueError before sending when speak text is over 1000 characters or
send_dtmf digits fall outside 0-9 A-D * #.