Lesson 1 / Unit 1: LiveKit Foundations
LiveKit Architecture
A call can connect, show green on every dashboard, and carry no audio. Separate signalling from media, then identify the component that owns the failure. Learn which one owns the symptom before you debug.
A caller dials in. The trunk answers, the room exists, your agent has joined, and every dashboard is green.
The caller hears nothing.
Start with the media path. A room and a connected agent prove that signalling worked; they do not prove that speech reached either participant.
System Components
This self-hosted telephony stack has five roles: SFU, SIP bridge, agent workers, Redis and TURN. They are not necessarily five processes: TURN can run inside the SFU, while SIP is optional for browser-only calls.
| Process | What it does | Runs on your laptop? |
|---|---|---|
| Server (SFU) | Receives each participant’s media once and forwards it | Yes, livekit-server --dev |
| SIP service | Bridges phone calls into rooms | Only if you set it up |
| Agent workers | Your code: STT, LLM, TTS, turn detection | Yes |
| Redis | Room state and message routing between nodes | No, a single node hides it |
| TURN | Relays media for clients that cannot reach the server directly | Rarely needed locally |
Every later lesson is about one row of that table.
Media Forwarding
The server is a Selective Forwarding Unit. It takes each participant’s audio once and forwards it to everyone who should hear it, with no mixing and no transcoding in the common path.
The SFU forwards subscribed tracks; it does not run your STT or LLM. Measure its resource use separately from the workers and model providers.
Port ranges can limit a deployment, but ports per call are not a LiveKit constant. UDP multiplexing changes the allocation model. The saved 18.3-per-call counter in this course needs its collection method verified before being used as a port budget. Unit 5 is that whole story, starting with why media servers run out of ports before CPU.
SIP Bridge
The SIP service is a separate process that talks SIP and RTP to telephony carriers on one side and joins rooms as an ordinary participant on the other. A phone caller shows up in your room as a participant it created.
It has its own addressing, its own port ranges, and its own failure modes. One of those cost us three days. For the NAT path in our case study, symmetric_rtp: true made replies follow the observed media source. Diagnose the packet path before treating it as a universal carrier setting. The full diagnosis is in the one-way audio lesson.
Worker Coordination
These three are easy to forget until one of them is missing.
Agent workers are your code. Python or Node processes register with the server, take a job when a room needs an agent, and run one process per active call. Everything AI lives here: STT, LLM, TTS and turn detection. LiveKit’s own docs describe how agents connect and receive jobs; unit 3 covers what that process model does under load.
Redis is coordination. Multi-node deployments use it for room state and for routing messages between nodes, and the SIP service uses its message bus. Agent workers register over WebSocket with LiveKit, not Redis. Multi-node self-hosting requires Redis, and the multi-node lesson shows the wiring.
TURN is the relay for clients whose network blocks a direct WebRTC path. It can be embedded in the server or run alongside it, and is useful when direct connectivity cannot cover your users’ networks.
Control and Media
Every call runs on two planes at once. Signalling and coordination go through the server and Redis, while audio goes directly between clients, the SFU, and the SIP service.
The split matters because the planes fail independently. The ports each one needs are listed in LiveKit’s ports and firewall reference: signalling can use a TLS reverse proxy, while media must reach the advertised candidates. This course uses range mode in its initial setup; UDP mux is another option.
A call can be perfectly healthy on the signalling plane and completely silent on the media plane, and signalling-only dashboards can still read green.
Fault Isolation
Triage by plane first, then by process. Three symptoms cover most pages:
| Symptom | Plane | Suspect first | Read next |
|---|---|---|---|
| Call never connects | Signalling | Server or SIP service | SIP self-hosting |
| Connected, but silent or one-way | Media | Ports, firewall, NAT, TURN | Calls that carry no audio |
| Connected, audio flows, agent mute | Worker | Agent worker process | Worker lifecycle |
The middle row needs media telemetry. Signalling counters alone can miss it. Knowing which plane owns a symptom saves the hour you would otherwise spend on the wrong one.
Next: the four objects every LiveKit API call speaks, and the one-to-one mapping that tells you when something has leaked.
Common questions
What is a LiveKit SFU?
The LiveKit server is a Selective Forwarding Unit (SFU): it receives each participant's audio once and forwards it to the others without mixing or transcoding. For participants in that room, the SFU forwards media. Capacity depends on transport configuration, participants, bandwidth and CPU.
Does LiveKit need Redis?
A single-node development server does not. Multi-node self-hosting uses Redis for coordination. The SIP service also uses Redis; agent workers connect to LiveKit over WebSocket rather than accessing Redis directly.
What does the LiveKit SIP service do?
It is a separate process that speaks SIP and RTP to telephony carriers on one side and joins LiveKit rooms as a participant on the other. It is the bridge between a phone call and a room, with its own addressing, port ranges, and failure modes.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.