VICIfast
Operations

How to write a filter that excludes recently called leads

Use a small SQL fragment in a VICIdial lead filter to skip leads you have already dialed in the last few days, then test it before going live.

VICIfast Support
··3 min read
How to write a filter that excludes recently called leads

If you are calling the same numbers over and over within a day or two, you burn through your data, annoy people, and waste agent time. A Lead filter is the clean way to stop that. It is a short piece of SQL that VICIdial bolts onto the query that picks which leads to dial, so you can quietly skip anyone you have already called recently while still dialing everyone else.

This post walks through the timestamp columns you can filter on, a couple of ready-to-paste SQL fragments, and the one habit that keeps you from accidentally emptying your dial queue.

Which columns track when a lead was called

Every Lead row carries a timestamp that updates each time the system dials it. When you want to exclude recently called records, that timestamp is what you compare against. The idea is simple: keep leads whose last call is older than your chosen window, and drop the ones called inside it.

You write the comparison as a SQL fragment, not a full query. VICIfast and stock VICIdial both expect just the WHERE-clause piece, because the Hopper cron script wraps it with the rest of the query automatically. One rule matters here: do not begin or end your fragment with the word AND. The cron script adds that AND for you, and a stray one at either end breaks the filter.

A fragment that skips leads called in the last few days

To exclude anyone dialed in the last seven days, you compare the last-call timestamp to a point seven days ago. A fragment like this keeps only leads whose most recent call is older than that window:

last_local_call_time < (NOW() - INTERVAL 7 DAY)

Change the number to widen or tighten the gap. A 3 gives you a three-day cooldown; a 14 holds numbers back for two weeks. The fragment stands on its own, with no leading or trailing AND, which is exactly what the hopper expects.

If you would rather count attempts since the last reset instead of a calendar window, you can filter on the per-reset call counter instead. Pairing a recency rule with an attempt cap is a common move for teams that practice careful Lead recycling rather than hammering every record.

How the filter fits into the dialing path

flowchart TD
  A[Hopper cron runs] --> B[Builds lead query]
  B --> C[Appends your filter SQL]
  C --> D{Last call older than window}
  D -->|Yes| E[Lead loaded to hopper]
  D -->|No| F[Lead skipped this pass]
  E --> G[Agent dials lead]

The filter does not delete or move anything. It simply changes which records the hopper pulls on each pass, so a skipped Lead becomes dialable again the moment it clears your window. Nothing about your list contents changes, and you can flip the filter off at any time to fall back to normal behavior.

Always test before you enable it

A recency filter can be aggressive. Set the window too wide on a heavily worked list and you might leave almost no dialable leads. Before you attach the filter to a live Campaign, use the Test On Campaign preview on the filter page to confirm there are still leads to call. If the count comes back near zero, shrink the window or load fresh data.

For the exact syntax rules behind these fragments, see our guide to filter SQL syntax. And for how filters fit into the bigger picture of clean dialing, read our quality control overview.

Want a managed VICIdial box where filters, hopper, and recordings just work out of the box? See our plans and pricing and have a branded dialer live in under 40 seconds.

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 excludes recently called leads”. VICIfast LLC, June 26, 2026. Retrieved from https://vicifast.com/blog/build-vicidial-filter-exclude-recent-calls

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

Comments are reviewed before they appear. We never publish your email.

No comments yet — be the first.