SIP trunks
A trunk holds your carrier’s SIP details: its SIP URL, credentials and the addresses it sends calls from. Map your numbers to a trunk and Unpod returns the origin endpoint - where your carrier sends calls for those numbers. Setting up your first trunk? Follow the Quick Start. This page covers each operation on its own. The samples read your credentials (UNPOD_BASE_URL,
UNPOD_PLATFORM_TOKEN, UNPOD_ORG_HANDLE) from the environment.
List trunks
auth_password is masked. See
List Trunks.
Get a trunk
404. See Get Trunk.
Create a trunk
Keep the returned
id (data.id in the cURL response): you need it to map numbers, get
or delete the trunk. The API has no call to update a trunk. See
Create Trunk.
Map numbers to a trunk
Mapping takes number ids, not E.164 numbers. Only aNOT_ASSIGNED number can be
mapped; detach an ASSIGNED number first
(Detach a number).
Read each number’s id from your org’s number list,
GET /telephony/numbers/?include_assigned=true. The SDK’s numbers.list() doesn’t
return the id yet - step 3 of the Quick Start shows a Python
lookup. For numbers already on your org, client.telephony.overview() returns the same
id as number_id - a pure-SDK way to find the ids to unmap.
ingress is where your carrier sends calls,
dids lists the numbers this request mapped, and accepted_source_ips are the addresses
Unpod accepts them from. Each eligible number gets a row in numbers with its own ok
and error; ids that aren’t an active NOT_ASSIGNED number are left out. If no id is
eligible, the request fails with 400 No valid unassigned numbers found. (the SDK
raises httpx.HTTPStatusError). See
Attach Numbers to Trunk.
Unmap numbers
NOT_ASSIGNED. A number that isn’t on this trunk
reports ok: false with Number is not mapped to this trunk. If no number unmaps, the
request fails with 400 (the SDK raises httpx.HTTPStatusError). See
Detach Numbers from Trunk.
Inbound config for a whole trunk
To send the trunk’s inbound calls to your app, set the inbound config on each of its numbers withset_did. It needs the Call API switched on for your org (otherwise
403 call_api_disabled).
404. set_trunk / PUT /sbc/v1/trunks/{name}/inbound
take the trunk’s internal Unpod name, which this API doesn’t return yet: the name you
gave the trunk returns 404. For every config field and how to answer the call, see
For a whole SIP trunk.
Delete a trunk
Delete detaches every number on the trunk back toNOT_ASSIGNED and removes the trunk, all
or nothing: if one number fails, nothing changes. Unmapping first shows you which number
failed and why, so the sample unmaps, then deletes only once every number has unmapped. Running it again after a partial failure? Drop
the ids that already unmapped: they now report ok: false, and if none unmap the request
fails with 400.
204, or 404 for a trunk that isn’t your org’s. If a number can’t be
detached it returns 400 (or 206) with the reason in message and the trunk stays.
trunks.delete() raises on the 400 but not on a 206, so check with
trunks.get(TRUNK_ID): it raises httpx.HTTPStatusError with 404 once the trunk is gone. See
Delete Trunk.