rhythmic-furniture-71949
08/25/2025, 4:13 AMSetting up and configuring a self-hosted SIP server for LiveKit telephony apps.
🔥 Caution
Both SIP signaling port (## Docker compose The easiest way to run SIP Server is by using Docker Compose:) and media port range (5060) must be accessible from the Internet. See [Firewall configuration](https://docs.livekit.io/home/self-hosting/ports-firewall.md) for details.10000-20000
shell
wget https://raw.githubusercontent.com/livekit/sip/main/docker-compose.yaml
docker compose up
This starts a local LiveKit Server and SIP Server connected to Redis.
## Running natively
You may also run SIP server natively without Docker.
### 1. Install SIP server
Follow instructions [here](https://github.com/livekit/sip/#running-locally).
### 2. Create config file
Create a file named config.yaml with the following content:
yaml
api_key: <your-api-key>
api_secret: <your-api-secret>
ws_url: ws://localhost:7880
redis:
address: localhost:6379
sip_port: 5060
rtp_port: 10000-20000
use_external_ip: true
logging:
level: debug
### 3. Run SIP server:
shell
livekit-sip --config=config.yaml
### 4. Determine your SIP URI
Once your SIP server is running, you would have to determine the publilc IP address of the machine.
Then your SIP URI would be:
<public-ip-address>:5060
---
This document was rendered at 2025-08-25T041314.476Z.
For the latest version of this document, see [https://docs.livekit.io/home/self-hosting/sip-server.md](https://docs.livekit.io/home/self-hosting/sip-server.md).
To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).
once i do this, how do i go and setup an agent on this if its ws: and not wss:? can i run it on the same vm?tall-airline-16756
08/25/2025, 4:13 AMtall-airline-16756
08/25/2025, 4:14 AMws:// instead of wss://, and the cool part is, you can even run it on the same VM as your LiveKit server.
In the docs, the examples show ws://localhost:7880 for local connections between the SIP server and LiveKit server. This works great if everything’s running on the same machine. And if you’re using the Docker Compose setup, all the services (LiveKit, SIP, and Redis) are already set up to run together on one machine.
Just a couple of things to double-check:
• Make sure all the necessary ports are open and reachable: SIP signaling port 5060, RTP media ports 10000-20000, and LiveKit WebSocket port 7880.
• Also, don’t forget to have use_external_ip: true enabled in your SIP config file so the public IP is advertised properly for media connections.
If you hit any bumps or want a hand with the setup, just give me a shout—I’m here to help!
Sources: Self-hosted SIP server | LiveKit Docs | docker-compose.yaml | Self-hosted SIP server | LiveKit Docsrhythmic-furniture-71949
08/25/2025, 4:15 AMrhythmic-furniture-71949
08/25/2025, 4:15 AMtall-airline-16756
08/25/2025, 4:16 AMuse_external_ip: true setting in your SIP server config is set right so it advertises the public IP for media connections.
• Redis Configuration: Both servers need to connect to the same Redis instance. If Redis is on the same VM, just ensure it’s set up properly and has enough resources to handle the load.
This setup definitely works, but for production, it’s usually best to run the SIP server on its own VM to avoid any resource hiccups and keep things running smoothly.
If you have any questions or want to chat more about your setup, I’m here to help!rhythmic-furniture-71949
08/25/2025, 4:27 AMtall-airline-16756
08/25/2025, 4:27 AMwss:// and other secure connections, the SIP agent and server can't chat securely when they're in different places. If you skip wss://, the communication falls back to unencrypted protocols like ws://, which really only works well for local or internal connections.
So, if your agent and server are spread out across different locations, it's important to use wss:// with the right certificates to keep everything secure. If you'd like, I’m here to help you with setting up those certificates or getting wss:// configured—just let me know!
Sources: pkg/sip/service_test.go | transport/layer.go | Self-hosted SIP server | LiveKit Docsrhythmic-furniture-71949
08/25/2025, 4:27 AMtall-airline-16756
08/25/2025, 4:28 AMws:// for some straightforward development testing across two different VMs. Here’s how you can get that going:
• First, update the ws_url in your SIP server config to point to the IP address or hostname of the VM where your LiveKit server lives, something like ws://<livekit-server-vm-ip>:7880.
• Make sure your LiveKit server is set up to accept connections from outside, for example by using --bind 0.0.0.0.
• Don’t forget to open up the WebSocket port (7880) on both VMs so they can talk to each other.
This setup works great for development, but when you’re ready for production, it’s best to switch to secure communication using wss://. If you have any questions or want a hand with this, just let me know—I’m here to help!
Sources: README.md | test/integration/sip_test.go