text stringlengths 0 152 |
|---|
So, yeah, you’ll want to be a full-stack developer, plus a VoIP guru, if you want to |
comfortably dive into WebRTC. We say this not to scare you off, but rather to assure |
you that if you find it challenging, it’s not due to any shortcoming on your part, but |
simply because this is complex, multilayered stuff. |
Having said all that, it is possible to get a taste of WebRTC without all of that, and in |
this chapter we’re going to configure Asterisk to support WebRTC, and run a pre- |
built web application that will demonstrate the basic audio/video capabilities of |
Asterisk’s WebRTC implementation. You’re still going to have that steep learning |
curve, but hopefully we’ve delivered a foundation on which to build. |
344 |
| |
Chapter 20: WebRTC |
Configuring Asterisk for WebRTC |
To pass calls through Asterisk using WebRTC, the PJSIP channel driver must be used. |
The configuration will be similar to that of standard SIP telephones, but not identical. |
For this we’ll need a transport type, which we’ll add to the /etc/asterisk/pjsip.conf file: |
[transport-udp] |
type=transport |
protocol=udp |
bind=0.0.0.0 |
[transport-tls] |
type=transport |
protocol=tls |
bind=0.0.0.0 |
cert_file=/home/asterisk/certs/self-signed.crt |
priv_key_file=/home/asterisk/certs/self-signed.key |
That’s all for editing the config file. For the rest of the PJSIP changes, we’ll be using |
the database.1 |
We’re going to create two new subscribers named WS_PHONE_A and WS_PHONE_B. The |
WebRTC client will use the credentials for these endpoints to communicate with the |
PJSIP channel driver in Asterisk (i.e., to make phone calls). |
Two records need to be added to the ps_aors table: |
INSERT into asterisk.ps_aors |
(id, max_contacts) |
values ('WS_PHONE_A', 5), |
('WS_PHONE_B', 5) |
; |
Corresponding ps_auth records are needed: |
INSERT into asterisk.ps_auths |
(id, auth_type, password, username) |
values ('WS_PHONE_A','userpass','spiderwrench','WS_PHONE_A'), |
('WS_PHONE_B','userpass','arachnoratchet','WS_PHONE_B') |
; |
We then create the endpoints themselves: |
INSERT INTO asterisk.ps_endpoints |
(id,aors,auth,context, |
transport,dtls_auto_generate_cert,webrtc,disallow,allow) |
VALUES |
('WS_PHONE_A','WS_PHONE_A','WS_PHONE_A','sets', |
'transport-tls','yes','yes','all','vp8,opus,ulaw'), |
('WS_PHONE_B','WS_PHONE_B','WS_PHONE_B','sets', |
'transport-tls','yes','yes','all','vp8,opus,ulaw'); |
1 Note that you can configure the PJSIP channel driver completely using the config file, but in this book we’re |
only doing so where necessary, and otherwise are using the database for PJSIP channel configuration. |
Configuring Asterisk for WebRTC |
| |
345 |
In Chapter 4 we already generated our certificates, so we should be able to use them |
here as well. |
$ ls -l /home/asterisk/certs/ |
That should take care of the channel configuration for our WebRTC example. |
We’ll now need to configure Asterisk’s web server to handle HTTPS. |
$ sudo vim /etc/asterisk/http.conf |
[general] |
enabled=yes |
bindaddr=0.0.0.0 |
bindport=8088 |
tlsenable=yes |
tlsbindaddr=0.0.0.0:8089 |
tlscertfile=/home/asterisk/certs/self-signed.crt |
tlsprivatekey=/home/asterisk/certs/self-signed.key |
Save and restart Asterisk. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.