我正在尝试在 node.js 中生成用户名和密码。看来我的密码与 TURN 服务器生成的密码不匹配。
这是我正在尝试的代码:
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;
我的服务器网址是:
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
] }
这是我从转向服务器收到的消息:
错误:check_stun_auth:找不到用户的凭据