[Asterisk-Users] PHP Manager

Alex Montoanelli alexm at unetvale.com.br
Fri Jan 6 11:18:26 MST 2006


try this
<?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");
* fputs($socket, "Action: Command\r\n");*
fputs($socket, "Command: show channels\r\n\r\n");
$wrets=fgets($socket,128);

?>

Code Lover wrote:
> 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
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>   




More information about the asterisk-users mailing list