text stringlengths 0 152 |
|---|
$ sudo service asterisk restart |
Verify that Asterisk is now running not just an HTTP server, but also HTTPS: |
*CLI> http show status |
HTTP Server Status: |
Server Enabled and Bound to 0.0.0.0:8088 |
HTTPS Server Enabled and Bound to 0.0.0.0:8089 |
Enabled URI's: |
/ws => Asterisk HTTP WebSocket |
You’re looking in the output for HTTPS to verify that the certificates are working, and |
you also want to see /ws as that indicates the WebSockets components have loaded. |
Hint: if it’s not working, always check /var/log/messages for any |
SELinux messages. |
$ sudo grep sealert /var/log/messages |
The firewall isn’t currently configured for those ports, so we’ll need to add a few rules |
to handle that: |
$ sudo firewall-cmd --zone=public --add-port=8088/tcp |
$ sudo firewall-cmd --zone=public --add-port=8088/tcp --permanent |
$ sudo firewall-cmd --zone=public --add-port=8089/tcp |
$ sudo firewall-cmd --zone=public --add-port=8089/tcp --permanent |
$ sudo firewall-cmd --zone=public --add-port=5061/udp |
$ sudo firewall-cmd --zone=public --add-port=5061/udp --permanent |
At this point you need to fire up your web browser and make a connection. Your |
browser will complain about the connection if you are using a self-signed certificate, |
346 |
| |
Chapter 20: WebRTC |
but it will allow you to make the connection. This is a critical step, as you need to tell |
your browser to store the certificate permanently, so that WebRTC can use the Web‐ |
Socket connection. The following URL will connect you: |
https://ip-of-asterisk-server:8089/ws |
If you get to an Upgrade Required message, that’s a good thing. It means that the con‐ |
nection is good, and that’s just the protocol telling you there’s not enough technology |
being served up for this to be an actual WebSocket connection. We’re where we need |
to be. |
Of course the next thing is to actually experience a WebRTC session through this |
environment we’ve configured, and in order to test all this out, we’re going to need to |
fire up our browser and load some sort of WebRTC client into it. The next section |
will do just that. |
Cyber Mega Phone |
In order to see WebRTC in action on your Asterisk system, you’ll need something |
running on your browser. The easiest way to see this in action is to take Digium’s |
Cyber Mega Phone for a spin. This will allow you to quickly set up a working |
WebRTC session using Asterisk. |
First up, since WebRTC requires the use of TLS (it’s not optional, as it is with SIP), |
we’re going to nag you one more time to verify that your certificates are installed. If |
you haven’t yet done so, now is the time to work through Chapter 4, or there is also a |
script provided as part of the Asterisk source code that will generate the keys and cer‐ |
tificates (you’ll find it in the Asterisk source code under the /home/astmin/src/ |
asterisk-16.<TAB>/contrib/scripts/ folder. The script is named ast_tls_cert, and it is |
documented on the Asterisk wiki. |
OK, now we need a tiny bit of dialplan for our WebRTC calls to arrive at: |
$ vim /etc/asterisk/extensions.conf |
exten => 246,1,Noop() |
same => n,Answer() |
same => n,Wait(0.5) |
same => n,StreamEcho(4) |
same => n,Hangup() |
The Cyber Mega Phone itself is found at GitHub, under the Asterisk account. |
You can download the code and run it from your local PC, or you can load it into a |
web server and serve it from there. |
Let’s serve it up from our Asterisk server: |
$ cd /var/lib/asterisk/static-http |
$ sudo git clone https://github.com/asterisk/cyber_mega_phone_2k.git |
Cyber Mega Phone |
| |
347 |
$ sudo chown -R asterisk:asterisk cyber_mega_phone_2k ; sudo chmod 755 cyber_mega_phone_2k |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.