extension status using AMI

Why don’t you use AMI? There’s are phpami project if you google.

Sent from my iPhone

On May 25, 2012, at 1:51 AM, Kamlesh Kumar wrote:

> Hi,
>
> I’m using AMI to get the extension status but always get -1 i.e. extension not found.
>
> #!/usr/bin/php -q
> < ?php
> include_once (“phpagi-2.14/phpagi.php”);
> include_once (“/phpagi-2.14/phpagi-asmanager.php”);
> $agi = new AGI();
> $as = new AGI_AsteriskManager();
> $exten = $agi->request['agi_extension'];
> $as->connect(“localhost”, “user”, “passwd”);
> $status = $as->ExtensionState($exten,’context’,1);
> $status1 = $status['Status'];
> $agi->verbose(“Extension status is “.$status1);
> ?>
>
> Always return Extension status is -1
>
> Thanks,
> Kamlesh
>
> –
> _____________________________________________________________________
> — Bandwidth and Colocation Provided by http://www.api-digital.com
> New to Asterisk? Join us for a live introductory webinar every Thurs:
> http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users