asterisk-rs
Async Rust client for Asterisk PBX. Originate calls, handle events, control channels, bridges, queues, and recordings across all three Asterisk interfaces.
- AMI -- monitor and control Asterisk over TCP. Typed events, actions, automatic reconnection, MD5 auth.
- AGI -- run dialplan logic from your Rust service. FastAGI server with typed async commands.
- ARI -- full call control via REST + WebSocket. Resource handles, typed events with metadata.
Example
use ;
async
Install
[]
= "0.2"
Or pick individual protocols:
[]
= "0.2" # AMI only
= "0.1" # AGI only
= "0.2" # ARI only
Capabilities
- Typed actions, events, and commands for the full Asterisk 23 protocol surface
- Filtered event subscriptions -- receive only what you need
- Event-collecting actions --
send_collecting()gathers multi-event responses (Status, QueueStatus, etc.) - Automatic reconnection with exponential backoff, jitter, and re-authentication
- Resource handles for ARI (ChannelHandle, BridgeHandle, PlaybackHandle, RecordingHandle)
- Domain types for hangup causes, channel states, device states, dial statuses, and more
- ARI event metadata (application, timestamp, asterisk_id) on every event
- AMI command output capture for
Response: Follows - URL-safe query encoding, HTTP timeouts, WebSocket lifecycle management
#[non_exhaustive]enums -- new variants won't break your code- Structured logging via
tracing
Protocols
| Protocol | Default Port | Transport | Use Case |
|---|---|---|---|
| AMI | 5038 | TCP | Monitoring, call control, system management |
| AGI | 4573 | TCP | Dialplan logic, IVR, call routing |
| ARI | 8088 | HTTP + WS | Stasis applications, full media control |
Documentation
MSRV
1.83 -- required for async fn in traits (RPITIT).
License
Licensed under either of
at your option.