Trunks
Trunks (SIP trunks) connect the phone system to telephone carriers. A tenant can use its own trunks as well as shared trunks provided by Exobyte. Scopes trunks:read / trunks:write.
Adding a trunk
curl -s -X POST https://centralino.exovoip.it/api/v1/trunks \
-H "X-API-Key: $EXOPBX_API_KEY" -H "Content-Type: application/json" \
-d '{"name":"Linea principale","registration":"outbound","host":"sip.provider.example",
"username":"0981123456","secret":"password-del-provider","codecs":["alaw","g722"]}'const { trunk, overlaps } = await pbx.trunks.create({
name: 'Linea principale',
registration: 'outbound',
host: 'sip.provider.example',
username: '0981123456',
secret: 'password-del-provider',
codecs: ['alaw', 'g722'],
});$out = $pbx->trunks->create([
'name' => 'Linea principale',
'registration' => 'outbound',
'host' => 'sip.provider.example',
'username' => '0981123456',
'secret' => 'password-del-provider',
'codecs' => ['alaw', 'g722'],
]);out = pbx.trunks.create({
"name": "Linea principale",
"registration": "outbound",
"host": "sip.provider.example",
"username": "0981123456",
"secret": "password-del-provider",
"codecs": ["alaw", "g722"],
})| Field | Description |
|---|---|
registration | outbound (the phone system registers with the carrier), inbound (the carrier registers with the phone system), none (IP-based authentication) |
host, port, transport | Carrier server and transport (udp, tcp, tls) |
username, secret | Credentials; the secret is never returned (hasSecret) |
codecs | Codecs in order of preference (e.g. alaw, g722) |
maxChannels | Maximum concurrent calls on the trunk |
Network verification
When a trunk is created or modified, its server addresses are compared with those of other trunks. If they overlap with trunks of other tenants or shared trunks, the trunk stays pending verification by Exobyte (approval.status = pending_approval) and does not receive calls until approved. The outcome is shown in the response (approval, overlaps).
Status and monitoring
GET /v1/trunks reports a summary status (registered, unregistered, rejected, unknown); real-time details (registration with reason, reachability, latency, active calls) are available in GET /v1/live/trunks and in trunk.state events.
curl -s https://centralino.exovoip.it/api/v1/trunks -H "X-API-Key: $EXOPBX_API_KEY"
curl -s https://centralino.exovoip.it/api/v1/live/trunks -H "X-API-Key: $EXOPBX_API_KEY"const { items } = await pbx.trunks.list();
const live = await pbx.live.trunks(); // registrazione, raggiungibilità, chiamate attive$trunks = $pbx->trunks->list()['items'];
$live = $pbx->live->trunks();trunks = pbx.trunks.list()["items"]
live = pbx.live.trunks()A trunk used by numbers or outbound routes cannot be deleted: 409 IN_USE.
Shared trunks (platform)
Shared trunks (tenantId: null) can be created and modified only with global keys. Without X-Tenant-Id the list shows all platform trunks; the verification queue is at GET /v1/trunks/approvals (scope security:read), with approval and rejection with a reason.
Endpoints
| Request | Scope | SDK method |
|---|---|---|
GET /v1/trunks/approvals | security:read | trunks.approvals() |
POST /v1/trunks/:id/approve | security:write | trunks.approve() |
POST /v1/trunks/:id/reject | security:write | trunks.reject() |
GET /v1/trunks | trunks:read | trunks.list() |
POST /v1/trunks | trunks:write | trunks.create() |
GET /v1/trunks/:id | trunks:read | trunks.get() |
PATCH /v1/trunks/:id | trunks:write | trunks.update() |
DELETE /v1/trunks/:id | trunks:write | trunks.delete() |
