[asterisk-users] Manager ExtensionState function
Danny Nicholas
danny at debsinc.com
Wed May 20 09:11:38 CDT 2009
This may or may not help, but put 'demo1' in ticks. Also, as I read this,
you're just testing extension 11?
-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Azher Mughal
Sent: Tuesday, May 19, 2009 10:07 PM
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] Manager ExtensionState function
Hi,
I am trying to get the extension status (weather it has dialed
outgoing call via SIP or IAX2), using the following piece of code
however it always returns -1 on all the extensions (valid/invalid).
Am i missing something ? Any help.
Thanks
-----------------------------------
#!/usr/bin/perl
use Asterisk::Manager;
use lib './lib', '../lib';
$|++;
my $astman = new Asterisk::Manager;
$astman->user('mark');
$astman->secret('mark');
$astman->host('127.0.0.1');
$astman->connect || die $astman->error . "\n";
$astman->setcallback('Hangup', \&hangup_callback);
$astman->setcallback('DEFAULT', \&default_callback);
my %out = $astman->sendcommand(
Action => 'ExtensionState',
Context => demo1,
Exten => 11,
ActionID => 1,
);
if( $out{'Status'} )
{
print STDERR "Extension Status $out{'Status'}\n";
}
$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";
}
------------------
_______________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list