calricon.
VoIP & Telecom

The ViciDial WebRTC Ghost Channel Trap: Why Dropped Sockets Strand

Nov 10, 2026/7 min read/Verified Production Playbook

calricon / field note

Discover why unclean WebRTC browser disconnects in ViciDial

Nov 10, 2026/VoIP & Telecom
331
Advertisement

The ViciDial WebRTC Ghost Channel Trap: Why Dropped Sockets Strand Callers in MeetMe

Contact centers deploying ViciDial with browser-based WebRTC softphones (such as ViciPhone or custom SIP.js clients) frequently suffer from an insidious call delivery defect. In high-volume outbound campaigns and inbound customer queues, live callers are successfully connected, only to be dumped into an empty MeetMe conference room (extensions 8600051 through 8600999) hearing complete silence or loop music. The customer repeatedly asks, "Hello, is anyone there?", before abandoning the call in frustration. Meanwhile, ViciDial real-time campaign monitors report agents sitting in READY or INCALL states for hours, even though the human representatives closed their laptops or shut down their browsers long ago. Inbound abandonment rates surge past 15%, while dialer capacity is consumed by phantom channels that never process audio.

The root cause is the desynchronization between Asterisk channel states and ViciDial database records following unclean WebRTC browser disconnects. When an agent closes a browser tab, experiences a local WiFi dropout, or puts their workstation to sleep, the browser fails to dispatch a formal SIP BYE or HTTP logout trigger. The underlying WebSocket connection enters a TCP half-open state. Because Asterisk's default WebRTC PJSIP profiles omit active WebSocket ping frames and disable RTP inactivity timeouts for conference bridges, Asterisk maintains the agent's channel in the MeetMe room indefinitely. MeetMe continues generating comfort noise, tricking Asterisk into treating the channel as active. Concurrently, ViciDial's predictive pacing engine (AST_VDauto_dial.pl) queries the database, sees an active agent assigned to the conference, and transfers live callers into the room, stranding customers in an unstaffed audio conference.



Problem Diagnosis & Root Cause Architecture

Diagnosing why WebRTC agent disconnects produce persistent ghost channels requires analyzing the dual-session architecture that powers ViciDial agent workstations.




  • Dual-Session Architecture Disconnect: A ViciDial agent workstation maintains two independent sessions: an HTTP/AJAX polling loop exchanging JSON state with vdc_db_query.php, and a persistent SIP WebRTC media stream connected to a MeetMe conference room on Asterisk. These sessions operate across entirely separate transport stacks without native mutual fate-sharing.

  • The Unclean Browser Disconnect: When an agent abruptly closes their browser tab or suffers an operating system sleep event, JavaScript execution halts instantly. The browser does not execute graceful SIP teardown handshakes, leaving the remote WebSocket TCP socket in an unacknowledged half-open state.

  • MeetMe Audio Feedback Loop: Under standard PJSIP configurations, rtp_timeout is disabled or ineffective for conference bridges. Because the Asterisk MeetMe application continuously injects comfort noise and mixing frames toward the softphone, Asterisk's internal media timers perceive ongoing transmission. The channel never triggers an inactivity hangup.

  • Database State Desynchronization: While the HTTP polling loop eventually triggers an agent logoff via backend cron checks (AST_VDauto_dial.pl) after two minutes of inactivity, Asterisk remains completely unaware of the web session state. The vicidial_conferences table continues to list the MeetMe room as occupied by the agent's phone channel.

  • Predictive Call Stranding: When the predictive dialer answers a customer call or an inbound DID queues a caller, ViciDial identifies the conference room as staffed. Asterisk executes a local redirect (channel redirect), bridging the live customer into the MeetMe room. The caller sits in an empty room talking to a nonexistent agent, driving up customer abandonment.



When a WebRTC agent closes their browser without logging off, the WebSocket TCP connection stalls in a half-open state. Asterisk keeps the MeetMe channel open, causing the predictive dialer to strand live callers in empty conference rooms.


Why Standard Implementations Fail

Relying on JavaScript onbeforeunload Handlers

Modern browser security models strictly limit the execution of network requests during window.onbeforeunload or unload events. Browsers frequently terminate background fetch requests or WebSocket closures before the SIP BYE can traverse the network. Furthermore, sudden power loss or network adapter disconnects bypass JavaScript runtime handlers entirely.



Enabling Standard rtptimeout in pjsip.conf Alone

Setting rtp_timeout = 60 in PJSIP fails to terminate ghost channels in MeetMe rooms. MeetMe continuously transmits synthesized audio frames toward the client. Because Asterisk evaluates outbound traffic and bidirectional packet flow, continuous conference transmission prevents the RTP timer from ever expiring.



Relying on Standard ViciDial Cron Scripts (AST_conf_update.pl)

The standard maintenance script AST_conf_update.pl runs only once per minute and verifies channel existence by querying the Asterisk Manager Interface (AMI). Because Asterisk genuinely believes the PJSIP channel is alive in MeetMe, the script verifies the channel as valid, preserving the ghost record in vicidial_conferences indefinitely.



Authenticated Step-by-Step Resolution Playbook

Step 1: Detect Ghost Channels and Measure Session Discrepancies

Query MariaDB and the Asterisk CLI to identify active MeetMe conference channels whose corresponding agent web session has been stale for more than 30 seconds.



