RustPBX

April 30, 2026 · View on GitHub

Crates.io License GitHub commit activity Crates.io Total Downloads GitHub Repo stars

A high-performance Software-Defined PBX built in Rust — An AI-native communication platform for next-generation contact centers.

Different from Asterisk/FreeSWITCH (C modules), RustPBX exposes all call control via HTTP/WebSocket/Webhook, making it fully programmable in any language. Route decisions, media control, and event streams are all externalized — AI becomes a native participant in every call.

Note: The Voice Agent functionality has been moved to a separate repository: Active Call. This repository now focuses on the SIP Proxy and PBX features.

GitHub | Website


Software-Defined Communication

RustPBX breaks the closed architecture of traditional PBX systems by exposing three powerful integration channels:

ChannelProtocolPurpose
Policy DecisionHTTP RouterReal-time routing decisions: AI first, agent queue, IVR, or direct transfer
Real-time ControlRWI (WebSocket)In-call control: listen, whisper, barge, transfer, hold, media injection
Event StreamWebhookPush CDR, queue status, and events to your CRM/ticketing system

Editions

CommunityCommerce
LicenseMITCommercial
SIP Proxy + Media
HTTP Router (dynamic routing)
Queue / ACD
Call Recording + SipFlow
Transcript (SenseVoice offline)
Web Console
RWI (WebSocket Interface)
VoIP Wholesale (VOS3000 alternative)
IVR Visual Editor
Voicemail Pro
Enterprise Auth (LDAP/SAML/MFA)
Endpoint Manager (phone auto-provisioning)

AI-Native UCaaS Architecture

RustPBX Architecture

Architecture Layers:

  • App Service Layer: AI Voice Agent, Human Agents, HTTP DialPlan Handler, RWI Call Control, Webhook Consumer, CRM/Ticketing
  • RustPBX Core Layer: B2BUA, IVR, Media Fabric, Queue/ACD, Recording, CDR, SIP Trunk
  • Access Layer: PSTN (SIP Trunk), WebRTC Browser, SIP Client, Mobile App

Core Capabilities

SIP & Media

  • SIP Proxy — Full SIP stack (UDP/TCP/WS/TLS/WebRTC), registration, auth, B2BUA
  • Media Proxy — RTP relay, NAT traversal, WebRTC ↔ SIP bridging
  • TLS/SRTP — End-to-end encryption with automatic ACME certificate management

Routing & Control

  • HTTP Router — Every INVITE hits your webhook; you return routing decision in JSON
  • RWI (WebSocket Interface) — Real-time call control: originate, answer, hold, transfer, record, queue management, supervisor whisper/barge, and media stream injection (PCM)
  • Queue / ACD — Sequential or parallel agent ringing, hold music, priority scheduling

Recording & Analytics

  • SipFlow Recording — Unified SIP+RTP capture; hourly files with on-demand playback (no file-handle exhaustion)
  • Transcript — Post-call transcription via local SenseVoice (offline, no cloud dependency)
  • CDR Webhooks — Push call detail records + recordings to your system on hangup

Operations

  • Web Console — Built-in management UI with visual configuration
  • WebRTC Phone — Built-in browser softphone for testing
  • RBAC — Role-Based Access Control with fine-grained permissions
  • Observability — Built-in Prometheus metrics + OpenTelemetry tracing

Typical Use Cases

ScenarioDescription
AI Contact CenterAI Voice Agent handles incoming calls, transfers to human agents for complex issues, 24/7 availability
Cloud Call CenterMulti-tenant SaaS architecture, remote agents, WebRTC + SIP endpoints
Enterprise UCInternal communication, conferencing, voicemail, CRM/OA integration
VoIP WholesaleMulti-carrier routing, flexible billing, profit optimization (Commercial)
Compliance RecordingFinancial/healthcare compliance recording, AI quality inspection, PCI masking
Outbound MarketingPredictive dialing, call analytics, lead scoring

Quick Start (Docker)

# Commerce image (includes Wholesale + all commercial plugins)
docker pull docker.cnb.cool/miuda.ai/rustpbx:latest

# Community image
docker pull ghcr.io/restsend/rustpbx:latest

Minimal config.toml:

http_addr = "0.0.0.0:8080"
database_url = "sqlite://rustpbx.sqlite3"

[console]
base_path = "/console"
allow_registration = false

[proxy]
addr = "0.0.0.0"
udp_port = 5060
modules = ["auth", "registrar", "call"]

[[proxy.user_backends]]
type = "memory"
users = [{ username = "1001", password = "password" }]

