Update a SIP trunk and its URIs
const url = 'https://api.siprtc.io/v1/Accounts/example/SipTrunk/WithUris/example';const options = { method: 'PUT', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"name":"Main PBX trunk","origination_uris_to_add":[{"priority":"10","sip_uri":"sip:pbx.example.com:5060","status":true}],"origination_uris_to_delete":["sip:old-pbx.example.com:5060"],"status":"active","termination_uris":"acme-trunk.pstn.siprtc.io"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://api.siprtc.io/v1/Accounts/example/SipTrunk/WithUris/example \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "name": "Main PBX trunk", "origination_uris_to_add": [ { "priority": "10", "sip_uri": "sip:pbx.example.com:5060", "status": true } ], "origination_uris_to_delete": [ "sip:old-pbx.example.com:5060" ], "status": "active", "termination_uris": "acme-trunk.pstn.siprtc.io" }'Updates one of your trunks and its URIs in one call. name and status are overwritten. termination_uris replaces the SIP domain of the trunk’s termination URI (an empty or missing value clears it), creating the termination URI when the trunk has none. origination_uris_to_delete removes origination URIs by SIP URI and origination_uris_to_add adds new ones; adding a URI the trunk already has fails with 400 after the other changes have been saved. A vendor account can pass customer_id to act on a direct child account’s record.
Authorizations
Section titled “ Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “ Path Parameters ”Auth ID of your account.
ID of the trunk.
Query Parameters
Section titled “ Query Parameters ”Vendor accounts only: act on this direct child account instead of your own.
Request Bodyrequired
Section titled “ Request Bodyrequired ”The new trunk settings and URI changes.
object
Trunk name, unique among the account’s trunks.
Example
Main PBX trunkOrigination URIs to add. Adding a URI the trunk already has fails.
object
Priority of the URI as a decimal string; lower is tried first.
Example
10SIP URI that inbound calls for the trunk’s numbers are sent to.
Example
sip:pbx.example.com:5060Whether the URI is enabled.
Example
trueSIP URIs of origination URIs to remove from the trunk.
Example
[ "sip:old-pbx.example.com:5060"]Trunk status, stored as sent (“active” or “inactive”).
Example
activeSIP domain of the trunk’s termination URI. It replaces the stored value (an empty value clears it); a termination URI is created when the trunk has none.
Example
acme-trunk.pstn.siprtc.ioResponses
Section titled “ Responses ”Updated (message “Trunk URIs updated successfully”).
object
Human-readable explanation of the outcome.
Outcome of the request: “success” or “failed”.
Example
{ "message": "Invalid auth ID", "status": "success"}Name is missing, the trunk is not yours or does not exist, the name is taken, a URI change failed, or the gateway did not supply your company (message “company id is empty”).
object
Human-readable explanation of the outcome.
Outcome of the request: “success” or “failed”.
Example
{ "message": "Invalid auth ID", "status": "success"}Missing or wrong Basic-auth credentials (returned by the API gateway).
Example generated
exampleCustomer_id is not a direct child of your account.
object
Human-readable explanation of the outcome.
Outcome of the request: “success” or “failed”.
Example
{ "message": "Invalid auth ID", "status": "success"}Your account or the customer account could not be looked up.
object
Human-readable explanation of the outcome.
Outcome of the request: “success” or “failed”.
Example
{ "message": "Invalid auth ID", "status": "success"}