Janus WebRTC Server
Janus is an open source, general purpose, WebRTC server designed and developed by Meetecho. This version of the server is tailored for Linux systems, although it can be compiled for, and installed on, MacOS machines as well. Windows is not supported, but if that's a requirement, Janus is known to work in the "Windows Subsystem for Linux" on Windows 10: do NOT trust repos that provide .exe builds of Janus, they are not official and will not be supported.
For some online demos and documentations, make sure you pay the project website a visit!
Note well: this is the main branch for the
multistreamversion of Janus, which is the new version. If you want to check the legacy version of Janus instead (i.e.,0.x, a.k.a. "legacy") click here instead.
If you have questions on Janus, or wish to discuss Janus with us and other users, please join our Community. If you encounter bugs, please submit an issue on GitHub: make sure you read the guidelines before opening an issue or a pull request, though.
To install it, you'll need to satisfy the following dependencies:
These are optional dependencies, depending on which features you're interested in:
A couple of plugins depend on a few more libraries (you only need to install the ones for the plugins you need):
All of those libraries are usually available on most of the most common distributions. Installing these libraries on a recent Fedora, for instance, is very simple:
yum install libmicrohttpd-devel jansson-devel \
openssl-devel libsrtp-devel sofia-sip-devel glib2-devel \
opus-devel libogg-devel libcurl-devel pkgconfig \
libconfig-devel libtool autoconf automakeNotice that you may have to yum install epel-release as well if you're attempting an installation on a CentOS machine instead.
On Ubuntu or Debian, it would require something like this:
apt install libmicrohttpd-dev libjansson-dev \
libssl-dev libsofia-sip-ua-dev libglib2.0-dev \
libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \
libconfig-dev pkg-config libtool automakeWhile libnice is typically available in most distros as a package, the version available out of the box in Ubuntu is known to cause problems. As such, we always recommend manually compiling and installing the master version of libnice.
To build libnice, you need Python 3, Meson and Ninja:
git clone https://gitlab.freedesktop.org/libnice/libnice
cd libnice
meson --prefix=/usr build && ninja -C build && sudo ninja -C build installpkg-config --cflags --libs nice to make sure Janus can find the right installation. If that fails, you may need to set the PKG_CONFIG_PATH environment variable prior to compiling Janus, e.g., export PKG_CONFIG_PATH=/path/to/libnice/lib/pkgconfigIn case you're interested in compiling the sample Event Handler plugin, you'll need to install the development version of libcurl as well (usually libcurl-devel on Fedora/CentOS, libcurl4-openssl-dev on Ubuntu/Debian).
If your distro ships a pre-1.5 version of libsrtp, you'll have to uninstall that version and install 1.5.x, 1.6.x or 2.x manually. In fact, 1.4.x is known to cause several issues with WebRTC. While 1.5.x is supported, we recommend installing 2.x instead. Notice that the following steps are for version 2.2.0, but there may be more recent versions available:
wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz
tar xfv v2.2.0.tar.gz
cd libsrtp-2.2.0
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make installNotice that the --enable-openssl part is important, as it's needed for AES-GCM support. As an alternative, you can also pass --enable-nss to have libsrtp use NSS instead of OpenSSL. A failure to configure libsrtp with either might cause undefined references when starting Janus, as we'd be trying to use methods that aren't there.
The Janus configure script autodetects which one you have installed and links to the correct library automatically, choosing 2.x if both are installed. If you want 1.5 or 1.6 to be picked (which is NOT recommended), pass --disable-libsrtp2 when configuring Janus to force it to use the older version instead.
--libdir=/usr/lib64 to the configure script if you're installing on a x86_64 distribution.If you want to make use of BoringSSL instead of OpenSSL (e.g., because you want to take advantage of --enable-dtls-settimeout), you'll have to manually install it to a specific location. Use the following steps:
git clone https://boringssl.googlesource.com/boringssl
cd boringssl
# Don't barf on errors
sed -i s/" -Werror"//g CMakeLists.txt
# Build
mkdir -p build
cd build
cmake -DCMAKE_INSTALL_PREFIX=/opt/boringssl -DCMAKE_CXX_FLAGS="-lrt" ..
make
sudo make installOnce the library is installed, you'll have to pass an additional --enable-boringssl flag to the configure script, as by default Janus will be built assuming OpenSSL will be used. By default, Janus expects BoringSSL to be installed in /opt/boringssl -- if it's installed in another location, pass the path to the configure script as such: --enable-boringssl=/path/to/boringssl If you were using OpenSSL and want to switch to BoringSSL, make sure you also do a make clean in the Janus folder before compiling with the new BoringSSL support. If you enabled BoringSSL support and also want Janus to detect and react to DTLS timeouts with faster retransmissions, then pass --enable-dtls-settimeout to the configure script too.
CCLD=c++ for any make command to build Janus itself.For what concerns usrsctp, which is needed for Data Channels support, it is usually not available in repositories, so if you're interested in them (support is optional) you'll have to install it manually. It is a pretty easy and standard process:
git clone https://github.com/sctplab/usrsctp
cd usrsctp
./bootstrap
./configure --prefix=/usr --disable-programs --disable-inet --disable-inet6
make && sudo make install--libdir=/usr/lib64 to the configure script if you're installing on a x86_64 distribution.The same applies for libwebsockets, which is needed for the optional WebSockets support. If you're interested in supporting WebSockets to control Janus, as an alternative (or replacement) to the default plain HTTP REST API, you'll have to install it manually:
git clone https://libwebsockets.org/repo/libwebsockets
cd libwebsockets
# If you want the stable version of libwebsockets, uncomment the next line
# git checkout v4.3-stable
mkdir build
cd build
# See https://github.com/meetecho/janus-gateway/issues/732 re: LWS_MAX_SMP
# See https://github.com/meetecho/janus-gateway/issues/2476 re: LWS_WITHOUT_EXTENSIONS
cmake -DLWS_MAX_SMP=1 -DLWS_WITHOUT_EXTENSIONS=0 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make installNote: if libwebsockets.org is unreachable for any reason, replace the first line with this:
The same applies for Eclipse Paho MQTT C client library, which is needed for the optional MQTT support. If you're interested in integrating MQTT channels as an alternative (or replacement) to HTTP and/or WebSockets to control Janus, or as a carrier of Janus Events, you can install the latest version with the following steps:
git clone https://github.com/eclipse/paho.mqtt.c.git
cd paho.mqtt.c
make && sudo make installIn case you're interested in Nanomsg support, you'll need to install the related C library. It is usually available as an easily installable package in pretty much all repositories. The following is an example on how to install it on Ubuntu:
aptitude install libnanomsg-devFinally, the same can be said for rabbitmq-c as well, which is needed for the optional RabbitMQ support. In fact, several different versions of the library can be found, and the versions usually available in most distribution repositories are not up-do-date with respect to the current state of the development. As such, if you're interested in integrating RabbitMQ queues as an alternative (or replacement) to HTTP and/or WebSockets to control Janus, you can install the latest version with the following steps:
git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git submodule init
git submodule update
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make && sudo make install--libdir=/usr/lib64 to the configure script if you're installing on a x86_64 distribution.To conclude, should you be interested in building the Janus documentation as well, you'll need some additional tools too:
On Fedora:
yum install doxygen graphv[1.x] double free in janus_websockets.c
[1.4.1] Fix missing TWCC feedback for audio-only publishers
[1.x] Incorrectly handled Compound Packets for RTCP mean that not all parts of the compound packet get correctly processed when recieved.
[1.4] Janus crashes with general protection fault in kernel log
1.4.1 Problem with Janus in (NC Talk Backend)
[0.x, 1.x] Race condition in janus_plugin_close_pc_internal() causes SIGSEGV (use-after-free)
[1.3.3] VideoRoom: H.265 simulcast from browser is detected but not relayed (PLI loop, no video delivered)
[1.x] crash on videoroom
[1.x] Segmentation fault in AudioBridge
[1.x] segfault on opus_decode