[Asterisk-Users] PHP Manager

Code Lover lateef.np at gmail.com
Wed Dec 28 01:10:45 MST 2005


Hi all,

I have a small problem to execute Asterisk Commands in Asterisk
Manager using PHP.
I am able to run all Asterisk Manager command but the problem is
comming with asterisk command.

here is the code i am trying to run.

<?php
 $socket = fsockopen("localhost","5038", $errno, $errstr, $timeout);
 fputs($socket, "Action: Login\r\n");
 fputs($socket, "UserName: 1212\r\n");
 fputs($socket, "Secret: 1212\r\n\r\n");
 fputs($socket, "Action: Command\r\n");
 fputs($socket, "Command: reload\r\n\r\n"); #Working well
 fputs($socket, "Command: show channels\r\n\r\n"); #Not working Working well
 fputs($socket, "Command: 'show channels'\r\n\r\n"); #Not working Working well
 $wrets=fgets($socket,128);

?>



If you see in my code when i am calling only "reload" command working
but when i am trying to call piar command it is just prompting :
== Manager '1212' logged off from localhost

without showing channels

Please advice me to solve this problem.
--
Thank You,
Code Lover



More information about the asterisk-users mailing list