function onClickSetPassword() {
newpassword= document.pass.value;
- downloadUrl("/cgi-bin/setpassword.cgi?newpassword="+newpassword,null);
+ downloadUrl("/cgi-bin/setpassword.cgi?newpassword="+newpassword,OnSetPasswordReturn);
// if not x86 (developement environment)
// pass=`echo "$QUERY_STRING" | grep -oe "pass=[^&?]*" | sed -n "s/pass=//p"`
function onClickInstall() {
firmwareurl=document.firmwareurl.value;
- downloadUrl("/cgi-bin/install.cgi?file="+firmwareurl,null);
+ downloadUrl("/cgi-bin/install.cgi?file="+firmwareurl,OnInstallReturn);
// if not x86 (developement environment)
// firmwareurl=`echo "$QUERY_STRING" | grep -oe "firmwareurl=[^&?]*" | sed -n "s/firmwareurl=//p"`
function onClickUpgrade() {
- downloadUrl("/cgi-bin/upgrade.cgi?arg=",null);
+ downloadUrl("/cgi-bin/upgrade.cgi?arg=",OnUpgradeReturn);
// if not x86 (developement environment)
// rev_before=`grep -oe "Revision: [0-9]*" /www/about.sh`
function onClickReset() {
- downloadUrl("/cgi-bin/reset.cgi",null);
+ downloadUrl("/cgi-bin/reset.cgi",OnResetReturn);
// if not x86 (developement environment)
// cp /etc/asterisk/extensions.conf.def /etc/asterisk/extensions.conf
function onClickRestart() {
- downloadUrl("/cgi-bin/restart.cgi",null);
+ downloadUrl("/cgi-bin/restart.cgi",OnRestartReturn);
// if not x86 (developement environment)
// reboot
--- /dev/null
+#!/bin/sh
+# restart.cgi
+# Ian Roberts 31 May 2012
+#
+# CGI to reboot ipox
+
+cat <<EOF
+Content-type: text/html
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1"></head></head>
+<body>
+EOF
+
+
+# check what sort of machine we are running on. Many operations
+# outlawed for x86
+
+cat /proc/cpuinfo | grep "CPU:.*ADSP" > /dev/null
+if [ $? -eq 0 ]; then
+ mach="ip0x"
+else
+ mach="x86"
+fi
+
+
+
+if [ $mach != "ip0x" ] ; then
+ echo "<html>Sorry, only supported on the IP0X</html>"
+ exit
+fi
+
+# kill cookie to log out. This ensures hitting refresh wont run
+# the restart process again
+
+cat <<EOF
+Content-type: text/html
+Set-Cookie: loggedin=1; expires=Thursday, 01-Jan-98 12:00:00 GMT
+
+<head>
+<title>Mini Asterisk - Restart</title>
+</head>
+<body>
+<h2>Restarting...come back in 1 minute</h2>
+</body>
+EOF
+#reboot
+
+
+cat <<EOF
+</body>
+</html>
+EOF
initialisePage();
}
+function OnResetReturn(doc,status) {
+ loadHtmlTextFile(doc, function(line) {
+ //parseSipShowPeers(line);
+ }
+ );
+
+ initialisePage();
+}
+
+function OnRestartReturn(doc,status) {
+ loadHtmlTextFile(doc, function(line) {
+ //parseSipShowPeers(line);
+ }
+ );
+
+ initialisePage();
+}
+
+function OnUpgradeReturn(doc,status) {
+ loadHtmlTextFile(doc, function(line) {
+ //parseSipShowPeers(line);
+ }
+ );
+
+ initialisePage();
+}
+
+function OnInstallReturn(doc,status) {
+ loadHtmlTextFile(doc, function(line) {
+ //parseSipShowPeers(line);
+ }
+ );
+
+ initialisePage();
+}
+
+function OnSetPasswordReturn(doc,status) {
+ loadHtmlTextFile(doc, function(line) {
+ //parseSipShowPeers(line);
+ }
+ );
+
+ initialisePage();
+}
// Load a html encoded text file, strips off the HTML tags
// and calls textLineProcessing() for every line