Getting incoming packet message processed, error 401: Unauthorized.

564 views
Skip to first unread message

Addy D

unread,
Jun 7, 2017, 8:40:51 AM6/7/17
to TURN Server (Open-Source project)
Hey guys,

I have tried couple of thing, I will mention all of them below.
1. Installing coturn.
2. Change /etc/default/coturn and added this line : TURNSERVER_ENABLED=1
3. After this executed user creation using following commands.
          sudo turnadmin -a -u test -r test -p test

          sudo turnadmin -A -u test -p test
4. I checked the database, I can see entries in the admin_user, turnusers_lt only. No realm is there.

5. I am using following command ot start the turn server.

           sudo turnserver -v -a -f -n --no-dtls --no-tls -u test:test -X -L 192.168.0.118

  in place of test I have tried my key which is something like this '160xaskawet25262492l25S3453".

           sudo turnserver -v -a -f -n --no-dtls --no-tls -u test:0x160xaskawet25262492l25S3453 -X -L 192.168.0.118

6. to test this setup I am using this code:

function checkTURNServer(turnConfig, timeout){

  return new Promise(function(resolve, reject){

    setTimeout(function(){
        if(promiseResolved) return;
        resolve(false);
        promiseResolved = true;
    }, timeout || 5000);

    var promiseResolved = false
      , myPeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection   //compatibility for firefox and chrome
      , pc = new myPeerConnection({iceServers:[turnConfig]})
      , noop = function(){};
    pc.createDataChannel("");    //create a bogus data channel
    pc.createOffer(function(sdp){
      if(sdp.sdp.indexOf('typ relay') > -1){ // sometimes sdp contains the ice candidates...
        promiseResolved = true;
        resolve(true);
      }
      pc.setLocalDescription(sdp, noop, noop);
    }, noop);    // create offer and set local description
    pc.onicecandidate = function(ice){  //listen for candidate events
      if(promiseResolved || !ice || !ice.candidate || !ice.candidate.candidate || !(ice.candidate.candidate.indexOf('typ relay')>-1))  return;
      promiseResolved = true;
      resolve(true);
    };
  });  
}

checkTURNServer({
    url: 'turn:192.168.0.118',
    username: 'test',
    credential: 'test'
}).then(function(bool){
    console.log('is my TURN server active? ', bool? 'yes':'no');
}).catch(console.error.bind(console));

I have tried 0x160xaskawet25262492l25S3453 key in place of credential as well, I am doing something wrong but I am not sure what, if anyone could help on this it would be good help.

Thanks.
Reply all
Reply to author
Forward
0 new messages