【问题标题】:wrong value for parameter wsServers参数 wsServers 的值错误
【发布时间】:2017-02-11 12:24:52
【问题描述】:

我正在使用freeswitch 1.6 并遵循cookbok 来实现webrtc。为此,我也下载了 sip.js@0.7.0。并创建了 call.html、call.js 和 answer.html、answer.js 页面。我的 call.html 包括 js 是

    <html>
        <body>
             <button id="startCall">Start Call</button>

             <button id="endCall">End Call</button>
             <br/>
             <video id="remoteVideo"></video>
             <br/>
             <video id="localVideo" muted="muted" width="128px" height="96px"></video>
             <!--<script src="js/sip-0.7.0.min.js"></script>-->
             <!--<script src="call.js"></script>-->
    </body>

    <HEAD>
    <script src="js/sip-0.7.0.min.js"></script>
    <script>

                var session;
                console.log('hiiiiiiiiiiii')
                var endButton = document.getElementById('endCall');
                endButton.addEventListener("click", function () {
                             session.bye();
                             alert("Call Ended");
                             }, false);
                console.log('hiiiii2')

                var userAgent = new SIP.UA({
                                uri: 'sip:anonymous@gmaruzz.org',
                                wsServers: ["ws://call.sia.co.in:5066"],
                                authorizationUser: 'anonymous',
                                password: 'welcome'
                });

                console.log('hiiii3')
                var startButton = document.getElementById('startCall');
                startButton.addEventListener("click", function () {
                    session =userAgent.invite('sip:1010@139.59.17.63', options);
                    alert("Call Started");
                }, false);

                console.log('hiiii4')
                var options = {
                        media: {
                                    constraints: {
                                                        audio: true,
                                                        video: true
                                                },
                                    render: {
                        remote:document.getElementById('remoteVideo'),
                        local: document.getElementById('localVideo')
                                                }
                                }
                };
</script>
</HEAD>
</html>

请纠正我哪里出错了。提前致谢。

【问题讨论】:

  • 你的语法是正确的。但是尝试将wsServers 作为字符串wsServers: "ws://call.sia.co.in:5066"wsServers: "ws://call.sia.co.in:5066/ws"
  • 是的,我做了同样的事情,但错误仍然是相同的:“参数“wsServers”的无效值“ws://call.sia.co.in:5066/ws””
  • 粘贴您在控制台中遇到的确切错误!
  • exception code : 1 message : "Invalid value [{"ws_uri":"wss://call.sia.co.in:7443"}] for parameter "wsServers"" name : "CONFIGURATION_ERROR" parameter : "wsServers"
  • 老兄,这很奇怪,你做错了什么!在您的代码中,您粘贴了wsServers: ["ws://call.sia.co.in:5066"],但错误显示[{"ws_uri":"wss://call.sia.co.in:7443"}] ws 已变为wss 并且端口已更改?

标签: sip sip-server


【解决方案1】:

您必须将 wsServers 放在 transportOptions 中,例如:

var userAgent = new SIP.UA({
uri: 'sip:anonymous@gmaruzz.org'

transportOptions: {
  wsServers: "ws://call.sia.co.in:5066"
},

authorizationUser: 'anonymous',
password: 'welcome'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-03
    • 2018-04-06
    • 2011-09-20
    • 1970-01-01
    • 2022-11-14
    • 1970-01-01
    • 2020-03-24
    相关资源
    最近更新 更多