diff --git a/conf/settings.ini.dist b/conf/settings.ini.dist
index f74cbe7..98c1dbc 100644
--- a/conf/settings.ini.dist
+++ b/conf/settings.ini.dist
@@ -9,9 +9,11 @@
;uri = 'https://vroom.exmple.com'
[turn]
-; The stun server sent to client. You can set it to your own stun server. Takes a full stun uri as defined by rfc7064
-;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
+; The stun server sent to client. You can set it to your own stun server. Takes a comma separated list of full
+; stun uri as defined by rfc7064
+;stun_server = 'stun:stun.l.google.com:19302','stun:vroom.example.net:3478'
+; The turn server sent to cliet, you should set it to your own server. Takes a comma separated list of 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
diff --git a/templates/default/documentation.html.ep b/templates/default/documentation.html.ep
index b991476..40a8697 100644
--- a/templates/default/documentation.html.ep
+++ b/templates/default/documentation.html.ep
@@ -288,15 +288,16 @@ cp /opt/vroom/conf/settings.ini.dist /opt/vroom/conf/settings.ini
If you plan to use VROOM only on a local network, where each peer can connect to each others, you can just omit this part. But if you want
VROOM to work from anywhere, you'll need use STUN and most likely TURN too.
- - stun_server: The STUN server to use. For example stun_server = 'stun:stun.l.google.com:19302'.
- This must be a full STUN URI as defined by rfc7064
- - turn_server: The TURN server to use (for now you can only define one, it should be possible to define
- several). For example turn_server = 'turns:my-turn-server.net:5349?transport=tcp'.
- This must be a full STUN URI as defined by rfc7065
+ - stun_server: The STUN server(s) to use. For example*
+ stun_server = 'stun:stun.l.google.com:19302','stun:vroom.example.net:3478'.
+ This must be a comma separated list of full STUN URI as defined by rfc7064
+ - turn_server: The TURN server(s) to use. For example
+ turn_server = 'turns:vroom.example.net:5349','turns:vroom.example.net:5349?transport=tcp'.
+ This must be a comma separated list of full STUN URI as defined by rfc7065
- turn_user and turn_password: To use your TURN server, you'll most likely require credentials.
You can either enter them here. If you let this empty, VROOM assumes that you're using
rfc5766-turn-server and will generate one user and password
- for each room. See the Configure rfc5766-turn-server section
+ for each room. See the Configure rfc5766-turn-server section. Note that the same credentials will be used for every TURN server you define
- realm: If you use rfc5766-turn-server with dynamic credentials, you must set here the realm configured in
/etc/turnserver/turnserver.conf
diff --git a/vroom.pl b/vroom.pl
index 43eaeef..34669ad 100755
--- a/vroom.pl
+++ b/vroom.pl
@@ -1708,9 +1708,7 @@ any '/api' => sub {
my $resp = {
url => $config->{'signaling.uri'},
peerConnectionConfig => {
- iceServers => [{
- url => $config->{'turn.stun_server'}
- }]
+ iceServers => []
},
autoRequestMedia => Mojo::JSON::true,
enableDataChannels => Mojo::JSON::true,
@@ -1736,18 +1734,30 @@ any '/api' => sub {
muted => Mojo::JSON::true
}
};
- # TODO: Support several TURN server in config
+ if ($config->{'turn.stun_server'}){
+ if (ref $config->{'turn.stun_server'} ne 'ARRAY'){
+ $config->{'turn.stun_server'} = [ $config->{'turn.stun_server'} ];
+ }
+ foreach my $s (@{$config->{'turn.stun_server'}}){
+ push @{$resp->{peerConnectionConfig}->{iceServers}}, { url => $s };
+ }
+ }
if ($config->{'turn.turn_server'}){
- my $turn = { url => $config->{'turn.turn_server'} };
- if ($config->{'turn.turn_user'} && $config->{'turn.turn_password'}){
- $turn->{username} = $config->{'turn.turn_user'};
- $turn->{credential} = $config->{'turn.turn_password'};
+ if (ref $config->{'turn.turn_server'} ne 'ARRAY'){
+ $config->{'turn.turn_server'} = [ $config->{'turn.turn_server'} ];
}
- else{
- $turn->{username} = $room->{name};
- $turn->{credential} = $room->{token};
+ foreach my $t (@{$config->{'turn.turn_server'}}){
+ my $turn = { url => $t };
+ if ($config->{'turn.turn_user'} && $config->{'turn.turn_password'}){
+ $turn->{username} = $config->{'turn.turn_user'};
+ $turn->{credential} = $config->{'turn.turn_password'};
+ }
+ else{
+ $turn->{username} = $room->{name};
+ $turn->{credential} = $room->{token};
+ }
+ push @{$resp->{peerConnectionConfig}->{iceServers}}, $turn;
}
- push @{$resp->{peerConnectionConfig}->{iceServers}}, $turn;
}
return $self->render(
json => {