POE::Component::Client::Asterisk::Manager - Event-based Asterisk / Aefirion Manager Client
use POE::Session; use POE::Component::Client::Asterisk::Manager; POE::Component::Client::Asterisk::Manager->new( Alias => 'monitor', RemoteHost => 'localhost', RemotePort => 5038, # default port CallBacks => { intput => ':all', # catchall for all manager events ring => { 'Event' => 'Newchannel', 'State' => 'Ring', }, }, inline_states => { input => sub { my $input = $_[ARG0]; # good for figuring out what manager events look like require Data::Dumper; print Data::Dumper->Dump([$input]); }, ring => sub { my $input = $_[ARG0]; # $input is a hash ref with info from print STDERR "RING on channel $input->{Channel}\n"; }, }, ); $poe_kernel->run();
POE::Component::Client::Asterisk::Manager is an event driven Asterisk manager client. This module should also work with Aefirion.
This method creates a POE::Component::Client::TCP session and works inside that session. You can specify the alias, host, port and inline_states. See the synopsis for an example.
Callbacks are events that meet a criteria specified in a hash ref
For example:
ring => { 'Event' => 'Newchannel', 'State' => 'Ring', },
The event 'ring' will be called with a hash href in ARG0 when the component receives a manager event matching 'Newchannel' and manager state 'Ring'.
You can specify a catch all event like this:
catch_all => ':all'
Note: This was changed from 'default' to ':all' in an effort to make it more clear. 'default' will also work.
Please report them via RT: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE%3A%3AComponent%3A%3AClient%3A%3AAsterisk%3A%3AManager
There are a few examples in the examples directory that can get you going.
David Davis, <xantus@cpan.org>
perl(1), POE::Filter::Asterisk::Manager, http://aefirion.org/, http://asterisk.org/, http://teknikill.net/
To install POE::Component::Client::Asterisk::Manager, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Client::Asterisk::Manager
CPAN shell
perl -MCPAN -e shell install POE::Component::Client::Asterisk::Manager
For more information on module installation, please visit the detailed CPAN module installation guide.