文档章节

搭建TurnServer服务器

Leisured
 Leisured
发布于 2015/12/21 15:58
字数 905
阅读 621
收藏 1

一:下载turnserver服务器

    官网:http://turnserver.sourceforge.net/

[root@iZ28d8mzdwrZ src]#wget http://ncu.dl.sourceforge.net/project/turnserver/turnserver-0.7.3.tar.bz2
[root@iZ28d8mzdwrZ src]#tar -xvf turnserver-0.7.3.tar.bz2
#下载并安装libconfuse依赖:
[root@iZ28d8mzdwrZ src]#wget  
[root@iZ28d8mzdwrZ src]#tar -zxvf confuse-2.7.tar.gz 
[root@iZ28d8mzdwrZ src]#cd confuse-2.7
[root@iZ28d8mzdwrZ confuse-2.7]#./configure --prefix=/usr
[root@iZ28d8mzdwrZ confuse-2.7]#maek && make install
[root@iZ28d8mzdwrZ confuse-2.7]#yuminstall flex  #安装flex依赖
[root@iZ28d8mzdwrZ confuse-2.7]#cd ../turnserver-0.7.3
[root@iZ28d8mzdwrZ turnserver-0.7.3]#./configure --enable-debug-build
[root@iZ28d8mzdwrZ turnserver-0.7.3]#make && make install

二:配置

[root@iZ28d8mzdwrZ turnserver-0.7.3]# cd extra/
[root@iZ28d8mzdwrZ extra]# ls
Makefile     Makefile.in             turnserver.conf.template  turnserver.fedora.initd  turnusers.txt.template
Makefile.am  packet-stun2-turn.diff  turnserver.debian.initd   turnserver.spec
[root@iZ28d8mzdwrZ extra]# cp turnserver.conf.template /usr/local/etc/turnserver.conf
[root@iZ28d8mzdwrZ extra]# cp turnusers.txt.template /usr/local/etc/turnusers.txt

1.1.1.10      修改配置文件:

[root@rlnf-76etc]# vi turnserver.conf

listen_address = {"183.62.225.76" }           #把公网IP地址写入,一般只要改这个配置,其它的用默认值就可以了。

## Account method.

account_method = "file"                        #配置账户数据为文件

 

## Account file (if account_method = file).

account_file ="/usr/local/etc/turnusers.txt" #指定账户文件位置

 

[root@rlnf-76etc]# vi turnusers.txt

foo:bar:domain.org:authorized

用户名:密码:领域:需要验证的

1.1.1.11      启动turnserver:

 

[root@rlnf-76etc]# cd ../sbin

[root@rlnf-76sbin]# ./turnserver -c /usr/local/etc/turnserver.conf

1.1.1.12      启动回显服务:

[root@rlnf-76bin]# ./test_echo_server

UDP Echo server started on port 4588

1.1.1.13      测试服务器是否正常

在其它机器上启动测试程序:

rdc@rdc-Virtual-Machine:/home/turnserver/src$./test_turn_client -t udp -s 183.62.225.76 -p 183.62.225.76 -w 4588 -u foo -g 1234-d domain.org         

Protocol: udp (17) use TLS: 0.

sock: 3 speer: (nil) connected!

Send Allocate request.

Send Allocate request.

Probably wrong credentials or requestedfamily not supported.

这个是说权限错误,一般是用户或密码不对。修改用户和密码,再次运行:

rdc@rdc-Virtual-Machine:/home/turnserver/src$./test_turn_client -t udp -s 183.62.225.76 -p 183.62.225.76 -w 4588 -u foo -gbar -d domain.org

Protocol: udp (17) use TLS: 0.

sock: 3 speer: (nil) connected!

Send Allocate request.

Send Allocate request.

Allocate an address!

Send CreatePermission request.

Permission installed!

Send Send indication.

Receive data: 1024

Send CreatePermission request.

Channel bound to 16393.

Send ChannelData.

Received ChannelData: 1024 bytes

Send Refresh request.

Cleanup and exit.

1.1.1.14      服务端打印的日志:

15:44:26.632297 [turnserver_main:4509]  Received UDP on listening address

15:44:26.632336[turnserver_listen_recv:3273]   Nomessage integrity

15:44:26.636506 [turnserver_main:4509]  Received UDP on listening address

15:44:26.636534[turnserver_listen_recv:3581]   OK basicvalidation are done, process the TURN message

15:44:26.636546 [turnserver_process_turn:2942]  Process a TURN message

15:44:26.636559[turnserver_process_allocate_request:2302]     Allocate request received!

15:44:26.636573[turnserver_process_allocate_request:2536]     lifetime: 165 seconds

15:44:26.636667 [turnserver_process_allocate_request:2767]      Account foo, allocations used: 3

15:44:26.636719[turnserver_process_allocate_request:2903]     Allocation successful, send success allocate response

15:44:26.640733 [turnserver_main:4509]  Received UDP on listening address

15:44:26.640758[turnserver_listen_recv:3581]   OK basicvalidation are done, process the TURN message

15:44:26.640770[turnserver_process_turn:2942]  Process aTURN message

15:44:26.640781[turnserver_process_createpermission_request:1627]      CreatePermission request received

15:44:26.640807[turnserver_process_createpermission_request:1767]      Install permission for 183.62.225.76 4588

15:44:26.640828[turnserver_process_createpermission_request:1806]      CreatePermission successful, send successCreatePermission response

15:44:26.645088 [turnserver_main:4509]  Received UDP on listening address

15:44:26.645110[turnserver_listen_recv:3581]   OK basicvalidation are done, process the TURN message

15:44:26.645121[turnserver_process_turn:2942]  Process aTURN message

15:44:26.645131[turnserver_process_send_indication:1414]      Send indication received!

