---
title: Configuring Asterisk as a WebRTC SFU Media Server – WebRTC.ventures
description: SFU has become a popular WebRTC topology for connecting through a centralized server to support a medium-sized VoIP conference. Altanai reviews the differences between Mesh, MCU and SFU for handling media streams and demonstrates Asterisk's SFU configuration for WebRTC endpoints.
image: https://blog.webrtc.ventures/hubfs/Imported_Blog_Media/Configuring-Asterisk-as-a-WebRTC-SFU-Media-Server.png
---

[Skip to content](https://blog.webrtc.ventures/2022/02/asterisk-webrtc-sfu-media-server#main-content)

![WebRTC.ventures](https://blog.webrtc.ventures/hubfs/logo-main-light.svg)

- [WebRTC Services](https://webrtc.ventures/webrtc-development-services/)
  
  Show submenu for WebRTC Services 
  
    - [Assess](https://webrtc.ventures/services/assess/)
    - [Build](https://webrtc.ventures/services/build/)
    - [Integrate](https://webrtc.ventures/services/integrate/)
    - [Test](https://webrtc.ventures/services/test/)
    - [Manage](https://webrtc.ventures/services/manage/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
- Our Partners
  
  Show submenu for Our Partners 
  
    - [Amazon Chime SDK](https://webrtc.ventures/partners/amazon-chime-sdk/)
- Stories of Success
  
  Show submenu for Stories of Success 
  
    - [Remote Video Interpreting Platform with Agent Routing](https://webrtc.ventures/successes/remote-video-translation-platform/)
    - [WebRTC to SIP Gateway for ASL Interpreters](https://webrtc.ventures/successes/webrtc-to-sip-gateway-for-asl-interpreters/)
    - [Audio Listening Device to Improve Surgical Outcomes](https://webrtc.ventures/successes/audio-listening-device-to-improve-surgical-outcomes/)
    - [Albania’s First Telemedicine Platform](https://webrtc.ventures/successes/albanias-first-telemedicine-platform/)
    - [Automated Video Storytelling with the Amazon Chime SDK](https://webrtc.ventures/successes/automated-video-storytelling-with-the-amazon-chime-sdk/)
    - [Large Scale Video Conferencing](https://webrtc.ventures/successes/large-scale-video-conferencing/)
    - [Broadcasting and Webcast Control Room](https://webrtc.ventures/successes/live-video-broadcasting-and-webcast-control-room/)
- WebRTC Resources
  
  Show submenu for WebRTC Resources 
  
    - [WebRTC Live](https://webrtc.ventures/webrtc-live/)
    - [WebRTC Tips](https://www.youtube.com/playlist?list=PLayYqdnyegt3QvxX-Rt6wbFIK8727Z5Oz)
    - [WebRTC.ventures Blog](https://webrtc.ventures/blog/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
    - [WebRTC.ventures Training Program](https://webrtc.ventures/webrtc-ventures-training-program/)
- [About Us](https://webrtc.ventures/our-team/)
  
  Show submenu for About Us 
  
    - [Blog](https://webrtc.ventures/blog/)
    - [Our Team](https://webrtc.ventures/our-team/)
    - [Jobs](https://webrtc.ventures/jobs/)

Open main navigation

Close main navigation

- [WebRTC Services](https://webrtc.ventures/webrtc-development-services/)
  
  Show submenu for WebRTC Services 
  
    - [Assess](https://webrtc.ventures/services/assess/)
    - [Build](https://webrtc.ventures/services/build/)
    - [Integrate](https://webrtc.ventures/services/integrate/)
    - [Test](https://webrtc.ventures/services/test/)
    - [Manage](https://webrtc.ventures/services/manage/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
- Our Partners
  
  Show submenu for Our Partners 
  
    - [Amazon Chime SDK](https://webrtc.ventures/partners/amazon-chime-sdk/)
- Stories of Success
  
  Show submenu for Stories of Success 
  
    - [Remote Video Interpreting Platform with Agent Routing](https://webrtc.ventures/successes/remote-video-translation-platform/)
    - [WebRTC to SIP Gateway for ASL Interpreters](https://webrtc.ventures/successes/webrtc-to-sip-gateway-for-asl-interpreters/)
    - [Audio Listening Device to Improve Surgical Outcomes](https://webrtc.ventures/successes/audio-listening-device-to-improve-surgical-outcomes/)
    - [Albania’s First Telemedicine Platform](https://webrtc.ventures/successes/albanias-first-telemedicine-platform/)
    - [Automated Video Storytelling with the Amazon Chime SDK](https://webrtc.ventures/successes/automated-video-storytelling-with-the-amazon-chime-sdk/)
    - [Large Scale Video Conferencing](https://webrtc.ventures/successes/large-scale-video-conferencing/)
    - [Broadcasting and Webcast Control Room](https://webrtc.ventures/successes/live-video-broadcasting-and-webcast-control-room/)
- WebRTC Resources
  
  Show submenu for WebRTC Resources 
  
    - [WebRTC Live](https://webrtc.ventures/webrtc-live/)
    - [WebRTC Tips](https://www.youtube.com/playlist?list=PLayYqdnyegt3QvxX-Rt6wbFIK8727Z5Oz)
    - [WebRTC.ventures Blog](https://webrtc.ventures/blog/)
    - [Migrating From Twilio Video](https://webrtc.ventures/twilio-video/)
    - [WebRTC.ventures Training Program](https://webrtc.ventures/webrtc-ventures-training-program/)
- [About Us](https://webrtc.ventures/our-team/)
  
  Show submenu for About Us 
  
    - [Blog](https://webrtc.ventures/blog/)
    - [Our Team](https://webrtc.ventures/our-team/)
    - [Jobs](https://webrtc.ventures/jobs/)
- [Contact us](https://webrtc.ventures/contact/)

[Contact us](https://webrtc.ventures/contact/)

 Feb 1, 2022 12:00:00 AM

# Configuring Asterisk as a WebRTC SFU Media Server

![Picture of Jen Oppenheimer](https://blog.webrtc.ventures/hs-fs/hubfs/Our-Team-Jen.jpg?width=50&name=Our-Team-Jen.jpg) [Jen Oppenheimer](https://blog.webrtc.ventures/author/jen-oppenheimer)

Share: [linkedin-in icon](http://www.linkedin.com/shareArticle?mini=true&url=https://blog.webrtc.ventures/2022/02/asterisk-webrtc-sfu-media-server) [X Twitter icon](https://twitter.com/intent/tweet?url=https://blog.webrtc.ventures/2022/02/asterisk-webrtc-sfu-media-server) [envelope icon](mailto:?body=https://blog.webrtc.ventures/2022/02/asterisk-webrtc-sfu-media-server)

[WebRTC](https://webrtc.ventures/2021/01/what-is-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](https://webrtc.ventures/2020/12/webrtc-media-servers-sfus-vs-mcus/)) is an alternate topology for connecting through a centralized server to route outgoing media streams from one to many users. 

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A1-2.jpg?width=512&height=254&name=A1-2.jpg) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A1-2.jpg?width=512&height=254&name=A1-2.jpg)

 Peer to Peer WebRTC Stream

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A2-3.png?width=512&height=325&name=A2-3.png) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A2-3.png?width=512&height=325&name=A2-3.png)

 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.

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A3-1.png?width=512&height=328&name=A3-1.png) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A3-1.png?width=512&height=328&name=A3-1.png)

 Mesh Topology

## A useful, innovative approach

An SFU becomes very useful to manage medium sized conferences. [In this architecture](https://webrtc.ventures/2021/12/how-to-architect-webrtc-application/), 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.

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A4-3.jpg?width=512&height=328&name=A4-3.jpg) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A4-3.jpg?width=512&height=328&name=A4-3.jpg)

 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](https://github.com/agilityfeat/Energyefficient_WebRTC_Asterisk_systems)

**Manual Setup** involves getting source code from [Asterisk Repo](https://downloads.asterisk.org/pub/telephony/asterisk/) and following the instructions below.

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

```
contrib/scripts/install_prereq install
```

```
./configure --with-jansson-bundled
```

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

```
sudo Make && make install
```

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

## **Certificates **

Generate keys (can use self signed, [LetsEncrypt](https://letsencrypt.org/) or even from trusted vendors such as [GoDaddy](https://www.godaddy.com/)).

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
```

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

# mini-HTTP server 

Modify http.conf:

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

Add tls support:

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

Check status on console:

```
*CLI> http show status
HTTP Server Status:
Prefix: 
Server: Asterisk
Server Enabled and Bound to 0.0.0.0:8088
HTTPS Server Enabled and Bound to 0.0.0.0:8089
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:
  None.
```

Check status on web:

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A5-1-2.png?width=512&height=324&name=A5-1-2.png) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A5-1-2.png?width=512&height=324&name=A5-1-2.png)

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

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A6-1.png?width=512&height=250&name=A6-1.png) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/A6-1.png?width=512&height=250&name=A6-1.png)

## Secure Websocket support 

```
[transport-wss]
type=transport
protocol=wss
bind=0.0.0.0
```

endpoint for Webrtc Clients 

```
[webrtc_client]
   type=aor
   max_contacts=5
   remove_existing=yes
[webrtc_client]
   type=auth
   auth_type=userpass
   username=webrtc_client
   password=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=public
   disallow=all
   ; vp8, vp9 and h264 are video pass-through codecs.
   allow=opus,g722,ulaw,vp9,vp8,h264
   max_audio_streams = 1
   max_video_streams = 15
```

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

# Conf with SFU Video Mode 

In confbridge.conf

```
[default_bridge]
type=bridge
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/](https://tryit.jssip.net/)) 

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

 configurung Asterisk WebRTC endpoint for JSSIP

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

 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](https://github.com/asterisk/cyber_mega_phone_2k) browser side client application by Digium.

![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png) ![](https://static.hsstatic.net/BlogImporterAssetsUI/ex/missing-image.png)

 configurung Asterisk WebRTC endpoint for Cyber Mega Phone 2K Ultimate Dynamic Edition

![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/SFU-1024x756-1.png?width=1024&height=756&name=SFU-1024x756-1.png) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/SFU-1024x756-1.png?width=1024&height=756&name=SFU-1024x756-1.png)

 Acreenshot of 5 participant SFU call via Asterisk Video SFU mode

Latencies and Delays

**About the Author**

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/author-Altanai-2-Apr-03-2024-06-16-15-5207-PM.jpg?width=867&height=335&name=author-Altanai-2-Apr-03-2024-06-16-15-5207-PM.jpg) ![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/author-Altanai-2-Apr-03-2024-06-16-15-5207-PM.jpg?width=867&height=335&name=author-Altanai-2-Apr-03-2024-06-16-15-5207-PM.jpg)](https://www.linkedin.com/in/altanai/)

# 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](https://webrtc.ventures/contact/) can help build awesome [custom video solutions](https://webrtc.ventures/custom-applications/) for business, emergency preparedness or to revolutionize work for remote and distributed teams. Get it touch at [https://webrtc](https://webrtc.ventures/contact/)[.](https://webrtc.ventures/contact/)[ventures/contact/](https://webrtc.ventures/contact/).

[CPaaS](https://blog.webrtc.ventures/tag/cpaas), [Managed Services](https://blog.webrtc.ventures/tag/managed-services), [Events](https://blog.webrtc.ventures/tag/events), [Video Conferencing](https://blog.webrtc.ventures/tag/video-conferencing), [Real Time Weekly](https://blog.webrtc.ventures/tag/real-time-weekly), [WebRTC Architecture](https://blog.webrtc.ventures/tag/webrtc-architecture), [Broadcasting](https://blog.webrtc.ventures/tag/broadcasting), [Medical](https://blog.webrtc.ventures/tag/medical), [WebRTC Live](https://blog.webrtc.ventures/tag/webrtc-live), [Showcase](https://blog.webrtc.ventures/tag/showcase), [Thoughts](https://blog.webrtc.ventures/tag/thoughts), [Vonage](https://blog.webrtc.ventures/tag/vonage), [Daily](https://blog.webrtc.ventures/tag/daily), [Jobs](https://blog.webrtc.ventures/tag/jobs), [Contact Centers](https://blog.webrtc.ventures/tag/contact-centers), [Telehealth](https://blog.webrtc.ventures/tag/telehealth), [Education](https://blog.webrtc.ventures/tag/education), [Technical](https://blog.webrtc.ventures/tag/technical), [General](https://blog.webrtc.ventures/tag/general), [Story of success](https://blog.webrtc.ventures/tag/story-of-success), [The WebRTC.ventures Blog](https://blog.webrtc.ventures/tag/the-webrtc-ventures-blog), [Testing](https://blog.webrtc.ventures/tag/testing), [Gaming](https://blog.webrtc.ventures/tag/gaming), [DevOps](https://blog.webrtc.ventures/tag/devops), [Symbl.ai](https://blog.webrtc.ventures/tag/symbl-ai)

## Related posts

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/faceoverlay-1.png?height=200&name=faceoverlay-1.png)](https://blog.webrtc.ventures/2017/02/kurento-asterisk-powerful-couple)

## [Kurento and Asterisk: A powerful couple](https://blog.webrtc.ventures/2017/02/kurento-asterisk-powerful-couple)

[Germán Goldenstein](https://blog.webrtc.ventures/author/germán-goldenstein) 

 Feb 8, 2017 12:00:00 AM

Using Kurento media server provides extra value to a WebRTC video call. In addition to the common...

[Read more](https://blog.webrtc.ventures/2017/02/kurento-asterisk-powerful-couple)

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/Using-Ansible-to-Run-Your-WebRTC-Asterisk-Based-Application-2.png?height=200&name=Using-Ansible-to-Run-Your-WebRTC-Asterisk-Based-Application-2.png)](https://blog.webrtc.ventures/2019/11/using-ansible-to-run-your-webrtc-asterisk-based-application)

## [Using Ansible to Run Your WebRTC Asterisk-Based Application](https://blog.webrtc.ventures/2019/11/using-ansible-to-run-your-webrtc-asterisk-based-application)

[Hector Zelaya](https://blog.webrtc.ventures/author/hector-zelaya) 

 Nov 19, 2019 12:00:00 AM

An important element of a DevOps philosophy is automation. When it comes to automating server...

[Read more](https://blog.webrtc.ventures/2019/11/using-ansible-to-run-your-webrtc-asterisk-based-application)

[![](https://blog.webrtc.ventures/hs-fs/hubfs/Imported_Blog_Media/Energy-Efficiency-in-WebRTC-Video-Conferencing-Topologies.png?height=200&name=Energy-Efficiency-in-WebRTC-Video-Conferencing-Topologies.png)](https://blog.webrtc.ventures/2022/02/energy-efficiency-webrtc-topoplogies)

## [Energy Efficiency in WebRTC Video Conferencing Topologies](https://blog.webrtc.ventures/2022/02/energy-efficiency-webrtc-topoplogies)

![Picture of Jen Oppenheimer](https://blog.webrtc.ventures/hs-fs/hubfs/Our-Team-Jen.jpg?width=50&name=Our-Team-Jen.jpg) [Jen Oppenheimer](https://blog.webrtc.ventures/author/jen-oppenheimer) 

 Feb 23, 2022 12:00:00 AM

In my previous blog post, we saw how the SFU (single forwarding unit) saves on the network...

[Read more](https://blog.webrtc.ventures/2022/02/energy-efficiency-webrtc-topoplogies)

### WebRTC.Ventures Services

...

- Assess
- Build
- Integrate
- Test
- Deploy & Manage

### Contact Us

...

**Video should be an opportunity, not a headache.**   
 We’re here to build, integrate, assess and optimize, test, and even deploy and manage your live video application. 

[Contact us](https://blog.webrtc.ventures/2022/02/asterisk-webrtc-sfu-media-server#contact)

### WebRTC Live

...

 View [past episodes](https://blog.webrtc.ventures/webrtc-live/) of our webinar interview series about the latest webRTC use cases and technical updates. Join our mailing list to learn about upcoming episodes! 

![WebRTC Live](https://blog.webrtc.ventures/hs-fs/hubfs/Template%20Images/widged-bannet.webp?height=90&name=widged-bannet.webp)

![logo-main-light](https://blog.webrtc.ventures/hubfs/logo-main-light.svg "logo-main-light")

We’re one of the few agencies in the world dedicated to WebRTC development. This dedication and experience is why so many people trust us to help bring live video application dreams to life.

 

### Let's get started!

###### **[Contact us today](https://webrtc.ventures/contact/)**

**[info@webrtc.ventures](mailto:info@webrtc.ventures)**

<https://www.linkedin.com/company/webrtc-ventures> <https://www.youtube.com/@WebrtcVentures>

### Join our mailing list

We don't e-mail often (a few times a month max), and it will be worth it when we do! Of course, we respect your privacy and will not share your contact information.

© 2023 WebRTC.ventures, an [AgilityFeat](https://agilityfeat.com/) company / [Privacy Policy](https://webrtc.ventures/privacy-policy//)

```json
{
  "@context" : "https://schema.org",
  "@type" : "BlogPosting",
  "author" : {
    "@type" : "Person",
    "name" : "Jen Oppenheimer",
    "url" : "https://blog.webrtc.ventures/author/jen-oppenheimer"
  },
  "dateModified" : "2024-04-03T18:20:23.370Z",
  "datePublished" : "2022-02-01T05:00:00.000Z",
  "headline" : "Configuring Asterisk as a WebRTC SFU Media Server – WebRTC.ventures",
  "image" : [ "https://blog.webrtc.ventures/hubfs/Imported_Blog_Media/Configuring-Asterisk-as-a-WebRTC-SFU-Media-Server.png" ],
  "mainEntityOfPage" : {
    "@id" : "https://blog.webrtc.ventures/2022/02/asterisk-webrtc-sfu-media-server",
    "@type" : "WebPage"
  },
  "publisher" : {
    "@type" : "Organization",
    "logo" : {
      "@type" : "ImageObject",
      "url" : "https://blog.webrtc.ventures/hubfs/logo-main-light.svg"
    }
  }
}
```