basic voip line screen working
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 12 Jan 2010 00:25:24 +0000 (00:25 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 12 Jan 2010 00:25:24 +0000 (00:25 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@108 01035d8c-6547-0410-b346-abe4f91aad63

easy-asterisk-gui/Makefile
easy-asterisk-gui/set_voipline.sh [deleted file]
easy-asterisk-gui/set_voiplines.pl
easy-asterisk-gui/set_voiplines.sh [new file with mode: 0644]

index 386bfe52c6709f4074d8acfbb62adaaccbfbe04e..e5bff4e8f4c7edec5c2e8fed8b181ffb16704b9d 100644 (file)
@@ -8,5 +8,5 @@
 #        make TESTIP=boris test
 
 test:
-       rcp set_voiplines.pl voiplines.sh voiplines.pl set_ring.sh prototype.js admin.sh index.html faq.sh faq.html about.sh at-530.html ipphones.pl ipphones.sh ipphones.js voipline.jpg anphone.png phoneline.jpg ipphone.png phones.pl tooltips.html phones.sh phones.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www
+       rcp set_voiplines.pl set_voiplines.sh voiplines.sh voiplines.pl set_ring.sh prototype.js admin.sh index.html faq.sh faq.html about.sh at-530.html ipphones.pl ipphones.sh ipphones.js voipline.jpg anphone.png phoneline.jpg ipphone.png phones.pl tooltips.html phones.sh phones.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www
        rcp sip.conf extensions.conf root@$(TESTIP):/etc/asterisk
diff --git a/easy-asterisk-gui/set_voipline.sh b/easy-asterisk-gui/set_voipline.sh
deleted file mode 100644 (file)
index 21b7844..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-# set_voipline.sh
-# # David Rowe 12 Jan 2010
-#
-# CGI to set voip line parameters in sip.conf.
-
-cat <<EOF
-<html>
-<head>
-<title>set_network.sh</title>
-<meta http-equiv="REFRESH" content="0;url=http:network.sh">
-<body>
-Please wait a few seconds.....
-</body>
-</head>
-</html>
-EOF
-
-user=`echo "$QUERY_STRING" | grep -oe "user=[^&?]*" | sed -n "s/user=//p"`
-pass=`echo "$QUERY_STRING" | grep -oe "pass=[^&?]*" | sed -n "s/pass=//p"`
-host=`echo "$QUERY_STRING" | grep -oe "host=[^&?]*" | sed -n "s/host=//p"`
-
-./set_voipline.pl $user $pass $host > /etc/asterisk/sip.conf
-
-cat <<EOF
-<html>
-<head>
-<title>set_voiplines.sh</title>
-<meta http-equiv="REFRESH" content="0;url=http:voiplines.sh">
-<body>
-Please wait a few seconds.....
-</body>
-</head>
-</html>
-EOF
\ No newline at end of file
index 44e9f150689e8119c39038572d0a03c25c6a1b82..880b3ba096ef45e818e9b81d2ea3bb97ec865263 100755 (executable)
@@ -54,8 +54,3 @@ while (<SIP>) {
 }
 close SIP;
 
-# generate form fields -------------------------------------------
-
-print "<tr><td>User:</td><td><input type=\"text\" name=\"user\" value=\"$user\"></td></tr>\n";
-print "<tr><td>Password:</td><td><input type=\"password\" name=\"pass\" value=\"$pass\"></td></tr>";
-print "<tr><td>Host:</td><td><input type=\"text\" name=\"host\" value=\"$host\"></td></tr>";
diff --git a/easy-asterisk-gui/set_voiplines.sh b/easy-asterisk-gui/set_voiplines.sh
new file mode 100644 (file)
index 0000000..4820b78
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+# set_voipline.sh
+# # David Rowe 12 Jan 2010
+#
+# CGI to set voip line parameters in sip.conf.
+
+# check we are logged in
+
+echo $HTTP_COOKIE | grep "loggedin" > /dev/null
+if [ $? -eq 1 ]; then
+    echo "<html>"
+    echo "<head>"
+    echo '<meta http-equiv="REFRESH" content="0;url=http:login.sh">'
+    echo "</head>"
+    echo "</html>"
+    exit
+fi
+
+user=`echo "$QUERY_STRING" | grep -oe "user=[^&?]*" | sed -n "s/user=//p"`
+pass=`echo "$QUERY_STRING" | grep -oe "pass=[^&?]*" | sed -n "s/pass=//p"`
+host=`echo "$QUERY_STRING" | grep -oe "host=[^&?]*" | sed -n "s/host=//p"`
+
+./set_voiplines.pl $user $pass $host > /etc/asterisk/sip.conf.new
+mv /etc/asterisk/sip.conf /etc/asterisk/sip.conf.bak
+mv /etc/asterisk/sip.conf.new /etc/asterisk/sip.conf
+asterisk -rx "sip reload" 2>/dev/null 1 > /dev/null
+
+cat <<EOF
+<html>
+<head>
+<title>set_voiplines.sh</title>
+<meta http-equiv="REFRESH" content="0;url=http:voiplines.sh">
+<body>
+Please wait a few seconds.....
+</body>
+</head>
+</html>
+EOF
+