# 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
# 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 -------------------------------
function localInit() {
+ if (init_internet == "yes")
+ $('internet').innerHTML = '<img src="tick.png" alt="tick" />';
+ else
+ $('internet').innerHTML = '<img src="cross.png" alt="tick" />';
}
# 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 = "<img $tool_tip src=\"phone.png\" alt=\"Analog Phone\" />";
- print "<tr><td>$analog{$a}</td><td>Port $a</td><td>$icon</td></tr>\n";
+ $icon = "<img src=\"anphone.png\" alt=\"Analog Phone\" />";
+ print "<tr><td $tooltip_ext>$analog{$a}</td><td $tooltip_anphone>Analog Phone</td><td $tooltip_port>Port $a</td><td>$icon</td></tr>\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 = "<img $tool_tip src=\"ipphone.png\" alt=\"IP Phone\" />";
- print "<tr><td>$s</td><td>$ipad{$s}</td><td>$icon</td></tr>\n";
+ $icon = "<img src=\"ipphone.png\" alt=\"IP Phone\" />";
+ print "<tr><td $tooltip_ext>$s</td><td $tooltip_ipphone>IP Phone</td<td $tooltip_ipphone_ip>$ipad{$s}</td><td>$icon</td></tr>\n";
}
}
-print '<tr><td colspan="2" align="left" valign="top" ><h2>Phone Lines</h2></td></tr>
-';
+$tool_tip = "onMouseOver=\"popUp(event,'phone_lines')\" onmouseout=\"popUp(event,'phone_lines')\"";
+
+print '<tr><td> </td></tr>';
+print "<tr $tool_tip><td colspan=\"4\" align=\"left\" valign=\"top\" ><h2>Phone Lines</h2></td></tr>
+";
# 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 = "<img $tool_tip src=\"phoneline.jpg\" alt=\"Phone Line\" />";
- print "<tr><td>$analog{$a}</td><td>Port $a</td><td>$icon</td></tr>\n";
+ $icon = "<img src=\"phoneline.jpg\" alt=\"Phone Line\" />";
+ print "<tr><td>$analog{$a}</td><td $tooltip_phoneline>Analog</td><td $tooltip_port>Port $a</td><td>$icon</td></tr>\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 = "<img $tool_tip src=\"voipline.jpg\" alt=\"VOIP Line\" />";
- print "<tr><td>$s</td><td>$ipad{$s}</td><td>$icon</td></tr>\n";
+ $icon = "<img src=\"voipline.jpg\" alt=\"VOIP Line\" />";
+ print "<tr><td>$s</td><td $tooltip_voipline>VOIP</td><td $tooltip_voipline_ip>$ipad{$s}</td><td>$icon</td></tr>\n";
}
}
# 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
<td valign="top">
<table align="right" width=600>
- <tr><td colspan="2" align="left" valign="top" ><h2>Phones</h2></td></tr>
+ <tr onMouseOver="popUp(event,'phone_system')" onmouseout="popUp(event,'phone_system')">
+ <td colspan="4" align="left" valign="top" ><h2>Phone System</h2></td>
+ </tr>
+ <tr onMouseOver="popUp(event,'network_internet')" onmouseout="popUp(event,'network_internet')">
+ <td colspan="3">Internet Connection:</td>
+ <td><div id="internet" > </div></td>
+ </tr>
+ <tr onMouseOver="popUp(event,'phone_ipaddress')" onmouseout="popUp(event,'phone_ipaddress')">
+ <td colspan="3">Phone System IP Address:</td>
+EOF
+echo "<td>$ipaddress</td>"
+cat <<EOF
+ </tr>
+ <tr><td> </td></tr>
+ <tr onMouseOver="popUp(event,'phone_phones')" onmouseout="popUp(event,'phone_phones')">
+ <td colspan="4" align="left" valign="top" ><h2>Phones</h2></td>
+ </tr>
EOF
# use perl to construct list of phones and phone lines for us
example due to DHCP problems on your network or a configuration mistake.
Write this number down somewhere!</div>
-<div id="phone_phone" class="tip">
- Analog Phone extension: Normal telephone plugged into a port on your phone system.
+<div id="phone_anphone" class="tip">
+ Analog Phone: Normal telephone plugged into a port on your phone system.
</div>
<div id="phone_ipphone" class="tip">
- IP Phone extension: IP Phone plugged into your network.
+ IP Phone plugged into your network.
</div>
<div id="phone_line" class="tip">
Analog Phone Line: Analog telephone line plugged into a port on your phone system.
<div id="phone_voipline" class="tip">
VOIP Phone Line: Make and receive phone calls over the Internet.
</div>
+
+<div id="phone_system" class="tip">
+ Important information about your Phone System.</div>
+
+<div id="phone_ipaddress" class="tip">
+ The address of your Phone System
+ on your network. Use this address to connect
+ IP Phones to your Phone System. </div>
+
+<div id="phone_phones" class="tip">
+ 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.</div>
+
+<div id="phone_lines" class="tip">
+ 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.</div>
+
+<div id="phone_ext" class="tip">
+ Dial this number to call this phone</div>
+
+<div id="phone_port_phone" class="tip">
+ Port on the rear of your Phone System for this
+ phone. Plug the phone into this Port.</div>
+
+<div id="phone_port_line" class="tip">
+ Port on the rear of your Phone System for this
+ phone line. Plug the phone line into this Port.</div>
+
+<div id="phone_ipphone_ip" class="tip">
+ IP Address of this phone on your network</div>
+
+<div id="phone_voipline_ip" class="tip">
+ IP Address of the VOIP Internet Service Telephone Provider</div>