2
votes

I am beginner in SIP-WebRTC and need to know how to configure websocket in freeswitch in asterisk is configured in /etc/asterisk/http.conf but I don't know configure in freeswitch, bellow is my sip.js

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

  }

)();

my project uses http://sipjs.com/

thanks very much to all!!!

1

1 Answers

2
votes

I assume that you have installed and running a FreeSwitch instance. In the conf file that defines the sockets for listening you need to uncomment the ws and wss ports for listening. This should get the instance listening for WebSocket messages from the sip.js.

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

For more Info - https://wiki.freeswitch.org/wiki/Webrtc