NAME

POE::Component::Client::Asterisk::Manager - Event-based Asterisk / Aefirion Manager Client

SYNOPSIS

  use POE qw( Component::Client::Asterisk::Manager );

  POE::Component::Client::Asterisk::Manager->new(
	Alias           => 'monitor',
	RemoteHost		=> 'localhost',
	RemotePort      => 5038, # default port
	CallBacks  => {
		input => ':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();

DESCRIPTION

POE::Component::Client::Asterisk::Manager is an event driven Asterisk manager client. This module should also work with Aefirion.

METHODS

new()

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

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.

BUGS

Please report them via RT: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE%3A%3AComponent%3A%3AClient%3A%3AAsterisk%3A%3AManager

EXAMPLES

There are a few examples in the examples directory that can get you going.

AUTHOR

David Davis, <xantus@cpan.org>

SEE ALSO

perl(1), POE::Filter::Asterisk::Manager, http://aefirion.org/, http://asterisk.org/, http://teknikill.net/