Skip to content

Commit

Permalink
feat(prosody) - Added TURN_USERNAME and TURN_PASSWORD (#1989)
Browse files Browse the repository at this point in the history
Co-authored-by: lala <[email protected]>
  • Loading branch information
lalayueh and lala authored Jan 6, 2025
1 parent 82e98d2 commit 3ba77e1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ services:
- STUN_HOST
- STUN_PORT
- TURN_CREDENTIALS
- TURN_USERNAME
- TURN_PASSWORD
- TURN_HOST
- TURNS_HOST
- TURN_PORT
Expand Down
44 changes: 41 additions & 3 deletions prosody/rootfs/defaults/prosody.cfg.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ log = {
{{ end }}
}

{{ if $PROSODY_ENABLE_METRICS }}
{{ if $PROSODY_ENABLE_METRICS }}
-- Statistics Provider configuration
statistics = "internal"
statistics_interval = "manual"
Expand All @@ -351,15 +351,53 @@ external_services = {
{{- range $idx1, $host := $TURN_HOSTS -}}
{{- range $idx2, $transport := $TURN_TRANSPORTS -}}
{{- if or $STUN_HOST $idx1 $idx2 -}},{{- end }}
{ type = "turn", host = "{{ $host }}", port = {{ $TURN_PORT }}, transport = "{{ $transport }}", secret = true, ttl = {{ $TURN_TTL }}, algorithm = "turn" }
{
type = "turn",
host = "{{ $host }}",
port = {{ $TURN_PORT }},
transport = "{{ $transport }}",
ttl = {{ $TURN_TTL }},

{{ if $.Env.TURN_CREDENTIALS -}}
secret = true,
algorithm = "turn",
{{- end }}

{{ if $.Env.TURN_USERNAME -}}
username = "{{$.Env.TURN_USERNAME}}",
{{- end }}

{{ if $.Env.TURN_PASSWORD -}}
password = "{{$.Env.TURN_PASSWORD}}",
{{- end }}
}
{{- end -}}
{{- end -}}
{{- end -}}

{{- if $TURNS_HOST -}}
{{- range $idx, $host := $TURNS_HOSTS -}}
{{- if or $STUN_HOST $TURN_HOST $idx -}},{{- end }}
{ type = "turns", host = "{{ $host }}", port = {{ $TURNS_PORT }}, transport = "tcp", secret = true, ttl = {{ $TURN_TTL }}, algorithm = "turn" }
{
type = "turns",
host = "{{ $host }}",
port = {{ $TURNS_PORT }},
transport = "tcp",
ttl = {{ $TURN_TTL }},

{{ if $.Env.TURN_CREDENTIALS -}}
secret = true,
algorithm = "turn",
{{- end }}

{{ if $.Env.TURN_USERNAME -}}
username = "{{$.Env.TURN_USERNAME}}",
{{- end }}

{{ if $.Env.TURN_PASSWORD -}}
password = "{{$.Env.TURN_PASSWORD}}",
{{- end }}
}
{{- end }}
{{- end }}
};
Expand Down

0 comments on commit 3ba77e1

Please sign in to comment.