Create audio from packet dumps located in a spooldir
If you need to get audio from a SIP and RTP packets dump stored in spooldir by voipmonitor sniffer, continue reading.
Requires
to have full RTP+SIP captures in a spooldir you get this with following options voipmonitor.conf
savesip=yes savertp=yes
You can also use capture rules in a GUI to get full RTP captures only for some IPs/Telnums
Example
Get (SIP+RTP) pcaps and merge them to single file
you need to locate SIP+RTP packet dumps in a spooldir using DATE and HH:MM and call-id header of the call's SIP session
Locate and untar SIP and RTP
Example is for the call with call-id: ad856a3587b477e2f8edc21856c6f2e1 (done at 2021-03-30 14:44) from spooldir with default compression settings
tar --wildcards -xOf '/var/spool/voipmonitor/2021-03-30/14/44/RTP/rtp_2021-03-30-14-44.tar' 'ad856a3587b477e2f8edc21856c6f2e1.pcap*' > tmp/aa/ad856a3587b477e2f8edc21856c6f2e1_RTP_lzo.pcap tar --wildcards -C /tmp/aa -xzf '/var/spool/voipmonitor/2021-03-30/14/44/SIP/sip_2021-03-30-14-44.tar.gz' 'ad856a3587b477e2f8edc21856c6f2e1.pcap*'
Decompress LZO
you need to decompress RTP packet dump using sniffer binary (by default the RTP packet dumps are additionally compressed with internal fast LZO compression tool)
voipmonitor -kc --unlzo-gui='/tmp/aa/ad856a3587b477e2f8edc21856c6f2e1_RTP_lzo.pcap /tmp/aa/ad856a3587b477e2f8edc21856c6f2e1_RTP.pcap'
Merge SIP and RTP packets together
mergecap /tmp/aa/ad856a3587b477e2f8edc21856c6f2e1_RTP.pcap /tmp/aa/ad856a3587b477e2f8edc21856c6f2e1.pcap -w /tmp/aa/merged.pcap
Use sniffer binary and GUI's codecs binary to generate the audio file
you need to put link of vmcodecs binary into PATH and prepare config file for audio create
create link to vmcodecs binary
to create the link to vmcodecs binary located in ./bin subfolder of voipmonitor's GUI - this is necessary to allow to create audio also from other then g711 codecs (requires working GUI license and GUI installation)
ln -s /var/www/html/bin/vmcodecs /sbin/vmcodecs
create the new config file for audio create
Example content of a file /etc/voipmonitorcliwav.conf file:
[general] saveaudio=ogg ogg_quality = 0.1 #saveaudio=wav saveaudio_stereo=no saveaudio_afterconnect = yes nocdr=yes keycheck=/var/www/html/php/lib/keycheck.php spooldir=/tmp
the CLI command for generate the audio
voipmonitor --config-file /etc/voipmonitorcliwav.conf -k -v0 -r /tmp/aa/merged.pcap --json_config='[{"saveaudio":"wav"},{"spooldir":"/tmp/testAu"}]'
Note: the settings done in /etc/voipmonitorcliwav.conf is overriden with the --json-config option, above command will results in wav file in /tmp/testAu folder.