WebRTC was designed to be a peer to peer communication system. However, it gives rise to a complicated mesh system when the number of participants increases. A Selective Forwarding Unit (SFU) is an alternate topology for connecting through a centralized server to route outgoing media streams from one to many users. 

Peer to Peer WebRTC Stream
Multi-point Peer to Peer WebRTC Stream

The multi-party peer to peer party configuration leads to enormous strain on a user machine to send and receive multiple streams from multiple peers and keep them in sync even in heterogeneous network conditions. Also it creates network congestion.

Mesh Topology

A useful, innovative approach

An SFU becomes very useful to manage medium sized conferences. In this architecture, every participant sends their outgoing stream to a centralized server that decides which other participants will receive the stream. It has the significant advantage of reducing the uplink strain on a client’s machine as well as being suited for heterogeneous networks.

SFU is an innovative approach to designing scalable conferences even for asymmetric networks and endpoints. 

  • SFU is more comparable to a media proxy than a media server 
  • SFU is suitable only when all the endpoints are using the same codec. SFU is usually the preferred setup for WebRTC conferences up to 20 participants.
SFU Topology

Drawbacks of SFU 

  • Even though both SFU and MCU can be thought of as centralized RTP topologies, when compared to MCU which mixes (re-encodes and rescales) the media  suited for all endpoints, SFU has a higher carbon footprint. 
  • Additionally the quality of stream delivered by SFU is dependent on the quality of the media stream each participant sends towards the SFU.
  • Since the number of incoming streams is still proportional to the number of participants in the confern, a single SFU is not a good approach for large active speaker based conferences.

Installation and Setup of Asterisk for Video SFU

Docker File for this experiment is available at https://github.com/agilityfeat/Energyefficient_WebRTC_Asterisk_systems

Manual Setup involves getting source code from Asterisk Repo and following the instructions below.

contrib/scripts/install_prereq install
./configure --with-jansson-bundled
sudo Make && make install


Generate keys (can use self signed, LetsEncrypt or even from trusted vendors such as GoDaddy).

Asterisk also provides a utility script, ast_tls_cert in its contrib/scripts source directory to make own self signed certs.

> sudo contrib/scripts/ast_tls_cert -C telcopoc.com -O "telcopoc" -d /etc/asterisk/keys

mini-HTTP server 

Modify http.conf:

Add tls support:

Check status on console:

*CLI> http show status
HTTP Server Status:
Server: Asterisk
Server Enabled and Bound to
HTTPS Server Enabled and Bound to
Enabled URI's:
/httpstatus => Asterisk HTTP General Status
/phoneprov/... => Asterisk HTTP Phone Provisioning Tool
/metrics/... => Prometheus Metrics URI
/ari/... => Asterisk RESTful API
/ws => Asterisk HTTP WebSocket
Enabled Redirects:

Check status on web:

Don’t forget to allow access is using self signed certs for secure web socket transport! Screenshot below.

Secure Websocket support 


endpoint for Webrtc Clients 

   ; 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
   ; vp8, vp9 and h264 are video pass-through codecs.
   max_audio_streams = 1
   max_video_streams = 15

Conf with SFU Video Mode 

In confbridge.conf

video_mode = sfu

In extensions.conf

exten => 7000,1,Answer()
  same => n,ConfBridge(sfuconfbridge)
  same => n,Hangup()

WebRTC Clients 

Using jssip for 2 clients (https://tryit.jssip.net/

configurung Asterisk WebRTC endpoint for JSSIP
Screenshot of two-party SFU call via Asterisk Video SFU mode

For Multiparty conference trials, one can use Cyber Mega Phone 2K Ultimate Dynamic Edition browser side client application by Digium.

configurung Asterisk WebRTC endpoint for Cyber Mega Phone 2K Ultimate Dynamic Edition
Acreenshot of 5 participant SFU call via Asterisk Video SFU mode

Latencies and Delays

About the Author

Next up 

Stay tuned for the next part in the series, “Analyzing compute and energy consumption of the most popular video conferencing topologies”. We will walk through a detailed analysis of RTP topologies for SIP telephony systems.

WebRTC.ventures can help build awesome custom video solutions for business, emergency preparedness or to revolutionize work for remote and distributed teams. Get it touch at https://webrtc.ventures/contact/.

Recent Blog Posts