couldn't get TURN REST API to work properly

137 views
Skip to first unread message

Arafat Al Mahmud

unread,
Oct 1, 2014, 5:20:12 AM10/1/14
to turn-server-project...@googlegroups.com
I am trying to generate the username and password in node.js. It seems my password doesnot match with the one generated by TURN server. 

Here is the code I am trying:
 var turn_user='arafat';
 
var timestamp= Math.round(new Date().getTime() / 1000) ;
 
var turn_username=turn_user+':'+timestamp;
 
var turn_password=crypto.createHmac('sha1','abc').update(turn_username).digest('base64');
 
var turnCredentials={};
 turnCredentials
.username=turn_username;
 turnCredentials
.password=turn_password;

and my server url is:

 var server = { iceServers: [ {url: "stun:stun.l.google.com:19302"}, //google's stun server
{url: "stun:23.21.150.121"}, //mozilla's stun server
 
{url: "turn:"+url, credential: turnCredentials.password, username: turnCredentials.username} // our working turn server
] }

Here is the message I am getting from turn server: ERROR: check_stun_auth: Cannot find credentials of user <arafat:1412151745>

Thomas Bruun

unread,
Oct 1, 2014, 5:47:04 AM10/1/14
to Arafat Al Mahmud, turn-server-project...@googlegroups.com
The timestamp is the time of expiration[1], so your credentials are
most likely expired.

The following will give your credentials a validity of 1 minute:
var timestamp= Math.round(new Date().getTime() / 1000) + 60;

It's also a good idea to check that the time on your TURN server and
the place where your credentials are generated are in sync.

[1] http://tools.ietf.org/html/draft-uberti-behave-turn-rest-00
> --
> You received this message because you are subscribed to the Google Groups
> "TURN Server (Open-Source project)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
> turn-server-project-rfc57...@googlegroups.com.
> To post to this group, send email to
> turn-server-project...@googlegroups.com.
> Visit this group at
> http://groups.google.com/group/turn-server-project-rfc5766-turn-server.
> For more options, visit https://groups.google.com/d/optout.



--
Thomas Bruun
Developer – https://appear.in

Arafat Al Mahmud

unread,
Oct 1, 2014, 6:51:13 AM10/1/14
to turn-server-project...@googlegroups.com, arafat.a...@gmail.com
It solved my problem! Thanks a lot :)
> To post to this group, send email to
Reply all
Reply to author
Forward
0 new messages