-1

I have created a SIP call, right now I dont have any sound to it i.e. I dont have a Sound Manager. I would like to play a Audio file for the Receiver instead. i.e. When I make a call to someone, I want them to hear the Audio message. How do I send the file and make it play?

 ContentLengthHeader contentLength = headerFactory.createContentLengthHeader(211);
 ContentTypeHeader contentType = 
     headerFactory.createContentTypeHeader("application", "sdp");

 String sdpData = "v=0\n" + 
                "o=test 795808818 480847547 IN IP4 "+localIP+"\n" + 
                "s=Audio Call\n" + 
                "u=/audio/play.wav"+
                "c=IN IP4 "+localIP+"\n" + 
                "t=0 0\n" + 
                "m=audio 8000 RTP/AVP 0 8 101\n" + 
                "a=rtpmap:0 PCMU/8000\n" + 
                "a=rtpmap:8 PCMA/8000\n" + 
                "a=rtpmap:101 telephone-event/8000\n" + 
                "a=sendrecv";

byte[] contents = sdpData.getBytes();        
request.setContent(contents, contentType);   

If I directly send the file like this will it play? Also is it possible to send text and play it over the call?

David L
  • 32,885
  • 8
  • 62
  • 93
gourig
  • 81
  • 1
  • 11
  • Please try something first, then ask a question. – john May 19 '15 at 12:50
  • 1
    can you suggest me the direction which I can follow for this implementation? – gourig May 19 '15 at 14:08
  • `For the transmission of media streams (voice, video) the SDP payload carried in SIP messages typically employs the Real-time Transport Protocol (RTP) or the Secure Real-time Transport Protocol (SRTP).` You don't "send" audio nor video with SIP. – j3141592653589793238 Apr 14 '19 at 13:55

1 Answers1

1

SIP is used only for signalling ie call setup, to play an audio file you need to instruct a Media Server to do that. I would recommend avoiding going to the lower layers and use a simple API to do that. RestComm would allow you to do that. There is even a docker image now http://www.telestax.com/docker-image-for-mobicents-restcomm-7-3-0/. RestComm comes with a number of preconfigured demos, the one playing a wav file is tied to the number 1234 see how to test it here http://docs.telestax.com/restcomm-testing-default-demos/

jeand
  • 2,325
  • 14
  • 12