【问题标题】:Play Audio file and play over SIP播放音频文件并通过 SIP 播放
【发布时间】:2015-05-19 12:48:18
【问题描述】:

我创建了一个 SIP 呼叫,现在我没有任何声音,即我没有声音管理器。我想为接收器播放音频文件。即当我打电话给某人时,我希望他们听到音频消息。如何发送文件并播放?

 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);   

如果我像这样直接发送文件,它会播放吗?还可以发送文本并在通话中播放吗?

【问题讨论】:

  • 请先尝试一下,然后提出问题。
  • 你能建议我在这个实现中可以遵循的方向吗?
  • 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). 您不会使用 SIP“发送”音频或视频。

标签: java audio sip jain-sip


【解决方案1】:

SIP 仅用于信令,即呼叫建立,播放音频文件需要指示媒体服务器执行此操作。我建议避免进入较低层并使用简单的 API 来做到这一点。 RestComm 将允许您这样做。现在甚至还有一个 docker 镜像http://www.telestax.com/docker-image-for-mobicents-restcomm-7-3-0/。 RestComm 附带了许多预配置的演示,播放 wav 文件的演示与数字 1234 相关,请在此处查看如何测试它http://docs.telestax.com/restcomm-testing-default-demos/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多