Browse Source

prosody: add ability to configure external TURN server

Co-authored-by: Thomas Butter <tbutter@gmail.com>
tbutter 3 years ago
parent
commit
856e414
3 changed files with 35 additions and 0 deletions
  1. 5 0
      docker-compose.yml
  2. 7 0
      env.example
  3. 23 0
      prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua

+ 5 - 0
docker-compose.yml

@@ -172,6 +172,11 @@ services:
             - JWT_TOKEN_AUTH_MODULE
             - JWT_TOKEN_AUTH_MODULE
             - LOG_LEVEL
             - LOG_LEVEL
             - PUBLIC_URL
             - PUBLIC_URL
+            - TURN_CREDENTIALS
+            - TURN_HOST
+            - TURNS_HOST
+            - TURN_PORT
+            - TURNS_PORT
             - TZ
             - TZ
         networks:
         networks:
             meet.jitsi:
             meet.jitsi:

+ 7 - 0
env.example

@@ -354,6 +354,13 @@ JIBRI_STRIP_DOMAIN_JID=muc
 # Directory for logs inside Jibri container
 # Directory for logs inside Jibri container
 JIBRI_LOGS_DIR=/config/logs
 JIBRI_LOGS_DIR=/config/logs
 
 
+# Configure an external TURN server
+# TURN_CREDENTIALS="secret"
+# TURN_HOST=turnserver.example.com
+# TURN_PORT=443
+# TURNS_HOST=turnserver.example.com
+# TURNS_PORT=443
+
 # Disable HTTPS: handle TLS connections outside of this setup
 # Disable HTTPS: handle TLS connections outside of this setup
 #DISABLE_HTTPS=1
 #DISABLE_HTTPS=1
 
 

+ 23 - 0
prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua

@@ -24,6 +24,26 @@ http_default_host = "{{ .Env.XMPP_DOMAIN }}"
 
 
 {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }}
 {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }}
 {{ $PUBLIC_URL := .Env.PUBLIC_URL | default "https://localhost:8443" -}}
 {{ $PUBLIC_URL := .Env.PUBLIC_URL | default "https://localhost:8443" -}}
+{{ $TURN_PORT := .Env.TURN_PORT | default "443" }}
+{{ $TURNS_PORT := .Env.TURNS_PORT | default "443" }}
+
+{{ if .Env.TURN_CREDENTIALS }}
+external_service_secret = "{{.Env.TURN_CREDENTIALS}}";
+{{ end }}
+
+{{ if or .Env.TURN_HOST .Env.TURNS_HOST }}
+external_services = {
+  {{ if .Env.TURN_HOST }}
+     { type = "turn", host = "{{ .Env.TURN_HOST }}", port = {{ $TURN_PORT }}, transport = "tcp", secret = true, ttl = 86400, algorithm = "turn" }
+  {{ end }}
+  {{ if and .Env.TURN_HOST .Env.TURNS_HOST }}
+  ,
+  {{ end }}
+  {{ if .Env.TURNS_HOST }}
+     { type = "turns", host = "{{ .Env.TURNS_HOST }}", port = {{ $TURNS_PORT }}, transport = "tcp", secret = true, ttl = 86400, algorithm = "turn" }
+  {{ end }}
+};
+{{ end }}
 
 
 {{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_ISSUERS }}
 {{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_ISSUERS }}
 asap_accepted_issuers = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_ISSUERS) }}" }
 asap_accepted_issuers = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_ISSUERS) }}" }
@@ -93,6 +113,9 @@ VirtualHost "{{ .Env.XMPP_DOMAIN }}"
         "ping";
         "ping";
         "speakerstats";
         "speakerstats";
         "conference_duration";
         "conference_duration";
+        {{ if or .Env.TURN_HOST .Env.TURNS_HOST }}
+        "external_services";
+        {{ end }}
         {{ if $ENABLE_LOBBY }}
         {{ if $ENABLE_LOBBY }}
         "muc_lobby_rooms";
         "muc_lobby_rooms";
         {{ end }}
         {{ end }}