i have to self host livekit.. what is the best and...
# ask-ai
s
i have to self host livekit.. what is the best and options available .. to achive low latency call .
t
Thanks for reaching out, Harsh. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To self-host LiveKit and enjoy low-latency calls, you have some great options to consider: • Running Locally for Development: You can install and run the LiveKit server right on your local machine using tools like Homebrew. This is a fantastic way to test things out and get comfortable with the setup. • Production Deployment: When you're ready for production, following LiveKit's deployment guides will help you configure the server for scalability. Don’t forget to manage your firewall settings to allow signaling and media traffic smoothly. • Using Docker Compose: Docker Compose is a handy way to orchestrate your self-hosted environment. It even supports components like the SIP gateway if you’re looking to integrate telephony. • Open Source Components: LiveKit’s open-source stack, including the core server, ingress, egress, and SIP gateway, gives you full control over deployment and integration — perfect if you want to customize your setup. • Geographic Deployment: To optimize latency, you can deploy instances strategically across different regions. Just keep in mind this requires some manual orchestration in self-hosted setups. For more detailed guidance, feel free to check out the self-hosting documentation. And if you’d like, I’m here to help you with any specific deployment method or configuration you’re working on! Sources: LiveKit Pricing | Running LiveKit locally | LiveKit Docs | Self-hosted SIP server | LiveKit Docs | README.md | Decentraland's Catalyst: using WebRTC to interact in the metaverse
s
i have to use docker compose . what is the min system requirements .. if i am using aws what will be the instance type and for azure also .
t
When running LiveKit with Docker Compose, here are some helpful recommendations to keep in mind: • Minimum System Requirements: Although not explicitly detailed, components that are resource-intensive like Egress and Ingress typically need at least 4 CPUs and 4 GB RAM per instance. For AI workloads, you might want to consider 4 CPUs and 8 GB RAM to ensure smooth performance. • AWS Instance Types: It’s best to go with non-burstable, compute-optimized instances such as m5, c5, or c6i. Burstable instances like t3/t4g can sometimes cause throttling and latency, so it’s good to avoid those for a smoother experience. • Azure Instance Types: While there aren’t specific recommendations, compute-optimized VMs like F-series (for example, F4, F8) or Dv5/DSv5-series work well, especially considering LiveKit’s CPU-focused needs. If you’d like, I’m here to help you pick the right instances for your specific workloads or chat about scaling strategies. Just let me know! Sources: Docs::Home | Self-hosting the Egress Service | LiveKit Docs | Self-hosting the Ingress Service | LiveKit Docs | Deploying to custom environments | LiveKit Docs | Deploying LiveKit | LiveKit Docs
s
write a docker compose with the ui dashboard and sip server ..
t
Thank you for reaching out! Here's a Docker Compose configuration that will help you deploy the LiveKit Server along with the SIP server. Just a heads-up, this setup focuses on the server and SIP components since the sources don’t include a UI dashboard service:
Copy code
version: '3.7'

services:
  redis:
    image: redis:6
    container_name: redis
    ports:
      - "6379:6379"

  livekit-server:
    image: livekit/livekit-server:latest
    container_name: livekit-server
    ports:
      - "7880:7880" # WebSocket signaling
      - "7881:7881" # HTTP API
      - "50000-60000:50000-60000/udp" # WebRTC media
    environment:
      - LIVEKIT_API_KEY=your_api_key
      - LIVEKIT_API_SECRET=your_api_secret
      - REDIS_URL=<redis://redis:6379>

  sip-server:
    image: livekit/sip-server:latest
    container_name: sip-server
    ports:
      - "5060:5060/udp" # SIP signaling
    environment:
      - SIP_API_KEY=your_api_key
      - SIP_API_SECRET=your_api_secret
      - LIVEKIT_WS_URL=<ws://livekit-server:7880>
      - REDIS_URL=<redis://redis:6379>

networks:
  default:
    name: livekit-network