[sipflow]
type = "local"
root = "./config/sipflow"
subdirs = "hourly"
docker run -d --name rustpbx --net host \
  -v $(pwd)/config.toml:/app/config.toml \
  -v $(pwd)/config:/app/config \
  ghcr.io/restsend/rustpbx:latest --conf /app/config.toml

# Create first admin
docker exec rustpbx /app/rustpbx --conf /app/config.toml \
  --super-username admin --super-password changeme

Web console: http://localhost:8080/console/ SIP proxy: udp://localhost:5060


Build from Source

Dependencies (Linux):

apt-get install -y cmake pkg-config libasound2-dev libssl-dev libopus-dev

macOS:

brew install cmake openssl pkg-config
git clone https://github.com/restsend/rustpbx
cd rustpbx
cargo build --release
cargo run --bin rustpbx -- --conf config.toml.example

Cross-compilation for aarch64 / x86_64 via cross:

cargo install cross
cross build --release --target aarch64-unknown-linux-gnu

HTTP Router — The Key Extension Point

RustPBX calls your API on every incoming INVITE. You decide what happens:

[proxy.http_router]
url = "https://your-api.com/route"
timeout_ms = 3000
// POST to your endpoint:
{ "call_id": "abc-123", "from": "sip:+861390000@trunk", "to": "sip:400800", "direction": "inbound" }

// Your response:
{ "action": "forward", "targets": ["sip:ai-agent@internal"], "record": true }

Actions: forward · reject · abort · spam See API Integration Guide for the full webhook and active call control reference.


RWI — Real-time WebSocket Interface

RWI provides JSON-over-WebSocket for real-time call control:

CategoryCommands
Call Controloriginate, answer, hangup, bridge, transfer, hold, reject
Media Controlplay, stop, stream_start, inject_start (PCM)
Recordingrecord.start, pause, resume, stop, mask_segment
Queue Managementenqueue, dequeue, set_priority, assign_agent, requeue
Supervisorlisten, whisper, barge, takeover
Conferencecreate, add, remove, mute, destroy

See RWI Protocol for details.


Screenshots

ExtensionsCall RecordsRoute Editor
TranscriptSIP FlowWebRTC Phone

Documentation

Configuration GuideAll config options
API Integration GuideHTTP Router, Webhooks, Active Call Control
RWI ProtocolWebSocket Interface for real-time call control

Troubleshooting

SIP 401 behind NAT/Docker — set the realm explicitly:

[proxy]
realms = ["your-public-ip:5060"]

Benchmark

Tested on 2026-04-03 · RustPBX 0.4.0 (release) · sipbot 0.2.28 · Linux x86_64 · 16 cores / 32 GB · G.711 PCMU

Full Comparison

LevelScenarioCompletionPeak ConcLossSetup LatencyCPU PeakMem Peak
500mediaproxy=none100%5000.00%4.40ms32.4%137.3 MB
500mediaproxy=all100%5000.00%3.73ms98.4%183.1 MB
500all + sipflow100%5000.00%5.96ms101.0%198.3 MB
800mediaproxy=none100%8000.00%8.32ms47.9%191.8 MB
800mediaproxy=all100%8000.00%6.38ms155.0%264.8 MB
800all + sipflow100%8000.00%6.08ms156.0%280.3 MB

Per-Channel Overhead

Metric500 (none)500 (all)500 (sipflow)800 (none)800 (all)800 (sipflow)
CPU (Peak)0.065%0.197%0.202%0.060%0.194%0.195%
Memory (Peak)0.275 MB0.366 MB0.397 MB0.240 MB0.331 MB0.350 MB

Resource Scaling Estimate

mediaproxy=none (signaling only):
  CPU%    ≈ 8 + concurrent × 0.05
  Mem(MB) ≈ 60 + concurrent × 0.16

  1000 conc: CPU ≈ 58% (0.6 cores),  Mem ≈ 220 MB
  2000 conc: CPU ≈ 108% (1.1 cores), Mem ≈ 380 MB
  5000 conc: CPU ≈ 258% (2.6 cores), Mem ≈ 860 MB

mediaproxy=all (RTP forwarding):
  CPU%    ≈ 8 + concurrent × 0.19
  Mem(MB) ≈ 80 + concurrent × 0.23

  1000 conc: CPU ≈ 198% (2.0 cores), Mem ≈ 310 MB
  2000 conc: CPU ≈ 388% (3.9 cores), Mem ≈ 540 MB
  5000 conc: CPU ≈ 958% (9.6 cores), Mem ≈ 1230 MB

See Benchmark Details for methodology and full results.


License

Community edition: MIT Commercial edition : hi@miuda.ai


https://miuda.ai - Maintenance & commercial support