Extracting audio from calls recorded with RTPProxy

November 15, 2011

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

Parallel forking for OpenSIPS in B2B mode

March 2, 2011

OpenSIPS is well-known as a scalable SIP proxy server.   But with the addition of two new modules: b2b_entities and b2b_logic, everything changed.  OpenSIPS is now able to act as a signaling Back to Back User Agent.  Being a signaling B2BUA means that media is still flowing between the end points, but signaling is divided in two individual legs: caller to opensips and opensips to callee.

A particular feature that I was missing with this new addition to opensips was parallel forking.  For instance, if a user is registered at multiple locations, only the one with the higher priority will be used in routing.  Starting with release 1.7, parallel forking for OpenSIPS in B2B mode works out of the box.   Simply perform a lookup() on the incoming INVITE and then relay the call in “b2b – top hiding” mode.

http://lists.opensips.org/pipermail/users/2011-March/017067.html