Using voice / video calls on your Synapse server can be tricky, especially if you have your homeserver setup at home, with a dynamic public IP. Luckily tricky doesn't mean impossible, like the requirements from Synapse itself might suggest.
This Guide will walk you through setting up a Turnserver (coturn in this case) in Kubernetes, behind a dynamic IP.
Setting up TURN
The turnserver needs to be aware of your public IP Address. Unfortunately almost all home ISP connections use a dynamic public IP, so this address changes daily. Turn does not recognize this IP change and will cease to function. To work around this, I created this docker image that will detect the IP change.
First create a folder to store your kubernetes manifests in, with
mkdir coturn && cd coturn/. Next create the configMap for coturn with the following content
Note: It's important, that you set the relay IP correctly. If you have a multi node cluster, it is necessary to pin coturn to a specific host, so that you can be sure which internal IP to point it to. There is no need to specifiy the external / public IP, as the POD will automatically detect it.
Next the deployment itself
Note: This deployment will run on the host network itself. This is to avoid multiple NATs and the need to port forward a lot of ports through a service. It might be possible to use a service, I haven't tried though.
Now apply the manifests with
kubectl apply -f configMap.yaml
kubectl apply -f deployment.yaml
homeserver.yaml configuration file, search for
TURN and add the following config
Note: If you do not use TLS just omit the lines starting with
After you made the change, save and exit the config and restart Synapse. Lastly you need to portforward a few Ports from your Router:
- 49160 - 49200/udp
They need to be forwarded to the host that is running the Turnserver POD. That's it! All that is left is verifying that it works. This can be done with this site. Input your Synapse domain and either a User / Password combination or an access token. You can get an access token through Element Desktop:
All Settings -> Help & About; scroll down; click
<click to reveal> next to Access Token.
Your setup is working if you see something like this.