to use local livekit sip server, i can use it with...
# ask-ai
f
to use local livekit sip server, i can use it with livekit cloud rtc or do i need to self host the livekit server also?
t
Thanks for reaching out, Manav. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking whether a local LiveKit SIP server can be used with LiveKit Cloud RTC or if you must self-host the full LiveKit server. You can use a local/self‑hosted LiveKit SIP server with LiveKit Cloud RTC — you do not need to self‑host the entire LiveKit server. The SIP server handles SIP↔️WebRTC bridging and media, while LiveKit Cloud manages rooms and participants. To integrate: • Configure the SIP server's
ws_url
to point at your LiveKit Cloud project (e.g.,
wss://your-project.livekit.cloud
) and provide valid API keys. • Ensure SIP signaling (5060) and media ports (10000–20000) are publicly reachable if the SIP server is on‑premises. Would you like the docker-compose example or the exact config snippet for
ws_url
and API key placement? Sources: SIP overview | LiveKit docs | sip | livekit/livekit_composite | DeepWiki | Self-hosted SIP server | LiveKit docs
f
give me exact steps to simply self host the livekit sip server on digital ocean droplet so i can follow those commands.
t
I'll give step-by-step commands to self-host the LiveKit SIP server on a DigitalOcean droplet and connect it to LiveKit Cloud. These steps assume you already have a LiveKit Cloud project and API key/secret. 1) Create a Droplet (Ubuntu 22.04 recommended) • Create a Droplet in the DigitalOcean UI with Ubuntu 22.04, at least 1 vCPU / 1–2 GB RAM. • Open ports: TCP 22 (SSH), TCP 5060 (SIP signaling), UDP 10000–20000 (RTP media), and TCP 443/80 if you want HTTPS for other services. 2) SSH into the droplet Replace USER and DROPLET_IP:
Copy code
ssh root@DROPLET_IP
3) Install Docker and Docker Compose
Copy code
# update
apt update && apt upgrade -y

# install basics
apt install -y ca-certificates curl gnupg lsb-release

# add Docker repo and install Docker
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# enable and start docker
systemctl enable docker
systemctl start docker
4) Clone LiveKit SIP repo and prepare docker-compose
Copy code
apt install -y git
git clone https://github.com/livekit/sip.git
cd sip
5) Create a configuration file Copy the example docker compose and create an env file. Replace the placeholders with your LiveKit Cloud project
ws_url
(example:
wss://your-project.livekit.cloud
) and API key/secret.
Copy code
# copy example compose (if present) or create a simple docker-compose.yaml
cp docker-compose.yaml docker-compose.local.yaml || true

# create .env
cat > .env <<EOF
# LiveKit Cloud websocket URL (replace with your project URL)
LIVEKIT_WS_URL=wss://your-project.livekit.cloud

# API key and secret with permissions to create participants (replace with your keys)
LIVEKIT_API_KEY=your_api_key
LIVEKIT_API_SECRET=your_api_secret

# SIP server external IP or hostname
SIP_PUBLIC_IP=YOUR_DROPLET_PUBLIC_IP

# SIP listening port (default 5060)
SIP_PORT=5060

# RTP port range
RTP_MIN_PORT=10000
RTP_MAX_PORT=20000
EOF
If the repository's docker-compose expects a different env key names, set them accordingly using the same values above. 6) Edit docker-compose if needed Open
docker-compose.local.yaml
(or
docker-compose.yaml
) and ensure: • The SIP container uses the above environment variables • Ports map
5060:5060/udp
(or tcp as required) and
10000-20000:10000-20000/udp
If the repository already exposes these ports, no change needed. Example snippet to verify:
Copy code
services:
  sip:
    image: livekit/sip:latest
    env_file: .env
    ports:
      - "5060:5060/udp"
      - "10000-20000:10000-20000/udp"
