Asterisk11 webrtc 安装及demo测试(SIPML5)
来源:互联网 发布:安卓博德之门2修改数据 编辑:程序博客网 时间:2024/05/01 18:02
二、安装Asterisk准备:(此后全部是root权限)
apt-get install build-essential libncurses5-dev libxml2-dev libsqlite3-dev libssl-dev openssl ncurses-dev zlibc zlib-bin libidn11-dev libidn libsrtp0-dev apt-get install uuid-dev (注:Asterisk 11 comes with an embedded pjproject. When building Asterisk 11, to get ICE support you'll need the UUID development library (uuid-dev for Debian, libuuid-devel for CentOS) library.)
三、实现webrtc功能要求:
1.浏览器支持
最新的支持webrtc功能的浏览器列表链接 http://en.wikipedia.org/wiki/WebRTC
最常用chrome浏览器
2.SRTP
Secure media is a requirement of WebRTC and as a result SRTP must be available. In order for Asterisk to build SRTP support the libsrtp library and development headers must be available.
(注:上面的apt-get install libsrtp0-dev 可能已经实现了srtp的安装,本人没有尝试。我按如下方法安装的,后来再apt-get install libsrtp0-dev ,发现srtp已经安装,可以用这一条语句安装完试试看有没有 res_srtp.so 如果有,则那一条安装语句就可以搞定,估计是可行的。查看模块方法 asterisk源码目录下, ./configure 然后 make menuselect 查看有没有这个模块)
本人安装srtp的方法:(转自 http://blog.csdn.net/yetyongjin/article/details/8563591)
因为WEBRTC要求用SRTP,而asterisk的SRTP模块依赖于libsrtp包,所以要先安装它。
#wgethttp://sourceforge.net/projects/srtp/files/srtp/1.4.4/srtp-1.4.4.tgz/download
# tar vzxf srtp-1.4.4.tgz
# cd srtp
# ./configure
# make
# make install
记得这样装完没有 res_srtp.so ,然后 apt-get install srtp-utils ,有了res_srtp.so模块。
四、安装asterisk
1.解压 tar -zxvf asterisk~~~
2.进入源码目录 cd asterisk
3.配置环境 ./configure
4. make menuselect 检查res_http_websocket,res_srtp, res_crypto and chan_sip 模块是否被选中,没选中要选中。
5. make
6. make install
7. make samples
安装完毕~
五、generate certificates for Asterisk to be able to use WebRTC
参考链接 https://wiki.asterisk.org/wiki/display/AST/Secure+Calling+Tutorial
In newer versions of Chrome and Firefox (and others) DTLS-SRTP is mandatory. This means you must generate certificates for Asterisk to be able to use WebRTC.
(1)First, let's make a place for our keys.
mkdir /etc/asterisk/keys
(2)Next, use the "ast_tls_cert" script in the "contrib/scripts" Asterisk source directory to make a self-signed certificate authority and an Asterisk certificate.
./ast_tls_cert -C pbx.mycompany.com -O "My Super Company" -d /etc/asterisk/keys
- The "-C" option is used to define our host - DNS name or our IP address.
- The "-O" option defines our organizational name.
- The "-d" option is the output directory of the keys.
This will create the /etc/asterisk/keys/ca.crt file.
You'll be asked to enter the pass phrase again, and then the /etc/asterisk/keys/asterisk.key file will be created.
The /etc/asterisk/keys/asterisk.crt file will be automatically generated.
You'll be asked to enter the pass phrase a third time, and the /etc/asterisk/keys/asterisk.pem will be created, a combination of the asterisk.key and asterisk.crt files.
(3)Next, we generate a client certificate for our SIP device.
./ast_tls_cert -m client -c /etc/asterisk/keys/ca.crt -k /etc/asterisk/keys/ca.key -C phone1.mycompany.com -O "My Super Company" -d /etc/asterisk/keys -o malcolm
- The "-m client" option tells the script that we want a client certificate, not a server certificate.
- The "-c /etc/asterisk/keys/ca.crt" option specifies which Certificate Authority (ourselves) that we're using.
- The "-k /etc/asterisk/keys/ca.key" provides the key for the above-defined Certificate Authority.
- The "-C" option, since we're defining a client this time, is used to define the hostname or IP address of our SIP phone
- The "-O" option defines our organizational name.
- The "-d" option is the output directory of the keys."
- The "-o" option is the name of the key we're outputting.
Now, let's check the keys directory to see if all of the files we've built are there. You should have:
- asterisk.crt
- asterisk.csr
- asterisk.key
- asterisk.pem
- malcolm.crt
- malcolm.csr
- malcolm.key
- malcolm.pem
- ca.cfg
- ca.crt
- ca.key
- tmp.cfg
六、配置Asterisk,以使用webrtc功能(配置文件在 /etc/asterisk/)
(参考文档 https://wiki.asterisk.org/wiki/display/AST/WebRTC+tutorial+using+SIPML5)I always recommend backing up your current .conf files and using clean, blank text files for trying out a tutorial like this. Especially if you are new to Asterisk.
备份真的很重要,我把安装完默认的 /etc/asterisk/ 下的文件全部备份了一下。
1.http.conf[general]enabled=yesbindaddr=0.0.0.0bindport=80882.rtp.conf
[general]rtpstart=10000rtpend=20000icesupport=yesstunaddr=stun.l.google.com:193023.sip.conf
[general]udpbindaddr=0.0.0.0:5060realm=123.123.123.123 ;replace with your Asterisk server public IP address or hosttransport=udp,ws;[general] 要修改成这样样子,如果按默认的配置,在运行demo时会出问题。。 [6001]host=dynamicsecret=DONT_USE_THIS_INSECURE_PASSWORDcontext=from-internaltype=friendencryption=yesavpf=yesforce_avp=yesicesupport=yesdirectmedia=nodisallow=allallow=ulawdtlsenable=yesdtlsverify=fingerprintdtlscertfile=/etc/asterisk/keys/asterisk.pem ;这两句加上,运行demo会有问题,不知道为什么,可能是keys下的文件生成的有问题dtlscafile=/etc/asterisk/keys/ca.crt ;同上dtlssetup=actpasstransport=udp,ws,wss ;这两句是参考了另一个文档,加上是可以用的,具体含义还要在研究,加在这里是可以的,运行demo不影响nat=yes,force_rport4.extensions.conf
[default][from-internal]exten => 1000,1,Answer()same => n,Playback(hello-world) ;参考文档里是 Playback(demo-congrats)same => n,Hangup()七、配置防火墙
查看防火墙状态 ufw status
设置:
ufw allow 5060 ufw allow 8088/tcp ufw allow 10000:20000/udp八、运行demo—— SIPML5
SIPML5网址: http://sippackets.com/
参考链接 https://wiki.asterisk.org/wiki/display/AST/WebRTC+tutorial+using+SIPML5
Configure SIPML5
On the registration page use the following configuration, replacing the IP addresses with your public IP for the Asterisk server.
Open the "Expert mode" settings page and use the following details, still replacing the IP of course:
Be sure to hit save! Just leave that tab open, or close it and go back to the main tab to make a test call.
Make a test call
Restart Asterisk, or start Asterisk if you haven't already.
Click "Login" with the SIPML5 client. On the Asterisk CLI you should see:
== WebSocket connection from 'X.X.X.X:46723' for protocol 'sip' accepted using version '13' -- Registered SIP '6001' at X.X.X.X:46723 > Saved useragent "IM-client/OMA1.0 sipML5-v1.2014.01.27" for peer 6001
Dial extension 1000 from your SIPML5 client and you should see CLI output:
== Using SIP RTP CoS mark 5 -- Executing [1000@from-internal:1] Answer("SIP/6001-00000000", "") in new stack > 0x28057f0 -- Probation passed - setting RTP source address to X.X.X.X:9177 -- Executing [1000@from-internal:2] Playback("SIP/6001-00000000", "demo-congrats") in new stack -- <SIP/6001-00000000> Playing 'demo-congrats.gsm' (language 'en')
If you don't have VERBOSE messages going to the console, and verbosity turned up at least to 3 then you may not see these messages.
我运行时,控制台显示下面信息,但是听不到声音。。。
- Asterisk11 webrtc 安装及demo测试(SIPML5)
- WebRTC: Sipml5+Asterisk11+Centos6
- WebRtc: PeerConnection demo测试
- asterisk11安装过程
- Dubbo安装配置及demo,helloworld测试
- Scrapy安装及demo测试笔记
- 第13篇研究webrtc官网(二)ninja安装(一)及安卓一对一测试问题
- webRTC demo
- TensorFlow安装指南(Centos 7&Windows)及DCGAN demo测试
- thrift 安装 C++server 及PHP Client 测试Demo
- sipml5实现SIP MESSAGE方法(一)
- webrtc工程DEMO建立
- 使用webRTC通话Demo
- WebRTC 聊天Demo
- webrtc android demo开发
- webrtc android demo开发
- webrtc网页视频demo
- Webrtc Demo环境搭建
- GitHub Student Pack 学生的福音
- 【Cocos2d-x】视线和光线:如何创建 2D 视觉范围效果
- 豆瓣API获取authorization_code时出错
- 应用到驱动的数值传递
- 虚拟机上Ubantu输出printk信息到指定文件
- Asterisk11 webrtc 安装及demo测试(SIPML5)
- ns3的安装
- 第二章 Backbonejs中的Model实践
- 一个证明了返回值与重载无关的小练习
- [LeetCode]Path Sum
- 【JUnit4.10源代码分析】3.4 Description与测试树
- Linux通过socket获取网口相关信息
- 掌握模拟电路设计需要阅读的几本参考书!
- LINUX命令——持续添加