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 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 !RefUnwindSafe for Endpoint
impl !UnwindSafe for Endpoint
impl Freeze for Endpoint
impl Send for Endpoint
impl Sync for Endpoint
impl Unpin for Endpoint
impl UnsafeUnpin 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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more