After following a lot of different tutorials (some of which worked some of which didn’t), I came up with a shell script using a couple tools to scrape a packet capture file, pull out the rtp packets, and then convert them back into audio.
For me this will be useful in automated testing. I currently drive automated SIP calls via SIPCLI and ruby for a variety of tests at work. But how do I know I get the right end point? In the past, I’d have the phone number I dial, record voice mail and send me an email, and the sipcli client would send over text to speech audio.
But I dont always have the luxury of being able to configure the phone number to voice mail.
I’ve been wanting to do a packet capture during the test and convert it back to audio afterwards, then do a wav comparison on the expected audio vs. the captured audio.
These are both linux tools.
tshark is a command line version of wireshark. It’s installed on centos boxes using yum install wireshark-gnome.
sox via yum install sox
Sox is a audio analysis tool that is run from the command line.
After looking at some examples online of different tools, I pieced this together from other people’s examples, with a few modifications. It seems to work for me:
Contents of pcap_to_wav.sh: