Asterisk AGI


I’ve written a AGI script in php for getting a channel variable value. Im not able to get the the variable value in my script even though i could see the output in the agi transactions of asterisk console. Here is the agi debug output from CLI,

When i print the value of the variable CALLS in the script getting previous commands output. Also, could see some strange agi transactions in the beginning of the script as below,

Version Details:

FYI - I’ve also tried cli version of php and still getting “510 Invalid or unknown command” error in the agi debug ouput.

I think many people would have faced this problem just a little help from them would be greatly appreciated.


Any help?

I can’t help you on the subject but I think you should use the phpagi ( class to work with Asterisk, it will make things easier.


First of all, you have to use the CLI version.

Also try using 2 dashes in front of the q option, like this:

#!/usr/bin/php --q

I tried --q, it didn’t work … as i mentioned before also tried cli version still it didn’t work.