ritch/ami-monitor
Composer 安装命令:
composer require ritch/ami-monitor
包简介
README 文档
README
This is a new colaboration of asterisk AMI with PHP.
Donate
Help this project grow. Has many things to improve.
Instalation
Via Composer just run composer require ritch/ami-monitor or clone this repository via Github.
Run composer install if you cloned the project by git directly
Run npm install
I Will improve this code and this explication, I swear,
but if you only read this code, mainly monitorManager.php or run php monitorManager.php, You can use.
Configuration
- Copy the
config.ini.sampletoconfig.iniand put your configs
To Run
- If you want use web socket, run
node webSocketServer.js, dont forget to put the configuration inconfig.ini. - Copy samples to your base directory
cp -rf vendor/ritch/ami-monitor/samples .or make your self monitor. - Run
php samples/monitorManager.php - Has a file
index.htmlin samples folder, if you has using web socket, and all right, you'll start receive the events on your web page.
Custom File monitor example:
<?php namespace App; //The path of autoload include 'vendor/autoload.php'; use App\WebSocket; use App\Ami; set_time_limit(0); $webSocket = new WebSocket(); $ami = new Ami(); //Filter some events or show All; $event = [ 'All', /*'AgentLogin', 'Hangup', 'BridgeEnter', 'AgentConnect', */ ]; do { switch ( @$amiEvent->Event ) { //If you has filtering some event, here you can do your logic, or send to websocket, case "Hangup": // You code here. $amiEvent = $ami->getEvent($event); $webSocket->emit( "MyCustomAction", [ $amiEvent ] ); print_r($amiEvent); break; case "AgentConnect": // You code here. break; default: $amiEvent = $ami->getEvent($event); $webSocket->emit( "ami", [ $amiEvent ] ); print_r($amiEvent); break; } } while ( Utils::check_asterisk_status() ); ?>
Donate
Help this project grow. Has many things to improve.
统计信息
- 总下载量: 53
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2020-09-01