asterisk-rs-ami 0.3.0

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

asterisk-rs-ami

Crates.io docs.rs License

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

AMI is a TCP protocol (default port 5038) for monitoring and controlling an Asterisk PBX. This crate provides a typed, async client built on tokio with:

  • 116 typed actions covering Asterisk 23
  • 161 typed events plus an Unknown variant for forward compatibility
  • MD5 challenge-response authentication
  • Automatic reconnection
  • Event bus with pub/sub subscriptions
  • tokio-util codec for the AMI wire protocol

Install

cargo add asterisk-rs-ami

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(())
}

See also the ami_originate.rs and ami_events.rs examples.

Workspace

This crate is part of asterisk-rs.

MSRV

1.83

License

Licensed under either of Apache License, Version 2.0 or MIT License at your option.