Back to Insights
VoIP Engineering

What Is a Session Border Controller (SBC)? Functions, Architecture and Open-Source Options

Telephony Engineering Team
· Updated
8 min read
What Is a Session Border Controller (SBC)? Functions, Architecture and Open-Source Options

A session border controller (SBC) is a network element that sits at the edge between two VoIP networks and controls the SIP signaling and RTP media that cross that border. It secures the edge, hides your internal topology, fixes interoperability problems between systems from different vendors, and keeps calls working through NAT and failures.

If you run a PBX, a contact center, a CPaaS, or a voice AI platform that connects to carriers, you already depend on SBC functions, whether you bought a box for it or not. This guide explains what an SBC does, how it works, when you need one, and how to build one from open-source parts.

What a session border controller does

An SBC is a purpose-built edge for real-time communications. Its main jobs are:

  • Security. Terminate untrusted traffic, rate-limit and block abusive sources, validate SIP messages, and stop scanning, registration floods, and toll-fraud attempts before they reach your core.
  • Topology hiding. Present one clean public address and rewrite headers so carriers and partners never see your internal IPs, hostnames, or architecture.
  • Interoperability. Normalize SIP headers, fix non-standard behavior, translate between SIP profiles, and bridge UDP, TCP, TLS, and WebSocket transports.
  • NAT traversal. Anchor media and correct addresses so calls work when endpoints sit behind NAT.
  • Media handling. Relay RTP, transcode between codecs, and interwork SRTP and plain RTP.
  • Routing and resilience. Route by rules, fail over between carriers, and enforce capacity limits so one trunk cannot overwhelm your platform.
  • Visibility. Produce call detail records, quality metrics, and SIP traces for troubleshooting and compliance.

SBC vs firewall vs SIP proxy

These three are often confused. They solve different problems.

FirewallSIP proxy (e.g. Kamailio)Session border controller
Understands SIPLimited (ALG, if enabled)YesYes
Touches media (RTP)Passes itNo, by itselfYes, relays and can transcode
Dialog modelNoneUsually stateless or transaction-statefulUsually back-to-back user agent (B2BUA)
Hides topologyPartly (NAT)With extra modulesCore feature
Typical roleNetwork perimeterRouting, registrar, load balancingTrust boundary for voice

A generic firewall cannot reliably secure SIP. Its SIP helper often rewrites packets badly, which is a common cause of one-way audio. See SIP ALG: what it is and how to disable it.

How an SBC works: signaling and media

Most SBCs operate as a back-to-back user agent (B2BUA). Instead of forwarding a call, the SBC terminates it and creates a second, independent call toward the destination. The two call legs have their own dialogs, headers, and addresses.

 Untrusted side                SBC                    Trusted side
 (carrier / partner)    +----------------+          (PBX / platform)
                        |                |
  INVITE  ------------> |  Leg A dialog  |
                        |  validate,     |
                        |  rate-limit,   |
                        |  normalize     |
                        |       |        |
                        |  Leg B dialog  | ------>  INVITE
                        |                |
  RTP  <==============> |  media anchor  | <======> RTP
                        +----------------+

Because each leg is separate, the SBC can change codecs, transports, and headers on one side without affecting the other, and neither network sees the other's internal details.

Signaling and media are separate planes. SIP signaling is cheap to process. Media is expensive in bandwidth and, when transcoding, in CPU. A good SBC design scales the two independently. See RFC 7092 for a taxonomy of back-to-back user agent behavior and RFC 5853 for the requirements that drive SBC deployments.

Core SBC functions in detail

Security and fraud protection

The public internet constantly scans port 5060. A typical SBC security policy includes:

  • Per-source and per-account rate limits on INVITE and REGISTER
  • Automatic blocking of sources that fail authentication repeatedly
  • Strict SIP message validation to drop malformed packets
  • Allow-lists of carrier IP ranges for trunk traffic
  • TLS for signaling and SRTP for media where peers support them
  • Call-per-second and concurrent-call ceilings per customer or trunk

Fraud control belongs here too. Limits on destinations, call duration, and spend stop a compromised account from running up a large bill overnight. See VoIP toll fraud prevention and VoIP security best practices.

Normalization and interoperability

No two SIP stacks behave identically. SBCs fix this with manipulation rules: adding or removing headers, rewriting numbers to E.164, changing From and P-Asserted-Identity handling, adjusting SDP, and correcting timers. Most real-world carrier integration work is normalization.

NAT traversal and media anchoring

When endpoints sit behind NAT, SDP advertises private addresses that the far side cannot reach. The SBC rewrites SDP and relays RTP so both sides send media to a reachable address. See NAT traversal with STUN, TURN and ICE.

Transcoding and encryption interworking

