asterisk-rs 0.1.0

Production Rust client for Asterisk AMI, AGI, and ARI
Documentation

asterisk-rs

crates.io docs.rs CI MSRV License

Async Rust clients for Asterisk AMI, AGI, and ARI.

Overview

asterisk-rs is a Rust workspace providing typed, async clients for the three Asterisk integration interfaces. Each protocol lives in its own crate with shared types and error handling in asterisk-rs-core.

Crates

Crate Description
asterisk-rs Umbrella crate, re-exports all protocols under feature flags
asterisk-rs-core Shared error types, event bus, reconnection policy
asterisk-rs-ami AMI client: typed actions, events, codec, reconnection
asterisk-rs-agi FastAGI server: handler trait, typed commands
asterisk-rs-ari ARI client: REST + WebSocket, typed events, resource handles

Quick Start

cargo add asterisk-rs
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!("{response:?}");

    client.disconnect().await?;
    Ok(())
}

Features

  • Async/await with tokio
  • Typed actions, commands, and events for all three protocols
  • Automatic reconnection with exponential backoff and jitter
  • MD5 challenge-response authentication (AMI)
  • Handle pattern for ARI resources (ChannelHandle, BridgeHandle, etc.)
  • Event bus with typed pub/sub
  • Structured logging via tracing
  • Feature flags for granular dependency control

Protocols

Protocol Port Transport Crate
AMI 5038 TCP asterisk-rs-ami
AGI 4573 TCP (FastAGI) asterisk-rs-agi
ARI 8088 HTTP + WebSocket asterisk-rs-ari

MSRV

1.75

License

Licensed under either of

at your option.

Contributing

See CONTRIBUTING.md for guidelines.