Trunk-uri SIP
11 endpoint-uri. Fiecare cale de mai jos este relativă la URL-ul de bază al API-ului și include deja prefixul /api/v1 — vezi convențiile pentru autentificare, paginare, erori și idempotență.
| Endpoint | ||
|---|---|---|
| GET | /telephony/sip-trunks | List SIP trunks with their gateways, optionally filtered by status or enabled_only, paginated |
| POST | /telephony/sip-trunks | Create a SIP trunk, deriving a slug and gateway name, and encrypting the password on write |
| GET | /telephony/sip-trunks/{id} | Fetch one SIP trunk with its gateways and DID mappings |
| PATCH | /telephony/sip-trunks/{id} | Update a SIP trunk's auth, transport, codec, ACL and digit-manipulation settings, returning the refreshed row |
| DELETE | /telephony/sip-trunks/{id} | Delete a SIP trunk |
| GET | /telephony/sip-trunks/{id}/config | The generated Sofia XML, so an operator can diff it before applying |
| GET | /telephony/sip-trunks/{id}/diagnostics | Return the trunk's most recent SIP diagnostic records for the log viewer, newest first |
| POST | /telephony/sip-trunks/{id}/test/inbound | Check inbound readiness for the trunk (DIDs, ACL, destination) and persist the result as a diagnostic |
| POST | /telephony/sip-trunks/{id}/test/options | Send a SIP OPTIONS probe to every gateway, persist each result and update trunk and gateway status |
| POST | /telephony/sip-trunks/{id}/test/outbound | Originate a parked test call to a destination through the trunk's primary gateway and report the SIP answer |
| POST | /telephony/sip-trunks/{id}/test/register | Attempt a SIP REGISTER for the trunk and persist the outcome, updating trunk status and failure counters |
Endpoint-uri
List SIP trunks with their gateways, optionally filtered by status or enabled_only, paginated
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de interogare
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
status | string | — | |
enabled_only | boolean | — | default false |
curl -X GET "$CALLAGENT_API_URL/telephony/sip-trunks?status=string&enabled_only=false" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks?status=string&enabled_only=false`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks?status=string&enabled_only=false');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.get(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks?status=string&enabled_only=false",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped array |
Exemplu de răspuns, generat din schemă:
{
"data": [
"string"
],
"meta": {
"page": 1,
"limit": 25,
"total": 1,
"pages": 1
}
}Create a SIP trunk, deriving a slug and gateway name, and encrypting the password on write
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
- camelCase body keys (authMode, srtpPolicy, outboundProxy, ...); password is stored encrypted and never returned
curl -X POST "$CALLAGENT_API_URL/telephony/sip-trunks" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.post(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
201 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
422 | Validation failed |
Fetch one SIP trunk with its gateways and DID mappings
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X GET "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.get(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped SipTrunk |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
Update a SIP trunk's auth, transport, codec, ACL and digit-manipulation settings, returning the refreshed row
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
- Request body keys are camelCase (e.g. authMode, srtpPolicy, outboundProxy), not the snake_case the rest of the wire format uses
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X PATCH "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'PATCH',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.patch(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
422 | Validation failed |
Delete a SIP trunk
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
- Acest răspuns nu este împachetat în
data.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X DELETE "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.delete(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
204 | No content |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
The generated Sofia XML, so an operator can diff it before applying
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
- Returns 500 if the trunk has no enabled gateway, or if an ACL entry is a /0 CIDR - both throw RuntimeException
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X GET "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/config" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/config`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/config');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.get(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/config",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
Exemplu de răspuns, generat din schemă:
{
"data": {
"files": {},
"file_name": "Support Line",
"path": "string",
"stale": true,
"xml": "string",
"acl": {
"path": "string",
"file_name": "Support Line",
"entries": "string",
"authorising": "string",
"stale": "string",
"xml": "string"
}
}
}Return the trunk's most recent SIP diagnostic records for the log viewer, newest first
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X GET "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/diagnostics" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/diagnostics`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/diagnostics');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.get(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/diagnostics",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | Array of SipDiagnostic |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
Exemplu de răspuns, generat din schemă:
{
"data": [
{
"id": "01JQ0000000000000000000000",
"organization_id": "01JQ0000000000000000000000",
"sip_trunk_id": "01JQ0000000000000000000000",
"sip_trunk_gateway_id": "01JQ0000000000000000000000",
"kind": "string",
"outcome": "string",
"response_code": 1,
"response_reason": "string",
"latency_ms": 1,
"target": "string",
"request_trace": "string",
"response_trace": "string",
"message": "string",
"context": {},
"triggered_by_user_id": "01JQ0000000000000000000000",
"created_at": "2026-01-01T12:00:00+00:00"
}
]
}Check inbound readiness for the trunk (DIDs, ACL, destination) and persist the result as a diagnostic
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X POST "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/test/inbound" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/test/inbound`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/test/inbound');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.post(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/test/inbound",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
Exemplu de răspuns, generat din schemă:
{
"data": {
"kind": "string",
"outcome": "success",
"response_code": null,
"response_reason": null,
"latency_ms": null,
"target": "string",
"request_trace": null,
"response_trace": null,
"message": "string",
"context": {
"checks": [],
"last_inbound_at": null
}
}
}Send a SIP OPTIONS probe to every gateway, persist each result and update trunk and gateway status
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X POST "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/test/options" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/test/options`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/test/options');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.post(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/test/options",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
Exemplu de răspuns, generat din schemă:
{
"data": {
"trunk_status": "unknown",
"gateways": {}
}
}Originate a parked test call to a destination through the trunk's primary gateway and report the SIP answer
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
Corpul cererii
| Câmp | Tip | Obligatoriu | Note |
|---|---|---|---|
destination | string | da | max 64 chars |
curl -X POST "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/test/outbound" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"destination": "string"
}'const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/test/outbound`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"destination": "string"
}),
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/test/outbound');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'destination' => 'string',
]),
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.post(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/test/outbound",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
json={
"destination": "string"
},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
422 | The destination field is missing or longer than 64 characters |
Exemplu de răspuns, generat din schemă:
{
"data": {
"kind": "string",
"outcome": "success",
"response_code": 486,
"response_reason": "string",
"latency_ms": 1,
"target": "string",
"request_trace": "string",
"response_trace": "string",
"message": "string",
"context": {
"gateway": "string",
"dialed": "string"
}
}
}Attempt a SIP REGISTER for the trunk and persist the outcome, updating trunk status and failure counters
- Handler-ul nu impune niciun scope — orice cheie validă îl poate apela.
Parametri de cale
| Nume | Tip | Obligatoriu | Note |
|---|---|---|---|
id | string | da |
curl -X POST "$CALLAGENT_API_URL/telephony/sip-trunks/01JQ0000000000000000000000/test/register" \
-H "Authorization: Bearer $CALLAGENT_API_KEY" \
-H "Accept: application/json"const response = await fetch(`${process.env.CALLAGENT_API_URL}/telephony/sip-trunks/01JQ0000000000000000000000/test/register`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.CALLAGENT_API_KEY}`,
Accept: 'application/json',
},
});
if (!response.ok) {
const { error } = await response.json();
throw new Error(`${error.type}: ${error.message}`);
}
const { data } = await response.json();<?php
$handle = curl_init(getenv('CALLAGENT_API_URL') . '/telephony/sip-trunks/01JQ0000000000000000000000/test/register');
curl_setopt_array($handle, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('CALLAGENT_API_KEY'),
'Accept: application/json',
],
]);
$body = json_decode(curl_exec($handle), true);
$status = curl_getinfo($handle, CURLINFO_HTTP_CODE);
curl_close($handle);
if ($status >= 400) {
throw new RuntimeException("{$body['error']['type']}: {$body['error']['message']}");
}
$data = $body['data'];import os, requests
response = requests.post(
f"{os.environ['CALLAGENT_API_URL']}/telephony/sip-trunks/01JQ0000000000000000000000/test/register",
headers={"Authorization": f"Bearer {os.environ['CALLAGENT_API_KEY']}"},
timeout=30,
)
response.raise_for_status()
data = response.json()["data"]Răspunsuri
| Status | Corp |
|---|---|
200 | data-wrapped object |
Erori
| Status | Când apare |
|---|---|
404 | No such trunk for this tenant |
Exemplu de răspuns, generat din schemă:
{
"data": {
"kind": "string",
"outcome": "string",
"response_code": 1,
"response_reason": "string",
"latency_ms": 1,
"target": "string",
"request_trace": "string",
"response_trace": "string",
"message": "string",
"context": {}
}
}