If you're interested in adding a UI dashboard, you would need to deploy it separately because there isn’t a specific dashboard configuration included here. Typically, the dashboard connects to the LiveKit Server’s WebSocket endpoint. Please feel free to reach out if you have any questions or need help setting that up—I’m here to assist you! Sources: Self-hosted SIP server | LiveKit Docs | Deploy to a VM | LiveKit Docs | test/integration/livekit_test.go
s
can i use self hosted livekit with plivo for sip trunk calls
t
Absolutely, you can use self-hosted LiveKit with Plivo for your SIP trunk calls! LiveKit works smoothly with Plivo for both inbound and outbound calls. Here’s a friendly overview to help you get started: • Inbound Trunk: You’ll want to configure Plivo to route calls to your LiveKit SIP endpoint. In the Plivo Console, just create an inbound trunk and add your LiveKit SIP URI (for example,
vjnxecm0tjk.sip.livekit.cloud
) as the destination. • Outbound Trunk: On the LiveKit side, create an outbound trunk using Plivo’s SIP URI along with your authentication credentials. Then, use the
CreateSIPParticipant
API to kick off outbound calls. • Dispatch Rules: Setting up dispatch rules in LiveKit can help you route incoming calls to specific rooms or even create unique rooms for each caller—whatever fits your needs best. • Authentication: Plivo takes care of authenticating inbound calls via the SIP endpoint, and LiveKit handles outbound call authentication with SIP credentials (username/password). • Security: For peace of mind, you can enable TLS/SRTP to keep signaling and media secure. Since Plivo is officially supported by LiveKit, there are detailed setup guides ready for you. If you’d like, I’m here to walk you through any specific part of the setup step-by-step—just let me know!
s
i have to do for outbound call
t
To help you set up outbound calls with Plivo using your self-hosted LiveKit, let's walk through the steps together: 1. Create an Outbound Trunk in LiveKit: You can use the LiveKit CLI or API to create an outbound trunk. Here's an example configuration to guide you:`{ "trunk": { "name": "Plivo Outbound Trunk", "address": "your-plivo-domain.com", "numbers": ["+15105550123"], "auth_username": "<your-plivo-username>", "auth_password": "<your-plivo-password>" } }`Then, run this command:
livekit-cli create-sip-trunk --request outbound-trunk.json
2. Initiate an Outbound Call: Next, use the
CreateSIPParticipant
API or CLI to place a call. Here's an example command:`livekit-cli create-sip-participant \ --room <room-name> \ --trunk-id <outbound-trunk-id> \ --call-to "+15105550123"`This will send an INVITE to Plivo, which then dials the number you specified. 3. Ensure Proper Authentication: LiveKit will use the SIP credentials (username and password) you provided in the trunk configuration to authenticate with Plivo. 4. Optional Security: If your setup requires it, you can enable TLS/SRTP for secure signaling and media to keep your calls safe. If you have any questions or would like me to help you with a particular step, please don’t hesitate to ask. I’m here to help!
s
when i am doing this ubuntu@voice-calling-agent:*~*$ cat outbound-call.json { "sip_trunk_id": "ST_ZPaDpMeWfnsQ", "sip_call_to": "+916388882098", "room_name": "hindi-telephony-agent", "participant_identity": "sip-hindi-telephony-agent", "participant_name": "Hindi Telephony Agent", "wait_until_answered": true } ubuntu@voice-calling-agent:*~*$ lk sip participant create outbound-call.json Device: azure-machine Requesting verification token... Please confirm access by visiting: https://cloud.livekit.io/cli/confirm-auth?t=eeb59230-a6c8-4e36-9aa3-b3ad208c5106 it is open cloud cli verification how can i do this for self hosted ones ..
the cli is wokring but i am getting lk sip participant create outbound-call.json Using url, api-key, api-secret from environment twirp error unknown: twirp error unknown: update room failed: missing API key or secret key ubuntu@voice-calling-agent:*~*$ this is .. livekit logs • 2025-09-11T060607.151Z INFO livekit rtcconfig/webrtc_config.go:284 failed to get external ip {"local": "172.17.0.1", "err": "context canceled"} • 2025-09-11T060607.151Z INFO livekit rtcconfig/webrtc_config.go:102 using external IPs {"ips": ["172.17.0.1/172.17.0.1", "51.8.131.141/172.18.0.4"]} • 2025-09-11T060607.152Z INFO livekit service/turn.go:145 Starting TURN server {"turn.relay_range_start": 30000, "turn.relay_range_end": 40000, "turn.portTLS": 5349, "turn.externalTLS": true, "turn.portUDP": 3478} • 2025-09-11T060607.154Z INFO livekit service/server.go:264 starting LiveKit server {"portHttp": 7880, "nodeID": "ND_hDX9w2Lx4s42", "nodeIP": "51.8.131.141", "version": "1.9.1", "bindAddresses": [""], "rtc.portTCP": 7881, "rtc.portICERange": [50000, 60000]} • 2025-09-11T061012.259Z INFO livekit.agents service/agentservice.go:298 worker registered {"namespace": "", "jobType": "JT_ROOM", "agentName": "", "workerID": "AW_jABNV8SYjiuN"} • 2025-09-11T062806.136Z ERROR livekit service/sip.go:596 cannot create sip participant {"room": "hindi-telephony-agent", "sipTrunk": "ST_ZPaDpMeWfnsQ", "toUser": "+916388882098", "participant": "sip-hindi-telephony-agent", "callID": "SCL_2yCarLTAt29j", "fromUser": "+918035736620", "toHost": "27099575003544952.zt.plivo.com", "error": "update room failed: missing API key or secret key"} • github.com/livekit/livekit-server/pkg/service.(*SIPService).CreateSIPParticipant • 2025-09-11T064349.973Z ERROR livekit service/sip.go:596 cannot create sip participant {"room": "hindi-telephony-agent", "sipTrunk": "ST_ZPaDpMeWfnsQ", "toUser": "+916388882098", "participant": "sip-hindi-telephony-agent", "callID": "SCL_WAeprKfgXFjt", "fromUser": "+918035736620", "toHost": "27099575003544952.zt.plivo.com", "error": "update room failed: missing API key or secret key"} • github.com/livekit/livekit-server/pkg/service.(*SIPService).CreateSIPParticipant • /workspace/pkg/service/sip.go:596 • github.com/livekit/protocol/livekit.(*sIPServer).serveCreateSIPParticipantProtobuf.func1.1 • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/livekit/livekit_sip.twirp.go:4461 • github.com/livekit/protocol/utils/xtwirp.DefaultServerOptions.ServerPassErrorDetails.func2.1 • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/utils/xtwirp/errors.go:165 • github.com/livekit/protocol/utils/xtwirp.DefaultServerOptions.ServerPassTimeout.func1.1 • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/utils/xtwirp/timeout.go:50 • github.com/livekit/protocol/livekit.(*sIPServer).serveCreateSIPParticipantProtobuf.func1 • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/livekit/livekit_sip.twirp.go:4463 • github.com/livekit/protocol/livekit.(*sIPServer).serveCreateSIPParticipantProtobuf.func2 • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/livekit/livekit_sip.twirp.go:4479 • github.com/livekit/protocol/livekit.(*sIPServer).serveCreateSIPParticipantProtobuf • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/livekit/livekit_sip.twirp.go:4480 • github.com/livekit/protocol/livekit.(*sIPServer).serveCreateSIPParticipant • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/livekit/livekit_sip.twirp.go:4341 • github.com/livekit/protocol/livekit.(*sIPServer).ServeHTTP • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/livekit/livekit_sip.twirp.go:1799 • github.com/livekit/protocol/utils/xtwirp.PassHeadersHandler.func1 • /go/pkg/mod/github.com/livekit/protocol@v1.41.1-0.20250902155548-e46b3f58f6a7/utils/xtwirp/headers.go:36 • net/http.HandlerFunc.ServeHTTP • /usr/local/go/src/net/http/server.go:2322 • net/http.(*ServeMux).ServeHTTP • /usr/local/go/src/net/http/server.go:2861 • github.com/urfave/negroni/v3.(*Negroni).UseHandler.Wrap.func1 • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:59 • github.com/urfave/negroni/v3.HandlerFunc.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:33 • github.com/urfave/negroni/v3.middleware.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:51 • net/http.HandlerFunc.ServeHTTP • /usr/local/go/src/net/http/server.go:2322 • github.com/livekit/livekit-server/pkg/service.(*APIKeyAuthMiddleware).ServeHTTP • /workspace/pkg/service/auth.go:107 • github.com/urfave/negroni/v3.middleware.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:51 • github.com/livekit/livekit-server/pkg/service.RemoveDoubleSlashes • /workspace/pkg/service/utils.go:75 • github.com/urfave/negroni/v3.HandlerFunc.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:33 • github.com/urfave/negroni/v3.middleware.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:51 • github.com/rs/cors.(*Cors).ServeHTTP • /go/pkg/mod/github.com/rs/cors@v1.11.1/cors.go:324 • github.com/urfave/negroni/v3.middleware.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:51 • github.com/urfave/negroni/v3.(*Recovery).ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/recovery.go:210 • github.com/urfave/negroni/v3.middleware.ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:51 • github.com/urfave/negroni/v3.(*Negroni).ServeHTTP • /go/pkg/mod/github.com/urfave/negroni/v3@v3.1.1/negroni.go:111 • net/http.serverHandler.ServeHTTP • /usr/local/go/src/net/http/server.go:3340 • net/http.(*conn).serve • /usr/local/go/src/net/http/server.go:2109 • 2025-09-11T064349.973Z INFO livekit.api service/twirp.go:128 API SIP.CreateSIPParticipant {"service": "SIP", "method": "CreateSIPParticipant", "room": "hindi-telephony-agent", "participant": "sip-hindi-telephony-agent", "toUser": "+916388882098", "trunkID": "ST_ZPaDpMeWfnsQ", "callID": "SCL_WAeprKfgXFjt", "fromUser": "+918035736620", "toHost": "27099575003544952.zt.plivo.com", "duration": "203.598729ms", "status": "500", "error": "twirp error unknown: update room failed: missing API key or secret key", "code": "unknown"}