WebRTC with Livekit

The WebRTC conversation service and its componen

This guide walks you through deploying webrtc-server using https://github.com/Conv-AI/webrtc-server/tree/mainarrow-up-right . You’ll need two domains:

  1. vm.example.com – main WebRTC server

  2. vm-turn.example.com – TURN server

The repo supports two deployment methods and includes the build_vm_init.sh helper script to generate a vm_init.sh setup script.

TLS with Caddy

1. Networking Requirements

Please ensure the following ports are accessible on the server

  • 443 - primary HTTPS and TURN/TLS

  • 7881 - for WebRTC over TCP

  • 3478/UDP - for TURN/UDP

  • 50000-60000/UDP - for WebRTC over UDP

2. Configure TLS certificates for caddy

mkdir /opt/livekit/certs

Place certificates and configure caddy.yaml with cert locations and configure domains

3. Configure livekit.yaml

set turn domain, api key and api secret

Example generated script

NLB terminated TLS

  1. Configure livekit.yaml turn domain, api key and secret

  2. Networking Requirements Please ensure the following ports are accessible on the vm

  • 7880 - primary server - tcp

  • 5349 - TURN/TLS - tcp

  • 7881 - for WebRTC over TCP

  • 3478/UDP - for TURN/UDP

  • 50000-60000/UDP - for WebRTC over UDP

3. VM target groups:

  1. 7880:TCP

  2. 5349:TCP

4. Create NLBs

  1. NLB1- vm.example.comarrow-up-right - Listening on TLS 443 - forward to 7880:TCP

  2. NLB2- vm-turn.example.comarrow-up-right - Listening on TLS 443 - 5349:TCP

Example generated script

WrbRTC Server

Once we have livekit setup completed, we can continue with the WebRTC Core service setup.

Image:

Environment Variable Setup

Create a .env file in your system. Lets assume a webrtc-server.env file exists at /var/secrets. Fill the file with the required configurations as specified by the team. Here is some sample data..

Container Deployment:

Run the following docker command to start the server:

Last updated