Update a SIP trunk
const url = 'https://api.siprtc.io/v1/Accounts/example/SipTrunk/example';const options = { method: 'PUT', headers: {Authorization: 'Basic <credentials>', 'Content-Type': 'application/json'}, body: '{"is_recording":false,"name":"Main PBX trunk","status":"active"}'};
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/example \ --header 'Authorization: Basic <credentials>' \ --header 'Content-Type: application/json' \ --data '{ "is_recording": false, "name": "Main PBX trunk", "status": "active" }'Renames one of your trunks, sets its status and turns call recording on or off. name, status and is_recording are all overwritten, so send the current values of those you do not want to change: an omitted status is stored empty (which hides the trunk from lists) and an omitted is_recording turns recording off. The name must be unique among the account’s trunks. 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.
object
Whether calls over the trunk are recorded. Omitting it turns recording off.
Example
falseTrunk name, unique among the account’s trunks.
Example
Main PBX trunkTrunk status. The value is stored as sent, so always send it (“active” or “inactive”).
Example
activeResponses
Section titled “ Responses ”Updated (message “Trunk 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 does not exist, the name is taken, 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"}