Janus WebRTC Server[edit]

Build (Rocky Linux 9)[edit]

ツール[edit]

dnf -y install jansson-devel libconfig-devel libmicrohttpd-devel meson ninja-build
dnf install libnice libnice-devel
dnf install libwebsockets libwebsockets-devel
dnf install usrsctp usrsctp-devel
libsrtp2 (SRTP: Secure Real-time Transport Protocol)[edit]
#git clone https://github.com/cisco/libsrtp.git  # このままだと libsrtp3 がダウンロードされる
git clone --branch v2.5.0 --depth 1 https://github.com/cisco/libsrtp.git libsrtp
cd libsrtp
./configure --prefix=/usr/local --enable-openssl
make -j"$(nproc)"
make install
最新版[edit]

Janus[edit]

git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
./autogen.sh
./configure --prefix=/usr/local --enable-rest --enable-websockets --enable-data-channels --disable-rabbitmq --disable-mqtt --disable-docs --enable-libsrtp2
make -j"$(nproc)"
make install
make configs

設定[edit]

設定ファイル[edit]

/usr/local/etc/janus/janus.jcfg[edit]
api_secret = ""        # Janus REST API 用の認証キー
admin_secret = ""      # Janus 管理用 API の認証キー
/usr/local/etc/janus/janus.transport.http.jcfg (デフォルト)[edit]
http = true
port = 8088      # for REST
/usr/local/etc/janus/janus.transport.websockets.jcfg (デフォルト)[edit]
ws = true
ws_port = 8188   # for Web Socket
/usr/local/etc/janus/janus.plugin.audiobridge.jcfg[edit]
general: {
 # 必要に応じて設定(例)
 # string_ids = true
 # rtp_port_range = "50000-60000"
 # local_ip = "1.2.3.4"
 # events = true
}

room-1234: {
 description = "Demo Room"
 is_private = false
 secret = "room-secret"    # ルーム操作用パスワード
 pin = "room-pin"          # 参加時パスワード(必要なら)
 sampling_rate = 48000     # or 16000 
 spatial_audio = true
 audiolevel_ext = true
 audiolevel_event = true
 audio_active_packets = 100
 audio_level_average = 25
 record = false
 # record_dir = "/var/recordings/"
 # record_file = "room-1234.wav"
 # allow_rtp_participants = false
 # rtp_forward_* = ...     # 外部RTP転送を使う場合のみ
}

Systemd[edit]

janus.service[edit]
[Unit]
Description=Janus WebRTC Server
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/janus -F /usr/local/etc/janus
Restart=on-failure
User=root

[Install]
WantedBy=multi-user.target

Apache で HTTPS, WSS リバースプロキシ[edit]

仮想ホスト設定(WSS対応)[edit]

STUN/TURN(coturn[edit]

設定[edit]

TEST[edit]

Janus の単体疎通テスト[edit]

REST (8088)[edit]
curl http://localhost:8088/janus/info
WS (8188)[edit]
printf '%s\n' '{"janus":"info","transaction":"t1"}' | websocat -H='Sec-WebSocket-Protocol: janus-protocol' - ws://127.0.0.1:8188/janus
WSS[edit]
printf '%s\n' '{"janus":"info","transaction":"t1"}' | websocat --text -H='Sec-WebSocket-Protocol: janus-protocol' -  wss://janus.jogrid.net/janusws

Coturn の STUN/TURN 動作確認[edit]

STUN 動作(UDP 3478)[edit]
# turnutils_stunclient -p 3478 janus.jogrid.net
0: (71074): INFO: IPv4. UDP reflexive addr: 202.26.150.72:35841
TURN 動作(UDP/TCP 3478, TLS 5349)[edit]
turnutils_peer -L 0.0.0.0 -p 5000

Janus + Coturn 経由の WebRTC 動作確認[edit]

ICE 候補の種類を確認(ブラウザ DevTools)[edit]

 
 

トップ   新規 ページ一覧 検索 最終更新   ヘルプ   最終更新のRSS