Hacker News

Rvoip 0.5 the complete VoIP stack in Rust

Comments

A Rust library for building communications applications. SIP, RTP, WebRTC, QUIC/WebTransport/WebSocket conversations, Media over QUIC, and voice-AI agents share one call model, and the whole stack is in the box: no external SIP server, media server, or RTP engine to install and wire together.

Five-minute start ยท For carriers ยท Which crate? ยท Pick a path ยท How it fits together ยท What ships ยท Interop evidence ยท Changes ยท Upgrading from 0.3

Overview

rvoip is a library, not a server you deploy next to your application. Signalling, media, codecs, NAT traversal, security, and the conversation model are all Rust crates in this workspace, so a call goes from your code to the wire without a separately installed SIP proxy, media server, or RTP engine.

The examples below run on a laptop with nothing installed but Rust; the same crates carry the release-gated interoperability evidence against Asterisk, FreeSWITCH, Jambonz, Kamailio, and OpenSIPS.

Carriers evaluating standards coverage, performance, and reliability should start with For carriers.

For Carriers

One AWS c8i.4xlarge (16 vCPU, 8 cores, Intel Xeon 6, 32 GiB) running a single rvoip process, measured with the RFC 7501/7502 benchmark:

Workload Max CPS CPS per vCPU Concurrent calls (10 s calls) p50 setup at 90% load p99 setup at 90% load
SIP over TLS, signaling only 8,348 ~520 n/a 1 ms 6 ms
SIP over UDP, signaling only 8,256 ~515 n/a 1 ms 6 ms
TLS + SRTP (SDES), G.711, 10 s calls 1,124 ~70 ~11,200 1 ms 4 ms
UDP + RTP, G.711, 10 s calls 1,204 ~75 ~12,000 n/m n/m

At 2x capacity, rvoip keeps admitting calls at its max CPS, refuses the excess with fast 503 responses, and recovers cleanly once the load drops.

  • Max CPS (calls per second; RFC 7502's Session Establishment Rate) is the highest rate with zero failed calls over a trial of at least 180 s and 50,000 call attempts.
  • rvoip was measured as a terminating endpoint: it answers each call and echoes its media. A relaying B2BUA or SBC handles two call legs per session.
  • G.711 media is passed through; nothing is transcoded.
  • Concurrent calls is the CPS times the 10 s call length, not a measured maximum; long-call capacity, where most SBC datasheets quote their concurrency, has not been measured yet.
  • The server is a cloud VM, not an appliance.
  • p50 and p99 setup are the RFC 6076 session request delay measured at 90% of max CPS, recorded in whole milliseconds (so 1 ms means 1 ms or less); n/m = not measured.
  • The UDP + RTP max CPS was confirmed twice rather than three times.
  • The release check also passed at 5% above the TLS and UDP signaling max CPS, so those two figures may be slightly understated.
  • Not yet measured: B2BUA/relay mode (two legs per call), registrations, transcoding, WebRTC (DTLS-SRTP), and failover.

Full method and per-trial data: RFC 7501/7502 benchmark report.

Five-Minute Start

  1. Add one dependency.
[dependencies]
rvoip-sip = "0.5.1"
tokio = { version = "1", features = ["full"] }

Upgrading an existing application from 0.3? The 0.4 migration guide has before/after code for every breaking change.

  1. Make a call.

Bob answers, Alice dials, Alice hangs up. Everything runs on loopback, so this works on a laptop with no PBX, no account, and no network setup.

use std::time::Duration;
use rvoip_sip::{Config, Endpoint, EndpointProfile};

#[tokio::main]
async fn main() -> rvoip_sip::Result {
    let bob = tokio::spawn(async {
        let mut bob = Endpoint::builder()
            .name("bob")
            .profile(EndpointProfile::Custom(Config::local("bob", 5071)))
            .build()
            .await?;
        let incoming = bob.wait_for_incoming().await?;
        let call = incoming.answer().await?;
        call.wait_for_end(None).await?;
        bob.shutdown().await
    });
    tokio::time::sleep(Duration::from_millis(300)).await;
    let alice = Endpoint::builder()
        .name("alice")
        .profile(EndpointProfile::Custom(Config::local("alice", 5070)))
        .build()
        .await?;
    let call = alice
        .call_and_wait("sip:bob@127.0.0.1:5071", Some(Duration::from_secs(10)))
        .await?;
    call.hangup_and_wait(Some(Duration::from_secs(5))).await?;
    alice.shutdown().await?;
    bob.await.unwrap()
}
  1. Or run the same program from the checkout.
git clone https://github.com/eisenzopf/rvoip.git && cd rvoip
cargo run -p rvoip-sip --example endpoint_local_call

From here, examples/ walks forward one step at a time: real microphone audio, registering to a PBX, hold/DTMF, transfers, SRTP and TLS, an IVR, a B2BUA, then browser and voice-AI gateways.

Which Crate?

The workspace contains 47 crates. You import one of them; it pulls in everything it needs. The rest are internal layers you never name in your own Cargo.toml.

You are building Depend on Enable
A SIP phone, PBX, IVR, registrar, proxy, B2BUA, or trunk gateway rvoip-sip nothing extra
One server that takes SIP and browser (WebRTC) callers and connects them rvoip features = ["app"]
A SIP or WebRTC caller talking to a hosted voice agent (Vapi) rvoip features = ["app", "vapi"]
Your own ASR / TTS / dialog pipeline, with recordings and signed vCons rvoip features = ["voip-3"]
A native, mobile, or embedded client SDK rvoip-client pick transports
Amazon Connect A2A callers bridged to an external agent rvoip-amazon-a2a -
SIP calls delivered to Amazon Connect agents rvoip-amazon-connect -
Media fan-out over Media over QUIC rvoip-moq -

Two shortcuts: rvoip-sip is the release-gated product. If your application is telephony, start and stay there. It is the only crate with a signed interoperability attestation (see evidence). rvoip is the facade. It re-exports rvoip-sip as rvoip::sip and adds the shared Orchestrator plus optional transports and extensions behind Cargo features. Its feature table and the deployment bundles (bundle-sip-endpoint, bundle-carrier-sip, bundle-browser-gateway, bundle-ai-conversation, bundle-full-pure-rust, bundle-full-native) are the only feature lists you need.

Deployment backends (Keycloak, LDAP, Redis, Postgres vCon storage, audit and SIEM sinks, SAML, SCIM, WebAuthn, STIR/SHAKEN, IMS AKA) are separate rvoip-* extension crates you add only when you operate that backend. The extension catalog lists them.

For JavaScript UCTP control, see the experimental browser/Node WebSocket client. It is available as source with TypeScript declarations; the package is not yet published to npm.

Application-profile dispatch is a separate opt-in server extension that stock servers do not enable.

Pick a Path

Four API surfaces, from simplest to most control. Most applications use the first one.

Surface Use it when Example
Endpoint You want a softphone, an account that registers, or a scripted caller/callee 01-quickstart-p2p, 02-softphone-audio, 03-register-to-pbx
StreamPeer You want a sequential "send, then wait for the matching event" client 04-call-control, 05-blind-transfer
CallbackPeer You are writing a server that reacts to inbound calls (IVR, auto-attendant) 09-ivr-server
UnifiedCoordinator + server::b2bua You need a PBX, registrar, proxy, or B2BUA with routing and media bridging 10-call-center-b2bua

Register an account on a PBX and place a call through it:

use std::time::Duration;
use rvoip_sip::{Endpoint, EndpointProfile, Result};
# async fn example() -> Result {
let mut endpoint = Endpoint::builder()
    .name("alice")
    .account("1001")
    .password("secret")
    .registrar("sips:pbx.example.com:5061")
    .profile(EndpointProfile::AsteriskTlsSrtpRegisteredFlow)
    .build()
    .await?;
endpoint.register().await?;
let call = endpoint
    .call_and_wait("1002", Some(Duration::from_secs(30)))
    .await?;
call.send_dtmf('1').await?;
call.hangup_and_wait(Some(Duration::from_secs(5))).await?;
endpoint.shutdown().await?;
# Ok(()) # }

Answer calls and react to key presses, the shape of an IVR or auto-attendant:

use rvoip_sip::{CallHandlerDecision, CallbackPeer, Config, Result};
# async fn example() -> Result {
let peer = CallbackPeer::builder(Config::local("ivr", 5120))
    .on_incoming(|call| async move {
        println!("incoming call from {}", call.from);
        CallHandlerDecision::Accept
    })
    .on_dtmf(|call, digit| async move {
        if digit == '0' {
            call.transfer_blind("sip:operator@127.0.0.1:5122").await?;
        }
        Ok(())
    })
    .on_ended(|call_id, reason| async move {
        println!("call {call_id} ended: {reason:?}");
        Ok(())
    })
    .build()
    .await?;
peer.run().await # }

Security and transports are configuration, not different APIs: SDES-SRTP in 07-secure-call-srtp, TLS in 08-tls-transport, DTLS-SRTP, G.729, AMR-NB/WB, and Opus behind Cargo features. The full surface is documented in the SIP crate README.

RvoipApp declares transports, roles, and routing through one builder and runs SIP, WebRTC, and UCTP listeners on the shared Orchestrator:

rvoip = { version = "0.5.1", features = ["app"] }
use rvoip::app::*;
# async fn run() -> rvoip::app::AppResult {
let app = RvoipApp::builder()
    .webrtc(
        WebRtcConfig::ws("127.0.0.1:8081")
            .allow(Role::Customer, [Capability::Text, Capability::Voice]),
    )
    .sip(
        SipConfig::bind("127.0.0.1:5060")
            .domain("callcenter.local")
            .allow(Role::Employee, [Capability::Voice])
            .registrar_users([("alice", "password123")]),
    )
    .employees(EmployeePolicy::named(["alice"]))
    .customers(CustomerPolicy::webrtc_only())
    .assignment(AssignmentPolicy::fixed("alice"))
    .on_message(|ctx, msg| async move {
        ctx.reply("Alice", format!("Alice received: {}", msg.text)).await
    })
    .build()
    .await?;
app.run().await # }

Start from 12-customer-escalation-sip-webrtc: a browser chat escalates to a SIP agent's phone. For SIP into Amazon Connect, see 13-sip-to-amazon-connect.

  • Hosted agent. rvoip-vapi speaks Vapi's bidirectional raw-audio WebSocket directly. Your SIP or WebRTC caller is bridged to the agent through the Orchestrator; the agent joins as its own AI participant with typed events, control messages, and supervised teardown. Start from 14-vapi-agent, one server that accepts either kind of caller.

Attaching an agent to a caller you already hold:

use std::sync::Arc;
use rvoip::Orchestrator;
use rvoip::core_traits::ids::ConnectionId;
use rvoip::vapi::{VapiAdapter, VapiApiKey, VapiAssistant, VapiCallOptions, VapiConfig};
# async fn attach(orchestrator: Arc, caller: ConnectionId)
# -> Result {
let key = VapiApiKey::new(std::env::var("VAPI_API_KEY")?)?;
let adapter = VapiAdapter::new(VapiConfig::new(key))?;
let options = VapiCallOptions::new(VapiAssistant::saved(std::env::var("VAPI_ASSISTANT_ID")?));
// Joins a distinct AI participant, originates the agent leg, bridges audio.
let mut call = adapter.attach_agent(&orchestrator, caller, options).await?;
call.say("One moment while I look that up.", false, true).await?;
let _outcome = call.wait().await;
# Ok(()) # }
  • Your own pipeline. rvoip-harness gives you ASR, TTS, dialog, and recording provider traits, and rvoip-vcon emits signed vCon records of the conversation. 11-ai-harness-demo runs the whole loop with deterministic providers, so you can see the shape before you plug in a real model.

How It Fits Together

Every transport turns into the same objects, so an application written against the conversation model does not care whether a leg arrived over SIP, a browser, or QUIC. That is what lets one Orchestrator bridge them.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Your application                                                  โ”‚
โ”‚ softphone ยท PBX ยท contact center ยท browser gateway ยท AI agent      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚
โ”‚ rvoip-sip / rvoip (+ features)โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Shared conversation model (rvoip-core)                            โ”‚
โ”‚ Orchestrator ยท Conversation ยท Session ยท Participant ยท Connection   โ”‚
โ”‚ routing ยท admission ยท bridges ยท media graph ยท events               โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚                โ”‚                โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ SIP + RTP   โ”‚ โ”‚ WebRTC      โ”‚ โ”‚ UCTP                 โ”‚
โ”‚ UDP/TCP/TLS โ”‚ โ”‚ ICE/DTLS    โ”‚ โ”‚ QUIC/WebTransport/WS โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                        โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Optional products and extensions     โ”‚
โ”‚ Vapi ยท AI harness ยท vCon ยท MoQ       โ”‚
โ”‚ Amazon Connect ยท identity ยท audit    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Words you will meet in the API:

  • Conversation - the thing people are in together. It outlives any one connection.
  • Session - one participant's time in a conversation.
  • Participant - a human or an AI agent. Roles (Agent, Observer, customer) can change without moving connections.
  • Connection - one transport leg: a SIP dialog, a browser peer connection, a UCTP session.
  • Stream - the audio (or video, or data) flowing on a connection. Bridges join streams across connections, transcoding when codecs differ.

Adapters depend on the shared ConnectionAdapter trait; the core never imports a transport. The design docs go deeper, starting with INTERFACE_DESIGN.md and CONVERSATION_PROTOCOL.md.

What Ships

Product area Available capabilities Maturity
SIP telephony Endpoints, reactive servers, PBX/registrar/proxy building blocks, B2BUA bridging, call control, transfers, authentication, full RTP media Beta-qualified
Media and devices RTP/RTCP, SDES-SRTP, G.711, optional G.729/AMR/Opus/G.722, DTMF, OS microphone/speaker, resampling, jitter buffering, mixing primitives Beta-qualified core + preview additions
WebRTC WHIP/WHEP and WebSocket signaling, full-gather and trickle ICE, DTLS-SRTP, Opus/G.711, VP8, SCTP data channels, RFC 4733 DTMF Developer preview
UCTP substrates One conversation protocol over raw QUIC, WebTransport, or WebSocket, with capability negotiation and RTP datagram framing Developer preview
Media over QUIC MOQT draft-19 transport, native helper, embeddable relay, media-graph broadcast adapter Developer preview
Gateways and bridges SIP โ†” WebRTC โ†” UCTP routing, the RvoipApp builder, SIP-to-Amazon-Connect audio and screen pops Developer preview

| Voice AI and conversation data | Pluggable ASR/TTS/dialog/recording prov

Read on Hacker News ↗ ← Back to News

Comments

No comments yet. Start the discussion.