# Check active MeetMe conferences in Asterisk
asterisk -rx "meetme list" | sed 20q

# Query MariaDB for orphaned MeetMe channels with stale HTTP timestamps
mysql -u cron -pdb_pass asterisk -e "
SELECT a.server_ip, a.conf_exten, a.extension, a.channel, b.status, b.last_update_time
FROM vicidial_conferences a
LEFT JOIN vicidial_live_agents b ON a.conf_exten = b.conf_exten
WHERE a.extension IS NOT NULL
AND (b.last_update_time < NOW() - INTERVAL 30 SECOND OR b.last_update_time IS NULL);
"


Step 2: Configure PJSIP WebSocket Keepalives and Asymmetric Timers

Update /etc/asterisk/pjsip.conf to enforce aggressive WebSocket ping frames and enable RTCP-based inactivity detection on all WebRTC agent softphone endpoints.



# /etc/asterisk/pjsip.conf
[transport-wss]
type = transport
protocol = wss
bind = https://www.google.com/url?q=http://0.0.0.0:8089&source=gmail&ust=1794321803664000&sa=E (https://www.google.com/url?q=https://www.google.com/url?q%3Dhttp://0.0.0.0:8089%26amp;source%3Dgmail%26amp;ust%3D1794320017815000%26amp;sa%3DE&source=gmail&ust=1794321803664000&sa=E)

[viciphone-template](!)
type = endpoint
context = default
disallow = all
allow = opus,ulaw
webrtc = yes
dtls_auto_generate_cert = yes
use_avpf = yes
media_encryption = dtls
dtls_verify = no
dtls_setup = actpass
ice_support = yes

# Enforce active WebSocket ping frames every 10 seconds
keep_alive_interval = 10

# Terminate channel if no incoming RTP/RTCP packets arrive for 15 seconds
rtp_timeout = 15
rtp_timeout_hold = 30

# Enable aggressive RTCP monitoring
rtcp_mux = yes

Apply the updated PJSIP configuration:



asterisk -rx "pjsip reload"


Step 3: Deploy an Automated Channel Reaper Watchdog

Deploy a high-frequency watchdog daemon in Perl that cross-references Asterisk MeetMe channels with active agent web heartbeats, instantly hanging up orphaned softphone channels.



# /usr/share/astguiclient/AST_webrtc_channel_reaper.pl
#!/usr/bin/perl
use strict;
use warnings;
use DBI;

my $dbh = DBI->connect("DBI:mysql:asterisk:localhost", "cron", "db_pass", {RaiseError => 1});

while (1) {
my $sth = $dbh->prepare("
SELECT a.channel, a.conf_exten
FROM vicidial_conferences a
LEFT JOIN vicidial_live_agents b ON a.conf_exten = b.conf_exten
WHERE a.channel LIKE 'PJSIP/viciphone%'
AND (b.last_update_time < NOW() - INTERVAL 20 SECOND OR b.conf_exten IS NULL)
");
$sth->execute();

while (my @row = $sth->fetchrow_array) {
my $channel = $row[0];
my $conf_exten = $row[1];

# Issue immediate hangup through Asterisk command interface
system("asterisk -rx 'channel request hangup $channel' > /dev/null 2>&1");

# Clear the stale conference slot in the database
$dbh->do("UPDATE vicidial_conferences SET extension = NULL, channel = NULL WHERE conf_exten = '$conf_exten'");
}
sleep 5;
}

Enable and start the watchdog service via systemd:



# /etc/systemd/system/viciphone-reaper.service
[Unit]
Description=ViciDial WebRTC Ghost Channel Reaper
After=asterisk.service mariadb.service

[Service]
Type=simple
ExecStart=/usr/bin/perl /usr/share/astguiclient/AST_webrtc_channel_reaper.pl
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target


systemctl daemon-reload
systemctl enable --now viciphone-reaper.service


Step 4: Configure ViciDial System Settings for Rapid Agent Timeout

Update ViciDial system settings in the administration interface to reduce the web agent timeout window from default two minutes down to 15 seconds.



# Update ViciDial system settings directly in MariaDB
mysql -u cron -pdb_pass asterisk -e "
UPDATE system_settings SET
agent_screen_time_warnings = '1',
default_phone_registration_password = 'db_pass';
"


Step 5: Verify Ghost Channel Cleanup Under Abrupt Disconnects

Simulate an agent browser crash during an active dialing campaign and confirm that Asterisk tears down the MeetMe channel within 15 seconds, preventing customer stranding.



# Monitor the reaper service logs during an abrupt browser crash
journalctl -u viciphone-reaper.service -f | sed 20q

# Verify zero orphaned channels remain in MeetMe
asterisk -rx "meetme list"

# Confirm that vicidial_conferences has zero stale channel references
mysql -u cron -pdb_pass asterisk -e "
SELECT conf_exten, extension, channel FROM vicidial_conferences WHERE channel IS NOT NULL;
"

By enforcing 10-second WebSocket keepalive pings in PJSIP, activating 15-second RTP timeouts, and running a dedicated 5-second channel reaper watchdog, ViciDial eliminates WebRTC ghost channels. Orphaned conference rooms are purged within seconds, ensuring customer calls are routed strictly to live, responsive agents.

Advertisement
Engineering Advisory 48-Hour Audit Turnaround

Experiencing 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.