ajperozoi / ami
Provide asterisk ami to laravel frok from Enniel Ami https://github.com/Enniel/Ami, im trying to use on laravel 7 and php>7.0
Requires
- php: ^7.2.5
- ext-mbstring: *
- clue/ami-react: ~0.3.1
- illuminate/console: ^7.0
- illuminate/contracts: ^7.0
- illuminate/events: ^7.25.0
- illuminate/support: ^7.0
- jackkum/phppdu: ^1.2.9
- react/dns: ~0.4.3
- react/event-loop: ~0.4.2
- react/socket-client: ~0.4.6
- react/stream: ~0.4.6
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15.0
- illuminate/config: ^7.25.0
- illuminate/container: ^7.25.0
- phpunit/phpunit: ~4.5|~5.0
README
Enniel\Ami
Easy control via asterisk manager interface (AMI).
Installation and configuration
To install as a composer package to be used with Laravel 5, simply run:
composer require "enniel/ami"
Once it's installed, you can register the service provider in config/app.php
in the providers
array:
'providers' => [ \Enniel\Ami\Providers\AmiServiceProvider::class, ]
Then publish assets with php artisan vendor:publish
. This will add the file config/ami.php
.
Usage
Connection options
You are can specify connection parameters for each command.
Listen ami events
php artisan ami:listen
Artisan::call('ami:listen');
If would you like to see event log in the console use monitor option
php artisan ami:listen --monitor
Send ami action
php artisan ami:action <action> --arguments=<key>:<value> --arguments=<key>:<value> ...
Artisan::call('ami:action', [ 'action' => <action>, '--arguments' => [ <key> => <value> ... ] ]);
Send sms messages using chan dongle
php artisan ami:dongle:sms <phone> <message> <device?>
Artisan::call('ami:dongle:sms', [ 'phone' => <phone>, 'message' => <message>, 'device' => <device?>, ]);
For sending long messages use pdu mode.
php artisan ami:dongle:sms <phone> <message> <device?> --pdu
Artisan::call('ami:dongle:sms', [ 'phone' => <phone>, 'message' => <message>, 'device' => <device?>, '--pdu' => true, ]);
Argument device is not required.
Send ussd commands using chan dongle
php artisan ami:dongle:ussd <device> <ussd>
Artisan::call('ami:dongle:ussd', [ 'device' => <device>, 'ussd' => <ussd>, ]);
Send ami commands
This command started cli interface for ami. Command attribute is optional.
php artisan ami:cli [command]
Close cli interface after sending command.
php artisan ami:cli [command] --autoclose
Artisan::call('ami:cli', [ 'command' => [command], '--autoclose' => true, ]);
Without Laravel
php ./vendor/bin/ami ami:listen --host=127.0.0.1 --port=5038 --username=username --secret=secret --monitor