Skip to end of metadata
Go to start of metadata

Introduction

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.

 

 

 

Prerequisites

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.  Don't forget, Asterisk 15.5 or better is required.

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 https://github.com/asterisk/cyber_mega_phone_2k.  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 pbx.example.com 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...

/etc/asterisk/http.conf

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

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

Asterisk CLI

 

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:

Shell Prompt

OK, let's test.  From your web browser, visit https://pbx.example.com:8089/cmp2k remembering to substitute your hostname or ip address as appropriate.

Did you get?...

Great.  

(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.

/etc/asterisk/pjsip.conf

You may already have some of the config from previous webrtc endpoints for certificates, keys, encryption, ice support etc and think you don't need to add the magical webrtc=yes but you do! The webrtc=yes flag does more than just shortcut already existing flags which are needed for proper SFU support.

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.

/etc/asterisk/confbridge.conf

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

/etc/asterisk/extensions.conf

NOW, restart Asterisk!

Join the Conference Bridge!

Open a browser window and visit  https://pbx.example.com:8089/cmp2k 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.

Recommendations

If you experience audio issues, it may be a good idea to turn on the jitterbuffer. This can cause the audio to be slightly delayed, but will also eliminate problems such as bursty audio packets causing disruptions. You can enable this option in confbridge.conf for a user, or you can do it through the dialplan before placing the user in the conference by using the JITTERBUFFER dialplan function for a more fine tuned experience.

 

  • No labels

3 Comments

  1. Esse tutorial não funciona a conta PJSIP, tiver que seguir esse exemplo para consegui autenticar:

    Configuring Asterisk for WebRTC Clients

    1. Quais parâmetros você precisou alterar?

      1. Usei dessa forma, porem não vejo video das outras pessoas que estão na conferencia somente audios das outras pessoas e o meu próprio video:

        [webrtc_client]
        type=aor
        max_contacts=5
        remove_existing=yes

        [webrtc_client]
        type=auth
        auth_type=userpass
        username=webrtc_client
        password=webrtc_client ; This is a completely insecure password! Do NOT expose this
        ; system to the Internet without utilizing a better password.

        [webrtc_client]
        type=endpoint
        aors=webrtc_client
        auth=webrtc_client
        dtls_auto_generate_cert=yes
        webrtc=yes
        ; Setting webrtc=yes is a shortcut for setting the following options:
        ; use_avpf=yes
        ; media_encryption=dtls
        ; dtls_verify=fingerprint
        ; dtls_setup=actpass
        ; ice_support=yes
        ; media_use_received_transport=yes
        ; rtcp_mux=yes
        context=default
        disallow=all
        allow=ulaw,h264
        max_audio_streams = 1
        max_video_streams = 15