Asterisk CLI live output on a webpage

Hello I have a php page that asks Asterisk CLI about the number of active peers (asterisk -rx ‘sip show peers’). There is a crontab entry that refreshes this script every minute.

I need to have such information on a webpage much more actual. I don’t want to use cron.
Does anybody have a solution for this? Maybe the only way is to use AGI scipts on which I do not know?

the best way i have found to do it is when a user logs into the web and requests CLI output, I modify the log conf file and send my logs to a RAM disk file… I then have a php program (you can find on web PHP tail) that will tail the file and outputs it to a window on the web page… I have a backend script running that when the ‘session’ expires it will shut down that ‘tail’. my use is only expected to serve 1 user per site… but thats all I need so it works…

another option is to use something like anyterm or such and put a terminal session in a web page…

and yet another is to run asterisk under ‘nohup’ and no console (no -c option on command line). and output all of asterisk’s output to rsyslog which you can then monitor in different ways with a web script…


Or you can use MONAST or FOP, projects using AMI to do that in nearly real time.

Thank you guys. Maybe there is another way?
I mean to execute AGI script on every new call and then use such data on a webpage? Is it possible? I just need to give access to some people to view what peer is calling right now.

Search in google for “call notification” there are a lot of programs free and with cost which do that also you can check our program: … erisk.html

Thanks a lot, but I can not find anything free written in php. I need to integrate it with my current webpage. Could anyone have something to share?

Use Monast or FOP as a base to do that via AMI with PHP, basically create a socket connect to AMI parse the events, pull out the data, display the data.

hint: php-agi library has a php-asmanager helper.