Vicidial SIP Trunk Setup: How to Add Your SIP Provider
Setting up a Vicidial SIP trunk, which means adding your Vicidial SIP provider as a carrier, is one of the first things you do on a new Vicidial system, and it's one of the most common reasons a new system "doesn't dial." The carrier screen packs several Asterisk concepts into a single form: a peer or endpoint definition, an optional registration, a global variable and a dialplan. Get all four lined up and calls flow. Get one of them wrong and you'll be staring at sip show peers at midnight.
This guide walks through the full process in generic terms, so it applies to most SIP trunk providers that support Vicidial. Every IP address, hostname and credential below is a placeholder. Use the values your carrier gives you.
Placeholders used in this guide
- Carrier signaling IP:
203.0.113.10- Carrier hostname:
sip.carrier.example- Your dialer's public IP:
203.0.113.50- Carrier ID / peer name:
KINGTRUNK
Before You Start: What to Get from Your Carrier
Ask your SIP trunk provider for these before you open the admin screen:
- Authentication method: IP authentication or registration (username and password).
- Signaling address(es): the IP or hostname, port and transport (UDP/TCP/TLS) to send calls to, plus every IP they may send inbound calls from.
- Supported codecs: usually G.711 µ-law (
ulaw) in North America, sometimes G.729. - DTMF method: usually RFC 2833/RFC 4733.
- Dialed number format: for example 1+10 digits for US/Canada, full E.164 with or without
+, or a required tech prefix. - Caller ID format and rules: which format they expect, and which numbers you're allowed to send.
- Media (RTP) IP ranges, if they're different from signaling, so you can open your firewall correctly.
IP Authentication vs. Registration
Carriers authenticate your traffic in one of two ways. Here's how they compare:
| IP authentication | Registration | |
|---|---|---|
| How the carrier trusts you | Your dialer's public IP (203.0.113.50) is whitelisted on their side |
Your dialer logs in with a username and password |
| Needs a static public IP | Yes | No |
| Vicidial "Registration String" | Leave blank | Required (chan_sip) or replaced by a registration object (PJSIP) |
| Inbound calls | Carrier sends to your whitelisted IP | Carrier sends to your registered contact |
| Common failure | Wrong or changed source IP, causing 403 Forbidden |
Bad credentials or a failed registration, causing 401/403 |
| Typical fit | Data-center or hosted dialers with fixed IPs | Dialers behind dynamic IPs or NAT |
For production call centers on a server with a static IP, IP authentication is usually the simpler and sturdier choice: nothing to re-register and no credentials to leak. Registration is handy when your public IP can change.
Step 1: Check Which SIP Stack You're Using
Modern Vicidial installs can use the legacy chan_sip driver, PJSIP, or both. Asterisk deprecated chan_sip and removed it in Asterisk 21, and recent ViciBox releases ship Asterisk with PJSIP support. In the Vicidial admin, go to Admin → System Settings and check Allowed SIP Stacks (SIP, PJSIP or SIP_and_PJSIP). If you run both, make sure the two stacks bind to different ports.
Use the account entry format that matches the protocol you pick for the carrier. A chan_sip peer pasted into a PJSIP carrier won't work.
Step 2: Open the Carrier Form
Go to Admin → Carriers → Add A New Carrier and fill in:
- Carrier ID: a short ID with no spaces, for example
KINGTRUNK. - Carrier Name / Description: anything readable for humans.
- Registration String: only for registration-based chan_sip carriers (see below).
- Account Entry: the peer or endpoint definition.
- Protocol:
SIP,PJSIPorIAX2. - Globals String: a variable that points to the trunk.
- Dialplan Entry: the extensions that send calls out through this carrier.
- Server IP: the dialer server this carrier should be built on.
- Active: set to
Nwhile you build, thenYto push the configuration.
Step 3: Write the Account Entry
Option A: chan_sip with IP Authentication
Leave the Registration String blank and use:
[KINGTRUNK]
type=peer
host=203.0.113.10
port=5060
disallow=all
allow=ulaw
dtmfmode=rfc2833
context=trunkinbound
insecure=port,invite
qualify=yes
nat=force_rport,comedia
directmedia=no
trustrpid=yes
sendrpid=yes
context=trunkinbound sends inbound calls from this carrier into Vicidial's inbound context, where your DIDs are matched.
Option B: chan_sip with Registration
Registration String:
register => YOUR_USERNAME:YOUR_PASSWORD@sip.carrier.example:5060
Account Entry:
[KINGTRUNK]
type=peer
host=sip.carrier.example
username=YOUR_USERNAME
secret=YOUR_PASSWORD
fromuser=YOUR_USERNAME
fromdomain=sip.carrier.example
disallow=all
allow=ulaw
dtmfmode=rfc2833
context=trunkinbound
insecure=port,invite
qualify=yes
directmedia=no
Option C: PJSIP with IP Authentication
With Protocol set to PJSIP, define an AOR, an identify object and an endpoint:
[KINGTRUNK]
type=aor
contact=sip:203.0.113.10:5060
qualify_frequency=30
[KINGTRUNK]
type=identify
endpoint=KINGTRUNK
match=203.0.113.10
[KINGTRUNK]
type=endpoint
context=trunkinbound
disallow=all
allow=ulaw
dtmf_mode=rfc4733
direct_media=no
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
send_rpid=yes
trust_id_inbound=yes
aors=KINGTRUNK
If your carrier uses registration on PJSIP, add an auth object (auth_type=userpass), reference it with outbound_auth= on the endpoint, and add a registration object with the carrier's server_uri and your client_uri. Add a match= line for every IP the carrier may send traffic from.
Step 4: Set the Globals String
The globals string links a short variable to your trunk, so dialplans stay tidy:
KINGTRUNK=SIP/KINGTRUNK
The name after SIP/ must match the bracketed name in the account entry. For PJSIP, many admins put the endpoint directly in the dial string instead (see below). Don't reuse the same variable name across carriers unless you mean to.
Step 5: Write the Dialplan Entry
Here's a standard US/Canada entry for chan_sip:
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(${KINGTRUNK}/${EXTEN:1},,To)
exten => _91NXXNXXXXXX,n,Hangup()
And for PJSIP:
exten => _91NXXNXXXXXX,1,AGI(agi://127.0.0.1:4577/call_log)
exten => _91NXXNXXXXXX,n,Dial(PJSIP/${EXTEN:1}@KINGTRUNK,,To)
exten => _91NXXNXXXXXX,n,Hangup()
Here's what each piece does:
_91NXXNXXXXXXis a pattern. The9is the campaign Dial Prefix,1is the country code, andNXXNXXXXXXis a 10-digit North American number (N= 2-9,X= 0-9).AGI(...call_log)logs the call for Vicidial's records. Keep it as the first step.${EXTEN:1}strips the first digit (the9), so the carrier receives1NXXNXXXXXX. If your carrier wants 10 digits, use${EXTEN:2}. If it wants a tech prefix, add it in front, for examplePREFIX${EXTEN:1}.Toare Dial options. Theooption, which passes the original caller ID, is expected by Vicidial and should stay in.- Different prefixes, different carriers. Use
8,7and so on for additional carriers or routes, with a matching dialplan pattern for each.
For international destinations, add patterns that match the number formats you dial and your carrier's expected format. Avoid catch-all patterns like _9X. on production unless you deliberately want to allow any destination.
Step 6: Point Your Campaign at the Carrier
In Campaigns → [your campaign] → Detail, set Dial Prefix to 9 (or whatever prefix your dialplan uses) and set a Campaign CallerID you're authorized to use. Avoid setting caller ID inside the carrier dialplan unless you have a specific reason. Vicidial manages caller ID in its own settings (campaign CallerID, list overrides and CID groups), and overriding it in the dialplan can cause confusing results.
Then set the carrier to Active: Y, and give Vicidial a minute to rebuild the Asterisk configuration.
Step 7: Test and Troubleshoot
Run these from the Asterisk CLI (asterisk -rvvv):
- chan_sip:
sip show peers(look forOKonKINGTRUNK) andsip show registry(for registration trunks). - PJSIP:
pjsip show endpoints,pjsip show aorsandpjsip show registrations. - Call flow: place a manual test call from an agent session and watch the CLI output.
Common problems and fixes:
403 Forbidden: on IP auth, your source IP isn't whitelisted, or the call left from a different IP. On registration, check the credentials.404or "number not found": wrong number format. Check${EXTEN:n}and any tech prefix.- One-way or no audio: NAT or firewall. Set your external address (
externip/localnetin chan_sip, orexternal_media_address/external_signaling_addresson the PJSIP transport) and open your RTP port range to the carrier's media IPs. - "Unable to create channel": the account entry name, globals string and dial string don't match.
- Codec mismatch (
488 Not Acceptable Here): line up theallow=codecs with what the carrier supports.
Security tip: lock down port 5060 and your RTP range at the firewall so only your carrier's IPs and your agents' networks can reach them. Exposed SIP ports attract scanners and toll-fraud attempts.
A Word on Caller ID and Compliance
Your carrier signs outbound calls under STIR/SHAKEN, and the attestation level depends on whether your right to use the caller ID has been verified. Send only numbers you're authorized to use, and keep those numbers stable and callable. Rotating numbers to dodge spam labels isn't a fix, and it can hurt both your reputation and your compliance posture. More importantly, a working trunk doesn't change your obligations under the TCPA, the Telemarketing Sales Rule, DNC rules and state law. Consent, opt-outs, calling hours and abandonment limits are all still on you. For more, read Does STIR/SHAKEN Stop Spam Labels?
Vicidial SIP Trunk FAQ
Should I use IP authentication or registration in Vicidial?
If your dialer has a static public IP, IP authentication is usually simpler and more secure. Use registration when your IP can change or your carrier requires it.
Do I need PJSIP, or can I keep chan_sip?
chan_sip still works on older Asterisk versions, but it's deprecated and was removed in Asterisk 21. New builds should plan for PJSIP. Check Allowed SIP Stacks in System Settings.
Why does my carrier show "UNREACHABLE"?
Qualify (OPTIONS) packets aren't getting answered. Check the firewall, the host/contact address and whether your carrier responds to OPTIONS at all. Some don't, in which case you can turn qualify off.
Can I use more than one carrier on one Vicidial system?
Yes. Give each carrier its own account entry, globals variable and dial prefix, then pick the prefix per campaign.
What number format should I send?
Whatever your carrier specifies. For US/Canada that's usually 1NXXNXXXXXX. Adjust ${EXTEN:n} and any prefix to match.
Skip the Setup with the King
Prefer a carrier that helps you get the entry right on the first try? Connectivity King SIP trunks work with Vicidial, GoAutoDial, Asterisk/FreePBX and 3CX, with Tier-1 carrier routes, A-level STIR/SHAKEN attestation on Connectivity King DIDs and 99.99% network uptime. Our routes, DIDs and porting cover the United States, and call centers based anywhere can sign up. Or let our team handle all of it with a hosted Vicidial dialer and DID numbers. Not sure which way to go? See what self-hosting really takes. Request a quote. Quotes usually come back the same day. You can also reach us at sales@connectivityking.com or +1 (888) 885-4202, 9am Eastern to 9pm Pacific.
