pub struct Endpoint {
pub inner: EndpointInnerRef,
}Expand description
SIP Endpoint
Endpoint is the main entry point for SIP protocol operations. It provides
a high-level interface for creating and managing SIP transactions, handling
incoming requests, and coordinating with the transport layer.
§Key Features
- Transaction management and lifecycle
- Automatic timer handling per RFC 3261
- Transport layer abstraction
- Graceful shutdown support
- Incoming request processing
§Examples
use ftth_rsipstack::EndpointBuilder;
use tokio_util::sync::CancellationToken;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let endpoint = EndpointBuilder::new()
.with_user_agent("MyApp/1.0")
.build();
// Get incoming transactions
let mut incoming = endpoint.incoming_transactions().expect("incoming_transactions");
// Start the endpoint
let endpoint_inner = endpoint.inner.clone();
tokio::spawn(async move {
endpoint_inner.serve().await.ok();
});
// Process incoming transactions
while let Some(transaction) = incoming.recv().await {
// Handle transaction
break; // Exit for example
}
Ok(())
}§Lifecycle
- Create endpoint using
EndpointBuilder - Start serving with
serve()method - Process incoming transactions via
incoming_transactions() - Shutdown gracefully with
shutdown()
Fields§
§inner: EndpointInnerRefImplementations§
Auto Trait Implementations§
impl Freeze for Endpoint
impl !RefUnwindSafe for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl !UnwindSafe for Endpoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more