Skip to content

Build and run ​

How the server is put together at build time, how to start it, and what it needs from the machine.

Build ​

The server is one binary, janus, in the janus/ crate. Plugins are Cargo features, as the C build has --enable-* flags. Transports, event handlers and the JSON logger are always compiled in and switch on from their config files.

sh
cargo build -p janus                                  # EchoTest and RecordPlay only
cargo build -p janus --features "plugin-videoroom plugin-videocall plugin-streaming plugin-textroom plugin-audiobridge plugin-nosip plugin-sip"
cargo build --release -p janus --features "..."       # optimised build, target/release/janus
FeaturePluginIn the default build
plugin-echotestEchoTestyes
plugin-recordplayRecordPlayyes
plugin-videoroomVideoRoom
plugin-videocallVideoCall
plugin-streamingStreaming
plugin-textroomTextRoom
plugin-audiobridgeAudioBridge
plugin-sipSIP
plugin-nosipNoSIP
plugin-luaLua scripting
plugin-duktapeJavaScript scripting (Boa, not Duktape)

plugin-lua compiles a vendored Lua with your C compiler (ADR-0008), and Opus goes through libopus bindings (ADR-0007). The project's purity gate still reports every package that is allowed to compile C. See Test and verify.

A plugin that is compiled in but whose config names no script, such as Lua or Duktape, logs plugin ... is not loaded and is left out of info. A plugin you did not compile in is simply absent. Either way a request to attach to it gets error 460.

Run ​

sh
target/debug/janus --configs-folder=/path/to/conf

The server needs a folder of .jcfg files. Plugins are inside the binary, so there is nothing to load from disk, but the server keeps C's checks: if janus.jcfg sets plugins_folder (or transports_folder), that folder must exist, even if empty, or the server stops with Couldn't access plugins folder... (verified). Left unset, the defaults are only logged.

WhatHow
StopCtrl-C, or SIGTERM. It prints Stopping server, please wait... and closes plugins and transports in order.
Config folder--configs-folder=path (default ./conf), or one file with --config=filename.
Log leveldebug_level in janus.jcfg, -d 0..7 on the command line, or the Admin request set_log_level while running.
Daemon-b or daemonize = true, with -p or pid_file for the PID file.
Everything elseCommand line, janus.jcfg.

Ports the server opens ​

PortOpened byConfig
8088Janus API over HTTPgeneral.port in janus.transport.http.jcfg
7088Admin API over HTTP, off by defaultadmin.admin_port, admin.admin_http
8188Janus API over WebSocketsgeneral.ws_port in janus.transport.websockets.jcfg
7188Admin API over WebSockets, off by defaultadmin.admin_ws_port, admin.admin_ws
UDP, randomICE, one socket per peer connectionmedia.rtp_port_range in janus.jcfg or -r min-max

Those are the sample defaults. HTTP and WebSockets only start when their file sets http = true or ws = true. At least one Janus API transport must be on, or the server stops with No Janus API transport is available.

Behind NAT

A server on a private address warns Janus is deployed on a private address ... but you didn't specify any STUN server. For a server reached from the internet set nat.stun_server, or nat.nat_1_1_mapping for a known public address, exactly as for the C server.

mDNS candidates from browsers

Browsers that hide their LAN address behind an .local mDNS name (Chrome without camera permission, Safari, Firefox by default) cannot connect to this server yet: its ICE agent never pairs .local remote candidates. A page that has camera or microphone permission sends real addresses and works. The status page and the Bench results track this.

The C oracle image ​

Parity work compares this server with the original one, built from the pinned commit in Docker.

sh
# context: a checkout of the C repo at bc0de3b3, without .git
docker build -f parity/oracle/Dockerfile.oracle --build-arg ORACLE_COMMIT=bc0de3b3 -t janus-c:bc0de3b3 ../januscaler-janus-gateway
docker run --rm -p 8088:8088 -p 7088:7088 janus-c:bc0de3b3   # the C server, every sample config switched on

The image has every sample config enabled and a self-signed DTLS certificate, so it runs as it is. Capture tools start containers named janus-cap-* and remove them again. The harness page has the rest.

GPL-3.0-or-later, like the Janus gateway it ports.