Configuring WebRTC in Asterisk (FreePBX)
Technical requirements
The telephony server must be accessible from the Internet, i.e. it must have a static IP.
Must have a working SSL/TLS certificate.
When using browser-based softphone, wss (WebSocket Secure) must be configured on the Asterisk server, and the port must be open to the outside (usually 8089) (?).
This is configured in the admin interface:
Advanced Settings > Asterisk Builtin mini-HTTP section > HTTPS Bind Port
Port range for RTP (typically 10000-20000) (?).
It is configured in the administrator interface:
Settings → Asterisk SIP Settings → General SIP Settings Tab
Setting
This example describes how to configure WebRTC in an already running FreePBX server:
is available at <example>.com and has an SSL/TLS certificate;
FreePBX version 16, Asterisk version 15;
wss is configured on port 8089;
all other relevant ports are open.
Configuring FreePBX
If the "Change To CHAN_PjSIP Driver" button (see below, in the internal number setting) is available, you do not need to do anything in this section.
Settings ➝ Advanced Settings
Settings ➝ Asterisk SIP Settings
Tab “SIP Legacy Settings [chan_sip]”
Verify that the variables are set:
Creating and setting up an extension number (extension)
Go to the FreePBX configuration interface and log in: https://<example>.com/
Go to section Applications ➝ Extensions
Button “+ Add Extension” ➝ “+ Add New SIP (Legacy) [chan_sip] Extension” (other versions of FreePBX may be “Add New Chan_SIP extension”)
In the tab General:
Press the button Submit
After that, open editing of the newly created extension in the list of extensions (in the line with 5001 in the Actions column, click the edit button with a pencil icon).
Go to the tab Advanced
First change the SIP Driver to PjSIP:
Press the button Submit
Then change the SIP Driver back:
Now to make the remaining customizations:
Press the button Submit
Press the button Apply Config
Testing that wss works
Let's use the sipML5 live demo from Doubango as an example:
https://www.doubango.org/sipml5/call.htm
Setting
First, the "Expert mode?" button.
The advanced settings page should open in the next tab
Press the button Save
Back to the main tab
Button Login
The word Connected should appear at the top above the Registration heading.
Call
Now you can make the call.
Under the Call control heading, dial the desired number (*43 for an echo call or a cell phone number with 8 first).
Press the button Call ➝ Audio
There's a call that should go out.
Profit!
Links
WebRTC support in Asterisk
Initial support for WebRTC in Asterisk starting with version 11:
PjSIP in Asterisk
New chan_pjsip driver in Asterisk 12: New in 12 - Asterisk Project - Asterisk Project Wiki
PjSIP is available by default in Asterisk 15: PJSIP-pjproject - Asterisk Project - Asterisk Project Wiki
FreePBX
Configuration examples
Last updated