From: drowe67 Date: Tue, 5 Jan 2010 23:04:29 +0000 (+0000) Subject: extensive tool tipping of phone page X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=252ee8e935b89dd98aa5a239515eb8ed179b1c8c;p=freetel-svn-tracking.git extensive tool tipping of phone page git-svn-id: https://svn.code.sf.net/p/freetel/code@96 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/easy-asterisk-gui/Makefile b/easy-asterisk-gui/Makefile index 196a21e8..99d0e862 100644 --- a/easy-asterisk-gui/Makefile +++ b/easy-asterisk-gui/Makefile @@ -9,5 +9,5 @@ TESTIP=192.168.1.150 # rcp index.html root@$(TESTIP):/var/lib/asterisk/static-http/ test: - rcp voipline.jpg phone.png phoneline.jpg ipphone.png phone.pl tooltips.html phone.sh phone.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh dashboard.sh dashboard.js network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin + rcp voipline.jpg anphone.png phoneline.jpg ipphone.png phone.pl tooltips.html phone.sh phone.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh dashboard.sh dashboard.js network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin rcp sip.conf extensions.conf root@$(TESTIP):/etc/asterisk diff --git a/easy-asterisk-gui/anphone.png b/easy-asterisk-gui/anphone.png new file mode 100644 index 00000000..9783372f Binary files /dev/null and b/easy-asterisk-gui/anphone.png differ diff --git a/easy-asterisk-gui/dashboard.sh b/easy-asterisk-gui/dashboard.sh index 81daa21c..87bfa3e8 100644 --- a/easy-asterisk-gui/dashboard.sh +++ b/easy-asterisk-gui/dashboard.sh @@ -3,12 +3,16 @@ # David Rowe 4 Jan 2010 # CGI for Easy Asterisk dashboard GUI -# See if we have Internet connectivity, unlike network.sh we don't check dns first +# See if we have Internet connectivity, first check dns as time outs can be very slow +dns=`cat /etc/resolv.conf | awk '/^nameserver/ {print $2}'` +dns_packet_loss=`ping $dns -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'` internet="no"; -packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'` -if [ $packet_loss == "0" ]; then - internet="yes"; +if [ $dns_packet_loss == "0" ]; then + packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'` + if [ $packet_loss == "0" ]; then + internet="yes"; + fi fi # Construct the web page ------------------------------- diff --git a/easy-asterisk-gui/phone.js b/easy-asterisk-gui/phone.js index 9c50ceac..74d6eaf1 100644 --- a/easy-asterisk-gui/phone.js +++ b/easy-asterisk-gui/phone.js @@ -1,3 +1,7 @@ function localInit() { + if (init_internet == "yes") + $('internet').innerHTML = 'tick'; + else + $('internet').innerHTML = 'tick'; } diff --git a/easy-asterisk-gui/phone.pl b/easy-asterisk-gui/phone.pl index f540360e..93157bbc 100755 --- a/easy-asterisk-gui/phone.pl +++ b/easy-asterisk-gui/phone.pl @@ -74,48 +74,56 @@ close SIP; # print list of analog phones -$tool_tip = "onMouseOver=\"popUp(event,'phone_phone')\" onmouseout=\"popUp(event,'phone_phone')\""; +$tooltip_anphone = "onMouseOver=\"popUp(event,'phone_anphone')\" onmouseout=\"popUp(event,'phone_anphone')\""; +$tooltip_ext = "onMouseOver=\"popUp(event,'phone_ext')\" onmouseout=\"popUp(event,'phone_ext')\""; +$tooltip_port = "onMouseOver=\"popUp(event,'phone_port_phone')\" onmouseout=\"popUp(event,'phone_port_phone')\""; foreach $a (sort keys %analog) { if ($zap{$a} eq "fxs") { - $icon = "\"Analog"; - print "$analog{$a}Port $a$icon\n"; + $icon = "\"Analog"; + print "$analog{$a}Analog PhonePort $a$icon\n"; } } # print list of IP phones -$tool_tip = "onMouseOver=\"popUp(event,'phone_ipphone')\" onmouseout=\"popUp(event,'phone_ipphone')\""; +$tooltip_ipphone = "onMouseOver=\"popUp(event,'phone_ipphone')\" onmouseout=\"popUp(event,'phone_ipphone')\""; +$tooltip_ipphone_ip = "onMouseOver=\"popUp(event,'phone_ipphone_ip')\" onmouseout=\"popUp(event,'phone_ipphone_ip')\""; foreach $s (sort keys %sip) { if ($sip{$s} eq "OK") { - $icon = "\"IP"; - print "$s$ipad{$s}$icon\n"; + $icon = "\"IP"; + print "$sIP Phone$ipad{$s}$icon\n"; } } -print '

Phone Lines

-'; +$tool_tip = "onMouseOver=\"popUp(event,'phone_lines')\" onmouseout=\"popUp(event,'phone_lines')\""; + +print ' '; +print "