If one side supports only G.711 and the other prefers Opus or G.729, the SBC transcodes. If one side requires SRTP and the other uses plain RTP, the SBC bridges them. Transcoding is the main driver of SBC CPU cost, so avoid it unless needed. See G.711 vs G.729 bandwidth.

Routing, failover, and regulatory functions

SBCs apply least-cost or priority routing, try the next carrier on failure, and enforce capacity limits. They are also the natural place to attach STIR/SHAKEN signing, emergency call routing, and lawful-intercept hooks. See STIR/SHAKEN compliance and E911 compliance for VoIP.

SBC deployment models

  • Enterprise SBC (E-SBC). Sits between your PBX or contact center and your SIP trunk provider.
  • Carrier or interconnect SBC. Sits between networks of service providers and handles high volumes and strict policy.
  • Cloud or virtual SBC. Runs as software in a VM or container, scales on demand, and suits multi-tenant platforms.
  • Certified SBC for Microsoft Teams Direct Routing. Microsoft requires an SBC from its certified list to connect Teams to the PSTN.

Do you need an SBC?

You probably do if any of the following are true:

  • You connect to more than one carrier or must fail over between them
  • You host multiple customers or tenants on shared infrastructure
  • You have been targeted by scanning, registration floods, or toll fraud
  • You must interoperate with partners whose SIP implementations differ from yours
  • You must keep your core addresses hidden from partners and carriers

You may not need a dedicated SBC if you use a single managed SIP trunk, a small private network, and a cloud UCaaS provider that already provides edge protection. Even then, you still need a properly configured firewall and strong authentication.

Open-source SBC options

You can build a capable SBC from open-source components, which avoids per-session licensing and gives you full control.

Kamailio + rtpengine is the most common pattern. Kamailio is a high-performance SIP server that handles signaling, authentication, rate limiting, topology hiding, and load balancing. rtpengine is a media proxy that relays RTP, handles SRTP, transcodes, and does NAT handling. See building an open-source SBC with Kamailio and rtpengine.

OpenSIPS plays a similar role to Kamailio and also works with rtpengine. See OpenSIPS vs Kamailio.

FreeSWITCH can act as a B2BUA and handles media itself, so it can serve as an SBC in some designs. It is a media server first, so large edge deployments usually put Kamailio in front. See scaling FreeSWITCH horizontally with Kamailio.

Open-source SBCs trade license fees for engineering effort. They are an excellent fit when you have telephony engineers or a partner who does, and a poor fit if no one will own them.

Designing for high availability and capacity

  • Separate signaling from media so each scales on its own metric: signaling by calls per second, media by concurrent calls and transcoding load.
  • Use stateless signaling where possible. A stateless Kamailio tier is easy to run active-active behind a virtual IP or DNS SRV, because any node can handle any request.
  • Plan failover for media. B2BUA and media state is harder to replicate. Decide whether in-progress calls must survive a failover or only new calls.
  • Size for the worst case. Transcoding, TLS handshakes, and call recording consume far more CPU than plain relaying.
  • Capture everything. Use SIP capture such as HEP/Homer so you can diagnose failures after the fact. See VoIP monitoring with Homer and HEP.

Common SBC mistakes

  • Leaving a SIP ALG enabled on a firewall in front of the SBC
  • Anchoring and transcoding all media when most calls need neither
  • Opening the SBC to the internet without rate limits or allow-lists
  • No monitoring of ASR, ACD, and post-dial delay per carrier
  • Ignoring registration and expiry handling for large phone fleets

Frequently asked questions

What does an SBC do in simple terms?

It acts as a secure, intelligent gateway for voice. It checks and cleans up SIP traffic, hides your internal network, makes mismatched systems interoperate, and routes calls with failover.

Is an SBC a firewall?

No. A firewall filters network traffic. An SBC understands SIP and RTP at the application layer and manages whole sessions. Many deployments use both.

Can Kamailio be an SBC?

Yes, when paired with rtpengine for media. Kamailio handles signaling and security, and rtpengine handles media, which together cover most SBC functions.

Do I need an SBC for SIP trunking?

Not always. A single managed trunk on a small deployment can work without one. As soon as you add multiple carriers, multiple tenants, or public exposure, an SBC becomes the safe choice.

References


Need an SBC designed and operated properly? Our Kamailio load balancing and SBC engineering team builds and hardens SIP edges for carriers, platforms, and enterprises.

Discussion

0

Join the conversation

Sign in with your preferred account to comment, reply, and keep the discussion useful for other engineers.

Takes a few seconds. No separate password required.

C

Controva LLC

Engineering Team

We build digital empires that scale. Specializing in high-performance web architecture, AI automation, and headless commerce.

Work with us

Share this article