Extracting audio from calls recorded with RTPProxy

Recording calls with RTPProxy is quite easy, using the rtpproxy module.  Getting the audio out of those pcap files can be tricky sometimes.  Here are the steps of how to extract audio from pcap files:

  • Step1:  Extract the audio out of the pcap file in raw format:
rtpbreak -W -g -f -r [rtpproxy_pcap_record].a.rtp
rtpbreak -W -g -f -r [rtpproxy_pcap_record].o.rtp

A set of files will be generated for each stream:
– rtp.[index].txt – a log of the extraction process;
– rtp.[index].0.txt – characteristics of the audio stream;
– rtp.[index].0.raw – the raw audio stream.

  • Step2:  Merge and convert and the two raw files in a wav file:
sox --combine merge -r 8k -e [format] rtp.0.0.raw \
                    -r 8k -e [format] rtp.1.0.raw \
                    -t wavpcm -s [rtpproxy_pcap_record].wav

Supported formats are listed on then sox manpage (search for −e ENCODING, −−encoding ENCODING).

The format of the raw file can be found in the rtp.[index].0.txt file (look for the “RTP payload type” line).  Make sure that you are using the proper format for the raw file, otherwise the wav file will sound garbled.

For PCMU use:

sox --combine merge -r 8k -e u-law rtp.0.0.raw \
                    -r 8k -e u-law rtp.1.0.raw \
                    -t wavpcm -s [rtpproxy_pcap_record].wav

For PCMA use:

sox --combine merge -r 8k -e a-law rtp.0.0.raw \
                    -r 8k -e a-law rtp.1.0.raw \
                    -t wavpcm -s [rtpproxy_pcap_record].wav

One Response to Extracting audio from calls recorded with RTPProxy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: