Connect to freeswitch via SIP.js from outside the network

255 views
Skip to first unread message

Birat Bhattacharjee

unread,
Sep 18, 2023, 5:43:03 AM9/18/23
to BigBlueButton-dev
Hi Team,

I have a big blue button server setup, and I want to make a SIP.js connection from my own frontend. However, when I am trying to make a websocket connection it fails with a 1006 error. 

Iam trying to build a websocket connection over port 5066. Checking the HTML5 client implementation, I saw that the websocket connection is being established using a session token. Iam confused on how to implement the same outside the server. Can someone please guide me? Any kind of help or clue is appreciated

Thanks

DistanceLearning.cloud

unread,
Sep 18, 2023, 6:56:41 AM9/18/23
to BigBlueButton-dev
So sip.nginx  routes the /ws and authenticates the websocket..   if you comment out # the two auth statements for testing only you can see it should work after nginx reload.

Once it works (test sip.js )... i would create another  mysip.nginx with  a /mysip and figure out how you want to authenicate your app... (or leave open at risk).
You could pass a token and send to custom endpoint on bbb server,  or limit to a range of ips etc.

/usr/share/bigbluebutton/nginx/sip.nginx
location /ws {
        proxy_pass http://x.x.x.x:5066;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_read_timeout 120s;
        proxy_send_timeout 120s;
        client_body_timeout 120s;
        send_timeout 120s;

        auth_request /bigbluebutton/connection/checkAuthorization;
        auth_request_set $auth_status $upstream_status;
}

Regards,
Stephen

Birat Bhattacharjee

unread,
Sep 19, 2023, 6:15:17 AM9/19/23
to BigBlueButton-dev
Hi Stephen,

Thanks, I am able to connect to the server using WebSocket now. However, I am still not able to establish an audio connection with freeswitch via SIP.js. I am using the correct voice bridge along with username and password.

My websocket URL looks like this: "wss://<hostname>/ws?<dummy_session_token>"

I checked port 5066 as well, which is open and listening for any incoming requests.

Please let me know if I am missing something. I have tested the same SIP configuration using Zoiper and it is working as expected.

Regards,
Birat

DistanceLearning.cloud

unread,
Sep 19, 2023, 6:25:01 AM9/19/23
to BigBlueButton-dev
Look in the fs_cli console when you attempt to make a call... Also how is your sip.js handling relay connections for users needing turn.    you will need to set auth for turn.
The freeswitch log should show call setup and the sdp's exchanged.   Possible the the dialplan is exiting early as well and that needs modification.

regards,
Stephen

Birat Bhattacharjee

unread,
Sep 27, 2023, 5:42:25 AM9/27/23
to BigBlueButton-dev
Hi Stephen,

For SIP.js I am defining the TURN servers with the correct credentials with iceTransport policy set to 'relay'. This is how my user agent looks like:

this.userAgent=new UserAgent({
    uri: UserAgent.makeURI(`sip:${this.authorizationusername}@${this.hostname}`),
    transportOptions: {
      server: `${(this.protocol === 'https:' ? 'wss://' : 'ws://')}${this.hostname}/ws?sessionToken=${token}`,
      connectionTimeout: this.USER_AGENT_CONNECTION_TIMEOUT_MS,
      keepAliveInterval: this.WEBSOCKET_KEEP_ALIVE_INTERVAL,
      keepAliveDebounce: this.WEBSOCKET_KEEP_ALIVE_DEBOUNCE,
      traceSip: this.TRACE_SIP,
    },
    sessionDescriptionHandlerFactoryOptions: {
      peerConnectionConfiguration: {
        iceServers,
        sdpSemantics: this.SDP_SEMANTICS,
        iceTransportPolicy: this.FORCE_RELAY ? 'relay' : undefined,
      },

    },
    displayName: this.callerIdName,
    userAgentString: 'BigBlueButton',
    authorizationPassword: this.authorizationPassword,
    authorizationUsername: this.authorizationUsername,
    hackViaTcp: true,
  });


After sending the SIP invite, the request gets timedout with no response from the server, and I am not seeing any logs in fs_cli console either. 

Regards,
Birat
Reply all
Reply to author
Forward
0 new messages