New: multiple lines, live AI transcription, queues and voicebots — early access now. More to come.See the roadmap →

Integration guide for FreePBX

Enable WebRTC on FreePBX 15 and later — install a certificate, verify the websocket, configure extensions for DTLS-SRTP and set up NAT, STUN and ICE host candidates.

View as Markdown

FreePBX supports WebRTC out of the box. This guide walks you through enabling the secure websocket, configuring extensions and handling NAT so that WebRTC Client can register from the browser.

Requirements

ComponentMinimum version
Asterisk11.5
Certificate Manager12.0.0alpha1
Core12.0.1beta9
User Control Panel12.0.0beta7
FreePBX12.0.1beta34 (tested on v15 and later)

Step 1 — Install a certificate for your domain

Use a certificate for your domain — not self-signed.

  1. In the top menu, click Admin.
  2. Choose Certificate Manager.
  3. No certificate yet? Generate a Certificate Signing Request (CSR) and apply for a certificate, or use the built-in Let's Encrypt option.
  4. Already have one? Upload the certificate and click Generate Certificate.
  5. Optionally set the certificate as the default.
FreePBX Certificate Manager with an uploaded certificate
FreePBX Certificate Manager: upload or generate the certificate for your domain.

Step 2 — Restart Asterisk and check the websocket

Go to Admin → Asterisk CLI and run:

text
core restart now

Then check that the websocket is listening:

text
http show status
FreePBX Asterisk CLI output of http show status with HTTPS bound to port 8089
The HTTPS server should be enabled and bound to port 8089.

Step 3 — Enable WebRTC on an extension

  1. Click Admin → Extensions (in newer versions: Applications → Extensions).
  2. Create or edit an extension.
  3. On the Advanced tab, set:
    • Enable AVPF = Yes
    • Enable ICE Support = Yes
    • Enable rtcp Mux = Yes
    • Media Encryption = DTLS-SRTP
  4. Save the extension and click Apply Config.

Step 4 — Add the websocket server to the management portal

Enter your domain, port 8089 and path /ws in the management portal — see Configure server settings.

Step 5 — Firewall and port forwarding behind NAT

If the PBX runs behind NAT, set up port forwarding and allow inbound traffic to the internal server. WebRTC media uses UDP ports (the RTP range, by default 10000–20000). You also need a STUN server to make two-way audio possible.

Example: FreePBX behind NAT on public IP 123.123.123.123 and private IP 10.10.10.231.

  1. Forward TCP port 8089 (and the RTP range) to 10.10.10.231 on your router.
  2. Adjust the NAT settings under Settings → Asterisk SIP Settings:
FreePBX SIP settings with external address and local networks
Set the external address and local networks.
  1. Add a STUN server under Settings → Asterisk SIP Settings:
FreePBX SIP settings with a STUN server configured
Configure a STUN server, e.g. stun.l.google.com:19302.
  1. Set up the ICE host candidate, mapping the private to the public address: 10.10.10.231 => 123.123.123.123
FreePBX ICE host candidates mapping the private IP to the public IP
ICE host candidate: private IP => public IP.

Internal domain name

When users also work on the same network (behind the same WAN IP) as the PBX, create an internal DNS record pointing to the server so the traffic stays local — for example webrtc.company.xyz A 10.10.10.231. You can also use a DNS rewrite in Pi-hole or AdGuard. See internal PBX with remote clients.