SIP-TRUNKINGTECHNICALVICIDIAL

SIP Trunk Setup: VICIdial, Asterisk & FreePBX

SIPNEX ·

Configuring a SIP trunk is the same fundamental process on every platform: point your phone system at the carrier’s SIP proxy, authenticate, set your codec and DTMF preferences, handle NAT if you are behind a firewall, and test. The specifics differ by platform — Asterisk uses sip.conf text files, FreePBX uses a web GUI, and VICIdial adds a carrier management layer on top of Asterisk. This guide walks through all three.

For detailed VICIdial-specific configuration including campaign setup, CID groups, and dial plan, see our comprehensive VICIdial SIP trunk setup guide. This guide covers the trunk connection itself across all three platforms.

SIPNEX provides SIP trunking for all three platforms. The carrier-side configuration is identical — the differences are entirely in how each platform manages its SIP settings.

What you need from your carrier

Before configuring any platform, you need these details from your SIP trunk provider:

  • SIP Proxy address: The IP address or hostname of the carrier’s SIP server
  • Authentication method: IP-based (carrier whitelists your IP) or digest (username/password)
  • If digest: username and password
  • Supported codecs: Typically G.711u, G.711a, G.729
  • DTMF method: Typically RFC 2833
  • Port: Usually 5060 (SIP) or 5061 (TLS/SIPS)
  • RTP port range: Usually 10000-20000 — needed for firewall rules

SIPNEX provides all of this during provisioning. We support both IP-based and digest authentication, G.711u as primary codec, and RFC 2833 for DTMF.

Asterisk (sip.conf)

Asterisk is configured through text files. The SIP trunk is defined as a peer in /etc/asterisk/sip.conf.

IP-based authentication:

[sipnex]
type=peer
host=CARRIER_IP
port=5060
disallow=all
allow=ulaw
allow=alaw
dtmfmode=rfc2833
canreinvite=no
nat=force_rport,comedia
qualify=yes
qualifyfreq=60
insecure=invite
context=from-trunk

Digest authentication — add credentials and a register line:

[sipnex]
type=peer
host=CARRIER_IP
port=5060
username=YOUR_USER
secret=YOUR_PASS
fromuser=YOUR_USER
disallow=all
allow=ulaw
allow=alaw
dtmfmode=rfc2833
canreinvite=no
nat=force_rport,comedia
qualify=yes
qualifyfreq=60
insecure=invite,port
context=from-trunk

register => YOUR_USER:YOUR_PASS@CARRIER_IP/sipnex

Outbound dial plan in /etc/asterisk/extensions.conf:

[outbound]
exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@sipnex,,tTo)
exten => _1NXXNXXXXXX,2,Hangup()

After editing, reload Asterisk: asterisk -rx "sip reload" then verify: asterisk -rx "sip show peers" — the sipnex peer should show as OK or Reachable.

FreePBX (web GUI)

FreePBX provides a graphical interface over Asterisk. The trunk is configured through the web admin panel.

  1. Navigate to Connectivity → Trunks → Add Trunk → Add SIP Trunk
  2. Trunk Name: SIPNEX
  3. Outbound CallerID: Your primary DID in E.164 format
  4. Peer Details (under SIP Settings → Outgoing):
host=CARRIER_IP
port=5060
type=peer
disallow=all
allow=ulaw&alaw
dtmfmode=rfc2833
canreinvite=no
nat=force_rport,comedia
qualify=yes
insecure=invite
  1. For digest auth, add username=YOUR_USER and secret=YOUR_PASS to peer details, and add the register string in the Registration field: YOUR_USER:YOUR_PASS@CARRIER_IP

  2. Submit and Apply Config

  3. Configure an Outbound Route (Connectivity → Outbound Routes) that matches your dial pattern (11-digit US numbers: 1NXXNXXXXXX) and routes through the SIPNEX trunk.

  4. Configure Inbound Routes (Connectivity → Inbound Routes) for each DID to route to the appropriate destination (extension, ring group, IVR).

VICIdial

