← All Tutorials

How to Manage ViciDial Lists: Deactivate, Reset and Delete Leads

ViciDial Administration Intermediate 12 min read #100 Published · Updated

Remove inactive leads, clear call history, and purge bad numbers from your ViciDial lists without losing dial data or crashing your database.

Deactivating and resetting leads in ViciDial requires direct database manipulation or careful use of the admin panel. The fastest method is a MySQL query against the vicidial_list table to mark leads as inactive or delete rows outright; the safest method uses the web UI to batch-process leads by status or phone number. Incorrect deletion can orphan records in vicidial_log and vicidial_closer_log, making call reporting inconsistent.

Tested on ViciDial 2.14 (SVN 3555+), Asterisk 16/18, MariaDB 10.5+, with PHP 7.4+.

Prerequisites

Understanding ViciDial lead status and list structure

A ViciDial list is a collection of phone numbers stored in the vicidial_list table. Each record has a status field (status) that controls whether agents dial it. Common statuses are:

When you deactivate a lead, you set its status to DEAD or DNC. When you reset a lead, you change status back to NEW or CALL. Deleting a lead removes the row entirely from vicidial_list, but does not remove historical records in vicidial_log or vicidial_closer_log.

The vicidial_list table schema:

DESCRIBE vicidial_list;

Key columns you will use:

Deactivating leads via the web interface

The safest method for small batches is the ViciDial admin panel.

  1. Log in to /vicidial/admin.php with an admin account.
  2. Select "Manage Leads" or "List Leads" from the menu.
  3. Filter by campaign or list name.
  4. Tick the checkboxes next to the leads you want to deactivate.
  5. Select the action "Change Status to DEAD" or "Change Status to DNC" from the dropdown.
  6. Click "Apply" or "Submit".

The system will update the vicidial_list table for each selected lead. The operation is logged in vicidial_log with a note indicating the status change.

For bulk operations, this method is slow. Use the database approach instead.

Deactivating leads via SQL query

To mark all leads in a specific campaign as DEAD:

UPDATE vicidial_list 
SET status = 'DEAD' 
WHERE list_id = 101 
AND status = 'NEW';

To mark leads with a specific phone pattern as DNC (e.g., all numbers ending in 00):

UPDATE vicidial_list 
SET status = 'DNC' 
WHERE list_id = 101 
AND phone_number LIKE '%00';

To deactivate leads that have been called more than 5 times:

UPDATE vicidial_list 
SET status = 'DEAD' 
WHERE list_id = 101 
AND called_count > 5;

After running any UPDATE, verify the row count returned. If it is 0 or unexpectedly low, check the WHERE clause.

Always run a SELECT first to confirm you are targeting the right records:

SELECT COUNT(*) FROM vicidial_list 
WHERE list_id = 101 
AND status = 'NEW';

Resetting leads back to NEW or CALL status

To requeue a lead that was marked DEAD or DONOTCALL:

UPDATE vicidial_list 
SET status = 'NEW', called_count = 0 
WHERE lead_id = 12345;

This sets the lead back to NEW and resets the call count, so agents will dial it as if it were fresh.

To reset all leads in a campaign back to NEW:

UPDATE vicidial_list 
SET status = 'NEW', called_count = 0 
WHERE list_id = 101;

Caution: This will requeue every lead, including those previously marked DNC or DEAD for good reason. Use this only if you intend to re-attempt the entire list.

To reset only leads marked CALL or DONOTCALL, leaving DNC and DEAD alone:

UPDATE vicidial_list 
SET status = 'NEW', called_count = 0 
WHERE list_id = 101 
AND status IN ('CALL', 'DONOTCALL');

After a reset, the dialer will pick up these leads on the next cycle.

Deleting leads completely

Deleting a lead removes it from vicidial_list but not from call history. This is appropriate for duplicate entries or test numbers added by mistake.

To delete a single lead by lead_id:

DELETE FROM vicidial_list 
WHERE lead_id = 12345;

To delete all leads in a specific campaign:

DELETE FROM vicidial_list 
WHERE list_id = 101;

To delete leads matching a phone pattern (e.g., test numbers):

DELETE FROM vicidial_list 
WHERE list_id = 101 
AND phone_number LIKE '555%';

To delete leads that are marked as DEAD and were last called more than 90 days ago:

DELETE FROM vicidial_list 
WHERE list_id = 101 
AND status = 'DEAD' 
AND last_local_call_time < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 90 DAY));

