An SFU/MCU integration for
heterogeneous environments
Building a SIP/WebRTC conferencing system with Janus
and FreeSWITCH
Giacomo Vacca - RTC Architect at Nexmo
Introduction
Overview
Janus and FreeSWITCH are two open source real-time communications
projects that can be used to build conferencing systems.
Among other things, Janus implements an SFU (Selective Forwarding Unit).
FreeSWITCH includes a conference module, which works as MCU (Multipoint
Control Unit).
Often we are asked to build solutions integrating existing applications and
services: this presentation shows an approach and example.
The three big integration points
WebRTC / SIP
SFU / MCU
Janus / FreeSWITCH
About me
Started working in the VoIP area in 2001, and since have worked for Truphone,
Libon and others, while currently on the SIP infrastructure at Nexmo.
User, promoter and contributor of open source projects in the RTC field.
I design and maintain solutions based on Kamailio, FreeSWITCH, Asterisk,
RTPEngine, Janus, Homer, and love debugging/troubleshooting.
About Nexmo
Nexmo provides API for RTC: messaging, voice, video, and many other features.
The SIP stack connects the Nexmo Voice API with the external world (SIP
customers and PSTN carriers).
Programmable SIP and SIP Connect: Link a DID to an application, reach it from
PSTN or SIP, and program the user experience of your customers.
The core SIP stack is built on Kamailio, Asterisk, nginx, with Voice API providing
the main features with FreeSWITCH. Hepic (Homer) for troubleshooting and
QoS analysis.
Try it out!
https://www.nexmo.com/voice
Coupon code:
JNCNX19
with €10 credit, available from Sep 22nd to Oct 25th.
Why combining MCU and SFU?
MCU integrates features on the server - heavier processing -
more suitable for traditional/mobile clients
SFU routes streams but delegates features to clients - lighter
processing - suitable for modern browsers
About FreeSWITCH
FS as MCU and gateway to SIP/PSTN
FS implements an MCU with mod_conference
FS also integrates SIP clients (and so PSTN) and
WebRTC clients (via mod_verto) directly.
Currently FS does not offer an SFU approach.
FS is widely adopted as B2BUA and conference
server.
The MCU approach allows for creative mixing of
audio/video.
A single stream for the entire conference is well
suited for mobile clients and other “traditional”
VoIP clients.
Not just SIP
endpoints
FS supports:
- SIP endpoints
- PSTN GWs
- WebRTC clients (verto protocol)
- WebSockets to exchange media
- Opus
- Transcoding
About FS and opus:
https://freeswitch.org/confluence/display/FREESWI
TCH/FreeSWITCH+And+The+Opus+Audio+Codec
FS operations for this project
SIP and verto
At ClueCon 2014 on using Kamailio and FS to
build a WebRTC service:
https://www.slideshare.net/GiacomoVacca/top-
5-challenges-to-add-web-calls-to-truphone-voip-
platform
JsSIP + WebSocket + Ephemeral Auth + coturn
verto protocol:
- JSON-based, exchanging SDP and
other call information
- verto.invite, verto.media, verto.answer,
verto.bye, verto.attach
Great documentation here:
http://evoluxbr.github.io/verto-docs/
FS - mod_conference
- Conferencing (MCU)
- Recording
- Whisper, ASR
- Opus + Opus at low sample rate for
PSTN*
- Canvas composition
- Single stream to each participant
- Transcoding
- Mute/Unmute streams (see relate
later)
* About Opus session negotiation:
https://www.giacomovacca.com/2016/09/opus-negotiation-for-practical-man.html
About Janus
How does the Janus Videoroom work?
SFU implementation
Subscriber/Publisher pattern
“A router of streams”
Lightweight processing of streams
Many opportunities to design the UI
on the client side
Main operations:
- Client creates a transaction
- Attaches to the plugin (PeerConnection)
- Joins a room (as a Publisher once or as a
Subscriber many times)
- Configure audio (then exchange media)
The PoC
PoC - High level architecture
FreeSWITCH Janus
Controller
API
verto(W
ebSocket)
WebRTC
Client
SIP Client
SIP
RTP/SRTP
ESL(TCP)
DTLS SRTP
PC
,
D
TLS
SRTP
Web Server HTTPS
Controller application
The controller application for the PoC is written in nodejs.Any other
technology can be used.
There are many libraries implementing Janus and FS clients.
e.g. https://janus.conf.meetecho.com/docs/resources#stacks
Connects to FS as a verto client (WebSocket) and to the ESL interface (TCP).
Connects to Janus HTTP API (or over WebSocket).
Expected RTP flow 1/2
FreeSWITCH Janus
SIP Client
A
SIP Client
B
WebRTC
Client
C
WebRTC
Client
D
A
C
D
C
D
DA
A
A
CD
C
Expected RTP flow 2/2
FreeSWITCH Janus
SIP Client
A
SIP Client
B
WebRTC
Client
C
WebRTC
Client
D
A
B
C
D
C
D
D
C
A
A
A
CD
AB
AB
AB
BCD
ACD
FS becomes a Publisher
FreeSWITCH Janus
SIP Client
A
Controller
1. INVITE SDPa
2. 200 SDPfsa
4. verto.invite
SDPfsb
5.create/attach/offer SDPfsb
6. answer SDPja
7.verto.answer SDPja
8. ICE + DTLS3. RTP
9. DTLS SRTP
FS becomes a Publisher
Note: “sendonly” and
“trickle”: false, otherwise
Janus will keep waiting for
ICE candidates from FS and
never start the DTLS
negotiation.
FS becomes a Subscriber
FreeSWITCH Janus
Controller
6. verto.media
SDPf
3. attach/join
4. attached
SDPjc
1. C
8. ICE + DTLS
9. DTLS SRTP
WebRTC
Client
C
5. verto.invite SDPjc
2. publishers list
7. start room
SDPf
FS becomes a subscriber
“trickle”: false, otherwise
Janus will keep waiting for
ICE candidates from FS.
Prestidigitation with the streams
- In an SFU model streams are separate
- An MCU mixes the streams
- WebRTC clients receive already streams from Janus directly
FS needs to eliminate the streams from WebRTC clients for the feeds towards
other WebRTC clients
- ‘relate’ function in mod_conference. “nospeak” option.
Testing it
Demo
Code used for the PoC:
https://github.com/giavac/janus_freeswitch_integration
Can this be
achieved in a
different way?
An MCU plugin could be developed for Janus.
An SFU module could be developed for FS.
Likely these solutions would be more cohesive
and efficient, but would require a larger
development effort.
To be evaluated case by case.
Performance assessment was out of scope in
this PoC.
Browsers support/compatibility also to be
verified.
Scalability
Performance was not in the scope of this PoC. However…
Another benefit of this modularity is that Janus and FS can scale
independently.
Each one with its own best practice (farming/clustering for FS, cascading for
Janus).
Not considered in this PoC
Many things!
- Creating and configuring rooms in Janus
- Clustering of FS and Janus instances (scaling)
- Dynamic dialplan in FS
- ...
Integrating Janus and FS
can bring the best of two
worlds together.
Think of this as an option
when building a
conferencing system in an
heterogeneous environment.
References
FS verto documentation: http://evoluxbr.github.io/verto-docs/
Janus VideoRoom documentation: https://janus.conf.meetecho.com/docs/videoroom
RFC 7667, https://tools.ietf.org/html/rfc7667 - RTP Topologies
“FreeSWITCH 1.8”, A. Minessale, G. Maruzzelli, Packt
Thanks!
Get in touch:
@giavac
https://www.linkedin.com/in/gia
comovacca/

