How to add external turn conig in livekit.yaml fil...
# ask-ai
g
How to add external turn conig in livekit.yaml file when self hosted. I have added it like this: turn: enabled: true domain: <DOMAIN> udp_port: 3478 # Bypass firewall restrictions tls_port: 443 external_tls: true # Use external coturn
t
Thanks for reaching out, Harsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're close — your snippet is enabling LiveKit's embedded TURN server instead of pointing clients to an external TURN. To use an external coturn, do one of the following: Option A — Advertise external TURN servers (recommended) • Remove or disable the embedded
turn:
section. • Add
turn_servers:
entries to advertise your external TURN URIs and credentials:
Copy code
turn_servers:
  - uri: turn:your-turn-domain.com:3478
    username: <username>
    password: <password>
    protocol: udp
  - uri: turns:your-turn-domain.com:443
    username: <username>
    password: <password>
    protocol: tcp
Option B — If you truly want to run the embedded TURN, keep
turn:
with
enabled: true
(this runs LiveKit's internal TURN; not needed when using coturn). Notes: •
external_tls
is not a valid field in
livekit.yaml
. • Ensure your coturn is reachable and ports are open (UDP 3478, TCP/443 for TURN/TLS) and any load balancer/proxy forwards those ports. If you want, share your full
livekit.yaml
(redact secrets) and your coturn URIs and I can show the exact lines to add. Sources: Deploying LiveKit | LiveKit docs | Ports and firewall | LiveKit docs | LiveKit turn detector plugin | LiveKit docs | Configuring firewalls | LiveKit docs | Deploy to a VM | LiveKit docs
g
my coturn uses auth-secret instead of username and password loginc
t
You're using coturn's auth-secret — good. LiveKit supports that by generating time-limited TURN credentials signed with a shared secret. To configure it, set the shared secret and advertise your TURN servers (no static username/password needed). Example `livekit.yaml`:
Copy code
turn_servers:
  - uri: turn:turn.yourdomain.com:3478
    protocol: udp
  - uri: turns:turn.yourdomain.com:443
    protocol: tcp

turn:
  # leave embedded TURN disabled (omit enabled: true)
  shared_secret: your-coturn-shared-secret
  realm: yourdomain.com
On coturn, ensure you have: • static-auth-secret=your-coturn-shared-secret • realm=yourdomain.com • ports open/forwarded (UDP 3478, TCP/443 for TURN/TLS) LiveKit will issue time-limited usernames/passwords (HMAC) that coturn validates with the shared secret. If you want, paste a redacted snippet of your
livekit.yaml
and your coturn `static-auth-secret`/realm (redact secrets) and I’ll confirm exact lines. Sources: Deploying LiveKit | LiveKit docs
g
turn: # leave embedded TURN disabled (omit enabled: true) shared_secret: your-coturn-shared-secret realm: yourdomain.com this is not valid in yaml right?
t
You're right — the snippet as written is not valid YAML. Key issues: • Inline comment about disabling embedded TURN should be on its own line (or
#
after a value). •
realm: [yourdomain.com](http://yourdomain.com)
is Markdown-style and invalid in YAML; use the plain domain string. • The
turn
section should be nested correctly and you normally also advertise
turn_servers:
separately. Valid example using shared secret (redact secrets when sharing):
Copy code
# advertise external TURN servers to clients
turn_servers:
  - uri: turn:turn.yourdomain.com:3478
    protocol: udp
  - uri: turns:turn.yourdomain.com:443
    protocol: tcp

turn:
  # do not enable the embedded TURN server here
  shared_secret: your-coturn-shared-secret
  realm: yourdomain.com
Replace values with your domain and secret. If you paste (redacted) lines from your
livekit.yaml
, I’ll check exact formatting.
g
i am saying shared_secret cannot be passed like this in yaml file
t
Thanks — I can help. To diagnose why
shared_secret
isn't being accepted, please share the following (redact secrets): 1. The exact
livekit.yaml
snippet you're using (show the full
turn:
and any
turn_servers:
sections with indentation). 2. LiveKit version and deployment method (binary, Docker image tag, or Kubernetes/Helm). 3. Exact error or startup log lines you see when LiveKit loads the config. 4. Relevant coturn config lines (
static-auth-secret
,
realm
, ports) with the secret redacted. 5. How you supply the secret in your deployment (direct in YAML, Kubernetes Secret, env var, Helm values). Once I have that I’ll confirm correct YAML placement and indentation and suggest the exact change to fix it. Sources: Deploying LiveKit | LiveKit docs
g
i am running livekit from dokcer compose. Docker compose: version: '3.9' services: livekit: image: livekit/livekit-server:latest # use a pinned version network_mode: "host" restart: unless-stopped volumes: - ./livekit.yaml/etc/livekit/livekit.yamlro command: --config /etc/livekit/livekit.yaml
t
Thanks — running via Docker Compose with that mount is clear. To help fix the
shared_secret
issue I need three quick things: 1. Paste your
turn:
and
turn_servers:
sections from
/etc/livekit/livekit.yaml
(redact the secret). 2. The exact LiveKit image tag you’re using (you said `latest`; confirm or give the pinned tag). 3. Any LiveKit startup/log error lines you see after container start that mention TURN or config parsing. With those I’ll correct the YAML (indentation/keys) and show the exact file you should mount in Docker Compose.