added sipshowpeers.cgi
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 11 May 2012 01:58:44 +0000 (01:58 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 11 May 2012 01:58:44 +0000 (01:58 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@414 01035d8c-6547-0410-b346-abe4f91aad63

mini-asterisk-gui2/cgi-bin/catproc.cgi
mini-asterisk-gui2/cgi-bin/sipshowpeers.cgi [new file with mode: 0755]

index 1e5b764cfc8b0b4481f5c67facd4b095b04ce2ff..65afe25e129b479bb67d9dff46c174ae8459e300 100755 (executable)
@@ -1,8 +1,10 @@
 #!/bin/sh
-# catprocversion.cgi
+# catproc.cgi
 #  Ian Roberts
 #  May 7 2012
-# CGI to cat /proc/(argument)
+# CGI to execute cat /proc/<argument>
+# script expects only one argument
+# valid arguments are version, loadavg, cpuinfo, mtd, meminfo, yaffs
 
 cat <<EOF
 Content-type: text/html
@@ -15,8 +17,10 @@ Content-type: text/html
 <body>
 EOF
 
-what=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
-cat /proc/$what
+arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+#Todo : Test for one argument
+#Todo : Test for valid argument
+cat /proc/$arg
 
 cat <<EOF
 </body>
diff --git a/mini-asterisk-gui2/cgi-bin/sipshowpeers.cgi b/mini-asterisk-gui2/cgi-bin/sipshowpeers.cgi
new file mode 100755 (executable)
index 0000000..be4fb91
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# sipshowpeers.cgi
+#  Ian Roberts
+#  May 11 2012
+# CGI to execute get sip phone info
+# no argument
+
+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
+
+#arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+
+#Todo : Test for asterisk running 
+
+asterisk "-rx sip show peers" 2>/dev/null
+
+cat <<EOF
+</body>
+</html>
+EOF