Skip to Content
SIP trunks

Create a SIP trunk

Permissionsip-trunks:createRetriesIdempotency-Key requiredAuthentication
POST
/sip-trunks

Creates a durable trunk row and starts asynchronous provider provisioning. Poll resource_url until status is active or error. Supply Idempotency-Key so a network retry cannot create a duplicate provider trunk.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Header Parameters

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body

Creates either a customer-managed SIP trunk or an automated Twilio trunk. Credentials are write-only and never appear in responses.

Workflow rules:

  • provider=twilio_automated requires account_sid and auth_token and forbids all BYO signaling, address, and auth fields; Kejue Voice derives those values.
  • provider=sip defaults sip_signaling_mode to static_peer. static_peer requires inbound_auth_mode. ip_allowlist requires inbound_allowed_addresses; credentials requires auth_username and auth_password.
  • registered_peer requires auth_username and auth_password and derives inbound auth/address configuration. If outbound_auth_mode is supplied it must be ip_allowlist.
  • remote_registered_peer requires auth_username, auth_password, and remote_registrar_address; it derives inbound and outbound routing. Other remote registration values have documented defaults.
  • A static outbound_address defaults outbound_transport to tls and outbound_auth_mode to credentials. Credential auth requires auth_username and auth_password; ip_allowlist forbids them unless registered_peer also needs them for registration.
  • outbound_capacity_mode defaults to unknown. fixed requires max_concurrent_outbound or max_outbound_cps; burst requires max_outbound_cps. Limits are forbidden for unknown and unlimited modes.
name*string

Unique display name within the organization. Leading and trailing whitespace is removed.

Length2 <= length <= 80
provider*SipTrunkProvider

sip uses customer-managed carrier/PBX configuration; twilio_automated provisions Twilio resources from stored account credentials.

Value in"sip""twilio_automated"
sip_signaling_mode?SipSignalingMode
Value in"static_peer""registered_peer""remote_registered_peer"
inbound_auth_mode?SipAuthMode
Value in"ip_allowlist""credentials"
inbound_allowed_addresses?array<>

IPv4/IPv6 addresses or CIDRs. Values are canonicalized and duplicates removed.

Itemsitems <= 100
outbound_address?string

SIP host or host:port without a username or URI scheme.

Lengthlength <= 512
outbound_transport?SipTransport
Value in"udp""tcp""tls"
outbound_auth_mode?SipAuthMode
Value in"ip_allowlist""credentials"
auth_username?string

Write-only SIP digest username. Limited to 256 encoded UTF-8 bytes.

Lengthlength <= 256
auth_password?string

Write-only SIP digest password. Limited to 1024 encoded UTF-8 bytes.

Lengthlength <= 1024
remote_registrar_address?string

Remote PBX/carrier SIP host or host:port. Required for remote_registered_peer.

Lengthlength <= 512
remote_registrar_transport?string

Defaults to udp.

Value in"udp""tcp""tls"
remote_registrar_domain?string

Digest domain; derived from remote_registrar_address when omitted.

Length1 <= length
remote_register_realm?string

Digest realm; defaults to remote_registrar_domain.

Length1 <= length
remote_register_expires_seconds?integer
Range60 <= value <= 3600
Default300
account_sid?string

Write-only Twilio account SID for provider=twilio_automated.

Lengthlength <= 128
auth_token?string

Write-only Twilio auth token for provider=twilio_automated.

Lengthlength <= 1024
inbound_advanced_settings?

Optional LiveKit inbound-leg settings. Omitted fields use provider defaults.

outbound_advanced_settings?

Optional LiveKit outbound-leg settings plus Kejue Voice toll-fraud destination allowlists.

outbound_capacity_mode?SipOutboundCapacityMode
Value in"unknown""fixed""unlimited"
max_concurrent_outbound?integer
Range1 <= value
max_outbound_cps?number
Range0 < value
outbound_cps_burst?integer
Range1 <= value
outbound_capacity_profile_id?string

Capacity profile in the same organization.

Formatuuid

Response Body

The trunk was created and provisioning was scheduled.

application/json
  1. response

Stable polling contract returned after asynchronous create or reconcile acceptance.

id*string
Formatuuid
status*string
resource_url*string
Match^/v1/sip-trunks/[0-9a-f-]+$
poll_after_seconds*integer
Range1 <= value
provisioning_async*boolean
Example Request
curl -X POST 'https://api.kejue.co/v1/sip-trunks' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{  "name": "string",  "provider": "sip"}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "status": "provisioning",  "resource_url": "string",  "poll_after_seconds": 1,  "provisioning_async": true}