By Sagar Shankaran, Founder of CallSphere
Kamailio 6.1 lets you reload dispatcher targets, set destination state, and run MI commands over RPC without restarting the proxy. For AI voice fleets that scale up and down hourly, that is the difference between a managed cluster and a maintenance window.
Key takeaways
Kamailio is the SIP load balancer of choice in front of FreeSWITCH, Asterisk, and AI media servers because the dispatcher module is the closest thing telephony has to a Kubernetes service. The 2026 release adds multi-threaded TLS and tighter MI-over-RPC plumbing, so you can drain an AI media node mid-spike without dropping calls.
Kamailio is a high-performance SIP proxy written in C, descended from SER and OpenSER. It is the canonical edge proxy for VoIP carriers and large enterprise PBXes. The dispatcher module load-balances SIP requests across a pool of backends with algorithms ranging from round-robin to weighted call-load to consistent hashing on Call-ID.
Management Interface (MI) is the legacy control channel: a FIFO file or a UDP socket that takes text commands like dispatcher.list or dispatcher.set_state. RPC is the newer JSON-RPC interface (HTTP, BinRPC, JSON-RPC over UDP) that exposes hundreds of commands across every module. The mi_rpc module bridges them so you can call MI commands via RPC and vice versa.
For AI voice the dispatcher pattern is everything. You have a fleet of media servers (FreeSWITCH boxes running mod_audio_stream, or LiveKit SIP gateways, or your own bridges); Kamailio fronts them and routes calls based on health, weight, and tenant policy. When a media server gets hot, you set its state to inactive over RPC and Kamailio drains it.
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
graph LR
A[Carrier SIP Trunks] --> B[Kamailio 6.1 Edge]
B -->|dispatcher| C[Media Server 1]
B -->|dispatcher| D[Media Server 2]
B -->|dispatcher| E[Media Server N]
F[Control Plane] -->|RPC| B
F -->|kamcli| B
G[AI Brain] -.->|MCP| F
The control plane talks to Kamailio over JSON-RPC on a private port (default 5060 with ctl module bound to /var/run/kamailio/kamailio_ctl). An AI brain or autoscaler can call dispatcher.set_state with a duid attribute to drain a destination, then dispatcher.reload after the database is updated.
# kamcli example: drain media-2 in group 1
kamcli dispatcher set-state inactive 1 sip:media-2.callsphere.local:5060
# verify
kamcli dispatcher list
# reload after DB change
kamcli dispatcher reload
CallSphere does not deploy Kamailio in front of our production stack. Every call on every product (Healthcare AI on FastAPI :8084 to OpenAI Realtime, Real Estate AI, Sales Calling AI with 5 concurrent outbound, Salon AI, IT Helpdesk AI, After-Hours AI with 120-second simul call+SMS) terminates on Twilio Programmable Voice. Twilio handles SIP-side load balancing across their carrier interconnects; we receive WebSocket-flavored audio downstream. For self-hosted enterprise deployments asking for on-prem Kamailio, our engineering team has a reference Kubernetes Helm chart that pairs Kamailio 6.1 with FreeSWITCH media nodes and a control plane that calls dispatcher RPC from our existing 90+ tools across 115+ DB tables. Pricing for that managed-on-prem option starts above our $1499 tier and is quoted case by case. The 22% affiliate and 14-day trial apply to the standard SaaS only.
dispatcher.set_state to mark a destination inactive before drain, active after.dispatcher.reload only after DB writes; the module rate-limits to one reload every 5 seconds by default.Is the FIFO MI still useful? For one-off shell scripts yes. For programmatic control RPC is cleaner because it returns structured JSON and supports HTTP transport.
How do I see all available RPC commands?
kamctl rpc system.listMethods returns the full list. There are over 300 in a default Kamailio 6.1 build.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Does Kamailio handle media? No. Kamailio is signaling-only. Media goes through rtpengine or your media server (FreeSWITCH, Asterisk, LiveKit).
How fast is dispatcher reload? Sub-100 ms typical for tables under 1000 entries; larger fleets use database-backed dispatcher with on-demand row caching.
Can I drain a node and let in-flight calls finish?
Yes. dispatcher.set_state inactive only blocks new calls; let active calls drain naturally, then take the node down.
Start a 14-day trial to skip the SIP proxy entirely with our managed Twilio stack, see pricing for $149/$499/$1499, or contact us about on-prem Kamailio reference architectures.
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
A founder's guide to the female voice generator landscape: AI female voices, Japanese voices, robot voices, and how CallSphere ships 57+ voices live.
MOS 4.3+ is the band where AI voice feels human. Drop below 3.6 and conversations break. Here is how to measure, improve, and alert on MOS in production AI voice using G.711, Opus, and the underlying packet loss / jitter / latency math.
Texas SB 1188 requires US-resident EHRs from January 1, 2026; Nevada's consumer-health-data law constrains health data; Colorado AI Act takes effect June 30, 2026. AI voice agents must architect for state-by-state data localization.
When your AI voice agent gets one-way audio, missed DTMF, or codec mismatch, sngrep and Wireshark are still the fastest path to root cause in 2026. Here is the playbook.
PCI DSS 4.0.1 future-dated requirements went mandatory March 31, 2025. AI voice agents that take card payments on behalf of healthcare providers — copays, deductibles, payment plans — must meet 12 requirements with DTMF masking and scope reduction.
Transcoding RTP to WebSocket is more CPU-intensive than people expect. For AI voice in 2026, where you place the transcode (edge near the carrier vs central near the model) decides your cost-per-minute.
© 2026 CallSphere LLC. All rights reserved.