RTCD Setup and Configuration

This guide provides detailed instructions for setting up, configuring, and validating a Mattermost Calls deployment using the dedicated RTCD service.

Prerequisites

Before deploying RTCD, ensure you have:

  • A Mattermost Enterprise license

  • A server or VM with sufficient CPU and network capacity (see the Performance section for sizing guidance)

Network Requirements

The following network connectivity is required:

Service Ports Protocols Source Target Purpose
API (Calls plugin) 80,443 TCP (incoming) Mattermost clients (web/desktop/mobile) Mattermost instance (Calls plugin) To allow for HTTP and WebSocket connectivity from clients to Calls plugin. This API is exposed on the same connection as Mattermost, so there's likely no need to change anything.
RTC (Calls plugin or rtcd) 8443 UDP (incoming) Mattermost clients (Web/Desktop/Mobile) and calls-offloader Mattermost instance or rtcd service To allow clients to establish connections that transport calls related media (e.g. audio, video). This should be open on any network component (e.g. NAT, firewalls) in between the instance running the plugin (or rtcd) and the clients joining calls so that UDP traffic is correctly routed both ways (from/to clients).
RTC (Calls plugin or rtcd) 8443 TCP (incoming) Mattermost clients (Web/Desktop/Mobile) and calls-offloader Mattermost instance or rtcd service To allow clients to establish connections that transport calls related media (e.g. audio, video). This should be open on any network component (e.g. NAT, firewalls) in between the instance running the plugin (or rtcd) and the clients joining calls so that TCP traffic is correctly routed both ways (from/to clients). This can be used as a backup channel in case clients are unable to connect using UDP. It requires rtcd version >= v0.11 and Calls version >= v0.17.
API (rtcd) 8045 TCP (incoming) Mattermost instance(s) (Calls plugin) rtcd service To allow for HTTP/WebSocket connectivity from Calls plugin to rtcd service. Can be expose internally as the service only needs to be reachable by the instance(s) running the Mattermost server.
STUN (Calls plugin or rtcd) 3478 UDP (outgoing) Mattermost Instance(s) (Calls plugin) or rtcd service Configured STUN servers (Optional) To allow for either Calls plugin or rtcd service to discover their instance public IP. Only needed if configuring STUN/TURN servers. This requirement does not apply when manually setting an IP or hostname through the ICE Host Override config option.

Installation and Deployment

There are multiple ways to deploy RTCD, depending on your environment. We recommend the following order based on production readiness and operational control:

Docker Deployment

Docker deployment is suitable for development, testing, or containerized production environments:

  1. Run the RTCD container with basic configuration:

    docker run -d --name rtcd \
      -e "RTCD_LOGGER_ENABLEFILE=true" \
      -p 8443:8443/udp \
      -p 8443:8443/tcp \
      -p 8045:8045/tcp \
      mattermost/rtcd:latest
    

    Note

    If you optionally use the RTCD_API_SECURITY_ALLOWSELFREGISTRATION setting, please note that it defaults to false. If enabled, it allows anyone who can connect to the service on the API port (8045) to successfully initiate calls. Understand the security implications of this setting before enabling it.

  2. For debugging purposes, you can enable more detailed logging:

    docker run -d --name rtcd \
      -e "RTCD_LOGGER_ENABLEFILE=true" \
      -e "RTCD_LOGGER_CONSOLELEVEL=DEBUG" \
      -p 8443:8443/udp \
      -p 8443:8443/tcp \
      -p 8045:8045/tcp \
      mattermost/rtcd:latest
    

    To view the logs:

    docker logs -f rtcd
    

You can also use a mounted configuration file instead of environment variables:

docker run -d --name rtcd \
  -p 8045:8045 \
  -p 8443:8443/udp \
  -p 8443:8443/tcp \
  -v /path/to/config.toml:/rtcd/config/config.toml \
  mattermost/rtcd:latest

For a complete sample configuration file, see the RTCD config.sample.toml in the official repository.

