Christian Lauinger schrieb:
Christian Lauinger schrieb:

Hello,

I want to recieve the output from astmanproxy in a php script.
Is that possible ?

I made a simple php script:

<PRE>
<?php
$socket = fsockopen("127.0.0.1","1234", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: xxx\r\n");
fputs($socket, "Secret: xxx\r\n\r\n");
fputs($socket, "Action: Command\r\n");
fputs($socket, "Command: Show Channels\r\n\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while (!feof($socket)) {
$wrets[] = fread($socket, 8192);
}
fclose($socket);
var_dump($wrets);
?>
</pre>

Output in debugmode at the console is correct, but I cannot read the output in php. If I use port 5038 I get the output, but I want to connect with multiple clients, so I should't use a direct connection to manager api, right ?

Why can't I read the output from astmanproxy ?


Tried and tried to get the output but no success.

Does nobody use the astmanproxy ?

Greets

Christian

_______________________________________________
And here is the output from astmanproxy in debugmode:
Starting Asterisk Manager Proxy: astmanproxyJul 5 13:20:42: config: parsing configuration file: /etc/asterisk/astmanproxy.conf
Jul  5 13:20:42: config: host, localhost,5038,xxx,xxx,on
Jul  5 13:20:42: config: retryinterval, 2
Jul  5 13:20:42: config: maxretries, 10
Jul  5 13:20:42: config: listenaddress, *
Jul  5 13:20:42: config: listenport, 1234
Jul  5 13:20:42: config: proc_user, asterisk
Jul  5 13:20:42: config: proc_group, asterisk
Jul  5 13:20:42: config: inputformat, standard
Jul  5 13:20:42: config: outputformat, standard
Jul  5 13:20:42: config: autofilter, on
Jul  5 13:20:42: config: logfile, /var/log/asterisk/astmanproxy.log
Jul  5 13:20:42: loading: module xml
Jul  5 13:20:42: loading: note, xml_onconnect does not exist; ignoring
Jul  5 13:20:42: loading: module standard
Jul  5 13:20:42: loading: module csv
Jul  5 13:20:42: loading: note, csv_read does not exist; ignoring
Jul  5 13:20:42: loading: note, csv_onconnect does not exist; ignoring
Jul  5 13:20:42: loading: module http
Jul  5 13:20:42: loading: note, http_write does not exist; ignoring
Jul  5 13:20:42: loading: note, http_onconnect does not exist; ignoring
Jul  5 13:20:42: [EMAIL PROTECTED]: Allocated server session
Jul  5 13:20:42: Set 127.0.0.1 input format to standard
Jul  5 13:20:42: Set 127.0.0.1 output format to standard
Jul  5 13:20:42: [EMAIL PROTECTED]: attempting read...
Jul  5 13:20:42: [EMAIL PROTECTED]: Not connected
Jul  5 13:20:42: [EMAIL PROTECTED]: Connecting (u=xxx, p=xxx)
Jul  5 13:20:42: [EMAIL PROTECTED]: attempting read...
Jul  5 13:20:42: launched ast localhost thread!
Jul  5 13:20:42: Listening for connections
Jul  5 13:20:42: [EMAIL PROTECTED] got: Asterisk Call Manager/1.0
Jul  5 13:20:42: [EMAIL PROTECTED] got: Response: Success
Jul  5 13:20:42: [EMAIL PROTECTED] got: Message: Authentication accepted
Jul  5 13:20:42: [EMAIL PROTECTED] got: Server: localhost
Jul  5 13:20:42: [EMAIL PROTECTED]: attempting read...
Jul  5 13:20:59: Connection received from 127.0.0.1
Jul  5 13:20:59: Set 127.0.0.1 input format to standard
Jul  5 13:20:59: Set 127.0.0.1 output format to standard
Jul  5 13:20:59: set destination:
Jul  5 13:20:59: writing block to localhost
Jul  5 13:20:59: Connection closed: 127.0.0.1
Jul  5 13:20:59: Client logged off - exiting thread
Jul  5 13:20:59: [EMAIL PROTECTED] got: Response: Follows
Jul 5 13:20:59: [EMAIL PROTECTED] got: Channel (Context Extension Pri ) State Appl. Data
0 active channel(s)
--END COMMAND--
Jul  5 13:20:59: [EMAIL PROTECTED] got: Server: localhost
Jul  5 13:20:59: [EMAIL PROTECTED]: attempting read...

The command is passed to "*" and gots a response.

May that helps ?

Greets

_______________________________________________
Asterisk-Users mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-users
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to