/usr/share/doc/libasterisk-agi-perl/examples/manager-test.pl is in libasterisk-agi-perl 1.01-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #!/usr/bin/perl
#
# Example script to show how to use Asterisk::Manager
#
# Written by: James Golovich <james@gnuinter.net>
#
#
use lib './lib', '../lib';
use Asterisk::Manager;
$|++;
my $astman = new Asterisk::Manager;
$astman->user('test');
$astman->secret('test');
$astman->host('duff');
$astman->connect || die $astman->error . "\n";
$astman->setcallback('Hangup', \&hangup_callback);
$astman->setcallback('DEFAULT', \&default_callback);
#print STDERR $astman->command('zap show channels');
print STDERR $astman->sendcommand( Action => 'IAXPeers');
#print STDERR $astman->sendcommand( Action => 'Originate',
# Channel => 'Zap/7',
# Exten => '500',
# Context => 'default',
# Priority => '1' );
$astman->eventloop;
$astman->disconnect;
sub hangup_callback {
print STDERR "hangup callback\n";
}
sub default_callback {
my (%stuff) = @_;
foreach (keys %stuff) {
print STDERR "$_: ". $stuff{$_} . "\n";
}
print STDERR "\n";
}
|