#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
header "Status" "Asterisk" "Asterisk Simple Managment"
if [ -e /var/run/asterisk.pid ]; then
ast_pid=$(cat /var/run/asterisk.pid)
ast_proc_info="$(cat /proc/$ast_pid/cmdline | sed 's/\0/ /g')"
asterisk_exec="$(echo $ast_proc_info | awk '{print $1}')"
if [ -z "$ast_conf_path" ]; then
asterisk_exec="/usr/sbin/asterisk"
fi
ast_conf_file="$(echo $ast_proc_info | awk '{for (i=2; i<=NF; i++) if ($i == "-C") print $(i+1)}')"
if [ -e $ast_conf_file ]; then
ast_conf_path="$(cat $ast_conf_file | grep '^astetcdir => ')"
if [ -n "$ast_conf_path" ]; then
ast_conf_path="$(echo $ast_conf_path | awk '{print $3}')"
else
ast_conf_path=/etc/asterisk
fi
else
ast_conf_path=/etc/asterisk
fi
........
else
has_pkgs asterisk
echo 'Asterisk is not running.'
#echo '<a href="system-editor.sh?path=/www/cgi-bin/webif&edit=status-asterisk.sh">You may need to edit this page and change conf_path= to the location of your config file for asterisk</a>'
fi
footer ?>
<!--
##WEBIF:name:Status:901:Asterisk
-->