https://github.com/opensoft/asterbunny
Send json encoded Asterisk AMI events to RabbitMQ exchanges
https://github.com/opensoft/asterbunny
Last synced: 6 months ago
JSON representation
Send json encoded Asterisk AMI events to RabbitMQ exchanges
- Host: GitHub
- URL: https://github.com/opensoft/asterbunny
- Owner: opensoft
- License: mit
- Created: 2012-05-11T21:20:05.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-10-24T20:29:57.000Z (about 13 years ago)
- Last Synced: 2025-04-19T16:41:31.597Z (7 months ago)
- Language: PHP
- Size: 131 KB
- Stars: 8
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
AsterBunny
==========
Simple PHP based CLI tool to publish Asterisk AMI events to a Rabbit Message Queue
PHP Versions
------------
Note: PAMI Requires PHP 5.3+. PHP versions 5.3.9 and 5.3.10 WILL NOT WORK due
to a bug introduced in stream_get_line() in 5.3.9. Please use 5.3.11+ or up
to 5.3.8 (see [README.PHP-5.3.9-and-5.3.10](https://github.com/marcelog/PAMI/blob/1.70.0/README.PHP-5.3.9-and-5.3.10)).
Install
=======
Clone the repo:
```bash
git clone https://github.com/opensoft/AsterBunny.git
```
Now install dependencies with composer
```bash
curl http://getcomposer.org/installer | php
php composer.phar install
```
Usage
=====
The CLI tool is located at `bin/asterbunny` and has a lot of configuration options relating to specifying hostnames, ports,
usernames, and passwords for Asterisk connections and RabbitMQ servers.
It's recommended to run the following to learn the configuration set, and defaults
```bash
./bin/asterbunny listen --help
```
Message Sending
===============
All asterisk events emitted by the Asterisk AMI interface are encoded as JSON and then sent to a configured RabbitMQ server.
Specifically, http://www.voip-info.org/wiki/view/asterisk+manager+events are:
1. Keys are converted to lowercase
2. The message is converted to JSON
And then submitted to the configured exchange with the `fanout` exchange type
#### Example
```json
{
"event": "Agentlogoff",
"agent": "",
"logintime": "",
"uniqueid": ""
}
```
Message headers are as follows:
* `timestamp` => The unix timestamp of when the event occured as seen by AsterBunny
* `content_type` => `application\json`
* `delivery_mode` => `2` - Indicates that the message should be persisted by RabbitMQ
Logging
=======
A default log4php configuration file is included with this tool.
$ cp log4php.dist.xml log4php.xml
Configure logging by editing the file according to instructions found [here](http://logging.apache.org/log4php/docs/configuration.html)
Requirements
============
* PHP 5.3
* RabbitMQ
* Asterisk AMI
License
=======
AsterBunny is licensed under the MIT License - see the LICENSE file for details
Acknowledgments
===============
* http://github.com/symfony/console
* http://github.com/videlalvaro/php-amqplib
* http://github.com/marcelog/pami