/etc/zapata.conf, so you may need this set up correctly for your
analog hardware. On the IP0X this happens automatically.
+The scripts need to run as root to run asterisk commands. This is
+probably OK an on IP0X but not a good idea on an x86. I am not happy
+with this security model and would appreciate any suggestions on how
+to improve it.
+
[[install]]
Installation
------------
$ svn co https://freetel.svn.sourceforge.net/svnroot/freetel/mini-asterisk-gui
+[[test]]
+Testing and debugging scripts
+-----------------------------
+
+. To download all the GUi scripts to an IP0X machine with the host name "ip04":
+
+ [david@bunny mini-asterisk-gui]$ make HOST=ip04 test
+
+. A simple cookie is used to indicate logged in status, so to run
+ scripts for each screen from the command line (for example to spot
+ script syntax errors):
+
+IP0X:
+
+ root:/www> export HTTP_COOKIE="loggedin=1" ; sh admin.sh
+
+ If you encounter a syntax error when testing a script on an IP0X
+ then running the same script on an x86 can be useful as it has much
+ better error reporting:
+
+x86:
+
+ [david@host cgi-bin]$ export HTTP_COOKIE="loggedin=1" ; sh admin.sh
+
+. The -x option at the stop of any sheel script can be useful to watch
+ execution on an IP0X:
+
+ #!/bin/sh -x
+
echo "$QUERY_STRING" | grep -oe "upgrade=1" > /dev/null
if [ $? -eq 0 ]; then
+
+ # test if we are running on an IP0X
+ which ipkg >> /dev/null
+ if [ $? -eq 1 ]; then
+ cat <<EOF
+ <html>
+ <head>
+ <title>Mini Asterisk - Upgrade</title>
+ </head>
+ <body>
+ Sorry upgrade only supported on IP0X at this time
+ </body>
+ </head>
+ </html>
+EOF
+ fi
+
cat <<EOF
<html>
<head>
<body>
<h2>Upgrading...</h2>
EOF
+
rev_before=`grep -oe "Revision: [0-9]*" /www/about.sh`
echo "<strong>Current $rev_before</strong><br>"
echo "<strong>Removing $ver_before</strong><br>"
exit
fi
+# Install New Firmware CGI ----------------------------------------------------
+# this is just a nasty option to run an arbitrary script as root!
+# not a good idea on x86 platforms...but a nice way of upgrading IP0X
+
+echo "$QUERY_STRING" | grep -oe "firmwareurl=" > /dev/null
+if [ $? -eq 0 ]; then
+
+ h=`hostname`
+ if [ ! $h == "ip04" ]; then
+ echo "<html>Sorry Firmware Upgreade only supported on IP04</html>"
+ fi
+
+ firmwareurl=`echo "$QUERY_STRING" | grep -oe "firmwareurl=[^&?]*" | sed -n "s/firmwareurl=//p"`
+ # convert URL encoded string, this can just handle : and / so be careful
+ # with script names
+ firmwareurl=`echo $firmwareurl | sed -e "s/%3A/:/" -e "s_%2F_/_g"`
+ wget $firmwareurl
+ filename=`echo $firmwareurl | sed 's_^.*/__'`
+ sh $filename
+ exit
+fi
+
# Construct the web page -------------------------------
cat <<EOF
<form action="admin.sh" method="get">
<tr onMouseOver="popUp(event,'admin_firmware')" onmouseout="popUp(event,'admin_firmware')">
<td>Firmware URL:</td>
- <td><input type="text" name="firmwareurl" ></td>
+ <td><input type="text" size="45" name="firmwareurl" ></td>
<td><input type="submit" value="Install"></td>
</tr>
</form>
Enter the URL of a firmware update script.
This option can be used to install new
firmware on your Phone System. Installing new
- firmware requires an Internet
- connection.</div>
+ firmware requires an Internet connection. the
+ full URL Must be entered,
+ e.g. http://rowetel.com/ucasterisk/mini/test.sh</div>