- Posts: 8
- Thank you received: 0
keywords: ip pbx voip gateway gsm gateway
[root@xxx ~]# asterisk -rx "gsm show span 2" 2>/dev/null |grep "Network Status:" | awk '{print;}'|sed 's/,//g'
Network Status: Registered (Home network)
<html>
<title>Network Status</title>
<head>
<script type="text/JavaScript">
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
</script>
</head>
<body onload="JavaScript:timedRefresh(5000);">
<?php
/* Here I am setting up the variables for the commands to pass down through to the shell */
$uptime = (shell_exec("uptime"));
$span2 = (shell_exec("asterisk -rx \"gsm show span 2\" 2>/dev/null |grep \"Network Status\" | awk '{print;}'|sed 's/,//g'"));
$span3 = (shell_exec("asterisk -rx \"gsm show span 3\" 2>/dev/null |grep \"Network Status\" | awk '{print;}'|sed 's/,//g'"));
$span4 = (shell_exec("asterisk -rx \"gsm show span 4\" 2>/dev/null |grep \"Network Status\" | awk '{print;}'|sed 's/,//g'"));
/* Here I am outputting to the screen the commands I have specified above*/
echo "<pre><font color=black>$uptime</font></pre>";
echo "<pre><font color=black>span 2 $span2</font></pre>";
echo "<pre><font color=black>span 3 $span3</font></pre>";
echo "<pre><font color=black>span 4 $span4</font></pre>";
?>
</body>
</html>