Using a Dial Prefix to Pick a Carrier in VICIdial
A dial prefix is a routing digit VICIdial adds in front of a number. Used well, it lets each campaign choose which carrier its calls go out.
A dial prefix is one of the most useful tricks in VICIdial carrier routing, and one of the most misunderstood. It's just a digit (or two) that VICIdial sticks on the front of every number a campaign dials. That extra digit never reaches the phone network; its only job is to tell Asterisk which carrier should carry the call. Set it up right and you can point different campaigns at different carriers without touching a single lead.
This post explains what a dial prefix is, how it steers a call to a specific trunk, and how to avoid the off-by-one mistakes that send calls nowhere.
What the prefix actually is
A Dial prefix is set on the campaign. When an agent dials, VICIdial prepends it to the number before handing the call to Asterisk. So a campaign with prefix 9 turns 18005551212 into 918005551212. Asterisk then matches that against Dialplan patterns, and the pattern that starts with 91 belongs to one specific Carrier. Change the prefix to 8 and a different pattern, pointing at a different trunk, picks up the call instead.
The prefix is stripped back off before the number leaves your server, using ${EXTEN:n} in the Dial line. The carrier only ever sees the real number; the routing digit is purely internal.
One prefix per carrier
The pattern is simple: give each carrier a distinct leading prefix, then set each campaign's dial prefix to the carrier you want it to use. Carrier A owns patterns starting with 9, Carrier B owns patterns starting with 8, and so on. Now campaign selection of a carrier is just a one-field change on the campaign, no dialplan editing required after the initial setup.
How the prefix steers the call
flowchart TD
A[Agent dials number] --> B[Campaign adds dial prefix]
B --> C{Prefix value?}
C -->|9| D[Match pattern 91...]
C -->|8| E[Match pattern 81...]
D --> F[Strip prefix and dial Carrier A]
E --> G[Strip prefix and dial Carrier B]
F --> H[Carrier A to PSTN]
G --> I[Carrier B to PSTN]The strip count has to match
This is where most prefix setups break. If you add one digit (9) you must strip one digit (${EXTEN:1}). If you add two (91) you must strip two (${EXTEN:2}). Get the count wrong and the carrier receives a number that's one digit short or carries a stray 9 on the front, and it rejects the call. Whenever you change a prefix, recheck the strip count in that carrier's Dial line.
- Campaign prefix digits must equal the leading digits of the carrier's pattern.
- The strip count in ${EXTEN:n} must equal the number of prefix digits.
- Each carrier needs its own non-overlapping prefix and pattern.
How this fits the bigger picture
Prefix-based selection is the manual cousin of automatic routing. If you want the system to choose the cheapest path instead of you choosing per campaign, that's least-cost routing. If you want a campaign to keep dialing when its carrier dies, layer in multi-carrier failover. All three sit on top of the same pattern matching covered in the carrier integration guide.
A dial prefix turns carrier selection into a single campaign setting. Assign each carrier its own prefix and pattern, keep the strip counts honest, and you can move whole campaigns between providers in seconds. VICIfast provisions a dedicated dialer with editable carrier patterns in under 40 seconds. See our pricing to put your carriers to work.
About VICIfast LLC
VICIfast LLC operates a managed VICIdial hosting + BYOI service for outbound and inbound call centers. We run the dialers, the carriers, the recordings pipeline, and the compliance plumbing so operators don’t have to.
Citing this article
VICIfast Engineering. “Using a Dial Prefix to Pick a Carrier in VICIdial”. VICIfast LLC, June 24, 2026. Retrieved from https://vicifast.com/blog/vicidial-dial-prefix-to-carrier
Have questions?
Related posts
You might be interested in
VICIfast newsletter
Liked this? Get the next one in your inbox.
We ship the kind of stuff you just read — concrete, numbers-first, no drip. One email when a new post goes live. Unsubscribe in one click.
Comments
No comments yet — be the first.