2015-05-04 107 views
1

我是SIP-WebRTC的初学者,需要知道如何在freeswitch中配置websocket,在/etc/asterisk/http.conf中配置星号,但我不知道配置FreeSWITCH的,波纹管是我sip.jsfreeswitch和sip.js如何配置websocket

(function() 
 
    { 
 
    var session; 
 
    var endButton = document.getElementById('endCall'); 
 
    endButton.addEventListener("click", function(){ 
 
      session.bye(); 
 
      alert ("Call Terminated"); 
 
      } 
 
      , false 
 
           ); 
 

 

 
    //Registration via websocket 
 
    var config = { 
 
         // my extension and ip of freeswitch 
 
         uri: '[email protected]', 
 

 
         //in asterisk i used some how this. here is my problem :(how to do it in freeswitch? 
 
         wsServers: 'ws://192.168.0.3:8088/ws', 
 

 
         //here is my 4009 
 
         authorizationUser: '4009', 
 

 
         // my password 
 
         password: 'testsip', 
 

 
         
 
         traceSip: true, 
 

 

 
         stunServers: 'null', 
 
       }; 
 

 

 
    
 
    var userAgent = new SIP.UA (config); 
 

 
    var options = { 
 

 
        media: { 
 
           constraints: { 
 
              audio: true, 
 
              video: false, 
 
              }, 
 
           render: { 
 
             remote: { 
 
                audio: document.getElementById('remoteAudio') 
 
               }, 
 

 
             local: { 
 
                audio: document.getElementById('localAudio') 
 
               } 
 
             } 
 
          } 
 
    }; 
 

 

 

 
    function onAccepted() 
 
    { 
 
     alert("Call Connected"); 
 
    } 
 

 
    function onDisconnected() 
 
    { 
 
     alert("Call Terminated"); 
 
    } 
 

 

 
    //makes the call 
 
    session = userAgent.invite('1000', options); 
 
    session.on('accepted', onAccepted); 
 
    //session.on('disconnected', onDisconnected); 
 

 
    } 
 

 
)();

我的项目使用http://sipjs.com/

非常感谢所有!

回答

2

我假设你已经安装并运行了一个FreeSwitch实例。在定义用于侦听的套接字的conf文件中,您需要取消注释ws和wss端口以进行侦听。这应该让实例侦听来自sip.js的WebSocket消息。

<param name="ws-binding" value=":80"/> 
<param name="wss-binding" value=":443"/> 

欲了解更多信息 - https://wiki.freeswitch.org/wiki/Webrtc

+0

大,非常好的,谢谢! –