webrtc coturn服务器搭建

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/EI__Nino/article/details/69569000

WebRTC 需要一个 turn服务来中转视频流,或者提供NAT打洞服务,Google的coturn就提供了这两个功能,如下是下载、安装、配置的流水账记录。


[work@localhost coturn]$ git clone https://github.com/coturn/coturn.git
Initialized empty Git repository in /home/work/coturn/coturn/.git/
remote: Counting objects: 6327, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 6327 (delta 7), reused 0 (delta 0), pack-reused 6303
Receiving objects: 100% (6327/6327), 2.00 MiB | 779 KiB/s, done.
Resolving deltas: 100% (4919/4919), done.
[work@localhost coturn]$ ls
coturn
[work@localhost coturn]$ ./configure --prefix=/home/work/turn-server
install is /usr/bin/install
pkill is /usr/bin/pkill
sqlite3 is /usr/bin/sqlite3
Use TMP dir /var/tmp
Compiler: cc
Library option -lsocket cannot be used
Library option -lwldap32 cannot be used
Library option -lwldap64 cannot be used
Library option -lintl cannot be used
Sockets code is fine: no sin_len field present
Ignore IP_RECVERR
Crypto SSL lib found.
SSL lib found.
Libevent2 development is not installed properly
ERROR: Libevent2 development libraries are not installed properly in required location.
ERROR: may be you have just too old libevent tool - then you have to upgrade it.
See the INSTALL file.
Abort.
[work@localhost coturn]$ sudo yum install libevent
[work@localhost coturn]$ wget https://sourceforge.net/projects/levent/files/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz/download
[work@localhost coturn]$ mv download libevent-2.0.22-stable.tar.gz
[work@localhost coturn]$ tar -zxf llibevent-2.0.22-stable.tar.gz
[work@localhost coturn]$ cd llibevent-2.0.22-stable
[work@localhost libevent-2.0.22-stable]$./configure
[work@localhost libevent-2.0.22-stable]$make
[work@localhost libevent-2.0.22-stable]$ sudo make install
[work@localhost coturn]$ ./configure --prefix=/home/work/turn-server
[work@localhost coturn]$ make
[work@localhost coturn]$ make install
1) If you system supports automatic start-up system daemon services,
the, to enable the turnserver as an automatically started system
service, you have to:
a) Create and edit /etc/turnserver.conf or
/usr/local/etc/turnserver.conf .
Use /usr/local/etc/turnserver.conf.default as an example.


b) For user accounts settings: set up SQLite or PostgreSQL or
MySQL or MongoDB or Redis database for user accounts.
Use /usr/local/share/turnserver/schema.sql as SQL database schema,
or use /usr/local/share/turnserver/schema.userdb.redis as Redis
database schema description and/or
/usr/local/share/turnserver/schema.stats.redis
as Redis status & statistics database schema description.


If you are using SQLite, the default database location is in
/var/db/turndb or in /usr/local/var/db/turndb or in /var/lib/turn/turndb.


c) add whatever is necessary to enable start-up daemon for the
/usr/local/bin/turnserver.
2) If you do not want the turnserver to be a system service,
then you can start/stop it "manually", using the "turnserver"
executable with appropriate options (see the documentation).
3) To create database schema, use schema in file
/usr/local/share/turnserver/schema.sql.
4) For additional information, run:
$ man turnserver
$ man turnadmin
$ man turnutils
[work@localhost bin]$ ./turnadmin -k -u test123 -r test123.com -p test123
0xxxxxxxxxxxxxxxxxx


turnserver.conf

#私有ip
listening-ip=11.11.11.11
# listening-port=3478
# tls-listening-port=5349
# relay-ip=22.22.22.22
#外网ip
external-ip=22.22.22.22
# relay-threads=50
#no-auth=true
lt-cred-mech
realm=test123.com
# username:passwd (no Ox)
user=test123:xxxxx
# userdb=/home/work/turn-server/etc/turnuserdb.conf
# max-bps=102400
pidfile=/home/work/turn-server/logs/turnserver.pid
log-file=/home/work/turn-server/logs/turn.log



[work@localhost bin]$ ./turnserver -c /home/work/turn-server/etc/turnserver.conf -o -a -f -r test123.com


强制走 turn 服务
http://stackoverflow.com/questions/22130311/webrtc-how-to-set-always-to-use-turn-server


turnserver conf详解
http://blog.csdn.net/xyblog/article/details/49835805


官方wiki

https://github.com/coturn/coturn/wiki/turnserver


rp rb sp sb的解释
https://github.com/coturn/coturn/blob/master/src/apps/relay/turn_admin_server.c

猜你喜欢

转载自blog.csdn.net/EI__Nino/article/details/69569000
今日推荐