7) Start the SIP server
Copy code
docker compose -f docker-compose.local.yaml up -d
8) Verify the container and logs
Copy code
docker ps
docker logs -f $(docker ps -q -f ancestor=livekit/sip:latest)
9) Confirm connectivity with LiveKit Cloud • Ensure your
LIVEKIT_WS_URL
is correct (wss://your-project.livekit.cloud). • Ensure API key/secret are valid. • Ensure firewall/DO networking allows inbound UDP 10000–20000 and UDP/TCP 5060 to the Droplet. • Check logs for successful websocket connection messages. 10) SIP provider / PBX config • Point your SIP trunk or PBX to the droplet IP and port 5060. • Use the SIP server logs to debug incoming calls bridging to LiveKit rooms. Notes and troubleshooting pointers • Ensure NAT and firewall allow RTP ports; otherwise media will fail even if signaling connects. • If using a hostname and TLS is required for SIP over WebSocket, ensure DNS and certificates are in place and
ws_url
uses
wss://
. • If the repo’s compose or env variable names differ, adapt the
.env
names and docker-compose accordingly. Would you like me to output a ready-to-run
docker-compose.yaml
and
.env
with placeholders filled for your droplet IP and your LiveKit project URL?
f
how to do inbound call with livekit sip via plivo?
t
You're asking how to receive inbound calls from Plivo into LiveKit via SIP. Below are exact, actionable steps to configure Plivo and LiveKit so incoming Plivo calls are bridged into LiveKit rooms. 1) Prerequisites • LiveKit Cloud project with valid API key/secret. • Plivo account and a purchased phone number. • (Optional) A running LiveKit SIP server if you self-host SIP; or use LiveKit Cloud SIP endpoint. 2) Create a Plivo Inbound Trunk • Sign in to Plivo Console → Zentrunk → Inbound Trunks → Create New Inbound Trunk. • Set Primary URI to your LiveKit SIP endpoint (from LiveKit Project Settings). Example: vjnxecm0tjk.sip.livekit.cloud;transport=tcp (Use
;transport=tls
for TLS if required.) • Save the trunk. 3) Attach your Plivo phone number to the trunk • Plivo Console → Phone Numbers → Your Numbers → Select number → Application Type = Zentrunk → choose the trunk → Update. 4) Create an inbound trunk in LiveKit (so LiveKit accepts calls for that number) Option A — CLI: • Create inbound-trunk.json:
Copy code
{
  "trunk": {
    "name": "Plivo Inbound",
    "numbers": [
      "+15105550100"
    ]
  }
}
• Run:
Copy code
lk sip inbound create inbound-trunk.json
Option B — Cloud Dashboard: • Go to LiveKit Cloud → Telephony → Configuration → Create new → Trunk → choose Inbound → add the Plivo number in E.164 format → Create. 5) Create a dispatch rule (how calls map to rooms) Example to create unique rooms per call: • dispatch-rule.json:
Copy code
{
  "dispatch_rule": {
    "rule": {
      "dispatchRuleIndividual": {
        "roomPrefix": "call-"
      }
    }
  }
}
• Run:
Copy code
lk sip dispatch create dispatch-rule.json
This produces rooms like
call-xxxxx
and joins a participant for the caller. 6) Verify connectivity & test • Ensure Plivo’s Primary URI matches the LiveKit SIP endpoint and Plivo number is linked to that trunk. • Place a call to your Plivo phone number. The call should be routed to LiveKit and a room created per your dispatch rule. • Check logs: ◦ Plivo call logs in Plivo Console. ◦ LiveKit Telephony logs in Cloud Dashboard or
lk
CLI. 7) Optional settings & tips • Use E.164 format (with +) for numbers in LiveKit. • Enable
krispEnabled
in trunk config to turn on noise cancellation. • Map SIP headers to participant attributes using
headers_to_attributes
if you need metadata. • If self-hosting the SIP server: ensure ports (5060 signaling, UDP 10000–20000 RTP) are reachable;
ws_url
must point to your LiveKit Cloud project if bridging to Cloud. • If you want incoming calls to route to specific agents or a static room, adjust dispatch rule to use
roomName
or agent dispatch configuration. Would you like a ready-to-run example
lk
CLI JSON set (inbound trunk + dispatch) prefilled with your Plivo number so you can run the commands directly? Sources: Create and configure a Plivo SIP trunk | LiveKit docs | SIP trunk setup | LiveKit docs | SIP participant | LiveKit docs | Agents telephony integration | LiveKit docs | Accepting inbound calls | LiveKit docs