From e5bafdaa561775a872077830d07b354118c84a12 Mon Sep 17 00:00:00 2001 From: horse69 Date: Tue, 20 Mar 2012 08:08:36 +0000 Subject: [PATCH] Added nice tick icons. eth0 -> eth1 git-svn-id: https://svn.code.sf.net/p/freetel/code@348 01035d8c-6547-0410-b346-abe4f91aad63 --- mini-asterisk-gui2/cgi-bin/getnetwork.cgi | 31 +++++++++++++++++++++++ mini-asterisk-gui2/minicommon.js | 22 ++++++++++++++++ mini-asterisk-gui2/phones.js | 26 ++++++++++++++----- 3 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 mini-asterisk-gui2/cgi-bin/getnetwork.cgi diff --git a/mini-asterisk-gui2/cgi-bin/getnetwork.cgi b/mini-asterisk-gui2/cgi-bin/getnetwork.cgi new file mode 100644 index 00000000..ceb0631a --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/getnetwork.cgi @@ -0,0 +1,31 @@ +#!/bin/sh +# getnetwork.cgi +# Ian Roberts 19 March 2012 +# +# CGI to return network connection details + +cat < + + + + + + +EOF + +internet=`fping google.com`; +#packet_loss=`fping google.com -c 1 -q | sed -n 's/.*received, \(.*\)%.*/\1/p'` +#if [ $packet_loss = "0" ]; then +# internet="yes"; +#fi + +echo INTERNET=\"$internet\" +#echo PACKETLOSS=\"$packet_loss\" + +cat < + +EOF diff --git a/mini-asterisk-gui2/minicommon.js b/mini-asterisk-gui2/minicommon.js index edf51422..81c92a20 100644 --- a/mini-asterisk-gui2/minicommon.js +++ b/mini-asterisk-gui2/minicommon.js @@ -18,6 +18,8 @@ var zap = []; var ip_ext = []; +var network = "no"; + function loadExtensions() { /* @@ -153,6 +155,26 @@ function loadIpExtensions(doc,status) { } ); + // we get Network connection details + + downloadUrl("/cgi-bin/getnetwork.cgi?cli=", loadNetwork); + // initialisePage(); +} + +// creates a network connection + +function loadNetwork(doc,status) { + loadHtmlTextFile(doc, function(line) { + //parseSipShowPeers(line); + if (line.indexOf("alive") != -1) { + network = "yes"; + } + } + ); + + // + + //downloadUrl("/cgi-bin/getnetwork.cgi?cli=", loadNetwork); initialisePage(); } diff --git a/mini-asterisk-gui2/phones.js b/mini-asterisk-gui2/phones.js index 7c7b2154..3284d8b6 100644 --- a/mini-asterisk-gui2/phones.js +++ b/mini-asterisk-gui2/phones.js @@ -40,8 +40,13 @@ function initialisePage() { html += '

Phones

'; for(var i=0; i" + "" + "Analog Phone" + ""; - html += "Port" + i + ""; + html += ""; + html += "" + analog_ext[i] + "" + "" + "Analog Phone" + ""; +// html += "Port" + i + "" +" "+"" + ""; +// html += "Port" + i + "" + '' + "" + ""; + html += "Port" + i + ""; + html += "" + '' + ""; + html += ""; } } @@ -49,8 +54,11 @@ function initialisePage() { for (j in ip_ext) { if (ip_ext[j] != '') { - html += "" + j + "" + "" + "IP Phone" + ""; - html += "" + ip_ext[j] + ""; + html += ""; + html += "" + j + "" + "" + "IP Phone" + ""; + html += "" + ip_ext[j] + ""; + html += "" + '' + ""; + html += ""; } } @@ -59,8 +67,11 @@ function initialisePage() { html += '

Phone Lines

'; for(var i=0; i" + "" + "Analog Phone" + ""; - html += "Port" + i + ""; + html += ""; + html += "" + "0" + "" + "" + "Analog Phone" + ""; + html += "Port" + i + ""; + html += "" + '' + ""; + html += ""; } } @@ -74,7 +85,8 @@ function initialisePage() { // fire off Ifconfig IP address to get IP Address - downloadUrl("/cgi-bin/ifconfig.cgi?arg=eth0", processIfconfig); +// downloadUrl("/cgi-bin/ifconfig.cgi?arg=eth0", processIfconfig); + downloadUrl("/cgi-bin/ifconfig.cgi?arg=eth1", processIfconfig); } -- 2.25.1