Free How much of your firm runs on you? Take the 2-minute Key Man Score.
Lesson reading
0%

Lesson 21 / Unit 5: Capacity Planning

Inbound Distribution

You need 500 concurrent inbound calls spread across SIP nodes. Distribution depends on the carrier targets and your SIP routing tier. Verify where INVITEs and RTP actually go.

The question was how to spread 500 concurrent inbound calls across several SIP nodes. The obvious answer is a load balancer.

It only works if the carrier targets it and it handles the required SIP transport and routing behaviour. A web load balancer elsewhere in the stack sees none of these calls.

Carrier Routing

Your carrier chooses the configured next hop. Providers differ; Twilio’s origination URL API is one concrete example of priority and weight semantics. It sends INVITEs to the Origination URIs configured on the trunk, one per address you gave it, so the distribution decision is made in the carrier’s console before any packet reaches your infrastructure.

Carrier behaviour varies: hostname resolution, multiple targets, priority, weighting and failover are provider-specific. A URI may point at a node or at a SIP-aware routing tier. The table below assumes each URI targets one node directly.

Here is what the three possible configurations actually produce:

Origination URIs on the trunkWhat you get
One URIEvery call on one node. Others sit idle.
Several, same priority, equal weightCalls spread across nodes, with failover.
Several, different prioritiesActive and standby. One node takes everything.

The second and third rows look almost identical in a carrier config screen. Only one of them spreads load.

Node Reachability

Every SIP node needs its own stable public address, and every node you add is another trunk entry. Scaling out is an address plus a change in the carrier account, made by whoever owns that account.

That has two practical consequences:

  1. No ephemeral addresses. A node that comes up on a new public IP after a replacement is a node the carrier cannot reach until someone edits the trunk. Allocate a fixed address per SIP node; the carrier already treats it as the origination target when you run the LiveKit SIP service yourself.
  2. Adding a node is not free. Autoscaling the SIP tier the way you autoscale media nodes on active calls only works if the trunk already lists the address the new node will take.

On the LiveKit side, the inbound trunk and dispatch rule are API objects rather than per-node config, so adding a node does not mean editing them.

The carrier decides distribution through its Origination URIs. A proxy collapses the signalling; media still goes straight to the node in the SDP.

Open full size

SIP Proxies

A SIP proxy lets the carrier point one URI at the proxy while the proxy distributes calls to your nodes internally. Node count stops being the carrier’s business.

It also does two things a carrier URI list does not do on its own. It can select a node on real load, and it can drop a dead node by probing it with keepalives. Kamailio’s dispatcher module is the usual building block: weighted and load-based distribution across a destination set, with SIP OPTIONS probes that mark an unresponsive destination inactive.

Media Routing

Kamailio and OpenSIPS are signalling proxies. In a signalling-only configuration they do not relay the audio; deployments can integrate RTP relays. Your media server answers with its own address in the SDP, so RTP flows from the carrier straight to that node and bypasses the proxy entirely.

This is the part people miss. The proxy collapses N trunk entries into one. It does not collapse N public addresses into one, because the carrier still needs to reach every media node directly. (SIP carries the session setup, per RFC 3261; the addresses the audio actually uses live in the SDP body it carries.)

If the goal is private media nodes, you have to pair the proxy with a media relay. That combination is what a session border controller actually is here. Then every call’s audio passes through one relay, which must itself be sized, monitored and scaled, and which introduces a new failure domain that also needs redundancy. The same port arithmetic from lesson 19 now applies to a box that carries everyone’s audio.

Routing Choices

A small, stable node list can be managed directly if the carrier supports it. The proxy earns its place in two situations:

  • the carrier cannot hold multiple Origination URIs on one trunk, or
  • node count makes URI management a standing chore, based on your rate of node changes and operational needs.

Below that, a proxy adds a component to operate without removing any public addresses.

Distribution Test

Before building any of it, open the carrier console and read the Origination URI list on the trunk. If it targets one node directly, verify whether the provider supports additional weighted targets. Test new-call distribution and failure behaviour; do not assume priority settings migrate existing calls.

Next: with signalling and media both spread, turn the per-call numbers into a capacity model that says how many nodes of each tier you actually need.

Common questions

Can a load balancer distribute inbound SIP calls across LiveKit SIP nodes?

Not in the usual setup. The carrier sends each INVITE to the Origination URIs configured on the trunk, so distribution is decided in the carrier account. For carriers that support weighted targets, equal-priority entries can distribute new calls. A single URI might instead point at a SIP routing tier.

Does a SIP proxy like Kamailio or OpenSIPS carry the call audio?

No. In a signalling-only deployment they proxy SIP; they can also integrate a separate media relay. The media server puts its own address in the SDP, so RTP flows from the carrier straight to that node. Hiding the media nodes needs a media relay as well, which adds a component every call depends on.

When is a SIP proxy tier worth adding in front of LiveKit?

When the carrier cannot hold multiple Origination URIs, or when node count makes managing the URI list a standing chore, based on your rate of node changes and operational needs. For a small stable list, direct carrier targets may be sufficient.

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.

Free guide

Be The 10x Entrepreneur

Get the firm out of your head.

  • 8 chapters
  • 7 worksheets
  • 30 day plan