Create audio from packet dumps located in a spooldir

Jump to navigation Jump to search

If you need to get audio from a SIP and RTP packets dump stored in spooldir by voipmonitor sniffer, continue reading.


to have full RTP+SIP captures in a spooldir you get this with following options voipmonitor.conf


You can also use capture rules in a GUI to get full RTP captures only for some IPs/Telnums


Get (SIP+RTP) pcaps

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 lzo)

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:

ogg_quality = 0.1
saveaudio_afterconnect = yes


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 setting in voipmonitorcliwav.conf is overriden by --json-config option, above command will result in wav file in /tmp/testAu folder.