cd /usr/src/asterisk-13.0.0/contrib/scripts
./ast_tls_cert -C 65.181.118.52 -O "My Super Company" -d /etc/asterisk/keys -o asterisk
Asterisk 11 Tutorial Overview
The idea for this tutorial is to demonstrate very basic WebRTC support and functionality in Asterisk 11. We will configure Asterisk to support a remote WebRTC client, and then make calls from said client (SIPML5) to Asterisk. ICE and STUN will be used for NAT traversal, and SIP will use a WebSocket transport.Get dependencies
Install a variety of essential dependencies to make sure we get them. Plus install the uuid-dev package that isn't included in the Asterisk 11 install_prereq script.sudo apt-get install build-essential libncurses5-dev libxml2-dev libsqlite3-dev libssl-dev libsrtp0-dev uuid-dev
sudo ./install_prereq install sudo ./install_prereq install-unpackaged
Build Asterisk with support for WebRTC
Using menuselect make sure Asterisk will build with res_http_websocket, res_crypto and chan_sip.In the Asterisk source directory:
./configure && make menuselect
make && make install && make samples
Configure Asterisk
Now we need to configure the various Asterisk components necessary for WebRTC support.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.
Configure http.conf
[general] enabled=yes bindaddr=0.0.0.0 bindport=8088
Configure rtp.conf
[general] rtpstart=10000 rtpend=20000 icesupport=true stunaddr=stun.l.google.com:19302
Configure sip.conf
[general] udpbindaddr=0.0.0.0 realm=123.123.123.123 ;replace with your Asterisk server public IP address or host transport=udp,ws icesupport=yes
directmedia=no qualify=yes trustrpid=yes generaterpid=yes sendrpid=yes realm=60.11.118.232 ;replace with your Asterisk server public IP address or host icesupport=yes media_address=60.11.118.232 ;replace with your Asterisk server public IP address or host nat=force_rport,comedia qualifyfreq=60 keepalive=60 bindport=5060 context=default
[phone](!) host=dynamic type=friend context=internal callcounter=yes ;trabaja en conjunto con device state disallow=all allow=ulaw allow=alaw callgroup = 1 pickupgroup = 1 dtmfmode=rfc2833 ;contactdeny=0.0.0.0/0.0.0.0 ; Use contactpermit and contactdeny to ;contactpermit=172.16.0.0/255.255.0.0 ; restrict at what IPs your users may callerid=phone nat=force_rport,comedia directmedia=no icesupport=yes
[3100](phone) username=3100 secret=11@ambiorix@34 callerid=Webrtc disallow=all allow=ulaw allow=alaw avpf=yes force_avp=yes icesupport=yes directmedia=no dtlsenable=yes dtlsverify=fingerprint dtlscertfile=/etc/asterisk/keys/asterisk.pem dtlscafile=/etc/asterisk/keys/ca.crt dtlssetup=actpass context=webrtc nat=force_rport,comedia allow=h263 allow=h263p allow=vp8 videosupport=no [3101](phone) username=3101 secret=11@ambiorix@34 callerid=Webrtc1 disallow=all allow=ulaw allow=alaw avpf=yes force_avp=yes icesupport=yes directmedia=no dtlsenable=yes dtlsverify=fingerprint dtlscertfile=/etc/asterisk/keys/asterisk.pem dtlscafile=/etc/asterisk/keys/ca.crt dtlssetup=actpass context=webrtc nat=force_rport,comedia allow=h263 allow=h263p allow=vp8 videosupport=no context=internal
Configure extensions.conf
We'll make a simple dialplan for receiving a test call from the SIPML5 client.[default] [from-internal] exten => 1000,1,Answer() same => n,Playback(demo-congrats) same => n,Hangup()
Configure the firewall in front of Asterisk
Firewall configuration is outside the scope of the tutorial, however here is the output from my Uncomplicated FireWall service to show you what you may need to open:To Action From -- ------ ---- 5060 ALLOW IN Anywhere 8088/tcp ALLOW IN Anywhere 10000:20000/udp ALLOW IN Anywhere
5060: This is the port configured in sip.conf
8088: This is the port configured in http.conf
10000:20000: This is the port range configured in rtp.conf
Configure SIPML5
Goto http://sipml5.org/ in your Chrome browser and use the live demo.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
== 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')
You should hear audio coming from your speakers or headphone! Congrats on making your first call via WebRTC using Asterisk!
No hay comentarios:
Publicar un comentario