khody2012/laravel-ami-toolkit 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

khody2012/laravel-ami-toolkit

最新稳定版本:v0.6.0.35

Composer 安装命令:

composer require khody2012/laravel-ami-toolkit

包简介

A powerful and developer-friendly Laravel package that provides seamless integration with Asterisk AMI (Asterisk Manager Interface).

README 文档

README

🚀 Laravel AMI Toolkit is a powerful, developer-friendly Laravel package for seamless integration with the Asterisk Manager Interface (AMI).

It provides clean abstractions and expressive APIs to connect to Asterisk, listen to AMI events, and send manager commands — all while staying idiomatic to Laravel’s ecosystem.

This package is designed for real-time, event-driven telephony applications such as CRMs, call centers, monitoring dashboards, and VoIP-based services.

✨ Features

  • 🔌 Persistent and configurable connection to Asterisk AMI
  • 📡 Listen to real-time AMI events (Dial, Hangup, Queue, etc.)
  • ⚡ Send AMI actions (Originate, Hangup, Ping, Command, …)
  • 🧩 Laravel Event & Listener integration
  • 🧪 Testable architecture with mockable components
  • 🛠️ Clean, extensible, and well-structured codebase
  • 🔒 Secure authentication handling
  • 📦 Laravel auto-discovery support

📦 Installation

Install the package via Composer:

composer require khody2012/laravel-ami-toolkit

⚡ Requirements

  • PHP 8.1+
  • Laravel 9.x, 10.x, 11.x, 12.x

⚙️ Configuration

Publish the configuration file:

php artisan vendor:publish --tag=ami-config

This will create config/ami.php.

Example configuration

return [
    'host' => env('AMI_HOST', '127.0.0.1'),
    'port' => env('AMI_PORT', 5038),
    'username' => env('AMI_USERNAME'),
    'password' => env('AMI_PASSWORD'),
    'timeout' => 5,
    'auto_reconnect' => true,
];

Add the following variables to your .env file:

AMI_HOST=127.0.0.1
AMI_PORT=5038
AMI_USERNAME=admin
AMI_PASSWORD=secret

🚀 Basic Usage

Connecting to Asterisk AMI

use Khody2012\LaravelAmiToolkit\Facades\Ami;

Ami::connect();
$response = Ami::ping();

if ($response->isSuccess()) {
    // Connection alive
}

📞 AMI Actions

Originate a Call

Ami::originate([
    'Channel'  => 'SIP/1000',
    'Context'  => 'default',
    'Exten'    => '1001',
    'Priority' => 1,
    'Timeout'  => 30000,
]);

Execute a raw AMI command

Ami::command('sip show peers');

Available Events (examples)

  • AmiDialEvent
  • AmiHangupEvent
  • AmiNewChannelEvent
  • AmiQueueMemberEvent
  • AmiBridgeEvent

You can easily extend or map new AMI events.

🧩 Architecture Overview

  • Connection Layer – Handles socket communication and authentication
  • Action Layer – Encapsulates AMI actions
  • Event Layer – Maps AMI events to Laravel events
  • Facade API – Clean developer-facing interface

This layered design keeps the package maintainable, testable, and extensible.

🔐 Security Notes

  • Credentials are never logged
  • Supports environment-based configuration
  • Connection timeouts and reconnection strategies included

🛣️ Roadmap

  • Async / non-blocking event loop
  • Queue-based event handling
  • Horizon & WebSocket integration
  • Dashboard helpers
  • Full API documentation website

🤝 Contributing

Contributions are welcome ❤️

  1. Fork the repository
  2. Create a feature branch
  3. Write tests
  4. Submit a pull request

📄 License

This package is open-sourced software licensed under the MIT license.

🏷️ Keywords

laravel, asterisk, ami, voip, pbx, telephony, event-driven, call-center, realtime

统计信息

  • 总下载量: 20
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固