Skip to main content

Crate asterisk_rs_ami

Crate asterisk_rs_ami 

Source
Expand description

Async Rust client for the Asterisk Manager Interface (AMI).

AMI is a TCP-based protocol for monitoring and controlling Asterisk PBX. This crate provides a fully async client with typed actions, events, automatic reconnection, and MD5 challenge-response authentication.

§Quick Start

use asterisk_rs_ami::AmiClient;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = AmiClient::builder()
        .host("127.0.0.1")
        .port(5038)
        .credentials("admin", "secret")
        .build()
        .await?;

    let response = client.ping().await?;
    println!("pong: {:?}", response);
    Ok(())
}

Re-exports§

pub use client::AmiClient;
pub use client::AmiClientBuilder;
pub use error::AmiError;
pub use event::AmiEvent;
pub use response::EventListResponse;
pub use tracker::CallTracker;
pub use tracker::CompletedCall;

Modules§

action
typed AMI action types
client
AMI client with builder pattern.
codec
AMI wire protocol codec.
connection
AMI TCP connection management.
error
AMI-specific error types.
event
typed AMI event types
response
AMI response types and ActionID correlation
tracker
call correlation engine — tracks AMI events by UniqueID into call lifecycle objects.