Skip to content
TriedDocs
Phone numbers

Update SIP trunk

Change a workspace SIP trunk and re-apply it to every attached number.

PATCHhttps://api.tried.com.au/update-sip-trunk/{id}

Needs keys Updates the fields you send and leaves the rest unchanged. The shared LiveKit trunks and dispatch rule are then synced with the new settings and the attached numbers, which is why this needs LiveKit (LIVEKIT_URL). Without it, mock mode records the requests in List telephony operations.

Request#

Path parameter Type Required Description
id string Yes The trunk ID, for example sip_trunk_5c1e8a92d4f70b36a1e9c4d2.

All body fields are optional. They are the same fields as Create SIP trunk.

Field Type Required Description
name string No Label for the trunk. At least one character.
termination_uri string No Where outbound calls are sent.
sip_trunk_auth_username string No Outbound digest username.
sip_trunk_auth_password string No Outbound digest password. Stored encrypted.
transport string No TCP, UDP or TLS.
media_encryption string No disabled, allowed or required.
allowed_inbound_addresses string[] No Replaces the list of IPs or CIDRs allowed to send inbound INVITEs.
inbound_auth_username string No Digest username your carrier must present on inbound INVITEs.
inbound_auth_password string No Digest password for inbound INVITEs. Stored encrypted.

Example request#

curl -X PATCH https://api.tried.com.au/update-sip-trunk/sip_trunk_5c1e8a92d4f70b36a1e9c4d2 \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "allowed_inbound_addresses": ["203.0.113.10/32", "203.0.113.11/32"] }'
const res = await fetch(
  "https://api.tried.com.au/update-sip-trunk/sip_trunk_5c1e8a92d4f70b36a1e9c4d2",
  {
    method: "PATCH",
    headers: {
      Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ allowed_inbound_addresses: ["203.0.113.10/32", "203.0.113.11/32"] }),
  },
);
const trunk = await res.json();
import os, requests

res = requests.patch(
    "https://api.tried.com.au/update-sip-trunk/sip_trunk_5c1e8a92d4f70b36a1e9c4d2",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={"allowed_inbound_addresses": ["203.0.113.10/32", "203.0.113.11/32"]},
)
trunk = res.json()

Response#

200 OK

The updated trunk. See Create SIP trunk for the fields.

{
  "sip_trunk_id": "sip_trunk_5c1e8a92d4f70b36a1e9c4d2",
  "name": "Melbourne PBX",
  "termination_uri": "pbx.example.com:5061",
  "sip_trunk_auth_username": "tried",
  "transport": "TLS",
  "media_encryption": "allowed",
  "allowed_inbound_addresses": ["203.0.113.10/32", "203.0.113.11/32"],
  "inbound_auth_username": null,
  "phone_numbers": ["+61390001234", "+61390005678"],
  "livekit_inbound_trunk_id": "ST_8fNc2kRw6HpA",
  "livekit_outbound_trunk_id": "ST_1dVs7qMe3LtG",
  "livekit_dispatch_rule_id": "SDR_5bXh9jTy4WnE",
  "last_modification_timestamp": 1792404000000
}

Errors#

Status When
400 Body validation failed, for example an unknown transport value or name: String must contain at least 1 character(s).
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request. This route needs the numbers scope. Members get The member role is read-only.
404 SIP trunk sip_trunk_... not found in this workspace.
429 Rate limit exceeded. See Rate limits.
500 LiveKit rejected the sync. The trunk's new settings are already saved; fix the cause and update again.

See Errors for the body format.