Skip to content

Add a SIP Trunk

A SIP trunk is the connection between UnifiedBX and a SIP carrier (ITSP). New trunks on UnifiedBX are PJSIP by default — chan_sip is legacy and should only be used if a carrier explicitly requires it.

Before You Start

  • The carrier has provided: SIP server FQDN/IP, port (5060 default), authentication method (registration credentials OR IP authentication), DIDs they will route to you.
  • The carrier knows your UnifiedBX public IP (for IP-auth trunks).
  • Your firewall allows SIP signaling from the carrier's IPs (see System Admin → Firewall → Networks/Trusted Zones).

Steps

  1. Go to Trunk Attributes → Trunks.
  2. Click + Add Trunk → Add SIP (chan_pjsip) Trunk.
  3. General Tab:
    • Trunk Name — internal label, e.g. Carrier-Voipms-Primary. No spaces.
    • Hide CallerIDNo unless you want all outbound from this trunk to be private.
    • Outbound CallerID — default CID this trunk presents on outbound calls (overridden by route/extension CID per the resolution chain — see Configure Caller ID).
    • CID OptionsAllow Any CID (default), Force Trunk CID (override everything), or Block Foreign CIDs.
    • Maximum Channels — concurrent call cap. Set per the carrier's purchased channel count.
    • Asterisk Trunk Dial Options — usually leave blank.
    • Continue if BusyNo.
    • Disable TrunkNo.
  4. PJSIP Settings → General Tab:
    • Username — auth username from the carrier (for registration trunks).
    • Secret — auth password.
    • AuthenticationOutbound for register-based; None for IP-auth.
    • RegistrationSend for register-based; None for IP-auth.
    • SIP Server — carrier hostname or IP, e.g. sip.voip.ms.
    • SIP Server Port — usually 5060, sometimes 5061 (TLS).
    • Context — leave at from-pstn (default).
    • Transportudp (default), tcp, tls, or 0.0.0.0-udp.
  5. PJSIP Settings → Advanced Tab (only if needed):
    • From Domain — set if the carrier requires a specific From: domain.
    • From User — usually leave blank or match Username.
    • DTMF ModeRFC 4733 for most carriers.
    • Codecs — match what the carrier supports (commonly ulaw,alaw).
    • Qualify Frequency60 seconds is fine.
  6. PJSIP Settings → Codecs Tab — confirm/restrict to what the carrier supports.
  7. Click Submit.
  8. Click Apply Config.

Verify

asterisk -rx "pjsip show endpoints" | grep -A2 <trunkname>
asterisk -rx "pjsip show registrations"

For registration trunks, look for Registered. For IP-auth, the endpoint should show Available when the carrier sends a qualify.

Place a test outbound call from an extension that uses a route pointing at this trunk.

Common Issues

  • Registration shows Rejected or Forbidden (403). Wrong username/secret, or the carrier hasn't whitelisted your IP. Re-check credentials and confirm the IP they have on file.
  • Outbound calls fail with "all circuits busy." Trunk is offline (registration failed or IP-auth not working). Check pjsip show endpoints.
  • One-way audio. NAT issue. Set the External Address in System Admin → Sysadmin → Network Settings OR add NAT to the trunk's PJSIP advanced settings (force_rport=yes, rewrite_contact=yes).
  • Calls connect but drop after 30 seconds. Asymmetric audio or RTP timeout. Check firewall RTP port range (10000-20000 by default).
  • Choose between Username/Secret OR IP-auth — not both. Setting Username and not setting Authentication=Outbound causes confusion.