How to write a filter that calls only certain area codes
Use a VICIdial lead filter to match phone-number prefixes so your campaign dials only the area codes you want, then test it before enabling.
State filters are great when your data carries a clean state column, but sometimes the only reliable signal you have is the phone number itself. The first three digits of a North American number are the area code, and you can filter on those directly. A Lead filter lets you tell your Campaign to dial only the area codes you care about, no re-importing required.
Matching on the phone number
Each Lead stores its number in a phone_number column. Two SQL approaches work well. The simplest matches a prefix with LIKE, where the percent sign means anything can follow. To call only the 415 area code:
phone_number LIKE '415%'
The cleaner approach when you want several area codes is to pull the first three characters and compare them with IN:
LEFT(phone_number,3) IN('415','510','650')
LEFT grabs the leftmost three characters, and IN checks them against your list. This only behaves correctly if your numbers are stored as bare 10-digit values. If yours include a leading country code or formatting, adjust the position so you are slicing the real area code, not a stray digit. For example, if every number is prefixed with a 1, you would use the four leftmost characters and compare against values like 1415, or strip the prefix during import so the column stays clean.
LIKE is fine for a single prefix, but IN with LEFT scales better when you maintain a long list of allowed codes, since you keep everything in one tidy condition instead of chaining OR clauses by hand.
Building the filter
- In the Filters section, add a filter with a short Filter ID and a clear Filter Name.
- Add a Filter Comment like dials only Bay Area codes so the intent is obvious later.
- Paste your fragment into Filter SQL. Do not start or end it with AND; the hopper adds that for you.
- Save and attach the filter to the campaign that should respect it.
How the hopper uses it
flowchart TD
A[Hopper cron runs] --> B[Read campaign filter SQL]
B --> C[Append filter as AND clause]
C --> D{Area code prefix matches}
D -->|Yes| E[Load lead into hopper]
D -->|No| F[Skip lead]
E --> G[Dialer places call]On each refill the hopper reads the area-code condition, treats it as another requirement, and only loads numbers whose prefix matches. Everything else is skipped without you touching the data. That keeps a Predictive dialing campaign humming while staying inside the regions you target.
A note on time zones
Area codes loosely map to geography, but they are not a reliable clock. A number can move with its owner across the country, so do not lean on area codes alone to stay inside legal calling hours. Pair this filter with proper time-zone handling, and keep your DNC (do not call) scrubbing in place so a tight geographic filter never accidentally surfaces a number you should not call.
Test it first
LIKE and LEFT patterns are easy to get slightly wrong, and a single misplaced digit can drop your dialable pool to zero. Run Test On Campaign on the filter page before enabling it. It reports how many leads remain callable, so you confirm there is real work for your agents before anyone clocks in.
To see where filters sit in the bigger compliance and quality picture, read our VICIdial quality control overview. If you are brand new to filters, start with how to add a VICIdial filter.
Every VICIfast plan includes the full filtering toolkit, and your dialer is live in under 40 seconds. Compare options on our pricing page.
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. “How to write a filter that calls only certain area codes”. VICIfast LLC, June 26, 2026. Retrieved from https://vicifast.com/blog/build-vicidial-filter-by-area-code
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.