Expand description
§SIP Client - Unified VoIP Client Library
This crate provides a unified, production-ready SIP client implementation that orchestrates:
- client-core: High-level SIP protocol handling and session management
- audio-core: Audio device management, format conversion, and pipeline processing
- codec-core: Audio codec encoding/decoding (G.711, etc.)
§Quick Start
use rvoip_sip_client::SipClient;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Simple one-line setup
let client = SipClient::new("sip:alice@example.com").await?;
// Make a call
let call = client.call("sip:bob@example.com").await?;
// Wait for answer
call.wait_for_answer().await?;
// Let the call run
tokio::time::sleep(Duration::from_secs(30)).await;
// Hangup
call.hangup().await?;
Ok(())
}
§Architecture
The library provides three levels of API:
- Simple API: Quick setup with sensible defaults
- Advanced API: Full control over audio pipeline and codecs
- Builder API: Progressive disclosure of configuration options
§Features
- Automatic codec negotiation
- Built-in echo cancellation and noise suppression
- Event-driven architecture for UI integration
- Zero-copy audio processing
- Comprehensive error handling
Re-exports§
pub use error::SipClientError;
pub use error::SipClientResult;
pub use builder::SipClientBuilder;
pub use types::Call;
pub use types::CallState;
pub use types::AudioConfig;
pub use types::CodecConfig;
pub use types::SipClientConfig;
pub use events::SipClientEvent;
pub use events::EventStream;
pub use simple::SipClient as SimpleSipClient;
pub use simple::SipClient;
pub use advanced::AdvancedSipClient;
pub use advanced::AudioPipelineConfig;
pub use advanced::AudioProcessorTrait;
pub use advanced::AudioProcessor;
pub use advanced::CodecPriority;
pub use advanced::MediaPreferences;
pub use advanced::AudioStream;
pub use advanced::CallStatistics;
Modules§
- advanced
- Advanced SIP client API for fine-grained control
- builder
- Builder pattern for creating SIP clients
- degradation
- Graceful degradation implementation
- error
- Error types for the SIP client library
- error_
reporting - Enhanced error reporting with actionable messages
- events
- Event system for the SIP client
- prelude
- Common imports for sip-client applications
- reconnect
- Automatic reconnection logic for the SIP client
- recovery
- Error recovery and resilience mechanisms for the SIP client
- simple
- Simple API for SIP client
- types
- Core types for the SIP client library
Enums§
- Audio
Direction - Audio direction (input/output)
Constants§
- VERSION
- Library version
Traits§
- Stream
Ext - An extension trait for the
Stream
trait that provides a variety of convenient combinator functions.
Functions§
- init
- Initialize the SIP client library
Type Aliases§
- CallId
- Unique identifier for a call