Getting queue channel variable through AMI

Hi,

I am working on queues with asterisk and trying to get MEMBERINTERFACE channel variable through AMI. Though this variable is being set, still I am getting it empty through AMI. Please help!

In that case your code is probably wrong. We are not clairvoyant and cannot work out what is wrong with code that we cannot see.

here is the code:

$socket = fsockopen(‘127.0.0.1’,‘5038’);
fputs($socket, “Action: Login\r\n”);
fputs($socket, “UserName: test\r\n”);
fputs($socket, “Secret: test\r\n\r\n”);
fputs($socket, “Action: GetVar\r\n”);
fputs($socket, “Variable: MEMBERINTERFACE\r\n\r\n”);
while ($line = fgets($socket)) {
echo $line;
//print fread($socket,256);

				}
				fclose($socket);

That will return the response from the login. You need to read that out first.

You may also need to force unbuffered operation.

Hi david,

It is also returning the response from GetVar action…but the channel variable is empty.

You haven’t specified a channel, so, if it doesn’t reject the request, it will return the global variable of that name.

How should I do that then? please help.

Channel:

You may find that you need to monitor events to work out what that should be, and you may then discover it is easier to find the agent channel from the events as well.

If you have a degenerate system, where there can only be one channel of interest, you could get it to store its channel name in a global variable.

The parameters for actions can be found using the CLI command "manager show command "

I am passing SIP/5060 as the channel, but still getting this error:

Response: Error
Message: No such channel

That’s not a channel. A channel would be like SIP/5060-12345678.