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: [email protected] [mailto:[email protected]] On Behalf Of Azher Mughal Sent: Tuesday, May 19, 2009 10:07 PM To: [email protected] 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 _______________________________________________ -- 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
