Skip to main content

STUN and TURN

Deprecation warning: The TURN settings and endpoints are deprecated and will be removed in the future. Previously, deployments with a Janus SFU relied on our TURN configuration and endpoint. With the transition from Janus to LiveKit, the TURN configuration is configured in LiveKit.

The backend provides an endpoint that offers information about the STUN and TURN servers. STUN URIs are simply a list of usable STUN endpoints that can be used by the client. The TURN server utilizes the pre_shared_key from the configuration to generate credentials. All STUN and TURN credentials and endpoints can be found in a list under /turn.

Configuration

The sections in the configuration file are called stun and `turn.

STUN section

FieldTypeRequiredDefault valueDescription
stunlist<string>no-List of STUN server endpoints

TURN section (deprecated)

FieldTypeRequiredDefault valueDescription
lifetimenumberno86400Lifetime of the generated credentials in seconds
serverslist<TurnServer>no-List of TURN server configurations, see TURN server configuration below

The configuration for a TurnServer

FieldTypeRequiredDefault valueDescription
urislist<string>no-List of TURN server endpoints
pre_shared_keystringyes-The pre-shared key to generate the TURN credentials

Examples

Custom Turn Server

[turn]
# Lifetime of the generated credentials (in seconds)
lifetime = 86400

[[turn.servers]]
# URIS of this Turn Server following rfc7065
uris = [
"turn:127.0.0.1:3478?transport=udp",
"turn:127.0.0.1:3478?transport=tcp",
"turns:127.0.0.1:5349?transport=tcp"
]
# The Pre Shared Key set with --static-auth-secret=...
pre_shared_key = "opentalk2"

Custom Stun Server

[stun]
uris = ["stun:127.0.0.1:3478"]