Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


At AstriDevCon 2017, Digium introduced a sample WebRTC Video Conference Web Application called CyberMegaPhone (CMP2K).  This document will walk you through installing the application and configuring it and Asterisk as a simple video conference server.




Table of Contents


Before proceeding, follow the instructions for Configuring Asterisk for WebRTC Clients and then use SIPML5 to test your connectivity by following the instructions at WebRTC tutorial using SIPML5.  The instructions below assume you've completed those steps.

You'll also need a working webcam and microphone on your client computer.  CMP2K will not connect unless both are available.

Get The Code

The CyberMegaPhone (CMP2K) code is located in Asterisk's public Github repository at  You can either download the code as a zip file or clone the repository using git.  Which ever way you choose, download it now to the directory of your choice.  We'll use /usr/src/asterisk/cyber_mega_phone_2k in the instructions below.

From an installation perspective, that's all there is to it.  It's just configuration from now on.

As a reminder, we'll be using as our hostname so substitute it with your own hostname or ip address.

Configure Asterisk

(Re)Configure the Asterisk HTTP Server

The CMP2K software needs to be served by a TLS capable web server.  The easiest way to do this by far is to simply use Asterisk's built-in HTTP server.  Here's what we need to add...

Code Block
; Existing definition
; Add the following if not already present
; Allow the HTTP server to serve static content from /var/lib/asterisk/static-http
enablestatic = yes
; Create an alias that will allow us to easily load the client in a web browser.
redirect = /cmp2k /static/cyber_mega_phone_2k/index.html

Restart Asterisk or issue the CLI command "config reload /etc/asterisk/http.conf"

Now check that the configuration was applied.  From the Asterisk CLI...

Code Block
titleAsterisk CLI
*CLI> http show status
HTTP Server Status:
Server: Asterisk/GIT-16-a84c257cd6
Server Enabled and Bound to [::]:8088

HTTPS Server Enabled and Bound to [::]:8089

Enabled URI's:
/test_media_cache/... => HTTP Media Cache Test URI
/guimohdir_rh => HTTP POST mapping
/httpstatus => Asterisk HTTP General Status
/phoneprov/... => Asterisk HTTP Phone Provisioning Tool
/amanager => HTML Manager Event Interface w/Digest authentication
/backups => HTTP POST mapping
/arawman => Raw HTTP Manager Event Interface w/Digest authentication
/manager => HTML Manager Event Interface
/rawman => Raw HTTP Manager Event Interface
/static/... => Asterisk HTTP Static Delivery
/amxml => XML Manager Event Interface w/Digest authentication
/mxml => XML Manager Event Interface
/moh => HTTP POST mapping
/ari/... => Asterisk RESTful API
/ws => Asterisk HTTP WebSocket

Enabled Redirects:
  /cmp2k => /static/cyber_mega_phone_2k/index.html


Notice that there's a new Redirect entry.  

For security reasons, the HTTP server will not serve arbitrary paths so the  /static/cyber_mega_phone_2k/index.html path will actually resolve to is /var/lib/asterisk/static-http/cyber_mega_phone_2k/index.html.  You can either move the CMP2K directory that you downloaded to /var/lib/asterisk/static-http or you can simply create a symlink to it as follows:

Code Block
titleShell Prompt
# cd /var/lib/asterisk/static-http
# ln -s /usr/src/asterisk/cyber_mega_phone_2k

OK, let's test.  From your web browser, visit remembering to substitute your hostname or ip address as appropriate.

Did you get?...


(Re)Configure PJSIP

In the Configuring Asterisk for WebRTC Clients tutorial, you created a PJSIP Endpoint named "webrtc_client".  We need to modify that definition for our purposes.

Code Block
; We need to allow more codecs.
; vp8, vp9 and h264 are video pass-through codecs.
; No special Asterisk modules are required to support them.
; Since video conferencing makemakes use of the Streams functionality added in Asterisk 15
; Wewe need to indicate the maximum number of streams allowed for audio and video.
max_audio_streams = 1
max_video_streams = 2015

There are two more Asterisk changes we need to make so no need to restart Asterisk just yet.

Configure app_confbridge

The sample confbridge.conf file is enough to get you going with one exception.  In the default_bridge section, we need to set video_mode=sfu.

Code Block
; other stuff
; SFU is Selective Forwarding Mode
; Basically all participant's video streams are relayed to all other participants.
video_mode = sfu

One more change...

Configure extensions.conf

Now we need to configure an extension that, when dialed, will put us into the video conference bridge, so add the following to extensions.conf

Code Block
exten = my_video_conference,1,Confbridge(MYCONF,default_bridge,default_user,sample_user_menu)

NOW, restart Asterisk!

Join the Conference Bridge!

Open a browser window and visit remembering to substitute your hostname or ip address as appropriate.

You should be back at the page you  got when you tested earlier...

Click the Account button and fill in the details as follows...

Now click anywhere outside the edit box or click the X in the upper right corner to save the information and you'll be be back to the previous page.

Now click Connect and you should see the button change to Disconnect

You should have also seen an == Endpoint webrtc_client is now Reachable message on the Asterisk console (if you were looking).

Finally, click Call...

You may be prompted to allow access to your microphone and camera.  If so, allow them both.

Now, did you hear the You are the only person in this conference prompt?  Do you see yourself in the video preview window?

That's it!

Bonus Points

Have a friend or co-worker join the bridge.  They can use the same webrtc_client credentials.