--- /dev/null
+#!/bin/sh
+# setring.cgi
+# David Rowe 9 March 2011
+#
+# CGI to set extension to ring on an incoming call
+#
+
+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
+
+
+# extract extensions to ring and reload extensions.conf
+
+a=`echo "$QUERY_STRING" | sed -n "s/=on*//pg" | sed -n 's,_,/,pg'`
+
+# escape & if present
+echo "$a" | grep "&" >> /dev/null
+if [ $? -eq 0 ]; then
+ a=`echo $a | sed -n "s/&/\\\\&/pg"`
+fi
+
+sed -i "s_s,1,Dial(.*) ;; mini-asterisk_s,1,Dial($a) ;; mini-asterisk_" /etc/asterisk/extensions.conf
+#asterisk -rx "dialplan reload" 2>/dev/null 1 > /dev/null
+
+
+cat <<EOF
+</body>
+</html>
+EOF
html += '<tr><td colspan="2">Phone System IP Address:</td><td> </td><td div id="ipaddress"></div></td></tr>';
html += '<tr><td> </td></tr>';
- // print out analog phones
+ html += '<form action="/cgi-bin/setring.cgi" method="get">';
+ // print out analog phones
html += '<tr><td colspan="4" align="left" valign="top"><h2>Phones</h2></td></tr>';
for(var i=0; i<zap.length; i++) {
if (zap[i] == 'FXS') {
html += "</td>";
html += "</tr>";
+
+ html += '</form>';
+
+
// print out phone lines
html += '<tr><td colspan="4" align="left" valign="top"><h2>Phone Lines</h2></td></tr>';