VoIP Infrastructure Guide

SIP Trunking Explained

8 min read  ·  Updated April 2026

SIP trunking replaces traditional ISDN/PRI lines with internet-based voice connections. Understanding how SIP trunks work is essential for troubleshooting registration failures, call quality issues, and routing problems.

In this guide

1. What is SIP trunking?

A SIP trunk is a virtual phone line that connects your PBX or UCaaS platform to the Public Switched Telephone Network (PSTN) over an IP network. Instead of physical copper lines or ISDN circuits, SIP trunks use the Session Initiation Protocol to set up, manage, and terminate calls over your internet connection.

One SIP trunk can carry many simultaneous calls — the number is limited by your internet bandwidth and the provider's concurrent call license, not by physical circuit capacity. A typical SIP trunk supports 10-100+ simultaneous calls on a single IP connection.

SIP trunks connect to your PBX (Asterisk, FreeSWITCH, 3CX, Cisco CUCM) or directly to an SBC. The SBC or PBX handles the translation between your internal extensions and the outside world.

2. How SIP trunks work technically

A SIP trunk call flow for an outbound call:

  1. Extension dials an external number → PBX matches dialplan and routes to trunk
  2. PBX sends INVITE to SIP trunk provider's server
  3. Provider authenticates the call (checks credentials or IP allowlist)
  4. Provider routes to PSTN gateway and returns 100 Trying → 180 Ringing → 200 OK
  5. PBX sends ACK → RTP media flows directly between PBX and provider
  6. Call terminates with BYE from either side

Authentication methods

Digest authentication (username/password) — provider sends 407 Proxy Auth challenge, PBX responds with credentials. Most common for dynamic IP deployments.

IP allowlisting — provider only accepts calls from your registered public IP. No credentials needed. Most common for static IP enterprise deployments.

Registration vs static trunks

Registration-based: Your PBX registers to the provider like a phone. Supports dynamic IPs. The REGISTER keeps the connection alive and lets the provider route inbound calls to you.

Static/IP-authenticated: No registration. Provider routes inbound calls to your IP directly. Requires static IP and IP allowlisting.

3. Configuring a SIP trunk

Asterisk PJSIP trunk configuration

; pjsip.conf [transport-udp] type=transport protocol=udp bind=0.0.0.0:5060 external_media_address=YOUR_PUBLIC_IP external_signaling_address=YOUR_PUBLIC_IP local_net=192.168.0.0/16 [trunk-auth] type=auth auth_type=userpass username=YOUR_TRUNK_USERNAME password=YOUR_TRUNK_PASSWORD [trunk-aor] type=aor contact=sip:sip.provider.com [mytrunk] type=endpoint transport=transport-udp context=from-trunk disallow=all allow=ulaw allow=alaw outbound_auth=trunk-auth aors=mytrunk dtmf_mode=rfc4733 direct_media=no [trunk-reg] type=registration transport=transport-udp outbound_auth=trunk-auth server_uri=sip:sip.provider.com client_uri=sip:support@sipsymp.com retry_interval=60

Key settings to verify

4. Common SIP trunk issues

Issue 01
Registration loops (401 repeating)
Wrong username, password, or realm. Check credentials exactly — they are case-sensitive. Verify the realm in the 401 WWW-Authenticate matches your auth configuration. Some providers use the DID number as the username, not a separate account credential.
Issue 02
One-way audio or no audio
NAT issue — your PBX is sending RTP to a private IP. Set external_media_address to your public IP in PJSIP transport, or nat=yes with externip in chan_sip. Also check that your firewall allows the RTP port range bidirectionally.
Issue 03
Inbound calls failing (404 or no ring)
The DID number isn't routing to your PBX. Check that your PBX is registered (or your IP is allowlisted). Verify the inbound context in your trunk configuration has a matching dialplan extension for the DID.
Issue 04
Calls dropping after 30 seconds
Missing ACK, NAT binding expiry, or session timer issue. Enable RTP keepalives, check that ACK packets pass through your firewall, and configure session timers with minimum 1800 seconds expiry.

5. Choosing a SIP trunk provider

Key factors when evaluating SIP trunk providers:

6. SIP trunk failover configuration

Configure multiple trunks with failover so calls continue if the primary provider has an outage:

; Asterisk dialplan — try primary trunk, failover to secondary exten => _1NXXNXXXXXX,1,Dial(PJSIP/${EXTEN}@primary-trunk) same => n,GotoIf($[${DIALSTATUS} = BUSY]?busy) same => n,GotoIf($[${DIALSTATUS} = ANSWER]?done) ; Primary failed — try secondary same => n,Dial(PJSIP/${EXTEN}@secondary-trunk) same => n(busy),Busy(20) same => n(done),Hangup()

Also configure DNS SRV records for automatic failover — most SIP providers publish SRV records that clients can use to discover backup servers without manual configuration.

Frequently asked questions

What is a SIP trunk?

A SIP trunk is a virtual phone line that connects your PBX or UCaaS platform to the PSTN over IP using the Session Initiation Protocol. Unlike physical ISDN lines, one SIP trunk can carry dozens of simultaneous calls. SIP trunks authenticate via username/password (digest auth) or IP allowlisting and connect to your PBX or SBC.

How does SIP trunking work?

SIP trunking works by sending SIP INVITE messages from your PBX to the provider's SIP server when a call is made. The provider authenticates the request, routes to the PSTN, and returns a 200 OK when the call connects. RTP media then flows directly between your PBX and the provider. Inbound calls reverse the flow — provider sends INVITE to your registered PBX.

What causes SIP trunk registration failure?

SIP trunk registration failures are caused by wrong credentials (username, password, or realm mismatch), firewall blocking port 5060, SIP ALG on the router corrupting the REGISTER packet, wrong server address in trunk configuration, or the provider requiring IP allowlisting instead of credential authentication. Check the 401 WWW-Authenticate realm matches your auth configuration.

SIP trunk issues causing call failures?

Paste your SIP trace into SIPSymposium. The analyzer identifies trunk authentication failures, NAT issues in the SDP, codec mismatches, and routing problems on your SIP trunk.

Analyze my trace Create free account
Related guides