From 1c00c1d241186ac2b685afc823b5a4f4c1a27b9f Mon Sep 17 00:00:00 2001 From: drowe67 Date: Sun, 3 Jan 2010 05:56:57 +0000 Subject: [PATCH] screen to set IP, but has problems with more than one event arriving git-svn-id: https://svn.code.sf.net/p/freetel/code@83 01035d8c-6547-0410-b346-abe4f91aad63 --- easy-asterisk-gui/Makefile | 9 + easy-asterisk-gui/ajamdemo.html | 321 ------------------------------- easy-asterisk-gui/get_network.sh | 2 + easy-asterisk-gui/set_network.sh | 52 +++++ 4 files changed, 63 insertions(+), 321 deletions(-) create mode 100644 easy-asterisk-gui/Makefile delete mode 100644 easy-asterisk-gui/ajamdemo.html create mode 100755 easy-asterisk-gui/set_network.sh diff --git a/easy-asterisk-gui/Makefile b/easy-asterisk-gui/Makefile new file mode 100644 index 00000000..8219ea80 --- /dev/null +++ b/easy-asterisk-gui/Makefile @@ -0,0 +1,9 @@ +# Makefile +# David Rowe 1 Jan 2010 +# Makefile for easy Asterisk GUI + +TESTIP=192.168.1.150 + +test: + rcp set_network.sh get_network.sh root@$(TESTIP):/var/lib/asterisk/scripts + rcp index.html root@$(TESTIP):/var/lib/asterisk/static-http/ diff --git a/easy-asterisk-gui/ajamdemo.html b/easy-asterisk-gui/ajamdemo.html deleted file mode 100644 index 4b911ab5..00000000 --- a/easy-asterisk-gui/ajamdemo.html +++ /dev/null @@ -1,321 +0,0 @@ - - - - - - -Asterisk™ AJAM Demo - - - - - - - - - - - - - - - - - - -
- - - - - - - - -

Asterisk™ AJAM Demo

Username:
Secret:
-
-   -
-
-
- -
-This is a demo of the Asynchronous Javascript Asterisk Manager interface. You can login with a -valid, appropriately permissioned manager username and secret. -
- - - - - - - -
-
StaticDHCP
IP Address:
Netmask:
Gateway:
DNS:
-
-
-
- - Copyright (C) 2006 Digium, Inc. Asterisk and Digium are trademarks of Digium, Inc. - -
- diff --git a/easy-asterisk-gui/get_network.sh b/easy-asterisk-gui/get_network.sh index f4d72620..30a11f29 100755 --- a/easy-asterisk-gui/get_network.sh +++ b/easy-asterisk-gui/get_network.sh @@ -4,6 +4,8 @@ # Extracts network config into /etc/asterisk/network.conf in a form # that the AJAM getconfig can read. +echo `date` " get_network.sh" >> /tmp/easy_gui.log + F="/etc/asterisk/network.conf" echo "[network]" > $F diff --git a/easy-asterisk-gui/set_network.sh b/easy-asterisk-gui/set_network.sh new file mode 100755 index 00000000..53a74e83 --- /dev/null +++ b/easy-asterisk-gui/set_network.sh @@ -0,0 +1,52 @@ +#!/bin/sh -x +# set_network.sh +# +# A system call from AJAM/Asterisk sets the network parameters of an IP0X using +# this script +# +# ./set_network yes|no [ipaddress] [netmask] [gateway] [dns] + +echo `date` " set_network.sh $1 $2 $3 $4 $5" >> /tmp/easy_gui.log + +if [ $1 == "yes" ]; then + + # DHCP + + if [ -f /etc/rc.d/S10network-static ]; then + /etc/init.d/network-static disable + /etc/init.d/network-static stop + /etc/init.d/network enable + /etc/init.d/network start + else + # if already running restart service + /etc/init.d/network stop + /etc/init.d/network start + fi +fi + +if [ $1 == "no" ]; then + + # Static IP + + # check correct number of arguments + + if [ $# -le 4 ]; then + exit + fi + + if [ -f /etc/rc.d/S10network ]; then + /etc/init.d/network stop + /etc/init.d/network disable + /etc/init.d/network-static enable + fi + + sed -i "s/DHCPD=.*/DHCPD=no/g" /etc/init.d/network-static + sed -i "s/IPADDRESS=.*/IPADDRESS=\"$2\"/g" /etc/init.d/network-static + sed -i "s/NETMASK=.*/NETMASK=\"$3\"/g" /etc/init.d/network-static + sed -i "s/GATEWAY=.*/GATEWAY=\"$4\"/g" /etc/init.d/network-static + sed -i "s/DNS=.*/DNS=\"$5\"/g" /etc/init.d/network-static + /etc/init.d/network-static stop + /etc/init.d/network-static start + exit +fi + -- 2.25.1