pub struct Caller { /* private fields */ }Expand description
Stateless helper bound to an account + endpoint.
Implementations§
Source§impl Caller
impl Caller
Sourcepub fn new(account: SipAccount, endpoint: Arc<SipEndpoint>) -> Self
pub fn new(account: SipAccount, endpoint: Arc<SipEndpoint>) -> Self
Construct a Caller for the given account and shared endpoint.
Sourcepub async fn dial(
&self,
target: Uri,
) -> Result<Call, Box<dyn Error + Send + Sync>>
pub async fn dial( &self, target: Uri, ) -> Result<Call, Box<dyn Error + Send + Sync>>
Place an outbound call to target and wait for it to be answered.
Binds a local RTP socket, offers G.711 SDP, sends the INVITE to the
account’s resolved server, follows provisional responses, and answers a
single 401/407 challenge. Returns the Call on a 2xx, or an error
if the call was rejected, timed out, or had no usable SDP answer.
Sourcepub async fn dial_cancellable(
&self,
target: Uri,
cancel: &CancellationToken,
) -> Result<Call, Box<dyn Error + Send + Sync>>
pub async fn dial_cancellable( &self, target: Uri, cancel: &CancellationToken, ) -> Result<Call, Box<dyn Error + Send + Sync>>
Like Caller::dial, but cancel aborts a still-ringing call with a
CANCEL (RFC 3261 §9). Firing the token once a provisional has arrived
tears the pending INVITE down; the returned error then reflects the
487 Request Terminated. Use cancel.is_cancelled() to tell a
cancellation apart from a callee rejection.
Sourcepub async fn dial_with_progress(
&self,
target: Uri,
cancel: &CancellationToken,
progress: Sender<StatusCode>,
) -> Result<Call, Box<dyn Error + Send + Sync>>
pub async fn dial_with_progress( &self, target: Uri, cancel: &CancellationToken, progress: Sender<StatusCode>, ) -> Result<Call, Box<dyn Error + Send + Sync>>
Like Caller::dial_cancellable, and additionally forwards each
provisional response status (e.g. rsip::StatusCode::Ringing) to
progress as it arrives — for a “ringing” UI. The channel closes when
the call reaches a final response.