| Crates.io | rvoip |
| lib.rs | rvoip |
| version | 0.1.26 |
| created_at | 2025-07-03 08:22:44.724183+00 |
| updated_at | 2025-08-15 17:53:25.667752+00 |
| description | Complete VoIP stack - SIP, RTP, media processing, and client/server APIs |
| homepage | https://github.com/eisenzopf/rvoip |
| repository | https://github.com/eisenzopf/rvoip |
| max_upload_size | |
| id | 1736009 |
| size | 171,303 |
⚠️ ALPHA RELEASE - NOT READY FOR PRODUCTION ⚠️
The rvoip library is the unified entry point for a comprehensive VoIP (Voice over IP) implementation in Rust. It provides a complete VoIP stack with SIP protocol support, real-time media processing, call management, and business logic coordination - all designed with modern Rust principles and async/await architecture.
This is an alpha release intended for development and testing purposes only. The APIs are unstable and the implementation is not yet production-ready.
sip-core, dialog-core, etc.media-core and rtp-corecall-engine and applicationsThe RVOIP crate sits at the top of the VoIP ecosystem, providing unified access to all specialized components:
┌─────────────────────────────────────────┐
│ Your VoIP Application │
├─────────────────────────────────────────┤
│ rvoip ⬅️ YOU ARE HERE
│ (Unified Interface) │
├─────────────────────────────────────────┤
│ call-engine │ client-core │ session │
│ │ │ -core │
├─────────────────────────────────────────┤
│ dialog-core │ media-core │ rtp-core│
├─────────────────────────────────────────┤
│ transaction │ sip-core │ sip- │
│ -core │ │transport│
└─────────────────────────────────────────┘
High-Level Application Layer
Core Protocol Layer
Media and Transport Layer
Infrastructure Layer
Complete end-to-end VoIP application architecture:
┌─────────────────┐ Unified API ┌─────────────────┐
│ │ ──────────────────────► │ │
│ VoIP App │ │ rvoip │
│(Business Logic) │ ◄──────────────────────── │ (Unified Stack) │
│ │ Event Handling │ │
└─────────────────┘ └─────────────────┘
│
Component Coordination │ Module Access
▼ ▼
┌─────────────────────────────────────────────────┐
│ call-engine | client-core | session-core │
│ dialog-core | media-core | rtp-core │
│ transaction | sip-core | sip-transport │
└─────────────────────────────────────────────────┘
rvoip::session_core::*)| Method | Status | RFC | Description | Implementation |
|---|---|---|---|---|
| INVITE | ✅ Complete | RFC 3261 | Session initiation and modification | Full state machine, media coordination |
| ACK | ✅ Complete | RFC 3261 | Final response acknowledgment | Automatic generation, dialog correlation |
| BYE | ✅ Complete | RFC 3261 | Session termination | Proper cleanup, B2BUA forwarding |
| CANCEL | ✅ Complete | RFC 3261 | Request cancellation | Transaction correlation, state management |
| REGISTER | ✅ Complete | RFC 3261 | User registration | Contact management, expiration handling |
| OPTIONS | ✅ Complete | RFC 3261 | Capability discovery | Method advertisement, feature negotiation |
| SUBSCRIBE | ✅ Complete | RFC 6665 | Event notification subscription | Event packages, subscription state |
| NOTIFY | ✅ Complete | RFC 6665 | Event notifications | Event delivery, subscription management |
| MESSAGE | ✅ Complete | RFC 3428 | Instant messaging | Message delivery, content types |
| UPDATE | ✅ Complete | RFC 3311 | Session modification | Mid-session updates, SDP negotiation |
| INFO | ✅ Complete | RFC 6086 | Mid-session information | DTMF relay, application data |
| PRACK | ✅ Complete | RFC 3262 | Provisional response acknowledgment | Reliable provisionals, sequence tracking |
| REFER | ✅ Complete | RFC 3515 | Call transfer initiation | Transfer correlation, refer-to handling |
| PUBLISH | ✅ Complete | RFC 3903 | Event state publication | Presence publishing, event state |
| Feature | Status | Algorithms | RFC | Description |
|---|---|---|---|---|
| Digest Authentication | ✅ Complete | MD5, SHA-256, SHA-512-256 | RFC 3261 | Challenge-response authentication |
| Quality of Protection | ✅ Complete | auth, auth-int | RFC 3261 | Integrity protection levels |
| SRTP/SRTCP | ✅ Complete | AES-CM, AES-GCM, HMAC-SHA1 | RFC 3711 | Secure media transport |
| DTLS-SRTP | ✅ Complete | ECDHE, RSA | RFC 5763 | WebRTC-compatible security |
| ZRTP | ✅ Complete | DH, ECDH, SAS | RFC 6189 | Peer-to-peer key agreement |
| MIKEY-PSK | ✅ Complete | Pre-shared keys | RFC 3830 | Enterprise key management |
| MIKEY-PKE | ✅ Complete | RSA, X.509 | RFC 3830 | Certificate-based keys |
| SDES-SRTP | ✅ Complete | SDP-based | RFC 4568 | SIP signaling key exchange |
| TLS Transport | ✅ Complete | TLS 1.2/1.3 | RFC 3261 | Secure SIP transport |
| Category | Feature | Status | Standards | Description |
|---|---|---|---|---|
| Audio Codecs | G.711 PCMU/PCMA | ✅ Complete | ITU-T G.711 | μ-law/A-law, 8kHz |
| G.722 | ✅ Complete | ITU-T G.722 | Wideband audio, 16kHz | |
| Opus | ✅ Complete | RFC 6716 | Adaptive bitrate, 8-48kHz | |
| G.729 | ✅ Complete | ITU-T G.729 | Low bandwidth, 8kHz | |
| Audio Processing | Echo Cancellation | ✅ Complete | Advanced AEC | 16.4 dB ERLE improvement |
| Gain Control | ✅ Complete | Advanced AGC | Multi-band processing | |
| Voice Activity | ✅ Complete | Advanced VAD | Spectral analysis | |
| Noise Suppression | ✅ Complete | Spectral NS | Real-time processing | |
| RTP Features | RTP/RTCP | ✅ Complete | RFC 3550 | Packet transport, statistics |
| RTCP Feedback | ✅ Complete | RFC 4585 | Quality feedback | |
| RTP Extensions | ✅ Complete | RFC 8285 | Header extensions | |
| Conference | Audio Mixing | ✅ Complete | N-way mixing | Multi-party conferences |
| Media Bridging | ✅ Complete | B2BUA | Call bridging |
| Transport | Status | Security | RFC | Description |
|---|---|---|---|---|
| UDP | ✅ Complete | Optional SRTP | RFC 3261 | Primary SIP transport |
| TCP | ✅ Complete | Optional TLS | RFC 3261 | Reliable transport |
| TLS | ✅ Complete | TLS 1.2/1.3 | RFC 3261 | Secure transport |
| WebSocket | ✅ Complete | WSS support | RFC 7118 | Web browser compatibility |
| SCTP | 🚧 Planned | DTLS-SCTP | RFC 4168 | Multi-streaming transport |
| Feature | Status | RFC | Description |
|---|---|---|---|
| STUN Client | ✅ Complete | RFC 5389 | NAT binding discovery |
| TURN Client | 🚧 Partial | RFC 5766 | Relay through NAT |
| ICE | 🚧 Partial | RFC 8445 | Connectivity establishment |
| Symmetric RTP | ✅ Complete | RFC 4961 | Bidirectional media flow |
| Feature | Status | RFC | Description |
|---|---|---|---|
| Early Dialogs | ✅ Complete | RFC 3261 | 1xx response handling |
| Confirmed Dialogs | ✅ Complete | RFC 3261 | 2xx response handling |
| Dialog Recovery | ✅ Complete | RFC 3261 | State persistence |
| Session Timers | ✅ Complete | RFC 4028 | Keep-alive mechanism |
| Dialog Forking | 🚧 Planned | RFC 3261 | Parallel/sequential forking |
| Feature | Status | RFC | Description |
|---|---|---|---|
| Core SDP | ✅ Complete | RFC 8866 | Session description |
| WebRTC Extensions | ✅ Complete | Various | Modern web compatibility |
| ICE Attributes | ✅ Complete | RFC 8839 | Connectivity attributes |
| DTLS Fingerprints | ✅ Complete | RFC 8122 | Security fingerprints |
| Media Grouping | ✅ Complete | RFC 5888 | BUNDLE support |
| Simulcast | ✅ Complete | RFC 8853 | Multiple stream support |
| Feature | Status | Description |
|---|---|---|
| Call Center Operations | ✅ Complete | Agent management, queuing, routing |
| B2BUA Operations | ✅ Complete | Back-to-back user agent |
| Media Quality Monitoring | ✅ Complete | Real-time MOS scoring |
| Conference Mixing | ✅ Complete | Multi-party audio mixing |
| Call Transfer | ✅ Complete | Blind transfer support |
| Call Hold/Resume | ✅ Complete | Media session control |
| DTMF Support | ✅ Complete | RFC 2833 DTMF relay |
┌─────────────────────────────────────────────────────────────┐
│ VoIP Application │
├─────────────────────────────────────────────────────────────┤
│ rvoip │
│ ┌─────────────┬─────────────┬─────────────┬─────────────┐ │
│ │call-engine │client-core │session-core │ │ │
│ ├─────────────┼─────────────┼─────────────┼─────────────┤ │
│ │dialog-core │media-core │rtp-core │ │ │
│ ├─────────────┼─────────────┼─────────────┼─────────────┤ │
│ │transaction │sip-core │sip-transport│infra-common │ │
│ └─────────────┴─────────────┴─────────────┴─────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Network Layer │
└─────────────────────────────────────────────────────────────┘
call-engine: Complete call center with agent management and routingclient-core: SIP client applications and softphone functionalitysession-core: Session coordination and call control operationsdialog-core: SIP dialog state management and RFC 3261 compliancetransaction-core: SIP transaction handling and retransmissionsip-core: SIP message parsing and protocol primitivesmedia-core: Audio processing, codecs, and quality monitoringrtp-core: RTP/RTCP implementation and media transportsip-transport: SIP transport layer (UDP, TCP, TLS)infra-common: Shared utilities, logging, and configurationAdd to your Cargo.toml:
[dependencies]
rvoip = "0.1.5"
tokio = { version = "1.0", features = ["full"] }
use rvoip::session_core::prelude::*;
#[tokio::main]
async fn main() -> Result<()> {
let session_manager = SessionManagerBuilder::new().with_sip_port(5060).build().await?;
println!("🚀 SIP server running on port 5060");
tokio::signal::ctrl_c().await?;
Ok(())
}
use rvoip::client_core::{ClientConfig, ClientManager, MediaConfig};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let config = ClientConfig::new()
.with_sip_addr("127.0.0.1:5060".parse()?)
.with_media_addr("127.0.0.1:20000".parse()?)
.with_media(MediaConfig::default());
let client = ClientManager::new(config).await?;
client.start().await?;
// Make a call
let call_id = client.make_call(
"sip:alice@127.0.0.1".to_string(),
"sip:bob@example.com".to_string(),
None
).await?;
println!("📞 Call initiated: {}", call_id);
tokio::signal::ctrl_c().await?;
Ok(())
}
use rvoip::call_engine::{prelude::*, CallCenterServerBuilder};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Alpha call center configuration for development/testing
let mut config = CallCenterConfig::default();
config.general.local_signaling_addr = "0.0.0.0:5060".parse()?;
config.general.domain = "call-center.dev.com".to_string();
config.general.registrar_domain = "agents.dev.com".to_string();
config.database.url = "sqlite:alpha_call_center.db".to_string();
// Create call center server
let mut server = CallCenterServerBuilder::new()
.with_config(config)
.with_database_path("alpha_call_center.db".to_string())
.build()
.await?;
// Start server
server.start().await?;
// Create default call queues
server.create_default_queues().await?;
println!("🏢 Alpha Call Center Features (Development/Testing):");
println!(" ✅ Agent SIP Registration");
println!(" ✅ Database-Backed Queuing");
println!(" ✅ Round-Robin Load Balancing");
println!(" ✅ B2BUA Call Bridging");
println!(" ✅ Real-Time Quality Monitoring");
// Monitor system health
let server_clone = server.clone();
tokio::spawn(async move {
let mut interval = tokio::time::interval(Duration::from_secs(30));
loop {
interval.tick().await;
if let Ok(stats) = server_clone.get_stats().await {
println!("📊 Call Center Stats:");
println!(" 📞 Total Calls: {}", stats.total_calls);
println!(" 👥 Available Agents: {}", stats.available_agents);
println!(" 📋 Queue Depth: {}", stats.total_queued);
println!(" ⏱️ Avg Wait Time: {:.1}s", stats.average_wait_time);
}
}
});
// Run the call center
println!("🚀 Call Center Server ready on port 5060");
server.run().await?;
Ok(())
}
use rvoip::session_core::api::*;
use std::sync::Arc;
#[tokio::main]
async fn main() -> Result<()> {
// Create session manager with advanced configuration
let coordinator = Arc::new(SessionManagerBuilder::new()
.with_sip_port(5060)
.with_local_address("sip:pbx@dev.com:5060")
.with_rtp_port_range(10000, 20000)
.with_max_sessions(1000)
.with_session_timeout(Duration::from_secs(3600))
.with_handler(Arc::new(AdvancedCallHandler::new()))
.build()
.await?);
// Start session coordination
SessionControl::start(&coordinator).await?;
println!("🎯 Advanced Session Management Features (Alpha):");
println!(" ✅ Real Media-Core Integration");
println!(" ✅ Quality Monitoring (MOS, Jitter, Packet Loss)");
println!(" ✅ Bridge Management for Conferences");
println!(" ✅ Event-Driven Architecture");
// Example: Create outgoing call with media monitoring
let session = SessionControl::create_outgoing_call(
&coordinator,
"sip:system@dev.com",
"sip:support@partner.dev",
None
).await?;
// Wait for call to be answered
match SessionControl::wait_for_answer(
&coordinator,
&session.id,
Duration::from_secs(30)
).await {
Ok(_) => {
println!("✅ Call answered - starting quality monitoring");
// Start comprehensive quality monitoring
MediaControl::start_statistics_monitoring(
&coordinator,
&session.id,
Duration::from_secs(5)
).await?;
// Monitor call quality
monitor_call_quality(&coordinator, &session.id).await?;
}
Err(e) => {
println!("❌ Call failed: {}", e);
}
}
Ok(())
}
async fn monitor_call_quality(
coordinator: &Arc<SessionCoordinator>,
session_id: &SessionId
) -> Result<()> {
while let Some(session) = SessionControl::get_session(coordinator, session_id).await? {
if session.state().is_final() {
break;
}
if let Some(stats) = MediaControl::get_media_statistics(coordinator, session_id).await? {
if let Some(quality) = stats.quality_metrics {
let mos = quality.mos_score.unwrap_or(0.0);
let quality_rating = match mos {
x if x >= 4.0 => "Excellent",
x if x >= 3.5 => "Good",
x if x >= 3.0 => "Fair",
x if x >= 2.5 => "Poor",
_ => "Bad"
};
println!("📊 Call Quality: {:.1} MOS ({})", mos, quality_rating);
println!(" Packet Loss: {:.2}%", quality.packet_loss_percent);
println!(" Jitter: {:.1}ms", quality.jitter_ms);
println!(" RTT: {:.0}ms", quality.round_trip_time_ms);
}
}
tokio::time::sleep(Duration::from_secs(5)).await;
}
Ok(())
}
#[derive(Debug)]
struct AdvancedCallHandler;
#[async_trait]
impl CallHandler for AdvancedCallHandler {
async fn on_incoming_call(&self, call: IncomingCall) -> CallDecision {
println!("📞 Incoming call from {} to {}", call.from, call.to);
// Route based on called number
if call.to.contains("support") {
CallDecision::Accept(None)
} else if call.to.contains("sales") {
CallDecision::Forward("sip:sales-queue@dev.com".to_string())
} else {
CallDecision::Reject("Number not in service".to_string())
}
}
async fn on_call_established(&self, call: CallSession, _local_sdp: Option<String>, _remote_sdp: Option<String>) {
println!("✅ Call {} established with media", call.id());
}
async fn on_call_ended(&self, call: CallSession, reason: &str) {
println!("📴 Call {} ended: {}", call.id(), reason);
}
}
The rvoip library provides the foundation for VoIP applications (alpha development stage):
The rvoip ecosystem provides seamless integration across all VoIP layers:
use rvoip::call_engine::prelude::*; // Call center operations
use rvoip::client_core::{ClientConfig, ClientManager}; // SIP clients
use rvoip::session_core::api::*; // Session management
use rvoip::dialog_core::prelude::*; // SIP dialog management
use rvoip::transaction_core::prelude::*; // SIP transactions
use rvoip::sip_core::prelude::*; // SIP message parsing
use rvoip::media_core::prelude::*; // Audio processing
use rvoip::rtp_core::prelude::*; // RTP transport
use rvoip::sip_transport::prelude::*; // SIP transport
use rvoip::infra_common::prelude::*; // Common utilities
The library provides comprehensive error handling across all components:
use rvoip::call_engine::CallCenterError;
use rvoip::client_core::ClientError;
use rvoip::session_core::SessionError;
// Unified error handling patterns
match voip_operation().await {
Err(CallCenterError::DatabaseError(msg)) => {
log::error!("Database error: {}", msg);
// Handle database failover
}
Err(ClientError::NetworkError(msg)) => {
log::error!("Network error: {}", msg);
// Handle network recovery
}
Err(SessionError::MediaNotAvailable) => {
log::warn!("Media unavailable");
// Handle media fallback
}
Ok(result) => {
// Handle successful operation
}
}
The rvoip ecosystem includes comprehensive examples demonstrating all capabilities:
# Complete call center demonstration
cd examples/call-center
cargo run
# Peer-to-peer calling
cd examples/peer-to-peer
cargo run
# Component-specific examples
cargo run --example basic_client -p rvoip-client-core
cargo run --example session_lifecycle -p rvoip-session-core
cargo run --example call_center_server -p rvoip-call-engine
Run the comprehensive test suite:
# Run all tests across the entire ecosystem
cargo test
# Run component-specific tests
cargo test -p rvoip-call-engine
cargo test -p rvoip-client-core
cargo test -p rvoip-session-core
# Run integration tests
cargo test --test '*'
# Run with real network tests (requires SIP server)
cargo test -- --ignored
# Run performance benchmarks
cargo test --release -- --ignored benchmark
Contributions are welcome! Please see the contributing guidelines for details.
The modular architecture makes it easy to contribute:
Development Status: ⚠️ Alpha VoIP Stack - NOT PRODUCTION READY
Production Readiness: ❌ NOT READY for Production Use
Current Capabilities: ⚠️ Alpha VoIP Stack
Ecosystem Status: 🚧 Alpha Development - Growing
| Component | Status | Description |
|---|---|---|
| call-engine | ⚠️ Alpha | Call center with database, queuing, routing (alpha - not production ready) |
| client-core | ⚠️ Alpha | SIP client applications with call control (alpha - not production ready) |
| session-core | ⚠️ Alpha | Session coordination with media integration (alpha - not production ready) |
| dialog-core | ⚠️ Alpha | SIP dialog management with RFC 3261 compliance (alpha - not production ready) |
| transaction-core | ⚠️ Alpha | SIP transaction handling with retransmission (alpha - not production ready) |
| media-core | ⚠️ Alpha | Audio processing with quality monitoring (alpha - not production ready) |
| rtp-core | ⚠️ Alpha | RTP/RTCP implementation with SRTP support (alpha - not production ready) |
| sip-core | ⚠️ Alpha | SIP message parsing and protocol primitives (alpha - not production ready) |
| sip-transport | ⚠️ Alpha | Multi-transport SIP (UDP, TCP, TLS) (alpha - not production ready) |
| infra-common | ⚠️ Alpha | Common utilities and infrastructure (alpha - not production ready) |
This project is licensed under either of
at your option.
Built with ❤️ for the Rust VoIP community - Alpha VoIP development for testing and exploration
Ready to explore VoIP development? Start with the examples or dive into the documentation!
⚠️ Remember: This is an alpha release - not suitable for production use