Back to Insights
VoIP Engineering

Building a Multi-Tenant PBX: Architecture Patterns for SaaS Telephony Providers

Solutions Architecture Team
8 min read
Building a Multi-Tenant PBX: Architecture Patterns for SaaS Telephony Providers

Building a telephony platform that serves one company is straightforward. Building one that serves thousands of independent tenants — each with their own dialplans, extensions, call recording rules, and billing — is an entirely different architectural problem, and most teams underestimate it until tenant #200 starts generating cross-contamination bugs.

The Core Design Decision: Isolation Model

There are three common patterns, in increasing order of operational complexity:

1. Shared Core, Logical Isolation

A single FreeSWITCH/Kamailio cluster serves all tenants, with tenant identity carried through SIP domains or custom headers, and dialplan logic branching per tenant. Cheapest to operate, but a misconfigured dialplan or a noisy-neighbor tenant can degrade everyone.

2. Namespace Isolation per Tenant

Each tenant gets a dedicated SIP domain and isolated dialplan context within a shared cluster (FreeSWITCH's XML dialplan contexts are well suited for this). Better fault containment than fully shared, still cost-efficient.

3. Dedicated Cluster per Tenant (or Tenant Tier)

Enterprise or compliance-sensitive tenants (healthcare, financial services) get their own FreeSWITCH nodes entirely. Highest cost, but eliminates any cross-tenant risk — often required for HIPAA or SOC 2 commitments.

Kamailio's Role: Tenant-Aware Routing at the Edge

Kamailio sits in front of the media layer and handles SIP registration, authentication, and routing decisions before a call ever reaches a FreeSWITCH media node. For multi-tenant platforms, this is where tenant identification, rate limiting per tenant, and load-based routing to the correct backend cluster all happen — keeping the expensive media layer stateless and horizontally scalable.

Billing and CDR Architecture

Every call needs to resolve to exactly one tenant for billing, with call detail records (CDRs) tagged at generation time, not reconstructed after the fact. Common mistakes:

  • Relying on caller ID alone to attribute calls (breaks the moment a tenant ports a number)
  • Storing CDRs in a single unpartitioned table, which becomes a query bottleneck once tenant count grows past a few hundred
  • Not capturing per-tenant concurrency limits, letting one runaway tenant consume shared trunk capacity

Building a multi-tenant voice platform and need the isolation model right the first time? Controva LLC has architected multi-tenant FreeSWITCH/Kamailio deployments from the ground up for SaaS telephony providers.

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