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.
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| Feature | Plugin | In the default build |
|---|---|---|
plugin-echotest | EchoTest | yes |
plugin-recordplay | RecordPlay | yes |
plugin-videoroom | VideoRoom | |
plugin-videocall | VideoCall | |
plugin-streaming | Streaming | |
plugin-textroom | TextRoom | |
plugin-audiobridge | AudioBridge | |
plugin-sip | SIP | |
plugin-nosip | NoSIP | |
plugin-lua | Lua scripting | |
plugin-duktape | JavaScript 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
target/debug/janus --configs-folder=/path/to/confThe 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.
| What | How |
|---|---|
| Stop | Ctrl-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 level | debug_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 else | Command line, janus.jcfg. |
Ports the server opens
| Port | Opened by | Config |
|---|---|---|
| 8088 | Janus API over HTTP | general.port in janus.transport.http.jcfg |
| 7088 | Admin API over HTTP, off by default | admin.admin_port, admin.admin_http |
| 8188 | Janus API over WebSockets | general.ws_port in janus.transport.websockets.jcfg |
| 7188 | Admin API over WebSockets, off by default | admin.admin_ws_port, admin.admin_ws |
| UDP, random | ICE, one socket per peer connection | media.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.
# 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 onThe 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.