Kubernetes Deployment

For detailed information on deploying RTCD in Kubernetes environments, including Helm chart configurations, resource requirements, and scaling considerations, see the Calls Deployment on Kubernetes guide.

Configuration

RTCD Configuration File

The RTCD service uses a TOML configuration file. Mattermost recommends using the official config.sample.toml as your base configuration file.

Note

A notable setting to be aware of is ice_host_override under the [rtc] section. You may need to configure this setting explicitly, particularly when RTCD is deployed behind NAT, in complex network topologies, or when automatic address discovery via STUN is unreliable. Setting ice_host_override directly to your server’s public IP address or hostname is the preferred approach.

TURN Configuration

For clients behind strict firewalls, you may need to configure TURN servers. In the RTCD configuration file, reference your TURN servers as follows:

[rtc]
# TURN server configuration
   ice_servers = [
     { urls = ["turn:turn.example.com:3478"], username = "turnuser", credential = "turnpassword" }
   ]

We recommend using coturn for your TURN server implementation.

System Tuning

For high-volume deployments, tune your Linux system:

  1. Add the following to /etc/sysctl.conf:

    # Increase UDP buffer sizes
    net.core.rmem_max = 16777216
    net.core.wmem_max = 16777216
    net.core.optmem_max = 16777216
    
  2. Apply the settings:

    sudo sysctl -p
    

Validation and Testing

After deploying RTCD, validate the installation:

  1. Check service status and version:

    curl http://YOUR_RTCD_SERVER:8045/version
    # Should return a JSON object with service information
    # Example: {"build_hash":"abc123","build_date":"2023-01-15T12:00:00Z","build_version":"0.11.0","goVersion":"go1.20.4"}
    
  2. Test UDP connectivity:

    Before testing, ensure the RTCD service is stopped, as it binds to the same port.

    sudo systemctl stop rtcd
    

    On the RTCD server:

    nc -l -u -p 8443
    

    On a client machine:

    nc -v -u YOUR_RTCD_SERVER 8443
    

    Type a message and hit Enter on either side. If messages are received on both ends, UDP connectivity is working.

  3. Test TCP connectivity (if enabled):

    Similar to the UDP test, but remove the -u flag from both commands.

  4. Monitor metrics:

    Refer to Calls Metrics and Monitoring for setting up Calls metrics and monitoring.

Horizontal Scaling

To scale RTCD horizontally:

  1. Deploy multiple RTCD instances:

    Deploy multiple RTCD servers, each with their own unique IP address.

  2. Configure DNS-based load balancing:

    Set up a DNS record that points to multiple RTCD IP addresses:

    rtcd.example.com.    IN A    10.0.0.1
    rtcd.example.com.    IN A    10.0.0.2
    rtcd.example.com.    IN A    10.0.0.3
    
  3. Configure health checks:

    Set up health checks to automatically remove unhealthy RTCD instances from DNS.

  4. Configure Mattermost:

    In the Mattermost System Console, set the RTCD Service URL to your DNS name (e.g., rtcd.example.com).

The Mattermost Calls plugin will distribute calls among the available RTCD hosts. Remember that a single call will always be hosted on one RTCD instance; sessions belonging to the same call are not spread across different instances.

Integration with Mattermost

Once RTCD is properly set up and validated, configure Mattermost to use it:

  1. Go to System Console > Plugins > Calls

  2. Enable the Enable RTCD Service option

  3. Set the RTCD Service URL to your RTCD service address (either a single server or DNS load-balanced hostname). Ensure you provide any generated credentials formulated in the URI (e.g., http://clientID:authKey@rtcd.local). For detailed capability/credential configuration, reference the RTCD Service URL documentation.

  4. Save the configuration

  5. Test by creating a new call in any Mattermost channel

  6. Verify that the call is being routed through RTCD by checking the RTCD logs and metrics

Other Calls Documentation

For detailed Mattermost Calls configuration options, see the Calls Plugin Configuration Settings documentation.