Hi,<br><br> I would like to get the status of asterisk extension with my php program. <br><br><b>My program as follows,</b><br><br><html><br><!--<meta http-equiv="refresh" content="1" />--><br>
<?php<br><br><br>$fp = fsockopen("xxx.xxx.xxx.xxx", 5038, $errno, $errstr, 30);<br>if (!$fp) <br>{<br>echo "$errstr ($errno)<br />\n";<br>} <br>else<br> {<br> $out = "Action: Login\r\n";<br>
$out .= "UserName: admin\r\n";<br>$out .= "Secret: amp111\r\n\r\n";<br><br>fwrite($fp, $out);<br>$in = "Action: ExtensionState\r\n";<br>$in .= "Exten: 777\r\n\r\n";<br>$in .= "Context: ext-did-custom\r\n\r\n"; <br>
$in .= "ActionID: 1\r\n";<br>//$in.= "Status: State\r\n";<br><br>$in .= "Action: Logoff\r\n\r\n\r\n";<br><br>fwrite($fp,$in);<br>while (!feof($fp))<br>{<br>echo fgets($fp, 256);<br>//echo $fp;<br>
}<br>echo "\r\n\r\n\r\n\r\n";<br>fclose($fp);<br>}<br>?><br></html><br clear="all"><br><b>When i try to run this program i am getting the following output</b><br><br>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.<br><br><b>My dialplan as follows</b><br>[outbound-allroutes-custom]<br>exten => 5101,1,Dial(SIP/5101)<br>exten => 5101,2,Hangup<br><br>exten => 5102,1,Dial(SIP/5102)<br>exten => 5102,2,Hangup<br>
<br>exten => 777,1,Wait(2)<br>exten => 777,hint,SIP/5101&SIP/5102<br><br><b>Scenario</b><br>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. <br>
<br>Any help would be appreciated.<br>-- <br>Thank you with regards,<br>Gopal,<br>PeopleTech Systems Private Limited<br><a href="http://www.peopletech.co.in">www.peopletech.co.in</a>