AriClient

Struct AriClient 

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

AriClient is a client for interacting with the Asterisk REST Interface (ARI). It manages the connection to the ARI and handles events.

Implementations§

Source§

impl AriClient

Source

pub fn with_config(config: Config) -> Self

Creates a new AriClient with the given configuration.

Source

pub fn on_unknown_event<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, Event) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for unknown events.

Source

pub fn on_event<F, Fut>( &mut self, key: impl Into<String>, handler: F, ) -> &mut Self
where F: Fn(Arc<Client>, Event) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for a specific event.

Source

pub async fn start(&mut self, application_name: impl Into<String>) -> Result<()>

Starts the ARI client and begins listening for events.

Source

pub async fn stop(&mut self) -> Result<(), AriError>

Stops the ARI client.

Source

pub fn client(&self) -> &Client

Returns a reference to the API client.

Source§

impl AriClient

Source

pub fn on_application_move_failed<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ApplicationMoveFailed>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_application_replaced<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ApplicationReplaced>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_bridge_attended_transfer<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<BridgeAttendedTransfer>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_bridge_blind_transfer<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<BridgeBlindTransfer>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_bridge_created<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<BridgeCreated>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_bridge_destroyed<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<BridgeDestroyed>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_bridge_merged<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<BridgeMerged>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_bridge_video_source_changed<F, Fut>( &mut self, handler: F, ) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<BridgeVideoSourceChanged>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_caller_id<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelCallerId>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_connected_line<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelConnectedLine>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_created<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelCreated>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_destroyed<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelDestroyed>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_dialplan<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelDialplan>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_dtmf_received<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelDtmfReceived>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_entered_bridge<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelEnteredBridge>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_hangup_request<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelHangupRequest>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_hold<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelHold>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_left_bridge<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelLeftBridge>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_state_change<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelStateChange>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_talking_finished<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelTalkingFinished>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_talking_started<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelTalkingStarted>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_tone_detected<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelToneDetected>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_unhold<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelUnhold>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_user_event<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelUserEvent>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_channel_var_set<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ChannelVarSet>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_contact_info<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ContactInfo>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_contact_status_change<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<ContactStatusChange>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_device_state_changed<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<DeviceStateChanged>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_dial<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<Dial>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_endpoint_state_change<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<EndpointStateChange>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_missing_params<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<MissingParams>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_peer<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<Peer>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_peer_status_change<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<PeerStatusChange>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_playback_continuing<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<PlaybackContinuing>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_playback_finished<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<PlaybackFinished>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_playback_started<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<PlaybackStarted>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_recording_failed<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<RecordingFailed>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_recording_finished<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<RecordingFinished>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_recording_started<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<RecordingStarted>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_stasis_end<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<StasisEnd>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_stasis_start<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<StasisStart>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Source

pub fn on_text_message_received<F, Fut>(&mut self, handler: F) -> &mut Self
where F: Fn(Arc<Client>, BaseEvent<TextMessageReceived>) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,

Registers a handler for the $event_variant event.

Methods from Deref<Target = Client>§

Source

pub fn applications(&self) -> Applications<'_>

Returns an instance of the Applications API.

Source

pub fn asterisk(&self) -> Asterisk<'_>

Returns an instance of the Asterisk API.

Source

pub fn endpoints(&self) -> Endpoints<'_>

Returns an instance of the Endpoints API.

Source

pub fn channels(&self) -> Channels<'_>

Returns an instance of the Channels API.

Source

pub fn bridges(&self) -> Bridges<'_>

Returns an instance of the Bridges API.

Source

pub fn recordings(&self) -> Recordings<'_>

Returns an instance of the Recordings API.

Source

pub fn sounds(&self) -> Sounds<'_>

Returns an instance of the Sounds API.

Source

pub fn playbacks(&self) -> Playbacks<'_>

Returns an instance of the Playbacks API.

Source

pub fn device_stats(&self) -> DeviceStats<'_>

Returns an instance of the DeviceStats API.

Source

pub fn mailboxes(&self) -> Mailboxes<'_>

Returns an instance of the Mailboxes API.

Source

pub fn events(&self) -> Events<'_>

Returns an instance of the Events API.

Trait Implementations§

Source§

impl Clone for AriClient

Source§

fn clone(&self) -> AriClient

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for AriClient

Source§

type Target = Client

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

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<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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: 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: 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,