From 34f92c019badf72c5adba466298e4673ac8ec807 Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 20 Feb 2015 12:01:50 +0100 Subject: [PATCH] Possibility to set fixed credentials for turn server --- conf/settings.ini.dist | 4 ++++ templates/default/join.html.ep | 18 ++++++++++++++++-- vroom.pl | 4 +++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/conf/settings.ini.dist b/conf/settings.ini.dist index d51f4f2..485ae1e 100644 --- a/conf/settings.ini.dist +++ b/conf/settings.ini.dist @@ -13,6 +13,10 @@ ;stun_server = 'stun:stun.l.google.com:19302' ; The turn server sent to cliet, you should set it to your own server. Takes a full turn uri as defined by rfc7065 ;turn_server = 'turns:my-turn-server.net:5349?transport=tcp' +; You can use fixed username/login to access turn. If you omit this, VROOM will generate credentials on the fly +; for rfc5766-turn-server in its database +;turn_user = '' +;turn_password = '' ; the realm used for turn accounts. Must match the realm of your turn server ;realm = 'vroom' diff --git a/templates/default/join.html.ep b/templates/default/join.html.ep index 5b48e5b..ce2f63e 100644 --- a/templates/default/join.html.ep +++ b/templates/default/join.html.ep @@ -455,8 +455,22 @@ url: "<%= $config->{'signaling.uri'} %>", peerConnectionConfig: { iceServers: [ - {"url":"<%= $config->{'turn.stun_server'} %>"}, - <%== ($config->{'turn.turn_server'} && $config->{'turn.turn_server'} ne '') ? "{\"url\":\"$config->{'turn.turn_server'}\", \"username\":\"$room\", \"credential\":\"$turnPassword\"}":'' %> + { + "url":"<%= $config->{'turn.stun_server'} %>" + }, + <% if ($config->{'turn.turn_server'} && $config->{'turn.turn_server'} ne ''){ %> + { + "url":"<%= $config->{'turn.turn_server'} %>", + <% if ($config->{'turn.turn_user'} && $config->{'turn.turn_user'} ne '' && + $config->{'turn.turn_password'} && $config->{'turn.turn_password'} ne '') { %> + "username":"<%== $config->{'turn.turn_user'} %>", + "credential":"<%== $config->{'turn.turn_password'} %>" + <% } else { %> + "username":"<%== $room %>", + "credential":"<%== $turnPassword %>" + <% } %> + } + <% } %> ] }, localVideoEl: 'webRTCVideoLocal', diff --git a/vroom.pl b/vroom.pl index 0f5c4a8..e94213f 100755 --- a/vroom.pl +++ b/vroom.pl @@ -32,7 +32,9 @@ $config->{'database.user'} ||= 'vroom'; $config->{'database.password'} ||= 'vroom'; $config->{'signaling.uri'} ||= 'https://vroom.example.com/'; $config->{'turn.stun_server'} ||= 'stun.l.google.com:19302'; -$config->{'turn.turn_server'} ||= ''; +$config->{'turn.turn_server'} ||= undef; +$config->{'turn.turn_user'} ||= undef; +$config->{'turn.turn_password'} ||= undef; $config->{'turn.realm'} ||= 'vroom'; $config->{'email.from '} ||= 'vroom@example.com'; $config->{'email.contact'} ||= 'admin@example.com';