Show SIP extensions on control panel

This commit is contained in:
Bob Mottram 2015-11-02 16:28:18 +00:00
parent 7e59a41e4f
commit 37be888820
1 changed files with 34 additions and 11 deletions

View File

@ -30,6 +30,7 @@
COMPLETION_FILE=$HOME/freedombone-completed.txt
SELECTED_USERNAME=
SIP_CONFIG_FILE=/etc/sipwitch.conf
function any_key {
echo ' '
@ -78,6 +79,26 @@ function add_user {
fi
}
function show_sip_extensions {
if [ ! -f $SIP_CONFIG_FILE ]; then
return;
fi
clear
echo "SIP phone extensions:"
echo " "
while read ext; do
if [[ $ext == *"user id"* ]]; then
echo -n " "
echo -n $(echo "$ext" | awk -F '"' '{print $2}' | awk -F '"' '{print $1}')
echo -n " "
fi
if [[ $ext == *"extension"* ]]; then
echo $(echo "$ext" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}')
fi
done < $SIP_CONFIG_FILE
any_key
}
function select_user {
SELECTED_USERNAME=
data=$(tempfile 2>/dev/null)
@ -519,13 +540,14 @@ function menu_top_level {
trap "rm -f $data" 0 1 2 5 15
dialog --backtitle "Freedombone Control Panel" \
--title "Control Panel" \
--radiolist "Choose an operation:" 13 70 6 \
--radiolist "Choose an operation:" 14 70 7 \
1 "Backup and Restore" off \
2 "Logging on/off" off \
3 "Manage Users" off \
4 "Email Filtering Rules" off \
5 "Security Settings" off \
6 "Exit" on 2> $data
2 "Show SIP Phone Extensions" off \
3 "Logging on/off" off \
4 "Manage Users" off \
5 "Email Filtering Rules" off \
6 "Security Settings" off \
7 "Exit" on 2> $data
sel=$?
case $sel in
1) exit 1;;
@ -533,11 +555,12 @@ function menu_top_level {
esac
case $(cat $data) in
1) menu_backup_restore;;
2) logging_on_off;;
3) menu_users;;
4) menu_email;;
5) freedombone-sec;;
6) break;;
2) show_sip_extensions;;
3) logging_on_off;;
4) menu_users;;
5) menu_email;;
6) freedombone-sec;;
7) break;;
esac
done
}