#!/bin/sh cat<

# DD-WRT Control Panel

Firmware: <% get_firmware_version(); %>
Uptime: <% get_uptime(); %>
WAN IP: <% nvram_status_get("wan_ipaddr"); %>

## Help

More...
EOF if [ "$REQUEST_METHOD" = "POST" ]; then read QUERY_STRING fi if [ -n "$QUERY_STRING" ]; then eval $(echo "$QUERY_STRING"|awk -F'&' '{for(i=1;i<=NF;i++){print $i}}') fi if [ -n "$post_reboot" ]; then cat<

# Status: Rebooting...

EOF echo "Your router is now rebooting. If you reload this page another reboot will be initiated!" sh -c "sleep 2;reboot">/dev/null 2>&1 & cat<

EOF elif [ -n "$post_route" ]; then cat<

# Status: Routing Table

EOF route -n|awk ' function td(s) { printf(" | %s", s); } function ip(s) { # if(s!~/\.0$/) { # td(sprintf("%s", s, s)); # } # else { td(s); # } } BEGIN { print "

"; } /^[0-9]/ { printf "
"; ip($1); ip($2); for(i=3;i<=NF;i++) td($i); printf "
\n"; } /^Destination/ { printf "
"; for(i=1;i<=NF;i++) printf("%s", $i); printf "
\n"; } END { print "

"; }' cat<

EOF elif [ -n "$post_restart" ]; then cat<

# Status: SER Restart

EOF if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi; serctl restart ser|awk 'sub("", " ") {print}'; sleep 3s; cat<

EOF else cat<

# Status: Overview

SER Stats: | $(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi; echo "Message type: Occurances"; serctl fifo sl_stats | awk 'sub("", " ") {print}';)
SER processes: | First Receiver Process per IP:Port $(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi ; serctl ps| grep child=0\ sock=0 | awk 'sub("", " ") {print}'; serctl ps| grep child=0\ sock=1 | awk 'sub("", " ") {print}'; serctl ps| grep child=0\ sock=2 | awk 'sub("", " ") {print}';)
RTPproxy: | $(ps | grep 'rtpproxy -l' | grep -v 'grep' | cut -f2 -d'l';)
lan address: | $( ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}')
wan address: | $(if [ $(nvram get wan_proto) = pppoe ] ; then if [ "`ifconfig | grep ppp0`" ]; then echo $(ifconfig ppp0|awk 'sub("inet addr:","") {print $1}') else echo "ppp0 interface not up" fi else echo $(ifconfig $(nvram get wan_ifname)|awk 'sub("inet addr:","") {print $1}') fi)
Device Info: | Boardtype: $(nvram get boardtype), Boardnum: $(nvram get boardnum)
SER Uptime: | $(if [ $(nvram get sip_domain) ]; then export SIP_DOMAIN=$(nvram get sip_domain); else export SIP_DOMAIN=$(ifconfig $(nvram get lan_ifname)|awk 'sub("inet addr:","") {print $1}'); fi; echo "Please note: Automatic SER restarts may be due to changing network interface addresses"; serctl fifo uptime | awk 'sub("", " ") {print}';)
Router Uptime: | $(uptime)

EOF fi cat<
EOF