The text of this text connection is: http://blog.csdn.net/freewebsys/article/details/47109183 not allowed to reprint without the Bo master.
1, about stun and turn
STUN (simple traversal of the UDP over Nats,nat) is a network protocol that allows clients located on a NAT (or multiple NAT) to find their own public address, find out what type of NAT they are in and NAT Internet-side port that is bound to a local port. This information is used to establish UDP traffic between two hosts that are at the same time behind the NAT router. The protocol is defined by RFC 3489. The RFC 3489 protocol is now superseded by the RFC 5389 protocol, where stun is defined as a tool that assists in traversing Nat and does not provide a cross-over solution independently. It also has an upgrade version of RFC 7350, which is currently being perfected.
Http://baike.baidu.com/view/884586.htm
Turn is all called traversal using Relay NAT, that is, through the Relay way through the Nat,turn application model by assigning the Turnserver address and port as the client's external accept address and port, That is, the message sent by the users of the private network must be relay forwarded by Turnserver.
Http://baike.baidu.com/subview/351571/10359693.htm
2, installation
Reference:
Http://www.hankcs.com/program/network/compile-rfc5766-turn-server-to-build-turn-server.html
Code Download:
Https://github.com/coturn/rfc5766-turn-server/releases
Download the latest tar.gz package. Rfc5766-turn-server-3.2.5.9.tar.gz
Install dependent environments
##ssl 需要yum安装yum install openssl openssl-libs libevent libevent-devel
If you still have an error, install libevent manually.
Libevent2notin required location
Download: http://libevent.org/official website, download
Https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz
Then unzip the compiled installation to
Compiling turn-server
-zxvf rfc5766-turn-server-3.2.5.9.tar.gzcd rfc5766-turn-server-3.2.5.9./configure makemake install
Configure success:
More is/usr/bin/moreinstall is/usr/bin/installpkill is/usr/bin/pkilluse TMP DIR/VAR/TMPCOMPILER:CC Do notUse-lsocket Do notUse-lwldap32 Do notUse-lwldap64 Do notUse-lintlsockets Code isFine:no sin_len field Presentignore ip_recverrcrypto SSLLibFound. SslLibFound. Libevent2 Development found. Libevent2 runtime found. Libevent2 OpenSSL found. Libevent2 Pthreads found. POSTGRESQL Development LIBRARY (LIBPQ.A) and/ORHEADER (libpq-fe.h) is notInstalled properly onThis SYSTEM. That' S OK but the TURN SERVER was BUILDING without POSTGRESQL DATABASE support.MYSQL Development LIBRARY (libmysqlclient) and/ORHEADER (mysql.h) is notInstalled properly onThis SYSTEM. That' S OK but the TURN SERVER was BUILDING without MYSQL DATABASE support.Hiredis Development LIBRARY (libhiredis.*) and/ORHEADERS (hiredis/*.h) is notInstalled properly onThis SYSTEM. That' S OK but the TURN SERVER was BUILDING without REDIS support.Prefix=/usr/local oslibs=-l/usr/local/Lib/-l/usr/local/Lib/-l/usr/local/lib64/-l/usr/local/lib64/-LRT-PTHREAD-LCRYPTO-LSSL-LEVENT_CORE-LEVENT_OPENSSL-LEVENT_PTHREADS-WL ,-rpath,/usr/local/Lib/-wl,-rpath,/usr/local/Lib/-wl,-rpath,/usr/local/lib64/-wl,-rpath,/usr/local/lib64/-wl,-rpath,/usr/lib64/mysql-wl,-rpath,/usr/local/Libdblibs= Oscflags=-g-wall-wno-deprecated-declarations-wextra-wformat-security-wnested-externs-wstrict-prototypes -wmissing-prototypes-wpointer-arith-wcast-qual-i/usr/local/include-i/usr/local/include/-I/usr/local/include- Dturn_has_daemon-dinstall_prefix=/usr/local dbcflags=
Just say that there is no database support library, temporarily do not need.
Instructions after installation:
1) If you system supports automaticStart-up System daemon Services, the, toEnable the Turnserver asAn automatically started system service and you have toACreate andEdit/etc/turnserver.confor/usr/Local/etc/turnserver.conf. use/usr/Local/etc/turnserver.conf.default asAn example. b for Useraccounts settings,if usingThe Turnserver withAuthentication:Create andedit/etc/turnuserdb.conf file,or SetUp PostgreSQLorMysqlorRedisDatabase for UserAccounts. use/usr/Local/etc/turnuserdb.conf.default asExample forFlat File DB,oruse/usr/Local/share/turnserver/Schema.SQL as SQL Database Schema,oruse/usr/Local/share/turnserver/Schema. Userdb.redis asRedisDatabase SchemaDescription and/or/usr/Local/share/turnserver/Schema. Stats.redis asRedis Status & StatisticsDatabase SchemaDescription. CAddWhatever isNecessary toEnableStart-up Daemon forthe/usr/Local/bin/turnserver.2)IfYou Do notWant the Turnserver toBe a system service, ThenYou canStart/stop it"Manually",usingThe"Turnserver"Executable withAppropriate options (see the documentation).3) to Create Database Schema, useSchema inchfile/usr/Local/share/turnserver/Schema.SQL.4) forAdditional information, run: $ Man Turnserver $ mans turnadmin $ man turnutils
Create a user.db file in the root directory
Start with Turnserver:
turnserver --userdb /root/turnuser.db 里面是webrtc用户名密码:webrtc:secret
3, page call
Https://github.com/EricssonResearch/openwebrtc-examples/tree/master/web
Before installing the node reference article:
Http://blog.csdn.net/freewebsys/article/details/46649667#t1
Modify Main.js
// must use ‘url‘ here since Firefox doesn‘t understand ‘urls‘var configuration = { "iceServers": [ { "url""stun:mmt-stun.verkstad.net" }, { "url""turn:mmt-turn.verkstad.net", "username""webrtc", "credential""secret" } ]};
Replace the stun server with the turn server.
4, summary
The text of this text connection is: http://blog.csdn.net/freewebsys/article/details/47109183 not allowed to reprint without the Bo master.
Stun and Trun are key servers for WEBRTC to get through, but limited resources are not tested in public networks.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
WEBRTC (2): CENTOS6 installation Stun/turn Service