Centos 7:

[root@turn ~]# yum -y install make gcc gcc-c++ openssl-devel libevent libevent-devel wget
[root@turn ~]# mkdir /root/turn
[root@turn ~]# cd /root/turn
[root@turn turn]# wget https://github.com/coturn/coturn/archive/4.5.0.3.tar.gz
[root@turn turn]# tar -xvzf 4.5.0.3.tar.gz
[root@turn turn]# cd coturn-4.5.0.3 && ./configure
[root@turn turn]# cd coturn-4.5.0.3/
[root@turn coturn-4.5.0.3]# ./configure
[root@turn coturn-4.5.0.3]# make
[root@turn coturn-4.5.0.3]# make install

turnserverの設定ファイルを /etc/turnserver.conf にアップロードします。

  • 添付の turnserver.conf を参照し、以下の変数をご自身の値に置き換えてください: {{ publicIp }} - サーバーのパブリックIPアドレス {{ secret }} - LiveAgentの音声通話・ビデオ通話設定で使用するパスワードを生成してください {{ maxBps }} - TURNサーバーを経由する接続に許可する最大ビットレート(推奨値:128000)

TURNサーバー用のSSL秘密鍵を /etc/turnserver.key にアップロードします。 TURNサーバー用のSSL証明書を /etc/turnserver.crt にアップロードします。

turnserverのサービスファイル /etc/systemd/system/turnserver.service を作成します。

[Unit]
Description=turnserver Service
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/turnserver -c /etc/turnserver.conf
Restart=on-abort

[Install]
WantedBy=multi-user.target

turnserverサービスを起動します:

[root@turn ~]# systemctl start turnserver

ポートを開放します:

[root@turn ~]# iptables -A INPUT -p tcp -m tcp --dport 3478 -j ACCEPT
[root@turn ~]# iptables -A INPUT -p udp -m udp --dport 3478 -j ACCEPT

[root@turn ~]# iptables -A INPUT -p tcp -m tcp --dport 5349 -j ACCEPT
[root@turn ~]# iptables -A INPUT -p udp -m udp --dport 5349 -j ACCEPT

サーバーの設定が完了したら、config.ymlファイルに以下のように設定を追加してください:

webrtc:
  voice:
    stun-url: stun:example.com
    turn-url: turn:example.com
    password: pass
    ice-transport: all
  video:
    stun-url: stun:example.com
    turn-url: turn:example.com
    password: pass
    ice-transport: all