Configuring Kamailio as anEnterprise Session Border Controller
Full Kamailio SBC setup: topology hiding, codec negotiation via rtpengine, TLS/SRTP enforcement, rate limiting, IP allowlisting, and STIR/SHAKEN attestation for production enterprise deployments.
Topology
Hide internal IPs
TLS+SRTP
Full encryption
30 req/2s
Pike rate limit
STIR
Call attestation
By Kaushik Parmar · Founder & VoIP Architect, CelloIP Technologies · January 8, 2026 · 17 min read
What does a Kamailio SBC do and how do you configure it?
A Kamailio SBC performs topology hiding (masking internal IPs), enforces TLS/SRTP security, rate-limits SIP traffic to prevent DDoS, normalises SDP, and handles STIR/SHAKEN call attestation at the network boundary.
Table of Contents
What Is a Session Border Controller?
An SBC sits at the network boundary between your trusted VoIP infrastructure and the public internet or SIP carrier. Kamailio + rtpengine is the most widely deployed open-source SBC stack in carrier and enterprise environments.
Topology Hiding
Masks internal IP addresses from external parties
TLS + SRTP
Enforces encrypted signalling and media at the border
Rate Limiting
Protects against SIP flooding and dictionary attacks
SDP Normalisation
Translates between incompatible endpoints (NAT, codecs)
STIR/SHAKEN
Regulatory call authentication to combat robocall spoofing
Topology Routing
Route calls to correct internal servers based on policy
Topology Hiding
What Gets Hidden
What External Parties See
# Load modules
loadmodule "topoh.so"
# Topology hiding parameters
modparam("topoh", "mask_key", "a_very_secret_key_32chars_long!!")
modparam("topoh", "mask_ip", "203.0.113.10") # Your SBC public IP
modparam("topoh", "mask_callid", 1) # Also obfuscate Call-IDs
# In request_route — apply for INVITE and all non-ACK requests:
route[TOPOLOGY_HIDE] {
if (!topology_hiding()) {
xlog("L_WARN", "Topology hiding failed for $ci\n");
}
}Rate Limiting & DDoS Protection
SIP flooding is the most common attack against public-facing SIP infrastructure. Without rate limiting, a basic UDP flood can exhaust your server in seconds.
loadmodule "pike.so"
modparam("pike", "sampling_time_unit", 2)
modparam("pike", "reqs_density_per_unit", 30) # 30 req/2sec max per IP
modparam("pike", "remove_latency", 120) # unblock after 120s
route[DOS_PROTECT] {
if (!pike_check_req()) {
xlog("L_ALERT","DoS from $si — blocking\n");
# Kernel-level block — stops flood before reaching Kamailio
exec_cmd("iptables -A INPUT -s $si -j DROP &");
sl_send_reply(503, "Flood Detected");
exit;
}
}
# IP allowlist — skip rate limiting for trusted carrier IPs
route[ALLOWLIST_CHECK] {
if (src_ip == "1.2.3.4" || src_ip == "5.6.7.8") {
return; # trusted carrier, skip DOS_PROTECT
}
route(DOS_PROTECT);
}TLS Signalling + SRTP via rtpengine
External Leg (Public Internet)
Internal Leg (Trusted Network)
modparam("rtpengine", "rtpengine_sock", "udp:127.0.0.1:22222")
route[RTPENGINE] {
if (is_method("INVITE") || is_method("ACK")) {
# External (SRTP) → Internal (RTP) bridge
rtpengine_manage(
"replace-origin replace-session-connection SRTP", # external leg
"replace-origin replace-session-connection RTP" # internal leg
);
}
}STIR/SHAKEN: Call Authentication
What STIR/SHAKEN Does
Compliance Timeline
Kamailio vs Commercial SBC Solutions
| Feature | Kamailio | Oracle ACME | Ribbon |
|---|---|---|---|
| Topology hiding | ✅ Full (topoh module) | ✅ Full | ✅ Full |
| SRTP/TLS enforcement | ✅ rtpengine + TLS | ✅ Full | ✅ Full |
| STIR/SHAKEN | ✅ stirshaken module | ✅ Full | ✅ Full |
| Hardware appliance | ❌ Software only | ✅ Physical/virtual | ✅ Physical/virtual |
| GUI admin | ⚠️ Kamctl CLI only | ✅ Full GUI | ✅ Full GUI |
| Vendor SLA support | ⚠️ Community + CelloIP | ✅ Enterprise SLA | ✅ Enterprise SLA |
| Cost (1,000 sessions) | ✅ ~$0 licence | ❌ $50k+/yr | ❌ $30k+/yr |
| Customisability | ✅ Full source access | ❌ Black box | ❌ Black box |
Frequently Asked Questions
QDo I need an SBC if I use a cloud SIP provider?
Not always for small deployments. But for enterprise environments with 50+ extensions, an SBC provides critical security, topology hiding, and policy enforcement that cloud SIP providers cannot offer on their shared infrastructure.
QCan Kamailio replace a commercial SBC?
For most enterprise use cases, yes. Commercial SBCs offer hardware appliances and vendor SLAs. Kamailio with professional configuration matches their functionality at a fraction of the cost — often saving $30k–$100k in annual licensing.
QWhat is the difference between Kamailio and OpenSIPS for SBC?
Both serve as SBC. Kamailio has broader module coverage for security and carrier features. OpenSIPS has a more approachable scripting language. CelloIP uses both depending on existing infrastructure and team familiarity.
QIs STIR/SHAKEN mandatory?
In the US, FCC mandated STIR/SHAKEN for carriers with 100+ employees since 2021. European equivalents are being rolled out in 2025–2026. Compliance avoids call labelling as 'potential spam' by carriers.
Related Articles
Official References
Enterprise SBC Deployment
CelloIP Technologies designs and deploys Kamailio SBC solutions for enterprise and carrier environments — replacing $50k+/year commercial SBCs with fully customised, open-source alternatives.