Moving creating TURN configration to the host machine instead of the bots - rtcBot
R=andresp@webrtc.org
Review URL: https://webrtc-codereview.appspot.com/24939004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@7468 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/tools/rtcbot/test.js b/webrtc/tools/rtcbot/test.js
index abf0e17..33ef960 100644
--- a/webrtc/tools/rtcbot/test.js
+++ b/webrtc/tools/rtcbot/test.js
@@ -9,6 +9,7 @@
// Provides a Test class that exposes api to the tests.
// Read test.prototype to see what methods are exposed.
var fs = require('fs');
+var request = require('request');
var BotManager = require('./botmanager.js');
function Test() {
@@ -71,6 +72,26 @@
createStatisticsReport: function (outputFileName) {
return new StatisticsReport(outputFileName);
},
+
+ // Ask computeengineondemand to give us TURN server credentials and URIs.
+ createTurnConfig: function (onSuccess, onError) {
+ request('https://computeengineondemand.appspot.com/turn?username=1234&key=5678',
+ function (error, response, body) {
+ if (error || response.statusCode != 200) {
+ onError('TURN request failed');
+ return;
+ }
+
+ var response = JSON.parse(body);
+ var iceServer = {
+ 'username': response.username,
+ 'credential': response.password,
+ 'urls': response.uris
+ };
+ onSuccess({ 'iceServers': [ iceServer ] });
+ }
+ );
+ },
}
StatisticsReport = function (outputFileName) {