diff --git a/docs/video-jitsi.md b/docs/video-jitsi.md new file mode 100644 index 00000000..1b6788d4 --- /dev/null +++ b/docs/video-jitsi.md @@ -0,0 +1,572 @@ +# Jitsi Meet Integration Configuration Guide + +This guide explains how to configure Reflector to use your self-hosted Jitsi Meet installation for video meetings, recording, and participant tracking. + +## Overview + +Jitsi Meet is an open-source video conferencing platform that can be self-hosted. Reflector integrates with Jitsi Meet to: + +- Create secure meeting rooms with JWT authentication +- Track participant join/leave events via Prosody webhooks +- Record meetings using Jibri recording service +- Process recordings for transcription and analysis + +## Requirements + +### Self-Hosted Jitsi Meet + +You need a complete Jitsi Meet installation including: + +1. **Jitsi Meet Web Interface** - The main meeting interface +2. **Prosody XMPP Server** - Handles room management and authentication +3. **Jicofo (JItsi COnference FOcus)** - Manages media sessions +4. **Jitsi Videobridge (JVB)** - Handles WebRTC media routing +5. **Jibri Recording Service** - Records meetings (optional but recommended) + +### System Requirements + +- **Domain with SSL Certificate** - Required for WebRTC functionality +- **Prosody mod_event_sync** - For webhook event handling +- **JWT Authentication** - For secure room access control +- **Storage Solution** - For recording files (local or cloud) + +## Configuration Variables + +Add the following environment variables to your Reflector `.env` file: + +### Required Variables + +```bash +# Jitsi Meet Domain (without https://) +JITSI_DOMAIN=meet.example.com + +# JWT Secret for room authentication (generate with: openssl rand -hex 32) +JITSI_JWT_SECRET=your-64-character-hex-secret-here + +# Webhook secret for event handling (generate with: openssl rand -hex 16) +JITSI_WEBHOOK_SECRET=your-32-character-hex-secret-here +``` + +### Optional Variables + +```bash +# Application identifier (should match Jitsi configuration) +JITSI_APP_ID=reflector + +# JWT issuer and audience (should match Jitsi configuration) +JITSI_JWT_ISSUER=reflector +JITSI_JWT_AUDIENCE=jitsi +``` + +## Installation Steps + +### 1. Jitsi Meet Server Installation + +#### Quick Installation (Ubuntu/Debian) + +```bash +# Add Jitsi repository +curl -fsSL https://download.jitsi.org/jitsi-key.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/jitsi-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/" | sudo tee /etc/apt/sources.list.d/jitsi-stable.list + +# Install Jitsi Meet +sudo apt update +sudo apt install jitsi-meet + +# Configure SSL certificate +sudo /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh +``` + +#### Docker Installation + +```bash +# Clone Jitsi Docker repository +git clone https://github.com/jitsi/docker-jitsi-meet +cd docker-jitsi-meet + +# Copy environment template +cp env.example .env + +# Edit configuration +nano .env + +# Start services +docker-compose up -d +``` + +### 2. JWT Authentication Setup + +#### Update Prosody Configuration + +Edit `/etc/prosody/conf.d/your-domain.cfg.lua`: + +```lua +VirtualHost "meet.example.com" + authentication = "token" + app_id = "reflector" + app_secret = "your-jwt-secret-here" + + -- Allow anonymous access for guests + c2s_require_encryption = false + admins = { "focusUser@auth.meet.example.com" } + + modules_enabled = { + "bosh"; + "pubsub"; + "ping"; + "roster"; + "saslauth"; + "tls"; + "dialback"; + "disco"; + "carbons"; + "pep"; + "private"; + "blocklist"; + "vcard"; + "version"; + "uptime"; + "time"; + "ping"; + "register"; + "admin_adhoc"; + "token_verification"; + "event_sync"; -- Required for webhooks + } +``` + +#### Configure Jitsi Meet Interface + +Edit `/etc/jitsi/meet/your-domain-config.js`: + +```javascript +var config = { + hosts: { + domain: 'meet.example.com', + muc: 'conference.meet.example.com' + }, + + // Enable JWT authentication + enableUserRolesBasedOnToken: true, + + // Recording configuration + fileRecordingsEnabled: true, + liveStreamingEnabled: false, + + // Reflector integration settings + prejoinPageEnabled: true, + requireDisplayName: true +}; +``` + +### 3. Webhook Event Configuration + +#### Install Event Sync Module + +```bash +# Download the module +cd /usr/share/jitsi-meet/prosody-plugins/ +wget https://raw.githubusercontent.com/jitsi-contrib/prosody-plugins/main/mod_event_sync.lua +``` + +#### Configure Event Sync + +Add to your Prosody configuration: + +```lua +Component "conference.meet.example.com" "muc" + storage = "memory" + modules_enabled = { + "muc_meeting_id"; + "muc_domain_mapper"; + "polls"; + "event_sync"; -- Enable event sync + } + + -- Event sync webhook configuration + event_sync_url = "https://your-reflector-domain.com/v1/jitsi/events" + event_sync_secret = "your-webhook-secret-here" + + -- Events to track + event_sync_events = { + "muc-occupant-joined", + "muc-occupant-left", + "jibri-recording-on", + "jibri-recording-off" + } +``` + +### 4. Jibri Recording Setup (Optional) + +#### Install Jibri + +```bash +# Install Jibri package +sudo apt install jibri + +# Create recording directory +sudo mkdir -p /var/recordings +sudo chown jibri:jibri /var/recordings +``` + +#### Configure Jibri + +Edit `/etc/jitsi/jibri/jibri.conf`: + +```hocon +jibri { + recording { + recordings-directory = "/var/recordings" + finalize-script = "/opt/jitsi/jibri/finalize.sh" + } + + api { + xmpp { + environments = [{ + name = "prod environment" + xmpp-server-hosts = ["meet.example.com"] + xmpp-domain = "meet.example.com" + + control-muc { + domain = "internal.auth.meet.example.com" + room-name = "JibriBrewery" + nickname = "jibri-nickname" + } + + control-login { + domain = "auth.meet.example.com" + username = "jibri" + password = "jibri-password" + } + }] + } + } +} +``` + +#### Create Finalize Script + +Create `/opt/jitsi/jibri/finalize.sh`: + +```bash +#!/bin/bash +# Jibri finalize script for Reflector integration + +RECORDING_FILE="$1" +ROOM_NAME="$2" +REFLECTOR_API_URL="${REFLECTOR_API_URL:-http://localhost:1250}" + +# Prepare webhook payload +TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%S.%3NZ) +PAYLOAD=$(cat < c2s:show() +> muc:rooms() +``` + +## Security Best Practices + +### JWT Security +- Use strong, unique secrets (32+ characters) +- Rotate JWT secrets regularly +- Implement proper token expiration +- Never log or expose JWT tokens + +### Network Security +- Use HTTPS/WSS for all communications +- Implement proper firewall rules +- Consider VPN for server-to-server communication +- Monitor for unauthorized access attempts + +### Recording Security +- Encrypt recordings at rest +- Implement access controls for recording files +- Regular security audits of file permissions +- Comply with data protection regulations + +## Migration from Whereby + +If migrating from Whereby to Jitsi: + +1. **Parallel Setup** - Configure Jitsi alongside existing Whereby +2. **Room Migration** - Update room platform field to "jitsi" +3. **Test Integration** - Verify meeting creation and webhooks +4. **User Training** - Different UI and feature set +5. **Monitor Performance** - Watch for issues during transition +6. **Cleanup** - Remove Whereby configuration when stable + +## Support and Resources + +### Jitsi Community Resources +- **Documentation**: [jitsi.github.io/handbook](https://jitsi.github.io/handbook/) +- **Community Forum**: [community.jitsi.org](https://community.jitsi.org/) +- **GitHub Issues**: [github.com/jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet) + +### Professional Support +- **8x8 Commercial Support** - Professional Jitsi hosting and support +- **Community Consulting** - Third-party Jitsi implementation services + +### Monitoring and Maintenance +- Monitor system resources (CPU, memory, bandwidth) +- Regular security updates for all components +- Backup configuration files and certificates +- Test disaster recovery procedures \ No newline at end of file