Reprocess Historical Calls: Difference between revisions
(Add documentation for reprocessing historical calls with process_spooldir.pl to enable features retroactively (e.g., save_sip_responses)) |
(Create new page: Reprocess Historical Calls guide) |
||
| Line 1: | Line 1: | ||
{{DISPLAYTITLE: | {{DISPLAYTITLE:Reprocess Historical Calls}} | ||
[[Category:Administration]] | |||
[[Category:Tools]] | |||
= 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 == | |||
{| class="wikitable" | |||
|- | |||
! 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 <code>save_sip_responses = yes</code> 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#License_Lock|License Lock]]) | |||
|} | |||
== | == Methods == | ||
=== Method 1: Single PCAP File (-r option) === | |||
Process a single PCAP file and generate CDRs: | |||
<syntaxhighlight lang="bash"> | |||
voipmonitor --config-file /etc/voipmonitor.conf -r /path/to/capture.pcap | |||
</syntaxhighlight> | |||
'''GUI alternative:''' Use '''Tools → Load PCAP''' to upload files via web interface. | |||
= | {{Note|1=Configure the upload sniffer config path in '''Settings → System Configuration → Upload sniffer conf path'''}} | ||
=== Method 2: Directory Processing (--readpcapdir) === | |||
Process all PCAPs in a directory (e.g., the spooldir): | |||
-- | <syntaxhighlight lang="bash"> | ||
voipmonitor --config-file /etc/voipmonitor.conf --readpcapdir /var/spool/voipmonitor | |||
-- | |||
</syntaxhighlight> | </syntaxhighlight> | ||
This recursively processes the spooldir structure (<code>YYYY-MM-DD/HH/MM/</code>). | |||
=== | === Method 3: Continuous Directory Scanning (scanpcapdir) === | ||
For near-real-time processing of PCAP files as they are created (e.g., by tcpdump): | |||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> | ||
# /etc/voipmonitor | # /etc/voipmonitor.conf | ||
scanpcapdir = /dev/shm/voipmonitor | |||
scanpcapmethod = newfile | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{ | {| class="wikitable" | ||
|- | |||
! Parameter !! Description | |||
|- | |||
| <code>scanpcapdir</code> || Directory to monitor for new PCAP files | |||
|- | |||
| <code>scanpcapmethod</code> || Detection method: <code>newfile</code> (default) or <code>rename</code> | |||
|} | |||
Example tcpdump command creating 5-second PCAP files: | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
tcpdump -i eth0 -G 5 -w /dev/shm/voipmonitor/%s.pcap | |||
</syntaxhighlight> | </syntaxhighlight> | ||
== Processing to a Separate Database == | |||
{{Warning|1='''Never reprocess directly to your production database.''' Always use a separate database for reprocessed data.}} | |||
=== Step 1: Create Isolated Database === | |||
=== Step | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
mysql -u root -p -e "CREATE DATABASE voipmonitor_reprocess;" | |||
mysql -u | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Step 2: Create Dedicated Configuration === | |||
<syntaxhighlight lang="bash"> | |||
cp /etc/voipmonitor.conf /etc/voipmonitor-reprocess.conf | |||
<syntaxhighlight lang=" | |||
/ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Edit the reprocess config: | |||
<syntaxhighlight lang="ini"> | |||
# /etc/voipmonitor-reprocess.conf | |||
mysqldb = voipmonitor_reprocess | |||
# Disable live capture | |||
interface = | |||
# | # Apply desired new settings | ||
save_sip_responses = yes | save_sip_responses = yes | ||
silencedetect = yes | |||
inbanddtmf = yes | |||
# | # Different manager port to avoid conflicts | ||
managerport = 5030 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Step 3: Run Reprocessing === | |||
<syntaxhighlight lang="bash"> | |||
voipmonitor --config-file /etc/voipmonitor-reprocess.conf --readpcapdir /var/spool/voipmonitor | |||
</syntaxhighlight> | |||
<syntaxhighlight lang=" | |||
=== Step 4: Connect GUI to Reprocessed Data === | |||
Either: | |||
* Change <code>mysqldb</code> in GUI's <code>configuration.php</code> temporarily, or | |||
</ | * Create a second GUI instance pointing to the reprocess database | ||
=== | == PCAP to Audio Conversion == | ||
Extract audio from a PCAP file without database: | |||
<syntaxhighlight lang="ini"> | <syntaxhighlight lang="ini"> | ||
# /tmp/voipmonitor-audio.conf | |||
# . | spooldir = /tmp/audio_output | ||
saveaudio = ogg | |||
nocdr = yes | |||
savesip = no | |||
savertp = no | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<syntaxhighlight lang="bash"> | |||
voipmonitor --config-file=/tmp/voipmonitor-audio.conf -k -v1 -r /path/to/call.pcap | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Audio formats: <code>ogg</code>, <code>wav</code>, <code>mp3</code> | |||
== Performance | == Performance Considerations == | ||
* ''' | * '''CPU:''' Reprocessing is CPU-intensive. Monitor <code>t0CPU</code> usage. | ||
* ''' | * '''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. | ||
* ''' | |||
{{Tip|1=Schedule reprocessing during off-peak hours to avoid impacting live monitoring.}} | |||
== Troubleshooting == | |||
{| class="wikitable" | |||
|- | |||
</ | ! Problem !! Solution | ||
|- | |||
| No CDRs generated || Verify PCAP contains complete SIP dialogs (INVITE through BYE). Check <code>sipport</code> 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 <code>savertp = yes</code>. | |||
|} | |||
</ | |||
== | == See Also == | ||
* [[ | * [[Tools#Load_PCAP|Tools: Load PCAP]] | ||
* [[ | * [[Data_Cleaning|Data Cleaning and Retention]] | ||
* [[ | * [[License#License_Lock|License Lock Recovery]] | ||
* [[Manual_export_of_pcap_files_from_spooldir|Manual PCAP Export from Spooldir]] | |||
== AI Summary for RAG | == AI Summary for RAG == | ||
'''Summary:''' | '''Summary:''' Guide for reprocessing historical PCAP files in VoIPmonitor. Three methods available: (1) Single file with <code>-r</code> option or GUI Load PCAP tool, (2) Directory processing with <code>--readpcapdir</code> for bulk reprocessing, (3) Continuous scanning with <code>scanpcapdir</code> config for near-real-time tcpdump integration. 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 <code>nocdr=yes</code> with <code>saveaudio</code> option. | ||
'''Keywords:''' reprocess, | '''Keywords:''' reprocess, pcap, readpcapdir, scanpcapdir, historical calls, offline processing, batch processing, audio extraction, pre-deployment verification, retroactive capture, separate database, voipmonitor -r, Load PCAP, scanpcapmethod | ||
'''Key Questions:''' | '''Key Questions:''' | ||
* How do I | * How do I reprocess historical PCAP files in VoIPmonitor? | ||
* How | * 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 | * How do I process multiple PCAP files from a directory? | ||
* Can I apply new | * How do I set up continuous PCAP scanning from tcpdump output? | ||
* How do I | * Can I reprocess calls to apply new configuration settings retroactively? | ||
* How do I safely reprocess data without affecting production? | |||
* How do I | * How do I recover calls after truncating the CDR table? | ||
Latest revision as of 16:51, 8 January 2026
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.conf -r /path/to/capture.pcap
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: Directory Processing (--readpcapdir)
Process all PCAPs in a directory (e.g., the spooldir):
voipmonitor --config-file /etc/voipmonitor.conf --readpcapdir /var/spool/voipmonitor
This recursively processes the spooldir structure (YYYY-MM-DD/HH/MM/).
Method 3: Continuous Directory Scanning (scanpcapdir)
For near-real-time processing of PCAP files as they are created (e.g., by tcpdump):
# /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: Never reprocess directly to your production database. Always use a separate database for reprocessed data.
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 =
# Apply desired new settings
save_sip_responses = yes
silencedetect = yes
inbanddtmf = yes
# Different manager port to avoid conflicts
managerport = 5030
Step 3: Run Reprocessing
voipmonitor --config-file /etc/voipmonitor-reprocess.conf --readpcapdir /var/spool/voipmonitor
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.
💡 Tip: Schedule reprocessing during off-peak hours to avoid impacting live monitoring.
Troubleshooting
| Problem | Solution |
|---|---|
| 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) Directory processing with --readpcapdir for bulk reprocessing, (3) Continuous scanning with scanpcapdir config for near-real-time tcpdump integration. 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, readpcapdir, 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 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?