Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(prosody) - Added TURN_USERNAME and TURN_PASSWORD #1989

Merged

Conversation

lalayueh
Copy link
Contributor

Fix: Add support for TURN servers that don't implement draft-uberti-behave-turn-rest-00

Problem

Cloudflare TURN servers do not support the draft-uberti-behave-turn-rest-00 specification, which is the default method used by mod_external_services to generate TURN credentials (username and password).

Solution

Added two new environment variables:

  • TURN_USERNAME: Define a static TURN username
  • TURN_PASSWORD: Define a static TURN password

When TURN_CREDENTIALS is not set, the module will not attempt to generate credentials using the draft-uberti-behave-turn-rest-00 method. Instead, it will use the static credentials if provided through TURN_USERNAME and TURN_PASSWORD.

This change allows Prosody to work with TURN servers that don't implement the expired draft spec, such as Cloudflare TURN.

Reference

transport = "tcp",
ttl = {{ $TURN_TTL }},

{{ if $.Env.TURN_CREDENTIALS -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this just be .Env.TURN_CREDENTIALS ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because .Env tries to access the Env field from the current scope rather than the root context.

In Go templates, the $ symbol refers to the root context. When accessing top-level variables like Env, we need to use $.Env instead of .Env to ensure we're accessing from the root scope rather than the current context.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ops, I forgot about that! Thanks for the reminder!

algorithm = "turn",
{{- end }}

{{ if $.Env.TURN_USERNAME -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

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

{{ if $.Env.TURN_PASSWORD -}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

@saghul saghul merged commit 3ba77e1 into jitsi:master Jan 6, 2025
2 checks passed
saghul added a commit that referenced this pull request Jan 13, 2025
* 3ba77e1 feat(prosody) - Added TURN_USERNAME and TURN_PASSWORD (#1989)
* 82e98d2 web: Added P2P_STUN_SERVERS environment variable (#1990)
* 02499f8 feat(grafana): prosody monitoring dashboard created (#1879)
* 3af0725 web: add option param for Automatic Gain Control
* 9bc57e2 misc: working on unstable
guillaumevillemont added a commit to matrix-org/docker-jitsi-meet that referenced this pull request Jan 17, 2025
release

* 3ba77e1 feat(prosody) - Added TURN_USERNAME and TURN_PASSWORD (jitsi#1989)
* 82e98d2 web: Added P2P_STUN_SERVERS environment variable (jitsi#1990)
* 02499f8 feat(grafana): prosody monitoring dashboard created (jitsi#1879)
* 3af0725 web: add option param for Automatic Gain Control
* 9bc57e2 misc: working on unstable
guillaumevillemont added a commit to matrix-org/docker-jitsi-meet that referenced this pull request Jan 17, 2025
release

* 3ba77e1 feat(prosody) - Added TURN_USERNAME and TURN_PASSWORD (jitsi#1989)
* 82e98d2 web: Added P2P_STUN_SERVERS environment variable (jitsi#1990)
* 02499f8 feat(grafana): prosody monitoring dashboard created (jitsi#1879)
* 3af0725 web: add option param for Automatic Gain Control
* 9bc57e2 misc: working on unstable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants