Skip to main content

ClosureHandler

Struct ClosureHandler 

Source
pub struct ClosureHandler { /* private fields */ }
Expand description

A CallHandler that delegates on_incoming_call to a closure.

Created by CallbackPeer::from_fn(). The closure receives a borrowed IncomingCall for inspection and returns a CallHandlerDecision. The peer applies that decision after the closure returns. Use CallbackPeer::builder for async closure hooks, DTMF, ended, transfer, or defer flows that need to own the IncomingCall.

Trait Implementations§

Source§

impl CallHandler for ClosureHandler

Source§

fn on_incoming_call<'life0, 'async_trait>( &'life0 self, call: IncomingCall, ) -> Pin<Box<dyn Future<Output = CallHandlerDecision> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Decide what to do with an incoming call. Read more
Source§

fn on_event<'life0, 'async_trait>( &'life0 self, event: Event, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called for every event before the more specific callback hook.
Source§

fn on_call_established<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when an outgoing or accepted incoming call is fully established.
Source§

fn on_call_progress<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, status_code: u16, reason: String, sdp: Option<String>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when an outgoing call receives a provisional 1xx response. Read more
Source§

fn on_call_ended<'life0, 'async_trait>( &'life0 self, call_id: CallId, reason: EndReason, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when any call (incoming or outgoing) ends.
Source§

fn on_call_failed<'life0, 'async_trait>( &'life0 self, call_id: CallId, status_code: u16, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a call fails before normal BYE teardown.
Source§

fn on_call_cancelled<'life0, 'async_trait>( &'life0 self, call_id: CallId, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a ringing call is cancelled before answer.
Source§

fn on_dtmf<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, digit: char, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a DTMF digit is received on an active call.
Source§

fn on_media_security_negotiated<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, state: MediaSecurityState, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when SRTP media security has been negotiated and contexts are installed. Read more
Source§

fn on_call_on_hold<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a locally requested hold is accepted.
Source§

fn on_call_resumed<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when a locally requested resume is accepted.
Source§

fn on_remote_call_on_hold<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the remote peer places this call on hold.
Source§

fn on_remote_call_resumed<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when the remote peer resumes this call.
Source§

fn on_transfer_accepted<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, refer_to: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when an outbound REFER is accepted by the peer.
Source§

fn on_refer_notify<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, status_code: u16, reason: String, subscription_state: Option<SubscriptionState>, body: Option<String>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when raw REFER NOTIFY status is received.
Source§

fn on_refer_progress<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, status_code: u16, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when provisional REFER progress NOTIFY is received.
Source§

fn on_refer_completed<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, target: String, status_code: u16, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when successful terminal REFER completion is received.
Source§

fn on_transfer_failed<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, status_code: u16, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when REFER failure is received.
Source§

fn on_transfer_target_answered<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, target_uri: String, evidence: TransferTargetEvidence, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when rvoip-sip has target-answer evidence for a transfer.
Source§

fn on_transfer_replacement_dialog_observed<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, dialog: DialogInfo, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when RFC 4235 observes a candidate replacement dialog.
Source§

fn on_transfer_replacement_dialog_terminated<'life0, 'async_trait>( &'life0 self, handle: SessionHandle, dialog: DialogInfo, reason: Option<String>, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when RFC 4235 or local evidence observes replacement dialog teardown.
Source§

fn on_dialog_package_notify<'life0, 'async_trait>( &'life0 self, subscription_id: CallId, entity: Option<String>, version: Option<u32>, dialogs: Vec<DialogInfo>, document: DialogInfoDocument, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called for every valid RFC 4235 dialog-package NOTIFY.
Source§

fn on_dialog_state_changed<'life0, 'async_trait>( &'life0 self, subscription_id: CallId, dialog: DialogInfo, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called for each parsed RFC 4235 dialog entry transition.
Source§

fn on_notify_received<'life0, 'async_trait>( &'life0 self, request: IncomingRequest, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase E — typed inbound NOTIFY hook. Carries the full IncomingRequest so applications can inspect every header on the NOTIFY (Server, Allow-Events, custom routing hints) in addition to the legacy pre-decoded fields. Default impl is a no-op.
Source§

fn on_refer_received<'life0, 'async_trait>( &'life0 self, request: IncomingRequest, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase E — typed inbound REFER hook. Apps drive accept/reject via req.accept_refer() / req.reject_refer(...) inside this callback. Use for header-level access (Referred-By, Replaces, Target-Dialog, custom X-*).
Source§

fn on_info_received<'life0, 'async_trait>( &'life0 self, request: IncomingRequest, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase E — typed inbound INFO hook. Today’s stack drops INFO at the dialog layer; this hook surfaces it so SIP-INFO DTMF (application/dtmf-relay), fax flow control, and other application-layer signalling can be observed.
Source§

fn on_message_received<'life0, 'async_trait>( &'life0 self, request: IncomingRequest, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase E — typed inbound MESSAGE hook (RFC 3428).
Source§

fn on_options_received<'life0, 'async_trait>( &'life0 self, request: IncomingRequest, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase E — typed inbound OPTIONS hook (RFC 3261 §11). Both in-dialog and out-of-dialog OPTIONS reach here; request.call_id discriminates.
Source§

fn on_update_received<'life0, 'async_trait>( &'life0 self, request: IncomingRequest, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase E — typed inbound UPDATE hook (RFC 3311). Fires in addition to the legacy hold/resume state transitions; subscribe here for Session-Expires / X-* header inspection.
Source§

fn on_register_received<'life0, 'async_trait>( &'life0 self, register: IncomingRegister, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

SIP_API_DESIGN_2 Phase D — typed inbound REGISTER hook (RFC 3261 §10). Registrar surfaces author the response via register.accept_builder() / register.challenge_builder(..) / register.reject_builder(status); if the handler returns without authoring a response, the dialog stack falls back to the auto-response path.
Source§

fn on_registration_success<'life0, 'async_trait>( &'life0 self, registrar: String, expires: u32, contact: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when registration succeeds.
Source§

fn on_registration_failed<'life0, 'async_trait>( &'life0 self, registrar: String, status_code: u16, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when registration fails.
Source§

fn on_unregistration_success<'life0, 'async_trait>( &'life0 self, registrar: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when unregistration succeeds.
Source§

fn on_unregistration_failed<'life0, 'async_trait>( &'life0 self, registrar: String, reason: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when unregistration fails.
Source§

fn on_sip_trace<'life0, 'async_trait>( &'life0 self, trace: SipTrace, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called for each SIP trace event when tracing is enabled.
Source§

fn on_auth_retrying<'life0, 'async_trait>( &'life0 self, call_id: CallId, status_code: u16, realm: String, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Called when an outgoing call receives a 401/407 and the coordinator is about to retry with Authorization / Proxy-Authorization (RFC 3261 §22.2). Informational — the retry proceeds automatically if credentials are on file via Config.credentials or coord.invite(...).with_credentials(...); this hook does not alter flow. Useful for logging or surfacing auth activity in a UI.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more