Skip to main content
Version: 0.9.12

SIP trunks

platform v0.9.11verified 2026-05-14

Path: /admin-settingsSIP Trunks tab

SIP trunks define how the platform identifies and authenticates inbound SIP traffic from external carriers, SIP providers, or WebRTC gateways. Multiple trunk types run in parallel on a single Kamailio instance.

How changes take effect

ChangeActionDowntime
Create / edit / enable / disable trunkRedis sync (Admin Tools → Sync All to Redis)None
Identification or auth credentials changedRedis syncNone
TLS settings or CA uploadRedis sync (~5 s for the TLS watcher)None — hot reload
TLS_ENABLED env var changeContainer restart (docker compose restart telpro)Brief restart
kamailio.cfg changedContainer rebuild + restartBrief restart

The TLS sync watcher polls Redis every 5 s for TLS material changes and triggers kamcmd tls.reload.

Identification

How Kamailio identifies which trunk a call belongs to. Trunks are evaluated in priority order (lower number = checked first). When multiple identification methods are enabled on a trunk, all must match (AND).

MethodChecksUse case
Source IPCaller's IP vs. list / CIDR.Carriers with static IPs.
From DomainSIP From header domain vs. regex.Distinct From-domain.
User-AgentUser-Agent header vs. regex.Recognisable UA strings.
CombinedTwo or three of the above.Higher specificity when ranges overlap.

Priority example

PriorityTrunkWhy
10IP + Domain + UAMost specific.
20IP + UANarrows by UA within IP range.
30From domain (digest)Any IP, specific domain, password required.
90IP-only catch-allNetwork-level fallback.

Fields

FieldRequiredDescription
Identify ByYesMulti-select: source_ip, from_domain, user_agent.
Allowed IPsConditionalWhen source_ip is selected. Array of CIDRs.
From Domain PatternConditionalRegex against From-header domain.
User-Agent PatternConditionalRegex against User-Agent.

Authentication

Runs after identification. Authorises the identified caller to proceed.

MethodHowPrerequisitesUse case
ip_onlyIdentification alone authorises.Allowed IPs configured.Trusted static-IP carriers (Twilio, Vonage).
digestSIP digest auth (407 challenge).Auth User + Pass on trunk.Carriers / devices supporting digest.
ip_and_digestSource IP + digest.Allowed IPs + Auth User + Pass.Maximum security.
FieldRequiredDescription
Auth MethodYesip_only / digest / ip_and_digest.
Auth RealmConditionalSIP realm sent in 407 (defaults to From-domain).
Auth UserConditionalUsername expected in digest response.
Auth PassConditionalPassword (stored encrypted).

Media

FieldDefaultDescription
SRTP Modedisableddisabled (plain RTP) / prefer (negotiate) / require (RTP/SAVP only). SRTP terminates at RTPEngine; TelSys always sees plain RTP.
Symmetric RTPfalseReply to the address:port the media was received from, ignoring SDP. Use for NAT or unreliable SDP.

TLS

Multiple TLS modes coexist on a single Kamailio instance — UDP/5060 and TLS/5061 run side by side.

Prerequisites

RequirementSetup
TLS enabled on KamailioTLS_ENABLED=true in docker-compose.yaml. Restart required.
Server certificateserver.crt + server.key in tls/ (volume-mounted).
CA certificate (for mTLS)Upload as Platform Secret with purpose CA_CERT and reference it on the trunk.

Modes

ModeSettingsEnforces
No TLSAll TLS fields offPlain UDP/TCP.
TLS requiredRequire TLS Transport = trueReject UDP/TCP with 403.
TLS + verify peerAbove + Verify Peer + Require Client Cert + CAVerifies client cert against the CA.
TLS + peer name+ Peer Name Verification + Remote Subject NameChecks the cert's CN matches.
Full mTLS + peer nameAll of the aboveMax security.

Fields

FieldDefaultDescription
Require TLS TransportfalseReject non-TLS with 403.
Verify Peer CertificatefalseVerify against CA bundle.
Require Client CertificatefalseClient must present a cert during the handshake.
Peer Name Verificationdisableddisabled / enabled — check CN.
TLS Remote Subject NameExpected CN (e.g. trunk.pstn.twilio.com).
TLS CA CertificatePlatform Secret of purpose CA_CERT.

TLS checks run before authentication and routing.

Call metadata

FieldDescription
Unique ID HeaderSIP header carrying the external call ID (e.g. X-Twilio-CallSid). Used to correlate with carrier CDRs.

Special handling

FieldDefaultDescription
Is InternalfalseMark internal trunk (Janus, localhost). Sets RTPEngine direction=priv direction=priv.
Requires X-CallfalseTrunk requires an X-Call-ID header pre-created by TelAPI. Used for WebRTC via Janus.

Technical

FieldDefaultDescription
Max Concurrent Calls0 (unlimited)Cap. Exceeded → 486 Busy Here.
Codec Preferences["PCMA", "PCMU"]Audio codec priority for RTPEngine.
Priority50Trunk matching priority.

Parallel operation

All trunk types run together: UDP and TLS in parallel; mixed auth methods; mixed media settings; mTLS-required and TLS-without-client-cert trunks coexist (TLS server domain uses verify_client = optional).

Workflows

IP-only trunk (Twilio-style)

Identify By source_ip, Allowed IPs ["54.172.60.0/23"], Auth ip_only → enable → save → Redis sync.

Digest-auth trunk

Identify By from_domain with pattern, Auth digest (user + pass + realm) → save → Redis sync.

Full mTLS trunk

Upload CA as Platform Secret → on the trunk, enable Require TLS, Verify Peer, Require Client Cert, link the CA, set Peer Name + Remote Subject Name → save → Redis sync.

Reference examples

Twilio production

SettingValue
Identify Bysource_ip, from_domain
From Domain Pattern.*\.twilio\.com$
Auth Methodip_only
Require TLS Transporttrue
SRTP Moderequire
Symmetric RTPtrue
Unique ID HeaderX-Twilio-CallSid
Priority20

Janus internal

SettingValue
Identify Bysource_ip
Allowed IPs["10.30.0.13/32"]
Auth Methodip_only
Is Internaltrue
Requires X-Calltrue
Priority10

See also