pub struct SipAgent { /* private fields */ }Expand description
A SIP user agent for one trunk. See the module docs.
Implementations§
Source§impl SipAgent
impl SipAgent
Sourcepub async fn start(cfg: SipConfig) -> Result<Self, FlowcatError>
pub async fn start(cfg: SipConfig) -> Result<Self, FlowcatError>
Start the agent: bind the SIP UDP transport, launch the endpoint serve loop + incoming-INVITE pump (+ registration loop if a password is set).
Does not block on registration; call SipAgent::register to await the
first REGISTER result, or just let the background loop keep the binding
fresh. Returns once the transport is bound and tasks are spawned.
Sourcepub async fn register(&self) -> Result<u32, FlowcatError>
pub async fn register(&self) -> Result<u32, FlowcatError>
Send one REGISTER now and await its result (does not start the refresh
loop — that runs from SipAgent::start). Useful at bring-up to fail fast
if the trunk credentials are wrong. Returns the registration expiry secs.
Sourcepub async fn next_inbound(&self) -> Option<InboundInvite>
pub async fn next_inbound(&self) -> Option<InboundInvite>
Yield the next inbound INVITE, or None once the agent is shut down.
Sourcepub async fn originate(
&self,
to_e164: &str,
caller_id: Option<&str>,
) -> Result<SipTransport, FlowcatError>
pub async fn originate( &self, to_e164: &str, caller_id: Option<&str>, ) -> Result<SipTransport, FlowcatError>
Originate an outbound call to to_e164 from caller_id (overrides the
configured caller-id when given). Awaits the 200 OK and returns the media
transport over the negotiated G.711.