Advertisement
Guest User

Untitled

a guest
Nov 29th, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. // bit6 ////////////
  2. Request.post("https://api.bit6.com/backend/1/ice", {json: true}, function(err, resp, body)
  3. {
  4. //if (!err) console.log(JSON.stringify(body, null, 4));
  5. //reply(body);
  6.  
  7. var result = { username: null, password: null, uris: [] };
  8.  
  9. //{
  10. // iceServers:
  11. // [
  12. // { url: "stun:turn.bit6.com" },
  13. // { url: "turn:turn.bit6.com:3478?transport=udp", username: "1469805320:1b173f6245473d2c@1xq81", credential: "J2vf4df6+IJCwbxNos7TxA+asUA=" },
  14. // { url: "turn:turn.bit6.com:443?transport=tcp", username: "1469805320:1b173f6245473d2c@1xq81", credential: "J2vf4df6+IJCwbxNos7TxA+asUA=" }
  15. // ],
  16. // ttl:86400,
  17. // expires:1469805320
  18. //}
  19.  
  20. /// bit6'den gelen veri yukarıdaki gibi olduğundan
  21. /// önce biraz değiştirmemiz gerekiyor
  22.  
  23. for (i = 0; i < body.iceServers.length; i++)
  24. {
  25. if (body.iceServers[i].username)
  26. {
  27. result.username = body.iceServers[i].username;
  28. result.password = body.iceServers[i].credential;
  29. }
  30. result.uris.push(body.iceServers[i].url);
  31. }
  32.  
  33. if (result.uris.length == 0)
  34. {
  35. result.username = "icadmin";
  36. result.password = "cCr3016*";
  37. result.uris = result.uris.concat([
  38. "stun:212.57.3.179:3478",
  39. "stun:stun.l.google.com:19302",
  40. "stun:stun1.l.google.com:19302",
  41. "stun:stun2.l.google.com:19302",
  42. "stun:stun3.l.google.com:19302",
  43. "stun:stun4.l.google.com:19302",
  44. "turn:212.57.3.179:3478?transport=udp",
  45. "turn:212.57.3.179:3478",
  46. "turn:212.57.3.179:3478?transport=tcp" ]);
  47. }
  48.  
  49. result.uris.sort();
  50.  
  51. reply(result);
  52.  
  53. }).auth("1xq81-AeEVrXsWgiGR", "wSTnVA0JY7W9oOns6ufPpAepU4MAaEjY", true);
  54. ////////////// bit6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement