cuddly-vr-85751
12/13/2025, 7:06 AMtall-airline-16756
12/13/2025, 7:06 AMtall-airline-16756
12/13/2025, 7:06 AMcuddly-vr-85751
12/13/2025, 7:12 AMtall-airline-16756
12/13/2025, 7:13 AMsip-config.yaml for your setup?
Answer those and I’ll produce the exact docker-compose addition, config file, and CLI commands to create trunks/dispatch rules.
Sources: sip | livekit/livekit_composite | DeepWiki | Self-hosted SIP server | LiveKit docs | SIP APIs | LiveKit docs | SIP trunk setup | LiveKit docscuddly-vr-85751
12/13/2025, 7:15 AMtall-airline-16756
12/13/2025, 7:15 AMsip-config.yaml generated?
6. Can your server make outbound UDP/TCP connections to the provider and reach the provider’s SIP ports?
Answer those and I’ll generate:
• The docker-compose service and sip-config.yaml for outbound routing
• Example lk CLI commands or API calls to create an outbound trunk
• Sample call flow your agents will use to place outbound calls.cuddly-vr-85751
12/13/2025, 7:16 AMtall-airline-16756
12/13/2025, 7:16 AMwss://lk.dezyit.com. I’ll guide you from scratch to enable outbound dialing for agents.
Before I create configs, I need two final details:
1. Do you have a Twilio SIP trunk or Voice SIP Credentials (username/password)? If not, I’ll include steps to create them in Twilio.
2. Do agents place calls from inside a LiveKit room (their audio is bridged to the SIP call) or from a separate agent app/server that triggers calls via the LiveKit SIP API?
Once you confirm, I’ll:
• Provide the docker-compose snippet and a ready-to-use sip-config.yaml
• Show how to configure Twilio (create trunk or credentials) and the exact SIP trunk settings to point to your SIP server
• Give the lk CLI/API commands to create an outbound trunk and example call flow for agents
• Include firewall/port checklist and basic troubleshooting commands
Which of the two agent call flows do you want?cuddly-vr-85751
12/13/2025, 7:17 AMtall-airline-16756
12/13/2025, 7:17 AMwss://lk.dezyit.com. I’ll include every file and command you need, Twilio setup steps, firewall ports, and a sample agent call flow.
Confirm you’re ready and I’ll generate:
• A ready-to-use docker-compose.yml snippet to add the LiveKit SIP service
• A sip-config.yaml tailored for wss://lk.dezyit.com
• Exact Twilio steps to create a SIP trunk and credentials
• lk CLI commands to create the outbound trunk in LiveKit
• A minimal example script showing how an agent places an outbound call
• Firewall/ports checklist and basic troubleshooting commands
If that sounds good, reply "go" and I’ll produce the full configs and commands.
Sources: Ports and firewall | LiveKit docs | Self-hosted SIP server | LiveKit docs | SIP outbound trunk | LiveKit docs | Make outbound calls | LiveKit docscuddly-vr-85751
12/13/2025, 7:21 AMtall-airline-16756
12/13/2025, 7:22 AMversion: "3.8"
services:
livekit-sip:
image: livekit/sip:latest
container_name: livekit-sip
restart: unless-stopped
ports:
- "5060:5060/udp"
- "5060:5060/tcp"
- "10000-20000:10000-20000/udp"
environment:
- LIVEKIT_API_KEY=REPLACE_WITH_LIVEKIT_API_KEY
- LIVEKIT_API_SECRET=REPLACE_WITH_LIVEKIT_API_SECRET
- LIVEKIT_WS_URL=wss://lk.dezyit.com
- REDIS_ADDRESS=redis:6379
- SIP_PUBLIC_HOST=sip.lk.dezyit.com
volumes:
- ./sip-config.yaml:/etc/sip-config.yaml:ro
depends_on:
- redis
# If you already have redis in your existing compose, ensure names/addresses match.
redis:
image: redis:7
restart: unless-stopped
Notes:
• If you already have a docker-compose for LiveKit and Redis, merge the service into your existing file. Ensure REDIS_ADDRESS points to your Redis host.
5) sip-config.yaml (SIP server config) Create sip-config.yaml in the same folder:
sip-config.yaml
api_key: "REPLACE_WITH_LIVEKIT_API_KEY"
api_secret: "REPLACE_WITH_LIVEKIT_API_SECRET"
ws_url: "wss://lk.dezyit.com"
redis:
address: "redis:6379"
sip_port: 5060
rtp:
min_port: 10000
max_port: 20000
public_ip: "YOUR_PUBLIC_IP_OR_DOMAIN" # e.g., 203.0.113.12 or sip.lk.dezyit.com
use_external_ip: true
logging:
level: info
Replace API key/secret with values from your LiveKit config. Set public_ip to your public IP or domain.
6) Start the SIP server From the folder with your compose files:
• If using a separate file:
docker compose -f docker-compose.sip.yml up -d
• If merged into existing compose:
docker compose up -d
Check logs:
• docker logs -f livekit-sip
You should see the SIP service bind to port 5060 and RTP ports.
7) Configure Twilio to reach your SIP server
• In Twilio trunk Termination → Termination, ensure the SIP URI/Origination points to sip.lk.dezyit.com:5060.
• Ensure Twilio is using the credential list you created. Twilio will send SIP INVITEs to your SIP server using those credentials.
8) Create Outbound Trunk in LiveKit (so LiveKit SIP service knows to route outbound calls via Twilio) Install LiveKit CLI if needed:
• npm install -g @livekit/cli
(or the CLI package name you use; adjust if you already have 'lk')
Login/Configure:
• lk login --url wss://lk.dezyit.com --api-key REPLACE --api-secret REPLACE
Create an outbound trunk via CLI or API. Example JSON file outbound-trunk.json:
outbound-trunk.json
{
"name": "twilio-outbound",
"type": "sip",
"address": "sip.twilio.com", // Twilio outbound SIP domain or trunk host
"port": 5060,
"protocol": "udp",
"auth": {
"username": "sipuser",
"password": "sippass123"
},
"from_number": "+1YOURTWILIONUMBER"
}
Create it:
• lk sip outbound create outbound-trunk.json
Save the returned trunk ID (SIPTrunkID).
Notes:
• Twilio’s exact SIP URI for outbound may be different (often your trunk domain). Use the domain provided in Twilio’s trunk docs or the trunk’s SIP URI.
9) Agent flow: placing an outbound call Two common approaches: A) Agent inside a LiveKit room: create a SIP participant that places an outbound call and bridges audio into the room. B) Agent app/server triggers outbound call and streams audio programmatically.
Below is a minimal example using the LiveKit HTTP API / SDK pattern to create a SIP participant which places an outbound call. Adjust for your language/SDK.
Example: Node.js (pseudo-code; adapt to your SDK)
const { LiveKitServer } = require('livekit-server-sdk'); // adjust import to actual package
const apiKey = 'REPLACE_WITH_KEY';
const apiSecret = 'REPLACE_WITH_SECRET';
const lkHost = 'https://lk.dezyit.com'; // HTTP API base if applicable
async function createOutboundCall(roomName, toNumber, trunkId) {
// Use the LiveKit server/admin API to create a SIP participant
// Exact call depends on the SDK available; below is conceptual.
const body = {
sip_trunk_id: trunkId,
sip_call_to: toNumber,
room_name: roomName,
participant_identity: 'agent-outbound',
participant_name: 'Agent Outbound',
wait_for_answer: true
};
// POST to LiveKit SIP endpoint (replace with actual endpoint path from your CLI/API)
// Example pseudo-request:
// POST https://lk.dezyit.com/sip/participants
// Authorization: (use API key/secret per LiveKit admin API)
// Body: JSON as above
// On success, the SIP call is initiated; the SIP participant joins the room when answered.
}
If using the official LiveKit CLI/SDK, use the CreateSIPParticipant API call with sip_trunk_id and sip_call_to.
10) Test the call
• Trigger the agent flow to place a call to an external number (e.g., your mobile).
• Check livekit-sip logs for outbound INVITE attempts.
• Check Twilio Console for inbound/outbound call logs.
11) Troubleshooting checklist
• No SIP INVITE to Twilio: verify outbound trunk config in LiveKit and that SIP server can resolve/connect to Twilio.
• No audio: verify UDP ports 10000–20000 open both ways; NAT/public IP configured in sip-config.yaml.
• Authentication failures: check credential list in Twilio matches what LiveKit sends.
• SIP 403/401: wrong username/password or trunk not allowing termination from your IP.
• Use docker logs -f livekit-sip and look for errors.
12) Optional: TLS and security
• Use SIP over TLS if Twilio and your setup support it. Configure certificates and change ports/protocols accordingly.
• Restrict firewall to Twilio IP ranges for SIP ports if possible.
13) Example values to replace
• REPLACE_WITH_LIVEKIT_API_KEY and SECRET — from your LiveKit config
• sip.lk.dezyit.com — point this DNS A record to your server public IP
• YOUR_PUBLIC_IP_OR_DOMAIN — set to your public IP for RTP and signaling if behind NAT
• Twilio trunk host — as provided in your Twilio trunk settings
• sippass123, sipuser — example credentials; use secure strong password
If you want, I can now:
• Generate an exact merged docker-compose (including LiveKit, Redis, Caddy entries) using your existing compose files if you paste them here.
• Generate a ready-to-run sample Node.js or Python script to call a number using CreateSIPParticipant (with concrete HTTP request lines).
• Walk through creating the Twilio credential list step-by-step with screenshots (text guidance).
Which of the above would you like next?