Learn how to diagnose and fix missing call recordings in ViciDial by checking configuration, Asterisk settings, file permissions, and database logging
Prerequisites
Before troubleshooting, ensure you have:
- Root or sudo access to your ViciDial server
- SSH access to the command line
- Basic knowledge of ViciDial configuration and Asterisk
- Access to the ViciDial web interface
- Understanding of Linux file permissions
- A test account with recording enabled
- Recent calls in your system to verify
This guide assumes ViciDial 2.14+ running on CentOS 7+ or Ubuntu 18.04+ with Asterisk 13+.
Understanding ViciDial Recording Architecture
ViciDial recordings operate through a layered system:
- Asterisk MixMonitor — captures audio from SIP channels
- VICIDIAL_RECORD context in extensions — routes recording signals
- Recording files — stored in
/var/spool/asterisk/monitor/by default - Database logging — tracks recording status in
vicidial_logandvicidial_closer_log - Web playback — retrieves and streams audio through PHP
If recordings are missing, the break typically occurs at one of these five points.
Prerequisites to Check First
Verify Recording Is Enabled in ViciDial Settings
Log in to your ViciDial web interface and navigate to System Settings.
Check these critical flags:
Administration → System Settings
Recording: YES
Asterisk Recording Format: GSM or WAV (most common)
Recording Path: /var/spool/asterisk/monitor/
Default Recording: ENABLED (per campaign)
You can also verify via database:
-- Connect to the asterisk database
mysql -u root -p asterisk
-- Check global recording setting
SELECT * FROM system_settings WHERE vari_name LIKE '%record%'\G
-- Check campaign recording settings
SELECT campaign_id, campaign_name, record_calls
FROM vicidial_campaigns
WHERE campaign_id = 'TEST_CAMPAIGN'\G
The record_calls field in vicidial_campaigns must be set to Y for that specific campaign.
Verify Agent Has Recording Permissions
Not all agent groups have recording enabled by default:
SELECT user_group, call_recording_override
FROM vicidial_user_groups
WHERE user_group = 'AGENT_GROUP'\G
The call_recording_override should be either ENABLED or left blank (defaults to enabled). If it's DISABLED, recordings won't capture.
Check if Calls Are Actually Being Logged
Missing recordings often indicate calls aren't being logged properly at all:
# Count records from today in vicidial_log
mysql -u root -p asterisk -e "
SELECT COUNT(*) as total_calls
FROM vicidial_log
WHERE call_date >= DATE(NOW());"
If counts are zero or extremely low, the issue is upstream—calls aren't being processed through ViciDial's call handling system correctly.
Configuration Verification
Step 1: Check Asterisk Extensions Configuration
ViciDial's recording is controlled by the VICIDIAL_RECORD context in your extensions file.
# Locate your extensions file
grep -r "VICIDIAL_RECORD" /etc/asterisk/ | head -20
Typically this is in /etc/asterisk/extensions-vicidial.conf. Check for the recording context:
[VICIDIAL_RECORD]
exten => 1,1,Answer()
exten => 1,2,MixMonitor(${MIXMON_FILENAME}.${MIXMON_FORMAT},b)
exten => 1,3,Return()
If this context doesn't exist or is malformed, recordings fail silently. The presence of MixMonitor application is critical.
Step 2: Verify SIP Configuration
Check your SIP channel configuration:
# Check SIP channel driver configuration
grep -E "^(record|monitor|mixmonitor)" /etc/asterisk/sip-vicidial.conf
Your SIP configuration should not have recording disabled:
[general]
; These lines MUST NOT appear:
; recordhistory=no
; videosupport=no
; These should be present or default:
canreinvite=no
Step 3: Check Core Asterisk Recording Settings
Verify Asterisk's global recording configuration in asterisk.conf:
cat /etc/asterisk/asterisk.conf | grep -A 10 "\[options\]"
Look for:
[options]
verbose = 3
debug = 3
Verbose and debug level 3+ helps identify recording issues in logs.
Step 4: Validate Monitor Directory Configuration
ViciDial stores recordings in a monitor directory. Verify the path:
# Check default monitor path
grep -r "monitor" /etc/asterisk/extensions-vicidial.conf | grep -i path
# Typically this should be
# /var/spool/asterisk/monitor/
The path can be overridden in variables. Check your outbound route configuration:
grep -B5 -A5 "MIXMON_FILENAME" /etc/asterisk/extensions-vicidial.conf | head -20
This should define a filename pattern like:
MIXMON_FILENAME=var/spool/asterisk/monitor/YYYY/MM/DD/CALLID_${EPOCH}
File System and Permissions Issues
Step 1: Verify Monitor Directory Exists and Has Correct Permissions
# Check if monitor directory exists
ls -ld /var/spool/asterisk/monitor/
# Expected output:
# drwxrwxr-x asterisk asterisk /var/spool/asterisk/monitor/
If the directory doesn't exist, create it:
mkdir -p /var/spool/asterisk/monitor
chown -R asterisk:asterisk /var/spool/asterisk/monitor
chmod -R 0755 /var/spool/asterisk/monitor
Step 2: Check Disk Space
Recordings consume significant disk space. If your partition is full, recordings fail:
# Check /var partition (where asterisk spool is stored)
df -h /var/spool/asterisk/
# Check if inode space is full
df -i /var/spool/asterisk/
If usage is above 90%, clean old recordings:
# Find and delete recordings older than 30 days
find /var/spool/asterisk/monitor/ -type f -mtime +30 -delete
# Verify space freed
du -sh /var/spool/asterisk/monitor/
Step 3: Verify Asterisk Process Has Write Permission
# Check Asterisk process user
ps aux | grep asterisk | grep -v grep
# Verify asterisk user owns the monitor directory
ls -ld /var/spool/asterisk/monitor/
If not owned by asterisk, fix permissions:
chown -R asterisk:asterisk /var/spool/asterisk/
chmod -R 755 /var/spool/asterisk/monitor/
Step 4: SELinux Context (if applicable)
On systems with SELinux enabled, check contexts:
# Check if SELinux is enforcing
getenforce
# If enforcing, check asterisk directory context
ls -Z /var/spool/asterisk/monitor/
# Should be something like: system_u:object_r:asterisk_spool_t:s0
If context is wrong:
semanage fcontext -a -t asterisk_spool_t "/var/spool/asterisk/monitor(/.*)?"
restorecon -Rv /var/spool/asterisk/monitor/
Asterisk Runtime Verification
Step 1: Check Active Channels and Recording Status
Connect to the Asterisk CLI and check recording:
# Connect to Asterisk CLI
asterisk -rx "core show channels verbose"
# Look for MixMonitor in the channel info
# Output should show channels with recording active
During an active call, you should see:
Channel State Application(Data)
SIP/2001-000XXXXX 6 MixMonitor(/var/spool/asterisk/monitor/2024/01/15/...)
If no MixMonitor is shown during calls, the recording context isn't being invoked.
Step 2: Enable Asterisk Verbose Logging for Recording
Temporarily increase logging to diagnose recording failures:
# Connect to Asterisk CLI
asterisk -rx "core set verbose 10"
asterisk -rx "core set debug 10"
# Tail the Asterisk log to watch recording attempts
tail -f /var/log/asterisk/full
Make a test call. Watch for messages like:
[Jan 15 14:32:15] VERBOSE[12345] app_mixmonitor.c: Started MixMonitor Recording to [/var/spool/asterisk/monitor/...]
If you see errors instead:
[Jan 15 14:32:15] WARNING[12345] app_mixmonitor.c: Cannot open MixMonitor file (permission denied)
This indicates a file permissions problem.
Step 3: Check MixMonitor Application Availability
# Verify MixMonitor app is compiled into Asterisk
asterisk -rx "module show like mixmonitor"
# Should show:
# res_mixmonitor.so Recording with file rotation support
If not loaded:
# Load the module
asterisk -rx "module load res_mixmonitor"
To make it permanent, ensure /etc/asterisk/modules.conf doesn't exclude it:
[modules]
; Check there's no line like:
; noload => res_mixmonitor.so
Step 4: Test Recording with a Simple Dialplan Entry
Create a test extension to verify recording works:
# Edit extensions-vicidial.conf or create a test file
cat >> /etc/asterisk/extensions-test.conf << 'EOF'
[test-record]
exten => 100,1,Answer()
exten => 100,2,MixMonitor(/var/spool/asterisk/monitor/test-${UNIQUEID}.wav,b)
exten => 100,3,VoiceMail(100@default)
exten => 100,4,Hangup()
EOF
Reload Asterisk:
asterisk -rx "dialplan reload"
Test with a SIP extension calling extension 100. Check if the test file is created:
ls -la /var/spool/asterisk/monitor/test-*.wav
If files appear, basic recording works. If not, your Asterisk compilation or permissions are broken.
ViciDial Database and Call Logging
Step 1: Verify Recording Flag in Call Log
After a test call, check the database:
SELECT * FROM vicidial_log
WHERE extension = '2001'
ORDER BY call_date DESC
LIMIT 1\G
Critical fields to check:
recording: Y or N (must be Y)
filename: /path/to/recording.wav (must be populated)
length_of_call: > 0 (call must have duration)
If recording field is N, ViciDial didn't mark the call for recording. If filename is empty, the recording wasn't saved.
Step 2: Check Recording Format Settings
SELECT * FROM system_settings
WHERE vari_name = 'RECORDING_FORMAT'\G
Should return something like:
vari_name: RECORDING_FORMAT
vari_value: WAV
Valid values are: GSM, WAV, ULAW, ALAW.
If not set, recordings default to GSM (smaller files but lower quality).
Step 3: Verify Campaign Recording Settings
SELECT campaign_id, campaign_name, record_calls, record_agents
FROM vicidial_campaigns
WHERE campaign_id = 'YOUR_CAMPAIGN'\G
Both record_calls and record_agents should be Y:
record_calls: Y— records inbound callsrecord_agents: Y— records agent lines
Step 4: Check Closer Log Recording Status
For inbound calls, check vicidial_closer_log:
SELECT call_id, filename, length_of_call, call_date
FROM vicidial_closer_log
WHERE closer_emp_id = 'AGENT_ID'
ORDER BY call_date DESC
LIMIT 5\G
The filename field should contain the full path to the recording file.
Step 5: Audit Recent Recording Database Changes
Check if something changed the recording settings recently:
-- Check system settings history (if available)
SHOW CREATE TABLE system_settings\G
-- Check if recording was recently disabled in a campaign
SELECT campaign_id, campaign_name, record_calls,
DATE(modify_date) as last_modified
FROM vicidial_campaigns
ORDER BY modify_date DESC
LIMIT 10\G
Common ViciDial-Specific Issues
Issue: Inbound Calls Recording but Outbound Not Recording
This occurs when the outbound route doesn't invoke the recording context.
Check your outbound route configuration:
grep -B10 -A10 "exten.*Dial" /etc/asterisk/extensions-vicidial.conf | head -40
Look for the outbound dialplan. It should include a recording application call:
exten => 1,1,Set(MIXMON_FORMAT=wav)
exten => 1,2,Set(MIXMON_FILENAME=/var/spool/asterisk/monitor/YYYY/MM/DD/...)
exten => 1,3,MixMonitor(${MIXMON_FILENAME}.${MIXMON_FORMAT},b)
exten => 1,4,Dial(SIP/${EXTEN}@carrier,30)
If MixMonitor is missing, add it before the Dial() application.
Issue: Recording Files Created but Empty or Corrupted
Empty files indicate Asterisk created the file but captured no audio:
# Check file sizes
find /var/spool/asterisk/monitor/ -type f -size 0
# Check for corrupted headers
file /var/spool/asterisk/monitor/2024/01/15/*.wav | grep -v "audio"
This usually indicates:
- No audio on the channel — check SIP codec settings
- RTP not flowing — firewall or NAT issue
- File created before audio starts — timing issue
Verify codecs in your SIP configuration:
grep -A 5 "disallow" /etc/asterisk/sip-vicidial.conf
grep -A 5 "allow" /etc/asterisk/sip-vicidial.conf
Should show:
disallow=all
allow=ulaw
allow=alaw
allow=gsm
Issue: Recordings Stop Mid-Call
MixMonitor sometimes terminates prematurely if:
- Call is transferred — recording stops at first bridge
- Call goes to voicemail — different context, recording disabled
- Asterisk crashes or reloads — in-progress recordings lost
Check for call transfers in your dialplan:
grep -n "Blind\|Attended\|Transfer" /etc/asterisk/extensions-vicidial.conf
To maintain recording through transfers, use the b flag in MixMonitor:
MixMonitor(${FILENAME}.${FORMAT},b)
^^^ this flag keeps recording after transfer
Issue: Recording Plays Wrong Audio or Dual Audio
Stereo/mono mismatch causes playback issues:
# Check recording properties
file /var/spool/asterisk/monitor/sample.wav
# Should show: audio/x-wav, 1 channel (mono) or 2 channels (stereo)
To force mono recordings, modify MixMonitor:
MixMonitor(${FILENAME}.${FORMAT},b,)
^^^ third parameter forces mono
Troubleshooting Checklist
Use this systematic checklist when recordings go missing:
Tier 1: Configuration Issues (Quickest Checks)
- ViciDial recording is globally enabled (
Administration → System Settings) - Campaign has
record_calls = Yin database - Agent group has
call_recording_override != DISABLED - Recording format is set (
GSM,WAV,ULAW, orALAW)
Test: Make a call. If this tier passes but no recordings appear, move to Tier 2.
Tier 2: File System Issues (5-10 minutes)
# Run these commands
ls -ld /var/spool/asterisk/monitor/ || echo "FAIL: Directory missing"
touch /var/spool/asterisk/monitor/test.txt && rm /var/spool/asterisk/monitor/test.txt && echo "PASS: Write permission OK" || echo "FAIL: Permission denied"
df -h /var/spool/asterisk/ | tail -1 | awk '{print $5}' | sed 's/%//' | awk '{if ($1 > 90) print "FAIL: Disk full"; else print "PASS: Disk OK"}'
Test: Run these three checks. If all pass, move to Tier 3.
Tier 3: Asterisk Runtime Issues (10-15 minutes)
# Check if MixMonitor is loaded
asterisk -rx "module show like mixmonitor" | grep -q "res_mixmonitor" && echo "PASS: MixMonitor loaded" || echo "FAIL: MixMonitor not loaded"
# Check for recent Asterisk errors
grep -i "mixmonitor\|record" /var/log/asterisk/full | tail -20 | grep -i "error\|fail"
# Make test call and check channels
asterisk -rx "core show channels verbose" | grep -i "mixmonitor"
Test: If channels show MixMonitor but files don't appear, move to Tier 4.
Tier 4: ViciDial Database Logging Issues (10-15 minutes)
# Check recent calls are being logged
mysql -u root -p asterisk -e "
SELECT COUNT(*) as total_calls, COUNT(DISTINCT(extension)) as agents
FROM vicidial_log
WHERE call_date > DATE_SUB(NOW(), INTERVAL 1 HOUR);"
# Check recent calls have recording flags
mysql -u root -p asterisk -e "
SELECT COUNT(*) as with_recording
FROM vicidial_log
WHERE call_date > DATE_SUB(NOW(), INTERVAL 1 HOUR)
AND recording = 'Y';"
# Check filenames are being logged
mysql -u root -p asterisk -e "
SELECT filename, length_of_call
FROM vicidial_log
WHERE call_date > DATE_SUB(NOW(), INTERVAL 1 HOUR)
LIMIT 5;"
Test: If recording flag is N, the issue is in ViciDial call handling, not Asterisk. If filename is empty but flag is Y, the recording process failed.
Performance Optimization for High-Call-Volume Systems
If you're losing recordings on a high-volume system, optimize:
Increase MixMonitor Buffer
; In extensions-vicidial.conf, increase buffer for MixMonitor:
MixMonitor(${FILENAME}.${FORMAT},b(1000),)
^^^^ buffer size in ms (default 0)
Implement Asynchronous Recording
For systems with 100+ concurrent calls, use async recording:
[VICIDIAL_RECORD]
exten => 1,1,Answer()
exten => 1,2,MixMonitor(${FILENAME}.${FORMAT},b)
exten => 1,3,Return()
Ensure ast_config_AST_RUN_DIR=/var/run/asterisk points to a fast filesystem.
Monitor Recording Daemon
Create a monitoring script to track failed recordings:
#!/bin/bash
# /usr/local/bin/check_recordings.sh
CALLS=$(mysql -u root -p asterisk -sss -e "
SELECT COUNT(*) FROM vicidial_log
WHERE call_date > DATE_SUB(NOW(), INTERVAL 1 HOUR)
AND recording = 'Y'")
FILES=$(find /var/spool/asterisk/monitor/ -type f -mmin -60 | wc -l)
if [ "$CALLS" -gt 0 ] && [ "$FILES" -lt "$CALLS" ]; then
echo "WARNING: Expected $CALLS recordings but found $FILES files"
# Send alert email
mail -s "ViciDial Recording Alert" [email protected]
fi
Run via cron every 5 minutes:
*/5 * * * * /usr/local/bin/check_recordings.sh
Summary
ViciDial recording failures follow a predictable debugging path:
- Configuration — 40% of issues are disabled settings in ViciDial UI or database
- File System — 30% are permission, disk space, or mount problems
- Asterisk Runtime — 20% are missing modules, SELinux, or dialplan errors
- Database Logging — 10% are call not being logged correctly
Start with the Troubleshooting Checklist in Tier 1. Each tier takes 5-15 minutes. Most production issues resolve within Tier 2.
Key files to know:
/etc/asterisk/extensions-vicidial.conf— recording dialplan/var/spool/asterisk/monitor/— recording storage/var/log/asterisk/full— detailed loggingvicidial_logandvicidial_closer_logtables — call metadata
Commands to remember:
asterisk -rx "core show channels verbose"— verify recording in progressmysql asterisk -e "SELECT ... FROM vicidial_log"— verify database loggingfind /var/spool/asterisk/monitor/ -mmin -5— find recent recordingsls -ld /var/spool/asterisk/monitor/— verify permissions
When recordings are missing, one of these five systems has failed. Methodically verify each, starting with the cheapest fixes (database settings and permissions) before diving into Asterisk compilation or SIP codec issues.