nginxwebrtccoturn

How to config coturn on Nginx for webRTC?


I am making a WebRTC application which is working fine on wifi. But when I open the app on my phone via 4G the webRTC Livestream won't start. It seems something is going wrong by making the iceConnectionState.

enter image description here

For the Iceserver I made a turn server with coturn on my Nginx server with the following settings:

listening-port=3478
tls-listening-port=5349

listening-ip=my-public-ip
relay-ip=my-public-ip
external-ip=my-public-ip


fingerprint
user=Dominique:GS7Yq_jK
lt-cred-mech
server-name=domain.com
realm=domain.com
log-file=/var/log/turnserver/turnserver.log
simple-log
external-ip=my-public-ip

total-quota=100
stale-nonce=600

# Authentication method
use-auth-secret
static-auth-secret=33515e71ba1d0a96e77083f7e4215d99afe36204b6f382e1715fbb9314ae61d0

cert=/etc/letsencrypt/live/domain.com/fullchain.pem
pkey=/etc/letsencrypt/live/domain.com/privkey.pem

in my nginx.conf I added the following block

stream {
        server {
                listen 3478 udp;
                proxy_pass domain.com:3478;
        }

        server {
                listen 5349 udp;
                proxy_pass domain.com:5349;
        }
}

When I test my Turn server via this testing site

I get this result with these settings

 urls: 'turn:domain.com:3478',
  username: 'Dominique',
  credential: 'GS7Yq_jK'

But it seems my turn server isn't working Is there anyone who can help me? I would like to get WebRTC working on 4G

Thanks for the help!

Gr, Dominique


Solution

  • I found a solution in this question :) I have added a /etc/nginx/conf.d/load-balancer.conf and then the turn server works

    stackoverflow question