VICIdial adds its own carrier management layer on top of Asterisk. The trunk is configured in both sip.conf (Asterisk level) and the VICIdial admin panel.

  1. Add the sip.conf peer definition (same as Asterisk above)
  2. In VICIdial Admin → CarriersAdd A New Carrier:
    • Enter the sip.conf peer block in the Account Entry field
    • Enter the outbound dial plan in the Dialplan Entry field
    • Set registration strings if using digest auth
  3. Configure Campaigns to use the carrier for outbound dialing
  4. Configure Inbound DIDs to route incoming calls to in-groups

See our complete VICIdial SIP trunk setup guide for detailed instructions including campaign configuration, CID groups for local presence, AMD settings, and troubleshooting.

Firewall configuration (all platforms)

Regardless of platform, your firewall must allow:

  • Outbound UDP 5060 to your carrier’s SIP proxy IP (SIP signaling)
  • Inbound UDP 5060 from your carrier’s SIP proxy IP (SIP signaling)
  • Outbound/Inbound UDP 10000-20000 to/from your carrier’s media IPs (RTP audio)
  • If using TLS: TCP 5061 to/from carrier

Block all other SIP traffic. An open SIP port on the public internet attracts brute-force registration attacks within hours. Only allow SIP traffic from known carrier IPs.

Testing your trunk

After configuration, test these scenarios:

  1. Outbound call to a known number: Verify the call connects, audio is clear in both directions, DTMF works (press a key during the call and verify it is received)
  2. Inbound call to your DID: Call your DID from an external phone. Verify it rings the correct destination, audio is bidirectional, caller ID displays correctly
  3. Caller ID display: Place an outbound call and check what CID the recipient sees. Verify it matches the DID you configured
  4. SIP registration (digest auth): Check sip show registry in Asterisk CLI. Status should show “Registered”
  5. Trunk status: Check sip show peers in Asterisk CLI. Your carrier peer should show “OK” with qualify response time

If any test fails, check your Asterisk SIP debug logs (sip set debug on in the CLI) and look for the SIP response codes that indicate the failure type.

Frequently asked questions

Is SIP trunk configuration the same on every PBX?

The underlying SIP protocol is the same on every platform — the parameters you configure (proxy address, authentication, codecs, DTMF, NAT) are identical. What differs is how each platform exposes these settings: Asterisk uses text configuration files (sip.conf), FreePBX provides a web GUI that writes to those same files, VICIdial adds a carrier management layer for campaign integration. 3CX, Cisco, and Avaya each have their own configuration interfaces. If you can configure a SIP trunk on one platform, you understand the concepts for all of them — you just need to find where each setting lives in the new platform’s interface.

What is the most common SIP trunk configuration mistake?

NAT misconfiguration causing one-way audio. If your PBX is behind a NAT router (which most are), you must configure nat=force_rport,comedia in Asterisk’s sip.conf (or equivalent settings on other platforms). Without this, your system sends RTP audio from a private IP address. The carrier sends return audio to the address in the SIP headers (which may be the private IP instead of your public IP). The carrier’s audio never reaches you. The result: you hear the other party but they cannot hear you, or vice versa.

How long does SIP trunk setup take?

The carrier provisioning (SIPNEX provides credentials within 24 hours) plus the PBX configuration (30 minutes to 2 hours depending on platform complexity and your familiarity). On Asterisk, adding a trunk peer and dial plan takes 15 to 30 minutes if you know what you are doing. On FreePBX, the GUI makes it slightly faster. On VICIdial, the additional carrier and campaign configuration adds time. Testing adds another 30 to 60 minutes. For a straightforward setup with IP authentication, the complete process from receiving credentials to making your first test call can be under an hour.


SIPNEX provides trunk credentials and configuration support for Asterisk, FreePBX, VICIdial, and any SIP-compliant platform. Our support team has configured these platforms on their own systems. Get trunk credentials or see our rates.

SIPNEX

FCC-licensed carrier with its own STIR/SHAKEN SP certificate. Operator-owned. SIP trunks built for operators who dial at volume.