2022-02-04 18:11:29 +00:00
# Setting up TURN/STURN
2024-05-09 01:26:05 +00:00
In order to make or receive calls, a TURN server is required. conduwuit suggests using [Coturn ](https://github.com/coturn/coturn ) for this purpose, which is also available as a Docker image.
2022-02-04 18:11:29 +00:00
2024-05-09 01:26:05 +00:00
### Configuration
2022-02-04 18:11:29 +00:00
2024-05-09 01:26:05 +00:00
Create a configuration file called `coturn.conf` containing:
2022-02-04 18:11:29 +00:00
2024-05-09 01:26:05 +00:00
```conf
use-auth-secret
static-auth-secret=< a secret key >
realm=< your server domain >
2022-02-04 18:11:29 +00:00
```
2024-05-09 01:26:05 +00:00
A common way to generate a suitable alphanumeric secret key is by using `pwgen -s 64 1` .
2022-02-04 18:11:29 +00:00
2024-05-09 01:26:05 +00:00
These same values need to be set in conduwuit. You can either modify conduwuit.toml to include these lines:
2022-02-04 18:11:29 +00:00
2024-05-09 01:26:05 +00:00
```
turn_uris = ["turn:< your server domain > ?transport=udp", "turn:< your server domain > ?transport=tcp"]
turn_secret = "< secret key from coturn configuration > "
```
or append the following to the docker environment variables dependig on which configuration method you used earlier:
```yml
CONDUIT_TURN_URIS: '["turn:< your server domain > ?transport=udp", "turn:< your server domain > ?transport=tcp"]'
CONDUIT_TURN_SECRET: "< secret key from coturn configuration > "
```
Restart conduwuit to apply these changes.
### Run
Run the [Coturn ](https://hub.docker.com/r/coturn/coturn ) image using
```bash
docker run -d --network=host -v $(pwd)/coturn.conf:/etc/coturn/turnserver.conf coturn/coturn
```
or docker-compose. For the latter, paste the following section into a file called `docker-compose.yml`
and run `docker compose up -d` in the same directory.
```yml
version: 3
services:
turn:
container_name: coturn-server
image: docker.io/coturn/coturn
restart: unless-stopped
network_mode: "host"
volumes:
- ./coturn.conf:/etc/coturn/turnserver.conf
2022-02-04 18:11:29 +00:00
```
2024-05-09 01:26:05 +00:00
To understand why the host networking mode is used and explore alternative configuration options, please visit [Coturn's Docker documentation ](https://github.com/coturn/coturn/blob/master/docker/coturn/README.md ).
2022-02-04 18:11:29 +00:00
2024-05-09 01:26:05 +00:00
For security recommendations see Synapse's [Coturn documentation ](https://element-hq.github.io/synapse/latest/turn-howto.html ).