15:44:26.645143[turnserver_check_bandwidth_limit:503] Tokendown bucket available: 150000, tokens requested: 1024

15:44:26.645154[turnserver_process_send_indication:1536]      Will not set DF flag

15:44:26.645166[turnserver_process_send_indication:1567]      Send data to peer

15:44:26.645224 [turnserver_main:4686]  Received UDP on a relayed address

15:44:26.645241[turnserver_check_bandwidth_limit:477] Tokenup bucket available: 150000, tokens requested: 1024

15:44:26.645314[turnserver_relayed_recv:3722]  Send datato client

15:44:26.649140 [turnserver_main:4509]  Received UDP on listening address

15:44:26.649165[turnserver_listen_recv:3581]   OK basicvalidation are done, process the TURN message

15:44:26.649177[turnserver_process_turn:2942]  Process aTURN message

15:44:26.649187[turnserver_process_channelbind_request:1860]  ChannelBind request received!

15:44:26.649199[turnserver_process_channelbind_request:1936]  Client request a ChannelBinding for 183.62.225.76 4588

15:44:26.649234[turnserver_process_channelbind_request:2055]  ChannelBind successful, send success ChannelBind response

15:44:26.653515 [turnserver_main:4509]  Received UDP on listening address

15:44:26.653532[turnserver_process_channeldata:1239]  ChannelData received!

15:44:26.653544[turnserver_check_bandwidth_limit:503] Tokendown bucket available: 150000, tokens requested: 1024

15:44:26.653557[turnserver_process_channeldata:1366]  Send ChannelData to peer

15:44:26.653596 [turnserver_main:4686]  Received UDP on a relayed address

15:44:26.653611[turnserver_check_bandwidth_limit:477] Tokenup bucket available: 150000, tokens requested: 1024

15:44:26.653623[turnserver_relayed_recv:3722]  Send datato client

15:44:26.657563 [turnserver_main:4509]  Received UDP on listening address

15:44:26.657586[turnserver_listen_recv:3581]   OK basicvalidation are done, process the TURN message

15:44:26.657598[turnserver_process_turn:2942]  Process aTURN message

15:44:26.657608[turnserver_process_refresh_request:2101]      Refresh request received!

15:44:26.657618[turnserver_process_refresh_request:2146]      lifetime: 0 seconds

15:44:26.657664[turnserver_process_refresh_request:2201]      Account foo, allocations used: 2

15:44:26.657677[turnserver_process_refresh_request:2203]      Explicit delete of allocation

15:44:26.657692[turnserver_process_refresh_request:2245]      Refresh successful, send success refresh response


© 著作权归作者所有

共有 人打赏支持
Leisured
粉丝 5
博文 16
码字总数 8840
作品 0
南京
前端工程师
搭建turnserver(转) 稍加整理

1.1.1 Turnserver 1.1.1.1 官网:http://turnserver.sourceforge.net/ (最新地址http://sourceforge.net/projects/turnserver/) 1.1.1.2 支持协议: TURN and STUN Request For Comments (......

young-轻人
2014/03/26
0
0
C#+WebSocket+WebRTC多人语音视频系统

WebRTC是谷歌的开源的实时视频音频聊天技术,支持跨平台,Nat穿透技术(Stun,Turn,Ice),在部分支持Html5的浏览器里集成了这个功能。 至目前为止支持的PC浏览器有:Chrome 31+,opera 19+...

甩葱哥丶
2014/07/22
0
29
Ubuntu 下搭建 AppRTC 服务

研究 WebRTC 协议,最好先自己基于官方 Demo 动手搭一套服务环境,其中包括 房间服务器 AppRTC 、信令服务器(AppRTC 目录下的 src/Collider)、coTurn NAT 穿透服务器 ,分别通过下载、编译...

Gobert
2017/08/23
0
0
WEBRTC 学习过程

1、webrtc可以无需插件基于web直接完成视频,目前主流的浏览器firefox/chrome/微软Edge均已经支持了 2、其部署依赖两个东西 2.1、一个是消息服务,负责对端连接信息(sdp)的交换 这里使用gol...

leicc
2015/12/17
108
0
Webrtc跨域局域网

webrtc事例在局域网已经成功,请问如何跨域局域网,我提供了turn服务,没有成功if (location.hostname !== 'localhost') { requestTurn( 'https://IP/turn.php?username=user ); }function r...

dch_love
2016/11/14
331
0

没有更多内容

加载失败,请刷新页面

加载更多

初级开发-编程题

` public static void main(String[] args) { System.out.println(changeStrToUpperCase("user_name_abc")); System.out.println(changeStrToLowerCase(changeStrToUpperCase("user_name_abc......

小池仔
今天
6
0
现场看路演了!

HiBlock
昨天
19
0
Rabbit MQ基本概念介绍

RabbitMQ介绍 • RabbitMQ是一个消息中间件,是一个很好用的消息队列框架。 • ConnectionFactory、Connection、Channel都是RabbitMQ对外提供的API中最基本的对象。Connection是RabbitMQ的s...

寰宇01
昨天
12
0
官方精简版Windows10:微软自己都看不过去了

微软宣布,该公司正在寻求解决方案,以减轻企业客户的Windows 10规模。该公司声称,企业客户下载整个Windows 10文件以更新设备既费钱又费时。 微软宣布,该公司正在寻求解决方案,以减轻企业...

linux-tao
昨天
20
0
TypeScript基础入门之JSX(二)

转发 TypeScript基础入门之JSX(二) 属性类型检查 键入检查属性的第一步是确定元素属性类型。 内在元素和基于价值的元素之间略有不同。 对于内部元素,它是JSX.IntrinsicElements上的属性类型...

durban
昨天
13
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部