Skip to content

Instantly share code, notes, and snippets.

@kylebakerio
Created August 20, 2020 01:26
Show Gist options
  • Save kylebakerio/201da3e7f4f6bcdcfa41bfe212a90990 to your computer and use it in GitHub Desktop.
Save kylebakerio/201da3e7f4f6bcdcfa41bfe212a90990 to your computer and use it in GitHub Desktop.

1. Installing Janus

https://github.com/meetecho/janus-gateway Note: might try this next time: https://snapcraft.io/install/janus-gateway/debian

1.a Dependencies (ubuntu here)

aptitude install libmicrohttpd-dev libjansson-dev \
	libssl-dev libsrtp-dev libsofia-sip-ua-dev libglib2.0-dev \
	libopus-dev libogg-dev libcurl4-openssl-dev liblua5.3-dev \
	libconfig-dev pkg-config gengetopt libtool automake

** ATTEMPT NOTE: libsrtp-dev is not available in debian 10, only deb 9; deb 10 seems to ship with libsrtp2-dev ** ** ATTEMPT NOTE: apt, not aptitude, for debian 10 **

1.a.i libnice

"While 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 install

** ATTEMPT NOTE: libnice is not in debian 10 repos, Debian 10 has libnice10. Looking at instructions here to consider installing from stretch repo ** ** ATTEMPT NOTE: need to install meson ** ** ... attempting: git clone https://github.com/mesonbuild/meson.git -> cd meson -> ./meson.py ** ** https://github.com/mesonbuild/meson.git** ** ATTEMPT NOTE: no ninja in repos; perhaps replaced by ninja-build ? yup, apt install ninja-build allowed the meson line above to work **

Note: Make sure you remove the distro version first, or you'll cause conflicts between the installations. In case you want to keep both for some reason, for custom installations of libnice you can also run pkg-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/pkgconfig"

1.a.ii libsrtp

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

~~
wget https://github.com/cisco/libsrtp/archive/v1.5.4.tar.gz
tar xfv v1.5.4.tar.gz
cd libsrtp-1.5.4
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
~~

** ATTEMPT NOTE: no libsrtp in debian 10, will try to install version 2.2 listed here... ** The instructions for version 2.x are practically the same. 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 install

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

1.a.iii usrsctp (data channels?)

** ATTEMPT NOTE: not at all clear if we need this... I'll assume so, since we need data channels if it is supported (again, not clear based on conversations whether mozilla's approach uses an entirely different channels implementation at this moment). will do this for now. **

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 && make && sudo make install

Note: you may need to pass --libdir=/usr/lib64 to the configure script if you're installing on a x86_64 distribution. ** ATTEMPT NOTE: did not pass this. **

1.a.iv

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:

** ATTEMPT NOTE: I think we need this based on comment in janus plugin repo suggesting they assume user will use websockets. I'm going to go ahead and use the 3.2 stable **

git clone https://libwebsockets.org/repo/libwebsockets
cd libwebsockets
# If you want the stable version of libwebsockets, uncomment the next line
# git checkout v3.2-stable
mkdir build
cd build
# See https://github.com/meetecho/janus-gateway/issues/732 re: LWS_MAX_SMP
cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make install

Note: if libwebsockets.org is unreachable for any reason, replace the first line with this:

git clone https://github.com/warmcat/libwebsockets.git

1.b install

Once you have installed all the dependencies, get the code:

git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway

1.c generate config

Then just use:

sh autogen.sh to generate the configure file. After that, configure and compile as usual to start the whole compilation process:

./configure --prefix=/opt/janus
make
make install

Since Janus requires configuration files for both the core and its modules in order to work, you'll probably also want to install the default configuration files to use, which you can do this way:

make configs Remember to only do this once, or otherwise a subsequent make configs will overwrite any configuration file you may have modified in the meanwhile.

1.d

Test it out locally at this stage!

** ATTEMPT NOTES ** Just trying to go into the folder and running ./janus seemed to get it to try, but it wouldn't find the folders it needed. Couldn't find plugins folder, so I found a command line option to point that one in the call. That worked, but then it couldn't find the transport folder.

Further digging, found the config file, and I see where the default locations are listed. /opt/janus/etc/janus/janus.jcfg Just running ./janus in its original folder still doesn't work though. Will try explicitly pointing to this config file now:

still not working... ./janus -F /opt/janus/etc/janus/

turned all file paths into absolute file paths. Now it seems to find them, but I get No Janus API transport is available... enable at least one and restart Janus I've seen this read somewhere, will look it up...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment