首页 > AI前沿 > Rvoip 0.5 the complete VoIP stack in Rust

Rvoip 0.5 the complete VoIP stack in Rust

Hacker News 2026-11-27 03:18 8 阅读 查看原文
rvoip 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 What rvoip is 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. Historical performance: published 0.5.0 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: 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. 2. 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() } 3. 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. You need one 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. 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. Pick your path 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. Path 1 — SIP telephony (rvoip-sip) Four API surfaces, from simplest to most control. Most applications use the first one. 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. Path 2 — Browser and cross-transport gateways (rvoip + app) 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. Path 3 — Voice AI (rvoip + vapi or voip-3) 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<(), Box > { 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(()) # } 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<(), Box > { 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. 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 today Beta-qualified means covered by the SIP release gate and its interoperability, security, standards, performance, and soak evidence. Developer preview means implemented and published, but API-unstable or outside that attestation. Planned items appear only in the roadmap. A published crate or Cargo feature is evidence of availability, not a blanket production-readiness statement. SIP application and signaling Media WebRTC, UCTP, MoQ, and integrations The WebRTC implementation of ICE and DTLS-SRTP is separate from the SIP beta claim. UCTP and MoQ availability does not imply that SIP-over-QUIC or RTP-over-QUIC has shipped. Extensions All 14 extension crates ship at 0.5.1. They stay optional so protocol crates depend on provider contracts, never on a deployment backend. How they attach: voip-3 on the facade brings in the harness, vCon, and the identity surface; vapi and sip-stir-shaken are their own facade features; everything else is a direct dependency. rvoip = { version = "0.5.1", features = ["sip", "vapi", "sip-stir-shaken"] } rvoip-keycloak = "0.5.1" rvoip-redis = "0.5.1" rvoip-audit = "0.5.1" The contracts they implement live in rvoip-auth-core, rvoip-users-core, and rvoip-identity. Workspace map For orientation only. Everything below the front doors is a transitive dependency of rvoip or rvoip-sip; depend on it directly only when you are extending the platform itself. SIP interoperability and release evidence The full release path exercises rvoip-sip public APIs against independently implemented peers. The exact peer versions, scenarios, transports, results, and exclusions are recorded in signed qualification evidence; see the compatibility matrix. Patch releases can explicitly use the shorter release path: unit, integration, regression, example, and doc tests, including runnable TURN/ICE examples, without benchmark, soak/load, or extended interoperability jobs. Each GitHub release links its tested commit and gate results; a reduced patch report marks performance qualification NOT RUN. The matrix below describes the full qualification scope, not a claim that a patch run repeated it. SIP interoperability attestation The strict full-beta gate requires an explicit PASS attestation for every required independently managed peer below. The report generator binds each row to the tested source tree, exact peer identity and configuration, selected matrix, and hashed evidence; it refuses to produce a strict release-candidate report if a required peer is missing, skipped, ambiguous, unpinned, or failing. The 0.5.1 release uses the shorter patch profile: regular unit, integration, regression, example, and doc tests, including TURN/ICE checks. Benchmarks and extended external interoperability were not rerun. See the 0.5.1 release notes and the release's qualification attachments for exact commands, results, and scope. Historical full-release evidence, retained at its original versions: Qualification report — exact versions, row counts, scenarios, hashes, PASS status. Performance report. RFC 7501/7502 benchmark report: sustained Session Establishment Rates for published 0.5.0 on one c8i.4xlarge, reported in IETF format (R1 TLS 8,348 and R5 UDP 8,256 sessions/s without media; R2 TLS+SRTP 1,124 and R6 UDP+RTP 1,204 with media). RFC evidence matrix and security posture. Interop plan — the evidence boundaries. Changelog, release notes and the 0.4 migration guide — what changed in this release and how to upgrade from 0.3. This is bounded interoperability evidence, not a claim of compatibility with every version, module, configuration, transport, codec, or SIP extension, and not carrier certification. Anything outside a stated qualification boundary remains the application's responsibility to validate in its own deployment. Developer-preview products document their own supported scope and gaps in their crate READMEs. A published crate or Cargo feature is evidence of availability, not a blanket production-readiness statement. Building and testing the workspace git clone https://github.com/eisenzopf/rvoip.git cd rvoip # Build the default workspace members cargo build # Run a working SIP call cargo run -p rvoip-sip --example endpoint_local_call # Run the workspace test suite scripts/test_all.sh Feature-gated targets (codecs, DTLS-SRTP, generated compliance suites) only build with their features on; use --all-features when you touch a gated path. docs/RELEASING.md describes the release train. Roadmap Remaining major items, beyond the developer-preview products above: SIP-over-QUIC and RTP-over-QUIC (RoQ) transport profiles. Integrated multi-party SFU/MCU products beyond the existing media primitives. Production graduation of AAuth as its standards work and deployment evidence mature. Deeper AI participants with multi-agent orchestration beyond today's provider harness. Additional qualification and release gates for the developer-preview products. Detailed engineering gaps are tracked in docs/GAP_PLAN.md and in issues. Contributing Bugs: open an issue with reproduction steps. Feature requests: use discussions or issues and describe the target product and compatibility expectations. Pull requests: workspace-wide tests run through scripts/test_all.sh. License Licensed under the MIT License. Built in Rust · Facade API · SIP API · Examples · Issues · Discussions