git-svn-id: https://svn.code.sf.net/p/freetel/code@644 01035d8c-6547-0410-b346-abe4f9...
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 29 Aug 2012 02:14:16 +0000 (02:14 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Wed, 29 Aug 2012 02:14:16 +0000 (02:14 +0000)
mini-asterisk-gui2/cgi-bin/setring.cgi [new file with mode: 0755]
mini-asterisk-gui2/phones.js

diff --git a/mini-asterisk-gui2/cgi-bin/setring.cgi b/mini-asterisk-gui2/cgi-bin/setring.cgi
new file mode 100755 (executable)
index 0000000..6d09a41
--- /dev/null
@@ -0,0 +1,37 @@
+#!/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
index 93ada138c700ee630918f00f10eabb8596ba11a1..86ed40a3c95d72eabbd73d8669add54b259a9404 100644 (file)
@@ -36,8 +36,9 @@ function initialisePage() {
     html += '<tr><td colspan="2">Phone System IP Address:</td><td> </td><td div id="ipaddress"></div></td></tr>';
     html += '<tr><td>&nbsp</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') {
@@ -104,6 +105,10 @@ function initialisePage() {
     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>';