Skip to main content

mod_janus

About

mod_janus is available from the github repo https://github.com/freeswitch/mod%5Fjanus

See the README in that repo for up to date documentation.

The mod_janus endpoint provides an interface to the Janus audiobridge (https://janus.conf.meetecho.com/docs/audiobridge.html).

This allows legacy POTS to join the same room as the WebRTC users that are already supported by Janus.

The module will only support audio calls - video calls will be rejected. The long polling HTTP interface is used in communication with Janus. No provision is given to the Websocket interface.

Click here to expand Table of Contents

Build Module

Make sure the following line is present and uncommented in /usr/src/freeswitch/modules.conf:

endpoints/mod_janus

Then build and install mod_janus:

make mod_janus-install

For freeBSD, use gmake.

If you have installed SSL after building the janus module, you will need to re-bootstrap, re-configure and re-build freeswitch.

Run 'fs_cli'.

load mod_janus

Enable Module

Uncomment the following in modules.conf.xml:

<load module="mod_janus"/>

Sample Configuration File

If called with the following dialstring ("{janus-use-existing-room=true}janus/demo/MyName@1234) this configuration file should allow you to test using the Janus audiobridge demo (https://janus.conf.meetecho.com/audiobridgetest.html)

<configuration name="janus.conf" description="Janus Endpoint">
<settings>
<param name="debug" value="false"/>
</settings>

<server name="demo">
<param name="url" value="https://janus.conf.meetecho.com/janus"/>
<!-- <param name="secret" value="the-secret"/> -->
<param name="enabled" value="true"/>
<param name="rtp-ip" value="$${bind_server_ip}"/>
<!-- <param name="apply-candidate-acl" value="localnet.auto"/> -->
<!-- <param name="local-network-acl" value="localnet.auto"/> -->
<param name="ext-rtp-ip" value="auto-nat"/>
<param name="codec-string" value="opus"/>
</server>
</configuration>

Channel Variables

The following channel variables are defined:

  • janus-use-existing-room - By default the module will create the room, if this flag is set then the caller is joined to an existing room.

  • janus-room-description - This is a textual description of the room specified in the *create* request to Janus (only applicable if janus-use-existing-room is false)

  • janus-room-record - The value is specified in the *create* request to Janus and indicates that the room mix should be recorded (only applicable if janus-use-existing-room is false). The default value is not to record.

  • janus-room-record-file - This value specifies the file name to which the recording should be written. It is passed in the *create* request to Janus (only applicable if janus-use-existing-room is false and janus-room-record is true). If omitted the default filename will be used.

  • janus-user-record - Janus should generate a file containing the audio from the user only. It is specified in the *configure* request. The default value is not to record.

  • janus-user-record-file - This specifies the base of the filename used when recording the user audio stream. If omitted the default filename will be used.

  • janus-start-muted - Included in the *confifigure* request to indicate that the user should enter the room muted (no mechanism exists in the module to modify the mute status later). The default value is that the user should not be muted.

Configuration

The configuration file consists of two sections:

  1. A settings section that currently only contains the debug flag, and
  2. A list of Janus servers to connect to. Multiple servers may be defined the module can route calls to any of them.

Each server contains the following fields:

  • name - is the internal name given to the server that must be specified in the dial string.
  • url - is the address of the server
  • secret - is the API secret required by Janus (if it has been enabled on the Janus end)
  • enabled - defines if the server should be brought into service when the module starts. This state may be modified by the console API. The default is false.
  • rtp-ip - see mod_sofia
  • ext-rtp-ip - see mod_sofia
  • apply-candidate-acl - see mod_sofia (default is none)
  • local-network-acl - see mod_sofia (default is "localnet.auto")
  • codec-string - the list of codecs that should be offered to Janus. Should always be Opus which is the default.

Console API

The following commands are available on the console API:

  • janus debug [true|false] - enables debug on/off
  • janus list - lists all the servers with the following values: name, enabled, total calls, calls in progress, start timestamp (usec) and the internal server id
  • janus server <name> [enable|disable] - set the server active or inactive. NB because we have to wait for the long poll to complete this may take around 30 seconds.
  • janus status - totalled for all servers the following are reported: total calls, calls in progress, start timestamp (usec)

Dialstring

The dial string is composed of the following parts:

/janus/<server>/<display name>@<room>