Phone Lines

+"; # print list of analog phone lines -$tool_tip = "onMouseOver=\"popUp(event,'phone_phoneline')\" onmouseout=\"popUp(event,'phone_phoneline')\""; +$tooltip_phoneline = "onMouseOver=\"popUp(event,'phone_phoneline')\" onmouseout=\"popUp(event,'phone_phoneline')\""; +$tooltip_port = "onMouseOver=\"popUp(event,'phone_port_line')\" onmouseout=\"popUp(event,'phone_port_line')\""; foreach $a (sort keys %analog) { if ($zap{$a} eq "fxo") { - $icon = "\"Phone"; - print "$analog{$a}Port $a$icon\n"; + $icon = "\"Phone"; + print "$analog{$a}AnalogPort $a$icon\n"; } } # print list of SIP VOIP trunks -$tool_tip = "onMouseOver=\"popUp(event,'phone_voipline')\" onmouseout=\"popUp(event,'phone_voipline')\""; +$tooltip_voipline = "onMouseOver=\"popUp(event,'phone_voipline')\" onmouseout=\"popUp(event,'phone_voipline')\""; +$tooltip_voipline_ip = "onMouseOver=\"popUp(event,'phone_voipline_ip')\" onmouseout=\"popUp(event,'phone_voipline_ip')\""; foreach $s (sort keys %voip) { if ($voip{$s} eq "OK") { - $icon = "\"VOIP"; - print "$s$ipad{$s}$icon\n"; + $icon = "\"VOIP"; + print "$sVOIP$ipad{$s}$icon\n"; } } diff --git a/easy-asterisk-gui/phone.png b/easy-asterisk-gui/phone.png deleted file mode 100644 index 9783372f..00000000 Binary files a/easy-asterisk-gui/phone.png and /dev/null differ diff --git a/easy-asterisk-gui/phone.sh b/easy-asterisk-gui/phone.sh index dc84c546..2e014dc8 100644 --- a/easy-asterisk-gui/phone.sh +++ b/easy-asterisk-gui/phone.sh @@ -3,6 +3,20 @@ # David Rowe 4 Jan 2010 # CGI for Easy Asterisk phones GUI +# See if we have Internet connectivity, first check dns as time outs can be very slow + +dns=`cat /etc/resolv.conf | awk '/^nameserver/ {print $2}'` +dns_packet_loss=`ping $dns -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'` +internet="no"; +if [ $dns_packet_loss == "0" ]; then + packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'` + if [ $packet_loss == "0" ]; then + internet="yes"; + fi +fi + +ipaddress=`ifconfig eth0 | sed -n 's/.*inet addr:\(.*\) Bcast.*/\1/p'` + # Construct the web page ------------------------------- sh check_loggedin.sh @@ -35,7 +49,23 @@ cat < - + + + + + + + + + +EOF +echo "" +cat < + + + + EOF # use perl to construct list of phones and phone lines for us diff --git a/easy-asterisk-gui/tooltips.html b/easy-asterisk-gui/tooltips.html index 9e0795d0..e652ae0c 100644 --- a/easy-asterisk-gui/tooltips.html +++ b/easy-asterisk-gui/tooltips.html @@ -9,11 +9,11 @@ example due to DHCP problems on your network or a configuration mistake. Write this number down somewhere! -
- Analog Phone extension: Normal telephone plugged into a port on your phone system. +
+ Analog Phone: Normal telephone plugged into a port on your phone system.
- IP Phone extension: IP Phone plugged into your network. + IP Phone plugged into your network.
Analog Phone Line: Analog telephone line plugged into a port on your phone system. @@ -21,3 +21,47 @@
VOIP Phone Line: Make and receive phone calls over the Internet.
+ +
+ Important information about your Phone System.
+ +
+ The address of your Phone System + on your network. Use this address to connect + IP Phones to your Phone System.
+ +
+ List of phones connected to your Phone + System. You can connect Analog or IP Phones + to your system. When IP Phones are + configured correctly, they appear on this + list. If an IP phone is not configured + correctly, it will not appear on this list. + Analog phones require hardware to be + installed in your Phone system.
+ +
+ List of phone lines available. Phone lines + are used to make and receive outside calls. + You can use regular Analog phone lines or + VOIP. VOIP Phone lines require an account + with an Internet Telephone Service provider. + Analog phone lines require hardware to be + installed in your Phone System.
+ +
+ Dial this number to call this phone
+ +
+ Port on the rear of your Phone System for this + phone. Plug the phone into this Port.
+ +
+ Port on the rear of your Phone System for this + phone line. Plug the phone line into this Port.
+ +
+ IP Address of this phone on your network
+ +
+ IP Address of the VOIP Internet Service Telephone Provider

Phones

Phone System

Internet Connection:
 
Phone System IP Address:$ipaddress
 

Phones