keywords: ip pbx voip gateway gsm gateway

×

Notice

The forum is in read only mode.
× Questions about G400/G410 Cards.

OpenVox G400E - Howto show span status with php?

9 years 2 months ago - 9 years 2 months ago #10217 by Shamanchik
howto show spans status with php? OpenVox G400E on Elastix 2.5.0-1

I want to see "Network Status" the status spans of pressing button on webform or autoreload with Ajax on my webpages
plz, help example php code...


Update: I found on ftp "G400_check_status.sh" - thinking :)
[root@xxx ~]# asterisk -rx "gsm show span 2" 2>/dev/null |grep "Network Status:" | awk '{print;}'|sed 's/,//g'

Network Status: Registered (Home network)
9 years 2 months ago #10218 by hua
Hi,

Please give us more details or do you just want to get Gsm status from web interface .
If yes I think you can try elastix.

Best regards
Upper
9 years 2 months ago - 9 years 2 months ago #10219 by Shamanchik
I'm coded php B) :
<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>

Output:
11:40:10 up 2:11, 1 user, load average: 0.11, 0.05, 0.01
span 2 Network Status: Registered (Home network)
span 3 Network Status: Registered (Home network)
span 4 Network Status: Registered (Home network)
Time to create page: 0.056 seconds
Powered by Kunena Forum