Rvoip 0.5 发布 用 Rust 实现全栈 VoIP 通信
Rvoip 0.5 将 SIP、RTP、WebRTC、QUIC/WebTransport 与语音 AI 智能体统一到同一套呼叫模型,全部以 Rust crate 形式内置,无需额外部署 SIP 代理、媒体服务器或 RTP 引擎。项目已通过 Asterisk、FreeSWITCH、Jambonz 等系统的互操作验证,适合在纯 Rust 环境中直接构建通信与语音 AI 应用。
报道正文
本文目录3 个章节
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:
| 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.
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:[email protected]: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_callFrom 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.
(注:更多技术实现细节与完整 API 文档请查阅原项目 README)