配置CoTurn on Ubuntu无法正常工作

时间:2017-11-08 20:59:13

标签: ubuntu webrtc stun turn coturn

在测试我的STUN& amp;时,我没有得到任何候选人。使用Chrome 62.0.3202.89在MacBook 10.12.6上使用Trickle ICE TURN服务器(CoTurn):

https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/

使用:

stun:<ip-adres>:3478
turn:<ip-adres>:3478 [username:test]    

On Digital Ocean我创建了一个Ubuntu 16.04.3 x64的Droplet并安装了CoTurn版本4.5.0.3:

sudo apt-get update
sudo apt-get install coturn

默认情况下,防火墙处于非活动状态。

接下来,我编辑了sudo vi /etc/turnserver.conf并提供了以下选项:

fingerprint
lt-cred-mech
user=username:test
realm=<ip-adres>
listening-ip=<ip-adres>
relay-ip=<ip-adres>
external-ip=<ip-adres>

接下来,我修改sudo vi /etc/default/coturn并取消注释选项:

TURNSERVER_ENABLED=1

然后我启动了Coturn守护程序:

sudo systemctl start coturn
sudo systemctl status coturn

这给出了输出:

● coturn.service - LSB: coturn TURN Server
   Loaded: loaded (/etc/init.d/coturn; bad; vendor preset: enabled)
   Active: active (exited) since Sat 2017-11-11 20:27:10 UTC; 52s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1386 ExecStart=/etc/init.d/coturn start (code=exited, status=0/SUCCESS)
    Tasks: 0
   Memory: 0B
      CPU: 0

Nov 11 20:27:10 coturn systemd[1]: Starting LSB: coturn TURN Server...
Nov 11 20:27:10 coturn coturn[1386]:  * coturn disabled in /etc/default/coturn turnserver
Nov 11 20:27:10 coturn coturn[1386]:    ...done.
Nov 11 20:27:10 coturn coturn[1386]:  * See /etc/default/coturn for instructions on enabling turnserver
Nov 11 20:27:10 coturn coturn[1386]:    ...done.
Nov 11 20:27:10 coturn systemd[1]: Started LSB: coturn TURN Server.
Nov 11 20:27:53 coturn systemd[1]: Started LSB: coturn TURN Server.

请帮帮我,这还需要什么来让它发挥作用?

2 个答案:

答案 0 :(得分:1)

开始不起作用:

sudo systemctl start coturn

这似乎是bug

修复此错误:

sudo systemctl edit --full coturn

删除所有内容并将其粘贴:

[Unit]  
Description=coturn  
Documentation=man:coturn(1) man:turnadmin(1) man:turnserver(1)
After=syslog.target network.target

[Service]
Type=forking
User=turnserver
Group=turnserver
RuntimeDirectory=turnserver
RuntimeDirectoryMode=0750
EnvironmentFile=/etc/default/coturn
PIDFile=/run/turnserver/turnserver.pid
ExecStart=/usr/bin/turnserver --daemon --pidfile /run/turnserver/turnserver.pid --syslog -c /etc/turnserver.conf $EXTRA_OPTIONS
Restart=on-abort
LimitCORE=infinity
LimitNOFILE=1000000
LimitNPROC=60000
LimitRTPRIO=infinity
LimitRTTIME=7000000
CPUSchedulingPolicy=other
UMask=0007

[Install]
WantedBy=multi-user.target

修改单元文件后,我重新加载systemd进程以获取我的更改:

sudo systemctl daemon-reload

现在开始实际工作:

sudo systemctl start coturn

使其在重启时自动重启:

sudo systemctl enable coturn

答案 1 :(得分:0)

我遇到了同样的问题,但是简单地执行systemctl restart coturn使其开始为我工作。在此之前,仅执行systemctl启动或停止即可报告成功,但实际上未启动任何进程。