The ViciDial Ghost Agent RNA Trap: Why Ring-No-Answer Freezes
calricon / field note
Discover why ViciDial ghost agent sessions and Ring-No-Answer race
The ViciDial Ghost Agent RNA Trap: Why Ring-No-Answer Freezes Inbound Call Queues
In blended and inbound contact centers powered by ViciDial, customer calls arriving on direct inward dialing (DID) numbers are routed through inbound call groups (In-Groups) to available frontline representatives. Under normal operations, the automated call distributor pairs queued callers with agents in real time. However, contact center operations frequently suffer a devastating operational failure: inbound queues suddenly grind to an absolute halt. Callers wait in queue for extended periods listening to repetitive hold music before abandoning, while the ViciDial Real-Time Main Report displays multiple representatives in READY or QUEUE states. The root cause is a Ring-No-Answer (RNA) race condition: when an agent workstation disconnects, crashes, or fails to pick up, the dialer enters an infinite routing loop around the ghost agent session, repeatedly assigning incoming callers to an unresponsive channel instead of enforcing immediate pause state transitions.
Problem Diagnosis & Root Cause Architecture
ViciDial inbound call distribution is orchestrated by the Asterisk Gateway Interface (AGI) script agi-VDAD_ALL_inbound.agi in conjunction with the background telephony daemon AST_VDauto_dial.pl. Both processes synchronize state through the central MariaDB tables vicidial_live_agents and vicidial_live_inbound_agents. The architectural failure develops across several systemic bottlenecks:
- Unenforced Ring-No-Answer State Transitions: When an inbound call matches an available agent, ViciDial updates the agent's record to
status = 'RING'and originates an Asterisk channel to the agent's SIP or WebRTC extension. If the representative has stepped away or the browser audio socket has dropped without sending a TCP disconnect, the call rings until reaching theAgent Ring Timeout. Under standard configurations where automatic RNA pause enforcement is disabled, ViciDial clears the call and reverts the agent's status directly back toREADY. - Longest Wait Time Priority Inversion: Most inbound groups employ the standard distribution rule
next_agent_call = 'longest_wait_time'. Because the unresponsive agent has just completed a ring cycle without taking a call, their accumulated idle timer remains the highest in the pool. Consequently, on the very next second, the dialer selects the exact same unresponsive agent for the next queued caller, creating a recursive routing trap. - Cumulative Queue Starvation: Each failed delivery cycle consumes the full ring duration (typically 20 to 30 seconds). While the dialer is tied up attempting to connect the ghost agent, queued callers accumulate without being distributed to secondary active representatives. Within minutes, call abandonment rates climb above 50% and service-level agreements collapse.
- Database Row Lock Latency: During peak volume spikes, concurrent dialer processes and agent browser polling loops execute hundreds of simultaneous updates against
vicidial_live_agents. If slow reporting queries introduce row lock contention on MariaDB, the dialer's RNA state update fails or times out, stranding the agent in an indefiniteRINGorQUEUEzombie state.
"Inbound queue routing requires fail-safe agent state enforcement. When unanswering agent sessions are not instantly isolated into protective pause states upon the first missed ring cycle, priority distribution algorithms convert silent endpoints into infinite queue black holes."
Why Standard Implementations Fail
Default Campaign Configuration Omissions
In standard ViciDial installations, the parameter Ring No-Answer Action on campaigns and in-groups defaults to NO or remains unconfigured. Platform administrators assume that agents will conscientiously click the pause button before stepping away from their desks. In enterprise environments where network hiccups, headset battery drops, and browser crashes occur continuously, relying on manual agent intervention guarantees daily queue freezes.
Excessive Agent Ring Timeout Intervals
Many system administrators configure Agent Ring Timeout to 30, 45, or even 60 seconds under the mistaken assumption that agents need ample time to notice ringing notifications. In reality, an excessive ring timer magnifies the impact of every ghost agent. A single disconnected workstation holding calls for 45 seconds can single-handedly paralyze a queue with dozens of waiting customers.
Absence of Automated Ghost Agent Cleanup Daemons
Standard ViciDial cron schedules run periodic log rotation and hopper loading scripts, but lack dedicated real-time monitors to detect and remediate stuck agent sessions. If an Asterisk channel hangs or a network partition isolates an agent during an active ring cycle, the agent record remains frozen in vicidial_live_agents indefinitely until an administrator manually logs them out via the management portal.
Validated Step-by-Step Resolution Playbook
Step 1: Identify Ghost Agents and Stuck Ring Sessions in MariaDB
Query the ViciDial database to locate agent records trapped in perpetual RING or QUEUE states exceeding normal operational thresholds:
# Connect to MariaDB and query live agent records with prolonged state timers
mysql -u cron -p -e "
SELECT user, server_ip, extension, status, lead_id, last_state_change,
TIMESTAMPDIFF(SECOND, last_state_change, NOW()) AS duration_sec
FROM asterisk.vicidial_live_agents
WHERE status IN ('RING', 'QUEUE')
AND TIMESTAMPDIFF(SECOND, last_state_change, NOW()) > 30;
"
# Monitor Asterisk AGI execution for ring-no-answer events in real time
tail -f /var/log/astguiclient/agiout.* | grep -E "RING NO ANSWER|RNA" | sed 15qStep 2: Configure Automated RNA Pausing in Campaign and In-Group Settings
Update the ViciDial administration settings to enforce immediate automatic pausing upon any missed ring cycle. Reduce the ring timeout to an optimal 10 to 12 seconds:
# /etc/asterisk/vicidial_settings.txt
# Recommended Campaign and In-Group configuration values:
# Under Campaign Screen -> Advanced Settings:
# Agent Ring Timeout: 12
# Ring No-Answer Action: PAUSE
# Ring No-Answer Pause Code: RNA
# Manual Dial RNA Action: PAUSE
# Under In-Group Screen -> In-Group Settings:
# Agent Ring Timeout: 12
# Next Agent Call: random (or few_calls, avoiding strictly longest_wait_time)
# Drop Action: DROP (or redirect to overflow in-group after 36 seconds total queue wait)Apply these configuration changes directly across all active inbound groups via MariaDB command line:
# Enforce RNA auto-pause across all active In-Groups in MariaDB
mysql -u cron -p -e "
UPDATE asterisk.vicidial_inbound_groups
SET agent_alert_exten = '',
queue_priority = '0'
WHERE active = 'Y';
UPDATE asterisk.vicidial_campaigns
SET ring_no_answer_pause = 'Y',
ring_no_answer_pause_code = 'RNA'
WHERE active = 'Y';
"Step 3: Create the RNA Pause Code in ViciDial
Ensure that the RNA pause code is registered and accessible across all campaigns so that state transitions execute cleanly without database schema rejections:
# Insert the RNA pause code into system pause codes
mysql -u cron -p -e "
INSERT IGNORE INTO asterisk.vicidial_pause_codes (pause_code, pause_code_name, billable)
VALUES ('RNA', 'Ring No Answer Automatic Pause', 'NO');
"Step 4: Deploy an Automated Ghost Agent Watchdog Daemon
Create a lightweight Perl or Bash recovery daemon that runs every minute to inspect vicidial_live_agents and immediately reset any agent session stuck in RING status for more than 40 seconds:
#!/bin/bash
# /usr/share/astguiclient/AST_ghost_agent_watchdog.sh
# Purpose: Detect and unfreeze ghost agent sessions in ViciDial
MYSQL_CMD="mysql -u cron -p1234 -D asterisk -s -e"
# Find agents stuck in RING state for over 40 seconds
STUCK_AGENTS=$($MYSQL_CMD "
SELECT user FROM vicidial_live_agents
WHERE status = 'RING'
AND TIMESTAMPDIFF(SECOND, last_state_change, NOW()) > 40;
")
for AGENT in $STUCK_AGENTS; do
echo "[$(date)] Remediating stuck ghost agent: $AGENT"
# Force agent status into PAUSED with RNA code
$MYSQL_CMD "
UPDATE vicidial_live_agents
SET status = 'PAUSED', pause_code = 'RNA', last_state_change = NOW()
WHERE user = '$AGENT';
INSERT INTO vicidial_agent_log (user, server_ip, event_time, campaign_id, pause_code, comments)
VALUES ('$AGENT', '192.168.10.10', NOW(), 'INBOUND', 'RNA', 'FORCED BY WATCHDOG');
"
doneAdd the watchdog script to the root crontab on the central database server:
# Add watchdog check to crontab
# crontab -e
* * * * * /usr/share/astguiclient/AST_ghost_agent_watchdog.sh >/dev/null 2>&1Step 5: Verify Inbound Queue Resiliency and RNA Failover
Simulate an agent disconnection during an active inbound call arrival to confirm that the queue cleanly bypasses the offline representative and delivers the caller to an active agent:
# 1. Log in a test agent and leave the softphone intentionally unauthenticated or closed
# 2. Inject an inbound test call into the In-Group using Asterisk CLI
asterisk -rx "originate Local/90009@default extension 18005551212@from-trunk"
# 3. Monitor live agent state transitions in MariaDB
watch -n 1 "mysql -u cron -p -e 'SELECT user, status, pause_code, last_state_change FROM asterisk.vicidial_live_agents;'"
# 4. Confirm that after exactly 12 seconds, the test agent automatically shifts to PAUSED (RNA)
# 5. Confirm that the incoming call instantly forwards to the next active representativeExperiencing this issue in your production systems?
Calricon conducts senior-level VoIP, SIP trunking, Asterisk, and cloud infrastructure audits. We review your live configs, identify packet drops or contention bottlenecks, and provide exact remediation runbooks.