Coturn server - Relay is not working

家住魔仙堡 提交于 2019-12-05 15:19:51

How does your config looks like?

My working example for webRTC usage:

sudo nano /etc/turnserver.conf ->

listening-port=80
tls-listening-port=1133
fingerprint
lt-cred-mech
userdb=/etc/turnuserdb.conf
realm=subdomain.domain.com
server-name=subdomain.domain.com
total-quota=100
bps-capacity=0
stale-nonce
log-file=/var/log/turnserver/turn.log
no-loopback-peers
no-multicast-peers

sudo nano /etc/turnuserdb.conf ->Username:Passwort

You also need to allow these ports in your firewall if enabled. Check your server here: Trickle ICE

Notice, that you always need to use your ip/url with port like 123.456.789.10:80

There were a few problems in the TURN server setup I had.

  • First off, we had taken it from a blog which was about two years old. As a result, the setup was also two years old - Coturn Monza. The ideal way to start would be to get the Coturn AMI (Amazon Machine Image)(Version 4.5.0.6 details) and use it to setup the server. Alternatively, we should have at least taken the most recent setup through the git repository.

  • Second problem was with the configurations. Even before posting the question here, we had missed to open the necessary ports on the server. Once we did that, we started getting the STUN responses, but the relay wasn't working yet.

  • Third key problem was with the configurations in Turnserver.config file. We had barely gone through all configurations and after Polaris's answer we did. The config file contains sufficient explanation for each configuration, and the problem was indeed with the configurations.

  • The last problem was with the test cases. We wanted to ensure that the relay was "working", and during earlier stages of testing we had identified a particular network setup that would require relay (i.e. only STUNs would not be able to complete the request.) Eventually we learned that even TURN server would not be able to get through that setup.

    We did spend some time trying the NOSTUN mode (it's there in the turnserver.config), but due to lack of good test cases, we were never able to confirm that relay was working.

    I don't fully understand the test code on Trickle ICE Page, but I believe the results over there are reliable.

Here are some troubleshooting tips:

  • make sure you add the fingerprint option, as mentioned by Polaris
  • try just using a static username and password for now, e.g.:

    user=username:test

  • then include this in your PeerConnectionConfig:

    {'url': 'turn:yourserver.com:3478', credential: 'test', username: 'username'}

  • Use the "WebRTC Network Limiter" chrome extension to force WebRTC to use the TURN server.

  • Comment out the cert and pkey for now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!