<#C088ZNU7QQ5> is there any load balancer logic or...
# ask-ai
m
#C088ZNU7QQ5 is there any load balancer logic or technique present in the livekit where if we have multiple trunks or ipsec tunnel then it can handle the calling capacity
✅ 1
t
Thanks for reaching out, Manas. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you're asking whether LiveKit includes logic to load-balance calls across multiple SIP trunks or IPsec tunnels to handle call capacity. Short answer: LiveKit provides internal load‑distribution for agents/servers and autoscaling, but it does not perform trunk- or IPsec‑tunnel level load balancing. Distribution across multiple trunks/tunnels is handled by your trunk/network provider or by external network routing. What LiveKit does provide: • Agent/server job distribution with round‑robin and single‑assignment behavior, considers server load (
load_fnc
/
load_threshold
) and geographic affinity to place sessions efficiently. • Autoscaling and graceful draining of agent servers to handle increased capacity. • SIP dispatch rules to control how calls are routed into rooms (
Individual
,
Direct
,
Callee
), but these do not load‑balance across multiple trunk endpoints. • Guidance on concurrent capacity per agent server (example: a 4‑core/8GB machine handles roughly 10–25 concurrent jobs depending on features used). If your goal is to spread inbound/outbound call capacity across multiple trunks/IPsec tunnels, I can help with options: • Do you want recommendations for design patterns to combine LiveKit with provider-level trunk load balancing (e.g., SIP registrar/edge load balancers, DNS load balancing, SBC clusters)? • Or do you want help mapping your current trunk/tunnel setup so I can suggest how LiveKit’s SIP dispatch rules and autoscaling should be configured? Tell me which option you prefer or share a brief diagram of your trunks/tunnels and desired behavior and I’ll suggest specific steps. Sources: Self-hosted deployments | LiveKit Documentation | Deploy and scale agents on LiveKit Cloud | LiveKit | sip | livekit/livekit_composite | DeepWiki | Agents telephony integration | LiveKit Documentation | Announcing LiveKit Cloud | LiveKit, with interactive elements
m
can i use Kamailio/OpenSIPS with livekit for load balancing of the calls based on channel capacity
t
Yes — you can use Kamailio or OpenSIPS in front of LiveKit to load‑balance calls by channel capacity. LiveKit does not handle trunk/tunnel‑level call distribution, so putting a SIP proxy/SBC (Kamailio/OpenSIPS) or SBC cluster at the edge is a common approach. How this typically works: • Kamailio/OpenSIPS handles SIP edge functions (registration, routing, trunk balancing) and can perform capacity‑aware routing using modules or custom logic (dialog/statistics, dispatcher, or realtime DB). • The proxy routes selected calls to LiveKit’s SIP gateway endpoints (or to your SBCs that interface with LiveKit). • Use Kamailio/OpenSIPS to distribute calls based on per‑trunk/channel availability, least‑load, or weighted rules; LiveKit then handles session/agent distribution and media. If you’d like, I can: • Suggest concrete Kamailio/OpenSIPS modules and routing patterns to track channel usage and route to LiveKit. • Outline how to map Kamailio/OpenSIPS routing to LiveKit SIP dispatch rules (
Individual
,
Direct
,
Callee
) and autoscaling settings. Which would you prefer? , with interactive elements