7

So using a syntax like

../sipp -sn uac SERVER_IP -s DESTINATION_NUMBER -ap AUTH_PASSWORD -aa -m 1 -l 1 -d 10000

I am able to initiate a sip call. What I want to achieve is, after the callee picks the call, play a .wav file and terminate the call after the file is finished playing.

I want to achieve this using the command line arguments. Has someone done this before?

douglaslps
  • 8,068
  • 2
  • 35
  • 54
BTR Naidu
  • 1,063
  • 3
  • 18
  • 45

2 Answers2

16

The latest SIPp version (3.4) does now support direct RTP streaming, from a correctly-encoded WAV file.

You'll want to create a custom scenario file (using the -sd uac option to dump out the sample UAC scenario as a starting point) and add <action><exec rtp_stream="file.wav" /></action> inside the <recv response="200"></recv> XML block, to trigger that WAV file to be played over RTP when the 200 OK is received.

http://sipp.sourceforge.net/doc/reference.html#Media%2FRTP+commands has more details on setting this up (such as looping or non-PCMA payload types).

(I'm the current maintainer of SIPp.)

rkday
  • 1,106
  • 8
  • 12
  • 2
    Producing a correctly-encoded WAV from audio samples wasn't self explanatory for me. I spent a lot of time until I discovered how to re-encode and convert them using gstreamer. gst-launch filesrc location=piano1.wav \ ! wavparse \ ! audioconvert \ ! audioresample \ ! alawenc \ ! audio/x-alaw, rate=8000, channels=1 \ ! wavenc \ ! filesink location=piano2.wav Hopefully this will save someone the time of discovery – Josiah DeWitt Feb 02 '16 at 18:59
  • @JosiahDeWitt. I've tried your suggestion with no luck. I always get a scrambled audio. Can you please check this question http://stackoverflow.com/questions/39332306/how-to-encode-wav-to-play-with-sipp ? – douglaslps Sep 08 '16 at 12:32
4

SIPp supports the ability to send a stream of pre-recorded RTP packets via the exec play_pcap_audio directive. (See the built-in uac_pcap scenario as a model for your scenario.) The packets to be sent are stored in a file with PCAP format. The packets can be extracted from a Wireshark capture of a test call, for instance.

$ sipp -sf custom_with_pcap_audio.xml SERVER_IP -s DESTINATION_NUMBER -ap AUTH_PASSWORD -aa -m 1 -l 1 -d 10000

To create custom_with_pcap_audio.xml, start here:

$ sipp -sd uac_pcap > custom_with_pcap_audio.xml

then edit the scenario to refer to your pcap file (obtained via one of the techniques previously linked). You will also need to make the delay the appropriate length for your pcap recording (rather than the 10000 given in the example).

yotommy
  • 1,472
  • 1
  • 12
  • 17
  • Thanks for your reply but I was not looking for links to manuals. You can assume I have already gone through those. – BTR Naidu Nov 21 '13 at 14:23
  • To answer your question precisely: yes, you can indeed achieve this with command line arguments and people have done this before. To expand that answer to be more useful, it also requires creating a custom scenario file and a pcap file, as described in the answer. I'll add sample command lines to the answer. – yotommy Nov 21 '13 at 14:51
  • thanks for your answer. Is it possible to play a wav or raw pcm file than a pcap file which is more complex to create? – BTR Naidu Nov 21 '13 at 15:10
  • No, sipp does not accept wav or pcm files. You can simplify the conversion process via a tool like http://wav2rtp.sourceforge.net/ though, assuming one of the supported codecs is acceptable. You may need to change the SDP in the sipp scenario to match the codec used in the conversion. – yotommy Nov 21 '13 at 15:12