After deletion, the lead no longer appears in the dialer queue. Historical call records in vicidial_log and vicidial_closer_log remain for reporting.

Clearing call history for specific leads

If you reset a lead but want to erase its call history, you must delete records from vicidial_log and vicidial_closer_log. This is rarely needed but necessary if a lead was called in error or data is corrupted.

To remove all log entries for a specific lead:

DELETE FROM vicidial_log 
WHERE lead_id = 12345;

DELETE FROM vicidial_closer_log 
WHERE lead_id = 12345;

Warning: This action is destructive and cannot be undone easily. Backups are essential.

To remove call logs for all leads in a campaign:

DELETE FROM vicidial_log 
WHERE list_id = 101;

DELETE FROM vicidial_closer_log 
WHERE list_id = 101;

After deletion, the leads will have no call history. If you run reports on this campaign, call counts and durations for these leads will not appear.

Bulk operations: importing and deactivating via CSV

For large batches, use the import feature in the admin panel.

  1. Create a CSV file with columns: phone_number, status, list_id
  2. Go to /vicidial/admin.php, select "Leads" > "Import Leads".
  3. Upload your CSV.
  4. Map the columns correctly.
  5. Choose "Update existing leads" or "Skip duplicates".
  6. Submit.

The system will insert or update rows in vicidial_list. Existing leads (matched by phone_number and list_id) will have their status updated to whatever you specify in the CSV.

Example CSV to deactivate a batch of leads:

phone_number,status,list_id
5551234567,DEAD,101
5559876543,DEAD,101
5555551212,DNC,101

Monitoring lead status and queue depth

To see how many leads in a campaign are waiting to be dialed:

SELECT status, COUNT(*) AS count 
FROM vicidial_list 
WHERE list_id = 101 
GROUP BY status;

Example output:

status   count
NEW      1050
CALL     230
DEAD     1200
DNC      340

This shows that 1050 leads are ready to dial, 230 require callback, and 1540 are marked as do-not-call or dead.

To see which leads have never been called:

SELECT COUNT(*) FROM vicidial_list 
WHERE list_id = 101 
AND called_count = 0;

To see leads that have been attempted but never reached:

SELECT phone_number, called_count, last_local_call_time 
FROM vicidial_list 
WHERE list_id = 101 
AND status = 'DEAD' 
AND called_count > 1 
ORDER BY last_local_call_time DESC 
LIMIT 20;

Automation: scripts for regular lead cleanup

Create a shell script to run cleanup queries on a schedule. Save this as /usr/local/bin/vicidial_cleanup.sh:

#!/bin/bash

DB_USER="root"
DB_PASS="your_password"
DB_NAME="asterisk"

# Archive and delete leads marked DEAD for over 180 days
mysql -u $DB_USER -p$DB_PASS $DB_NAME << 'EOF'
DELETE FROM vicidial_list
WHERE status = 'DEAD'
AND last_local_call_time < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 180 DAY))
AND list_id IN (101, 102, 103);
EOF

# Reset leads marked CALL to NEW if they are older than 30 days without a callback
mysql -u $DB_USER -p$DB_PASS $DB_NAME << 'EOF'
UPDATE vicidial_list
SET status = 'NEW'
WHERE status = 'CALL'
AND last_local_call_time < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 DAY))
AND list_id IN (101, 102, 103);
EOF

echo "Lead cleanup completed at $(date)" >> /var/log/vicidial_cleanup.log

Make it executable:

chmod +x /usr/local/bin/vicidial_cleanup.sh

Add to crontab to run weekly:

0 2 * * 0 /usr/local/bin/vicidial_cleanup.sh

This runs at 2 AM every Sunday.

Troubleshooting

No rows updated or deleted, even though query syntax is correct

Check that the list_id and status values match exactly. Status is case-sensitive in most ViciDial deployments. Verify with a SELECT:

SELECT DISTINCT status FROM vicidial_list 
WHERE list_id = 101 
LIMIT 10;

If the output shows "NEW" in mixed case, use that exact case in your UPDATE.

Dialer still queues leads that should be DEAD

The dialer process caches the lead list in memory. After a large UPDATE, restart the dialer:

/etc/init.d/asterisk restart

Or reload the dialer module without restarting Asterisk:

asterisk -rx "reload chan_vicidial.so"

Wait 30 seconds for the cache to refresh.

Database locked or query hangs

If you are updating millions of rows, MySQL may lock the table. Add a LIMIT clause and run the query in batches:

UPDATE vicidial_list 
SET status = 'DEAD' 
WHERE list_id = 101 
AND status = 'NEW' 
LIMIT 10000;

Run this repeatedly until the row count drops to 0.

Alternatively, use pt-online-schema-change (from Percona Toolkit) if available:

pt-online-schema-change --alter "MODIFY status='DEAD'" D=asterisk,t=vicidial_list --execute

Cannot log in to admin panel to use web UI method

Verify your account has manager or admin role. Check the vicidial_users table:

SELECT user, user_level FROM vicidial_users 
WHERE user = 'your_username';

user_level must be 1 (manager) or higher. If not, update it:

UPDATE vicidial_users 
SET user_level = 1 
WHERE user = 'your_username';

Agents still see deleted leads in their recent calls list

Call history in vicidial_closer_log is separate from the lead queue. Deleting from vicidial_list does not remove closer_log entries. This is by design. If you need to hide them from reports, use filters in the reporting interface or archive older closer_log records.

Phone numbers appear to be duplicated after reset

Check the vicidial_list table for entries with identical phone_number but different lead_id:

SELECT phone_number, COUNT(*) 
FROM vicidial_list 
WHERE list_id = 101 
GROUP BY phone_number 
HAVING COUNT(*) > 1;

If duplicates exist, delete the one with the older or higher called_count:

DELETE FROM vicidial_list 
WHERE lead_id IN (
  SELECT lead_id FROM (
    SELECT lead_id 
    FROM vicidial_list 
    WHERE phone_number = '5551234567' 
    ORDER BY called_count DESC 
    LIMIT 1
  ) t
);

Frequently asked questions

What is the difference between DEAD and DNC status?

DEAD status is assigned automatically when the dialer detects that a number is invalid, disconnected, or a fax machine answered. DNC status is typically set manually or imported from a do-not-call list; it indicates that the consumer has requested not to be contacted. Both prevent the dialer from queuing the lead, but DNC carries legal weight in compliance contexts.

Can I undo a bulk delete?

If you deleted leads from vicidial_list, the only way to restore them is from a backup. Deleted records from vicidial_log and vicidial_closer_log cannot be recovered. Always back up before running DELETE queries. If you realize immediately, you can roll back the transaction if you ran it within a transaction block: ROLLBACK; will undo the last DELETE if you did not COMMIT.

How do I prevent agents from dialing a specific number without deleting it?

Set the lead status to DONOTCALL or DNC. The lead remains in the database for historical reference, but the dialer will skip it. You can change the status back later if needed. This is safer than deletion.

What happens to call recordings if I delete a lead?

Call recordings are stored as separate audio files on disk (typically in /var/spool/asterisk/monitor/), not in the database. Deleting a lead removes only the database record. Recordings persist until you manually delete the files. To clean up old recordings, use a separate script to remove files older than a threshold, e.g., find /var/spool/asterisk/monitor/ -type f -mtime +90 -delete.

How long does it take to reset or delete 100,000 leads?

On a modern server with MariaDB 10.5+, a simple UPDATE or DELETE for 100,000 rows typically completes in 5 to 30 seconds, depending on disk I/O and index performance. For larger operations (over 1 million rows), expect 2 to 10 minutes. Monitor progress with SHOW PROCESSLIST; in MySQL if the query seems slow. Add indexes on list_id and status to speed up WHERE clause evaluation: ALTER TABLE vicidial_list ADD INDEX idx_list_status (list_id, status);

Summary

ViciDial lead management via database is straightforward: UPDATE vicidial_list to change status (NEW, DEAD, DNC, etc.), reset called_count to requeue, and DELETE to remove leads entirely. The web interface is safer for small batches but slower than SQL for bulk operations. Always back up before running UPDATE or DELETE queries. After large operations, restart Asterisk or the dialer cache to force reload. Historical call records in vicidial_log and vicidial_closer_log are independent of the lead queue, so deleting a lead does not erase its call history. For ongoing maintenance, create a weekly script to archive old DEAD leads and reset stale CALL leads. Monitor status distribution regularly with COUNT and GROUP BY queries to understand queue depth and prevent the dialer from running low on NEW leads.

Stuck on something specific?

Book a free 30-minute call. I run ViciDial centers across 3 countries and can usually unblock your setup in one session — or build it for you.

Book a Free Consultation