Reprocess Historical Calls
Reprocess Historical Calls
This guide explains how to re-analyze previously captured PCAP files using VoIPmonitor. This is useful for applying new configurations, testing detection methods, or recovering data after schema changes.
Use Cases
| Use Case | Description |
|---|---|
| Pre-deployment verification | Upload sample traffic (VoLTE, WebRTC, TLS) to confirm VoIPmonitor can parse the protocol before deploying live mirroring |
| Retroactive SIP response capture | Enable save_sip_responses = yes to find intermediate SIP codes (like 491) from calls captured before this feature was enabled
|
| Testing new detection methods | Apply updated algorithms for fax/DTMF/silence detection to historical data |
| Configuration experimentation | Test how new capture rules would have behaved on past traffic |
| Schema upgrades | Reprocess old PCAPs to leverage new database features |
| License reset recovery | Reprocess PCAPs after truncating CDR tables (see License Lock) |
Methods
Method 1: Single PCAP File (-r option)
Process a single PCAP file and generate CDRs:
voipmonitor --config-file /etc/voipmonitor-reprocess.conf -k -r /path/to/capture.pcap
Use a dedicated config file, see Step 2. To process a directory of ordinary PCAP files, run this command in a loop over the files.
GUI alternative: Use Tools → Load PCAP to upload files via web interface.
ℹ️ Note: Configure the upload sniffer config path in Settings → System Configuration → Upload sniffer conf path
Method 2: Spooldir Processing (process_spooldir.pl)
To create CDRs from the recordings in a spooldir (for example after losing the database or moving PCAPs to a new server), use the process_spooldir.pl script from the scripts folder of the GUI installation (for example /var/www/html/scripts/):
cd /var/www/html/scripts
perl process_spooldir.pl \
--voipcfg=/etc/voipmonitor-reprocess.conf \
--spooldir=/var/spool/voipmonitor \
--fromdate='2026-05-13 00:00' \
--todate='2026-05-13 23:59'
⚠️ Warning: The sniffer has no --readpcapdir option in any version. It fails with unrecognized option '--readpcapdir', and upgrading does not help. Neither does reindex_all = yes in the config file: that option does not exist, and the command line option --reindex-all only rebuilds the spool cleaning index, it does not create CDRs.
| Parameter | Description | Default |
|---|---|---|
--fromdate, --todate |
Time range to import, format YYYY-MM-DD[ HH:MM] |
Required |
--voipcfg |
Sniffer config file used for the import. Must contain the database access | /etc/voipmonitor-test.conf
|
--spooldir |
Directory with the recordings to import | /var/spool/voipmonitor
|
--tmpdir |
Working directory. The script deletes its RTP, SIP and MERGE subfolders |
/tmp
|
--voipbin, --mergecap |
Paths to the binaries | /usr/local/sbin/voipmonitor, /usr/bin/mergecap
|
How it works: for each minute in the range the script unpacks the SIP and RTP TAR archives, merges the SIP and RTP of each call with mergecap, and imports the result with voipmonitor -r.
Requirements: the sniffer binary, mergecap, tar, gunzip, unzstd and the Perl module Date::Parse (the script reports what is missing), read access to the spooldir and access to the database. No license is required, and it can run on a different server than the one that captured the calls.
Good to know:
- It is very slow. Each call is imported separately, so a large spooldir can take days or weeks. Start with one hour, check the result in the GUI, then continue with the rest.
- Disable saving in the config (see Step 2). Otherwise the sniffer saves another copy of all the packets into its
spooldir. - CDRs are added as new rows with the latest IDs. Sort by
calldate, not by ID, and do not import a time range that is already in the database, because those calls would be duplicated. - Identifying imported calls: set
id_sensorin the config to an unused value such as999, and add a sensor with that ID in Settings → Sensors (IP127.0.0.1, the samemanagerportas in the config). - Compressed archives: SIP TARs can be plain, gzip or zstd, RTP TARs only plain or gzip. RTP TARs created with
tar_compress_rtp = zstdorlzmaare not unpacked. - Very old spools: add
--use-old-split-charif RTP chunks are not joined correctly.
Method 3: Continuous Directory Scanning (scanpcapdir)
For near-real-time processing of PCAP files as they are created (e.g., by tcpdump):
⚠️ Warning: The sniffer deletes each file in scanpcapdir after processing it. Never point it at a spooldir or at PCAPs you want to keep. It also reads only plain PCAP files in that one directory, not the spooldir structure with TAR archives.
# /etc/voipmonitor.conf
scanpcapdir = /dev/shm/voipmonitor
scanpcapmethod = newfile
| Parameter | Description |
|---|---|
scanpcapdir |
Directory to monitor for new PCAP files |
scanpcapmethod |
Detection method: newfile (default) or rename
|
Example tcpdump command creating 5-second PCAP files:
tcpdump -i eth0 -G 5 -w /dev/shm/voipmonitor/%s.pcap
Processing to a Separate Database
⚠️ Warning: When testing configuration changes, never reprocess directly to your production database. Use a separate database. Importing into the main database makes sense only when recovering calls that are missing from it.
Step 1: Create Isolated Database
mysql -u root -p -e "CREATE DATABASE voipmonitor_reprocess;"
Step 2: Create Dedicated Configuration
cp /etc/voipmonitor.conf /etc/voipmonitor-reprocess.conf
Edit the reprocess config:
# /etc/voipmonitor-reprocess.conf
mysqldb = voipmonitor_reprocess
# Disable live capture
interface =
# Do not save another copy of the packets (spooldir: an empty directory, not the one being imported)
spooldir = /var/spool/voipmonitor-reprocess
savesip = no
savertp = no
savertcp = no
savegraph = no
# Apply desired new settings
save_sip_responses = yes
silencedetect = yes
inbanddtmf = yes
# Different manager port to avoid conflicts
managerport = 5030
Step 3: Run Reprocessing
mkdir -p /var/spool/voipmonitor-reprocess
cd /var/www/html/scripts
perl process_spooldir.pl --voipcfg=/etc/voipmonitor-reprocess.conf --spooldir=/var/spool/voipmonitor \
--fromdate='2026-05-13 00:00' --todate='2026-05-13 00:59'
Step 4: Connect GUI to Reprocessed Data
Either:
- Change
mysqldbin GUI'sconfiguration.phptemporarily, or - Create a second GUI instance pointing to the reprocess database
PCAP to Audio Conversion
Extract audio from a PCAP file without database:
# /tmp/voipmonitor-audio.conf
spooldir = /tmp/audio_output
saveaudio = ogg
nocdr = yes
savesip = no
savertp = no
voipmonitor --config-file=/tmp/voipmonitor-audio.conf -k -v1 -r /path/to/call.pcap
Audio formats: ogg, wav, mp3
Performance Considerations
- CPU: Reprocessing is CPU-intensive. Monitor
t0CPUusage. - I/O: SSD recommended for large datasets. Spooldir uses nested TAR archives.
- Memory: Same requirements as live capture.
- Parallelization: Use multiple instances with different date ranges for faster processing. Each
process_spooldir.plinstance needs its own--tmpdir.
💡 Tip: Schedule reprocessing during off-peak hours to avoid impacting live monitoring.
Troubleshooting
| Problem | Solution |
|---|---|
unrecognized option '--readpcapdir' |
This option does not exist in any version. Use process_spooldir.pl. |
| No CDRs generated | Verify PCAP contains complete SIP dialogs (INVITE through BYE). Check sipport matches ports in PCAP.
|
| CDR count mismatch | Some calls may span multiple PCAP files. Ensure all related files are processed. |
| Permission errors | Run as root or ensure voipmonitor user has read access to PCAP files. |
| Database connection failed | Verify MySQL credentials in config and that target database exists. |
| Missing audio | Ensure PCAP contains both SIP and RTP packets. Check savertp = yes.
|
See Also
AI Summary for RAG
Summary: Guide for reprocessing historical PCAP files in VoIPmonitor. Three methods available: (1) Single file with -r option or GUI Load PCAP tool, (2) Spooldir processing with the process_spooldir.pl script from the GUI scripts folder, which unpacks the TARs, merges SIP and RTP and imports each call with voipmonitor -r; it is very slow and adds CDRs as new rows. The option --readpcapdir does NOT exist in any sniffer version (error: unrecognized option) and reindex_all does not create CDRs, (3) Continuous scanning with scanpcapdir config for near-real-time tcpdump integration (deletes files after processing, never use it on a spooldir). The import config should disable savesip/savertp/savertcp/savegraph and use an empty spooldir. Critical safety rule: always use separate database for reprocessed data, never production. Common use cases include pre-deployment protocol verification (VoLTE, WebRTC), retroactive SIP response capture, testing new detection methods (silence, DTMF), and license lock recovery after CDR truncation. For audio extraction without database, use nocdr=yes with saveaudio option.
Keywords: reprocess, pcap, process_spooldir.pl, readpcapdir, unrecognized option, reindex_all, rebuild CDR, import spooldir, migrate PCAP, scanpcapdir, historical calls, offline processing, batch processing, audio extraction, pre-deployment verification, retroactive capture, separate database, voipmonitor -r, Load PCAP, scanpcapmethod
Key Questions:
- How do I reprocess historical PCAP files in VoIPmonitor?
- How do I upload and process a PCAP file to verify protocol support?
- How do I extract audio from a PCAP file without a database?
- How do I process multiple PCAP files from a directory?
- How do I create CDRs from PCAP files in the spooldir?
- Why do I get unrecognized option '--readpcapdir'?
- How do I set up continuous PCAP scanning from tcpdump output?
- Can I reprocess calls to apply new configuration settings retroactively?
- How do I safely reprocess data without affecting production?
- How do I recover calls after truncating the CDR table?