How to get a response back from AMI?

Hello, I have read over the documentation, and there are references regarding being able to retrieve data from AMI, such as “status”.

Sofar I have not been able to locate any examples or have success with trial and error.

How to get a response back?

This works great for reload:

<?php $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, $timeout); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: $manager_user\r\n"); fputs($socket, "Secret: $manager_pass\r\n\r\n"); fputs($socket, "Action: Command\r\n"); fputs($socket, "Command: reload\r\n\r\n"); $wrets=fgets($socket,128); ?>

But this returns nothing:

<?php $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, $timeout); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: $manager_user\r\n"); fputs($socket, "Secret: $manager_pass\r\n\r\n"); fputs($socket, "Action: Command\r\n"); fputs($socket, "Command: status\r\n\r\n"); $wrets=fgets($socket,128); ?>

How to force this to return it’s “response” data?

Thanks

It looks like your format is good, but the ‘status’ command is not a CLI command.

Try: Command: sip show peers\r\n\r\n