A trunk is a named SIP/RTP egress (and ingress) profile. The public SDK refers to trunks by trunk_id when dialing; this page is how that trunk_id gets created and configured.
No SDK wrapper. Build the request as a serde envelope and write it on a fresh QUIC bidirectional stream. See Raw RPC Format.

AddTrunk / UpdateTrunk

AddTrunk and UpdateTrunk accept the same DTO. Use Add for first-time provisioning; Update for in-place edits. Both replace the full record (no patch semantics) — read with GetTrunk first if you only want to change a subset of fields.

Request DTO (AddTrunkRequest / UpdateTrunkRequest)

FieldTypeDefaultNotes
admin_tokenstringAdmin JWT.
trunk_idstringStable identifier; this is what SDKs reference.
channel_limituint3250Max concurrent calls on the trunk.
internal_sip_ipstringGateway-side SIP bind.
external_sip_ipstringPublic IP advertised in SIP headers (NAT).
internal_rtp_ipstringGateway-side RTP bind.
external_rtp_ipstringPublic IP for RTP; usually equals external_sip_ip.
gateway_ipstringFar-end peer (carrier / SBC).
sbc_ipstringIf routing through an SBC, its address.
source_pbx_portuint165060Local SIP source port.
destination_sbc_portuint165060Far-end SIP port.
display_namestringCaller-ID display-name for outbound INVITEs.
domainstringSIP From domain.
proxystringOutbound proxy URI, if any.
require_registrationboolfalseIf true, gateway registers with sip_username/sip_password.
sip_usernamestringRegistrar credentials.
sip_passwordstringRegistrar credentials.
register_expires_secuint323600REGISTER Expires value.
codec_preferencesvector<string>[PCMU, PCMA, OPUS]Offer order in SDP.
rtp_start_portuint1616384RTP port range start.
rtp_end_portuint1632768RTP port range end.
media_ip_cidrsvector<string>[]Allow-listed media peers; non-matching SDPs are rejected.
reject_incoming_callsbooltrueDefault-deny inbound; flip to false when you wire inbound_rule.
reject_sip_codeuint16603SIP response code used when rejecting.
reject_audio_filestringURL of audio to play before rejecting (if 200 OK-then-hangup mode).
ignore_early_mediaboolfalseSuppress 183 Session Progress audio.
terminate_on_holdboolfalseHang up the call instead of going on hold.
inbound_ruleint320One of InboundRule (0=REJECT, 1=PLAY_AND_HANGUP, 2=NOTIFY_AND_HANGUP, 3=HANDLE_AI).
inbound_audio_urlstringUsed by PLAY_AND_HANGUP.
inbound_webhook_urlstringUsed by NOTIFY_AND_HANGUP.
inbound_ai_websocket_urlstringUsed by HANDLE_AI.
inbound_ai_quic_urlstringUsed by HANDLE_AI for QUIC-side AI bridges.
api_bearer_tokenstringPer-trunk webhook signing token.
ai_websocket_urlstringDefault AI endpoint for outbound calls on this trunk.
ai_quic_urlstringSame, QUIC variant.
auto_bargein_modestring"energy""energy", "vad", "semantic", or "off".
auto_bargein_aggressivenessint32203. Higher = barge sooner.
agent_idstringOptional bound agent DAG id (resolved server-side).
Returns Empty on success.

RemoveTrunk

FieldType
admin_tokenstring
trunk_idstring
Returns Empty. Existing in-flight calls keep running until they hang up naturally; new originations against a removed trunk_id fail with ERR_INVALID_TRUNK.

GetTrunk

Request:
FieldType
admin_tokenstring
trunk_idstring
Response (GetTrunkResponse):
FieldTypeNotes
foundboolfalse ⇒ no trunk by that id.
configApiTrunkConfigSanitised view (no SIP credentials).
ApiTrunkConfig:
FieldTypeNotes
trunk_idstring
channel_limituint32
display_namestring
domainstring
is_cb_trippedboolCircuit-breaker state.
current_asrdoubleLive answer-seizure ratio %.
current_acduint32Live average call duration (seconds).
current_mosdoubleLive mean opinion score estimate.
The credential-bearing fields (sip_password, api_bearer_token, …) are never returned. To rotate them, do another UpdateTrunk with the new values.