b
Hey
t
Thanks for reaching out, Akash. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! Could you share a bit more about your question or what’s going on? That way, I can help you out in the best way possible.
b
{ "dispatch_rule": { "rule": { "dispatchRuleDirect": { "roomName": "sales-room" } }, "name": "Sales Agent Direct Route", "metadata": "{\"agentId\":\"sales-agent-001\",\"jwtToken\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZ2VudElkIjoic2FsZXMtYWdlbnQtMDAxIiwicm9sZSI6InNhbGVzIiwiaWF0IjoxNjk0NTQ0MDAwfQ.dummy-signature\"}", "roomConfig": { "agents": [{ "agentName": "sales-agent-001", "metadata": "{\"agentId\":\"sales-agent-001\",\"jwtToken\":\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZ2VudElkIjoic2FsZXMtYWdlbnQtMDAxIiwicm9sZSI6InNhbGVzIiwiaWF0IjoxNjk0NTQ0MDAwfQ.dummy-signature\"}" }] }, "attributes": { "agent_id": "sales-agent-001", "phone_number": "+15105550100" } }, "trunk_ids": ["ST_AchhvN4rm8cU"] } correct it as i am not able to map trunk ...giving <any>
t
To map trunk IDs to a dispatch rule in LiveKit, you just need to include the
trunk_ids
parameter when you're creating or updating the dispatch rule. Here’s a quick rundown on how to do it: • When creating a dispatch rule: Add the
trunk_ids
array in the
CreateSIPDispatchRule
request. If you leave this list empty or don’t include it, the dispatch rule will apply to all trunks. • When updating a dispatch rule: Use the
UpdateSIPDispatchRule
request and include the
trunk_ids
field inside the
SIPDispatchRuleUpdate
object to update which trunk IDs are associated. Just make sure the trunk ID you’re trying to map is valid and matches your system’s setup. If you run into any trouble or have questions, feel free to reach out—I’m here to help! Sources: livekit/livekit_sip.pb.go | SIP APIs | LiveKit Docs | SIP APIs | LiveKit Docs | test/lktest-sip-outbound/README.md
b
is it good way to have the same server running for web and teelphony or shoud we keep it separate then how
t
To get the best performance and reliability out of LiveKit, especially if you’re self-hosting, it’s a good idea to run your web and telephony servers separately. The SIP service, which takes care of telephony integration, works best as its own component apart from the core LiveKit server. Here’s a friendly guide on how to set them up: 1. Deploy Redis: Make sure Redis is up and running, and that both the LiveKit server and SIP service can access it for smooth communication and session state storage. 2. Configure the SIP Service: You can use a YAML config file or environment variables to set things like: ◦
api_key
and
api_secret
from your LiveKit project ◦ `ws_url`: The WebSocket URL of your LiveKit server ◦ `redis.address`: The shared Redis instance ◦ `sip_port`: The port for SIP traffic ◦ `rtp_port`: The range for RTP media traffic 1. Run the Services: Use Docker Compose to launch both the LiveKit server and SIP service with host networking. Just make sure the SIP service has a public IP so external SIP peers can connect without a hitch. 2. Set Up SIP Resources: Create SIP trunks and dispatch rules that will route calls to the right LiveKit rooms. This setup helps keep SIP protocols and media running smoothly, while the LiveKit server handles WebRTC signaling and room management. If you want, I’m here to help with any part of the setup—just let me know! Sources: SIP overview | LiveKit Docs | SIP overview | LiveKit Docs | test/integration/sip_test.go
b
do we need to keep separate livekit server for bihh ty
both
t
You don’t need to use separate LiveKit servers for web and telephony services. One LiveKit instance can easily handle both web and telephony participants in rooms. That said, the SIP service, which takes care of telephony integration, does need to be set up separately from the main LiveKit server if you’re self-hosting. If you’re thinking about separating them for reasons like performance, security, or scalability, it really depends on your specific setup and needs. Feel free to reach out if you want to chat more or need any help with this! Sources: SIP overview | LiveKit Docs | SIP overview | LiveKit Docs | Deploying to production | LiveKit Docs | Deploying to custom environments | LiveKit Docs | Intro to LiveKit | LiveKit Docs
b
#!/bin/bash echo "=== Starting Services Step by Step (Docker-Compose Compatible) ===" # Create volume for Redis data if it doesn't exist echo "Creating Redis volume..." docker volume create redis_data 2>/dev/null || echo "Redis volume already exists" # Step 1: Start Redis echo "Step 1: Starting Redis..." docker run -d --name redis \ -p 6379:6379 \ -v redis_data:/data \ redis:latest # Wait for Redis to be ready echo "Waiting for Redis to start..." for i in {1..30}; do if docker exec redis redis-cli ping 2>/dev/null | grep -q PONG; then echo "✅ Redis started successfully" break fi sleep 1 done if ! docker exec redis redis-cli ping 2>/dev/null | grep -q PONG; then echo "❌ Redis failed to start after 30 seconds" exit 1 fi # Step 2: Start LiveKit Server (matching docker-compose config) echo "Step 2: Starting LiveKit Server..." docker run -d --name livekit-server \ --network host \ livekit/livekit-server \ --dev \ --redis-host localhost:6379 \ --bind 0.0.0.0 sleep 5 if docker ps | grep -q livekit-server; then echo "✅ LiveKit Server started successfully" else echo "❌ LiveKit Server failed to start" exit 1 fi # Step 3: Start SIP Service (matching docker-compose config) echo "Step 3: Starting SIP Service..." docker run -d --name livekit-sip \ --network host \ -e SIP_CONFIG_BODY="api_key: 'devkey' api_secret: 'secret' ws_url: 'ws://localhost:7880' redis: address: 'localhost:6379' sip_port: 5060 rtp_port: 10000-20000 use_external_ip: true logging: level: debug" \ livekit/sip sleep 5 if docker ps | grep -q livekit-sip; then echo "✅ SIP Service started successfully" else echo "❌ SIP Service failed to start" exit 1 fi echo "" echo "=== Service Status ===" docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}" echo "" echo "=== Port Check ===" echo "Redis (6379): $(netstat -tuln | grep :6379 >/dev/null && echo "✅ Listening" || echo "❌ Not listening")" echo "LiveKit HTTP (7880): $(netstat -tuln | grep :7880 >/dev/null && echo "✅ Listening" || echo "❌ Not listening")" echo "LiveKit WebRTC (7881): $(netstat -tuln | grep :7881 >/dev/null && echo "✅ Listening" || echo "❌ Not listening")" echo "SIP UDP (5060): $(netstat -tuln | grep :5060 >/dev/null && echo "✅ Listening" || echo "❌ Not listening")" echo "" echo "🎯 All services started! Ready for next step." is this correct way to create
t
Hey there! Your bash script for setting up Redis, the LiveKit server, and the SIP service using Docker looks like it’s on the right track. That said, the easiest and most reliable way to get everything running smoothly is by using the official
docker-compose.yaml
file provided by LiveKit. It takes care of all the tricky bits to make sure everything is configured just right. Here’s how you can use the official method: 1. Download the
docker-compose.yaml
file:
wget https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml
2. Start all the services with:
docker compose up
This way, you’ll get: • Host networking set up properly so ports are exposed correctly • Redis connected for managing state and coordination • SIP and LiveKit services configured just right If you’d rather stick with your bash script, just make sure it includes: • Host networking (
--network host
) for all your containers • The right environment variables for SIP setup • Correct port mappings and volume mounts Feel free to share your script if you want me to take a closer look or help out with any part of the setup. I’m here to help! Sources: Self-hosted SIP server | LiveKit Docs | README.md