An SFU/MCU integration for heterogeneous environments

  • 1.
    An SFU/MCU integrationfor heterogeneous environments Building a SIP/WebRTC conferencing system with Janus and FreeSWITCH Giacomo Vacca - RTC Architect at Nexmo
  • 2.
  • 3.
    Overview Janus and FreeSWITCHare two open source real-time communications projects that can be used to build conferencing systems. Among other things, Janus implements an SFU (Selective Forwarding Unit). FreeSWITCH includes a conference module, which works as MCU (Multipoint Control Unit). Often we are asked to build solutions integrating existing applications and services: this presentation shows an approach and example.
  • 4.
    The three bigintegration points WebRTC / SIP SFU / MCU Janus / FreeSWITCH
  • 5.
    About me Started workingin the VoIP area in 2001, and since have worked for Truphone, Libon and others, while currently on the SIP infrastructure at Nexmo. User, promoter and contributor of open source projects in the RTC field. I design and maintain solutions based on Kamailio, FreeSWITCH, Asterisk, RTPEngine, Janus, Homer, and love debugging/troubleshooting.
  • 6.
    About Nexmo Nexmo providesAPI for RTC: messaging, voice, video, and many other features. The SIP stack connects the Nexmo Voice API with the external world (SIP customers and PSTN carriers). Programmable SIP and SIP Connect: Link a DID to an application, reach it from PSTN or SIP, and program the user experience of your customers. The core SIP stack is built on Kamailio, Asterisk, nginx, with Voice API providing the main features with FreeSWITCH. Hepic (Homer) for troubleshooting and QoS analysis.
  • 7.
    Try it out! https://www.nexmo.com/voice Couponcode: JNCNX19 with €10 credit, available from Sep 22nd to Oct 25th.
  • 8.
    Why combining MCUand SFU? MCU integrates features on the server - heavier processing - more suitable for traditional/mobile clients SFU routes streams but delegates features to clients - lighter processing - suitable for modern browsers
  • 9.
  • 10.
    FS as MCUand gateway to SIP/PSTN FS implements an MCU with mod_conference FS also integrates SIP clients (and so PSTN) and WebRTC clients (via mod_verto) directly. Currently FS does not offer an SFU approach. FS is widely adopted as B2BUA and conference server. The MCU approach allows for creative mixing of audio/video. A single stream for the entire conference is well suited for mobile clients and other “traditional” VoIP clients.
  • 11.
    Not just SIP endpoints FSsupports: - SIP endpoints - PSTN GWs - WebRTC clients (verto protocol) - WebSockets to exchange media - Opus - Transcoding About FS and opus: https://freeswitch.org/confluence/display/FREESWI TCH/FreeSWITCH+And+The+Opus+Audio+Codec
  • 12.
    FS operations forthis project SIP and verto At ClueCon 2014 on using Kamailio and FS to build a WebRTC service: https://www.slideshare.net/GiacomoVacca/top- 5-challenges-to-add-web-calls-to-truphone-voip- platform JsSIP + WebSocket + Ephemeral Auth + coturn verto protocol: - JSON-based, exchanging SDP and other call information - verto.invite, verto.media, verto.answer, verto.bye, verto.attach Great documentation here: http://evoluxbr.github.io/verto-docs/
  • 13.
    FS - mod_conference -Conferencing (MCU) - Recording - Whisper, ASR - Opus + Opus at low sample rate for PSTN* - Canvas composition - Single stream to each participant - Transcoding - Mute/Unmute streams (see relate later) * About Opus session negotiation: https://www.giacomovacca.com/2016/09/opus-negotiation-for-practical-man.html
  • 14.
  • 15.
    How does theJanus Videoroom work? SFU implementation Subscriber/Publisher pattern “A router of streams” Lightweight processing of streams Many opportunities to design the UI on the client side Main operations: - Client creates a transaction - Attaches to the plugin (PeerConnection) - Joins a room (as a Publisher once or as a Subscriber many times) - Configure audio (then exchange media)
  • 16.
  • 17.
    PoC - Highlevel architecture FreeSWITCH Janus Controller API verto(W ebSocket) WebRTC Client SIP Client SIP RTP/SRTP ESL(TCP) DTLS SRTP PC , D TLS SRTP Web Server HTTPS
  • 18.
    Controller application The controllerapplication for the PoC is written in nodejs.Any other technology can be used. There are many libraries implementing Janus and FS clients. e.g. https://janus.conf.meetecho.com/docs/resources#stacks Connects to FS as a verto client (WebSocket) and to the ESL interface (TCP). Connects to Janus HTTP API (or over WebSocket).
  • 19.
    Expected RTP flow1/2 FreeSWITCH Janus SIP Client A SIP Client B WebRTC Client C WebRTC Client D A C D C D DA A A CD C
  • 20.
    Expected RTP flow2/2 FreeSWITCH Janus SIP Client A SIP Client B WebRTC Client C WebRTC Client D A B C D C D D C A A A CD AB AB AB BCD ACD
  • 21.
    FS becomes aPublisher FreeSWITCH Janus SIP Client A Controller 1. INVITE SDPa 2. 200 SDPfsa 4. verto.invite SDPfsb 5.create/attach/offer SDPfsb 6. answer SDPja 7.verto.answer SDPja 8. ICE + DTLS3. RTP 9. DTLS SRTP
  • 22.
    FS becomes aPublisher Note: “sendonly” and “trickle”: false, otherwise Janus will keep waiting for ICE candidates from FS and never start the DTLS negotiation.
  • 23.
    FS becomes aSubscriber FreeSWITCH Janus Controller 6. verto.media SDPf 3. attach/join 4. attached SDPjc 1. C 8. ICE + DTLS 9. DTLS SRTP WebRTC Client C 5. verto.invite SDPjc 2. publishers list 7. start room SDPf
  • 24.
    FS becomes asubscriber “trickle”: false, otherwise Janus will keep waiting for ICE candidates from FS.
  • 25.
    Prestidigitation with thestreams - In an SFU model streams are separate - An MCU mixes the streams - WebRTC clients receive already streams from Janus directly FS needs to eliminate the streams from WebRTC clients for the feeds towards other WebRTC clients - ‘relate’ function in mod_conference. “nospeak” option.
  • 26.
  • 27.
    Demo Code used forthe PoC: https://github.com/giavac/janus_freeswitch_integration
  • 28.
    Can this be achievedin a different way? An MCU plugin could be developed for Janus. An SFU module could be developed for FS. Likely these solutions would be more cohesive and efficient, but would require a larger development effort. To be evaluated case by case. Performance assessment was out of scope in this PoC. Browsers support/compatibility also to be verified.
  • 29.
    Scalability Performance was notin the scope of this PoC. However… Another benefit of this modularity is that Janus and FS can scale independently. Each one with its own best practice (farming/clustering for FS, cascading for Janus).
  • 30.
    Not considered inthis PoC Many things! - Creating and configuring rooms in Janus - Clustering of FS and Janus instances (scaling) - Dynamic dialplan in FS - ...
  • 31.
    Integrating Janus andFS can bring the best of two worlds together. Think of this as an option when building a conferencing system in an heterogeneous environment.
  • 32.
    References FS verto documentation:http://evoluxbr.github.io/verto-docs/ Janus VideoRoom documentation: https://janus.conf.meetecho.com/docs/videoroom RFC 7667, https://tools.ietf.org/html/rfc7667 - RTP Topologies “FreeSWITCH 1.8”, A. Minessale, G. Maruzzelli, Packt
  • 33.