LiveKit Docs › Self-hosting › SIP server --- Sel...
# ask-ai
r
LiveKit Docs › Self-hosting › SIP server --- # Self-hosted SIP server
Setting up and configuring a self-hosted SIP server for LiveKit telephony apps.
🔥 Caution
Both SIP signaling port (
5060
) and media port range (
10000-20000
) must be accessible from the Internet. See [Firewall configuration](https://docs.livekit.io/home/self-hosting/ports-firewall.md) for details.
## Docker compose The easiest way to run SIP Server is by using Docker Compose:
Copy code
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:
Copy code
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:
Copy code
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:
Copy code
<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?
t
Thanks for reaching out, Rhythm. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! You can totally set up an agent on a self-hosted SIP server using
ws://
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 Docs
r
wondeirng if this will cause any issues
moreso, will self hosting this on the exact same VM cause issues?
t
Running both the SIP server and LiveKit server on the same VM is totally doable and works great for development or testing. Just a few things to keep in mind to make sure everything runs smoothly: • Port Conflicts: Double-check that the SIP server's ports (5060 for SIP signaling and 10000-20000 for RTP media) aren’t being used by anything else on your VM. • Resource Competition: Both servers can use quite a bit of CPU, memory, and network bandwidth. If your VM has limited resources, you might notice things like audio glitches or dropped calls. • Firewall and Networking: Make sure your firewall lets traffic through on the needed ports, and that the
use_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!
r
am i correct in stating that if we do not do certs for wss and whatnot then we cannot have the agent and local be at diff places?
t
You're absolutely right! Without setting up certificates for
wss://
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 Docs
r
will it work on ws? like, will it work and run for simple dev tesitng on two diff vms?
t
Yes, you can definitely have the SIP server and agent chat over
ws://
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