saigop at gmail.com Guest
|
Posted: Sat Jun 28, 2008 4:39 am Post subject: [asterisk-users] AMI extenstion state |
|
|
Hi,
I would like to get the status of asterisk extension with my php program.
*My program as follows,*
<html>
<!--<meta http-equiv="refresh" content="1" />-->
<?php
$fp = fsockopen("xxx.xxx.xxx.xxx", 5038, $errno, $errstr, 30);
if (!$fp)
{
echo "$errstr ($errno)<br />\n";
}
else
{
$out = "Action: Login\r\n";
$out .= "UserName: admin\r\n";
$out .= "Secret: amp111\r\n\r\n";
fwrite($fp, $out);
$in = "Action: ExtensionState\r\n";
$in .= "Exten: 777\r\n\r\n";
$in .= "Context: ext-did-custom\r\n\r\n";
$in .= "ActionID: 1\r\n";
//$in.= "Status: State\r\n";
$in .= "Action: Logoff\r\n\r\n\r\n";
fwrite($fp,$in);
while (!feof($fp))
{
echo fgets($fp, 256);
//echo $fp;
}
echo "\r\n\r\n\r\n\r\n";
fclose($fp);
}
?>
</html>
*When i try to run this program i am getting the following output*
Asterisk Call Manager/1.0 Response: Success Message: Authentication accepted
Response: Success Message: Extension Status Exten: 777 Context: default
Hint: Status: -1 Response: Error Message: Missing action in request
Response: Goodbye ActionID: 1 Message: Thanks for all the fish.
*My dialplan as follows*
[outbound-allroutes-custom]
exten => 5101,1,Dial(SIP/5101)
exten => 5101,2,Hangup
exten => 5102,1,Dial(SIP/5102)
exten => 5102,2,Hangup
exten => 777,1,Wait(2)
exten => 777,hint,SIP/5101&SIP/5102
*Scenario*
The exten that I have used in the program is "777" that is my hint
extension. Instead of the 777 if i try 5101 also I am getting the same -1
status.
Any help would be appreciated.
--
Thank you with regards,
Gopal,
PeopleTech Systems Private Limited
www.peopletech.co.in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080628/48af56b6/attachment.htm |
|