Browse Source

Enable or disable voip via onion

Bob Mottram 9 years ago
parent
commit
b6e9dfae9d
1 changed files with 78 additions and 17 deletions
  1. 78
    17
      src/freedombone-controlpanel

+ 78
- 17
src/freedombone-controlpanel View File

43
 # Minimum number of characters in a password
43
 # Minimum number of characters in a password
44
 MINIMUM_PASSWORD_LENGTH=8
44
 MINIMUM_PASSWORD_LENGTH=8
45
 
45
 
46
+# voip
47
+VOIP_PORT=64738
48
+VOIP_ONION_PORT=8095
49
+
46
 USB_DRIVE=sdb
50
 USB_DRIVE=sdb
47
 # get default USB from config file
51
 # get default USB from config file
48
 CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
52
 CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
144
         echo -n -e "$(pad_string ${DEFAULT_DOMAIN_NAME})"
148
         echo -n -e "$(pad_string ${DEFAULT_DOMAIN_NAME})"
145
         echo "$(cat ${COMPLETION_FILE} | grep 'XMPP onion domain' | awk -F ':' '{print $2}')"
149
         echo "$(cat ${COMPLETION_FILE} | grep 'XMPP onion domain' | awk -F ':' '{print $2}')"
146
     fi
150
     fi
151
+    if grep -q "VoIP onion domain" $COMPLETION_FILE; then
152
+        echo -n -e "$(pad_string 'VoIP/Mumble')"
153
+        echo -n -e "$(pad_string ${DEFAULT_DOMAIN_NAME})"
154
+        echo "$(cat ${COMPLETION_FILE} | grep 'VoIP onion domain' | awk -F ':' '{print $2}')"
155
+    fi
147
     if grep -q "Wiki domain" $COMPLETION_FILE; then
156
     if grep -q "Wiki domain" $COMPLETION_FILE; then
148
         echo -n -e "$(pad_string 'Wiki')"
157
         echo -n -e "$(pad_string 'Wiki')"
149
         WIKIDOM=$(cat ${COMPLETION_FILE} | grep 'Wiki domain' | awk -F ':' '{print $2}')
158
         WIKIDOM=$(cat ${COMPLETION_FILE} | grep 'Wiki domain' | awk -F ':' '{print $2}')
198
         fi
207
         fi
199
         echo ''
208
         echo ''
200
     fi
209
     fi
210
+
201
     echo ''
211
     echo ''
202
 }
212
 }
203
 
213
 
1179
     fi
1189
     fi
1180
 }
1190
 }
1181
 
1191
 
1192
+function mumble_via_onion {
1193
+    if ! grep -q $"VoIP onion domain" $COMPLETION_FILE; then
1194
+        return
1195
+    fi
1196
+    if [ ! -f /etc/mumble-server.ini ]; then
1197
+        return
1198
+    fi
1199
+    enable_mumble_via_onion="no"
1200
+    dialog --title $"Enable Mumble via onion service" \
1201
+           --backtitle $"Freedombone Control Panel" \
1202
+           --defaultno \
1203
+           --yesno $"Enable Mumble via an onion domain?" 10 60
1204
+    sel=$?
1205
+    case $sel in
1206
+        0) enable_mumble_via_onion="yes";;
1207
+        255) return;;
1208
+    esac
1209
+
1210
+    if [[ $enable_mumble_via_onion == "yes" ]]; then
1211
+        sed -i "s|port=.*|port=${VOIP_ONION_PORT}|g" /etc/mumble-server.ini
1212
+    else
1213
+        sed -i "s|port=.*|port=${VOIP_PORT}|g" /etc/mumble-server.ini
1214
+    fi
1215
+
1216
+    systemctl restart mumble-server
1217
+}
1218
+
1182
 function menu_backup_restore {
1219
 function menu_backup_restore {
1183
     while true
1220
     while true
1184
     do
1221
     do
1322
     done
1359
     done
1323
 }
1360
 }
1324
 
1361
 
1362
+function menu_voip {
1363
+    while true
1364
+    do
1365
+        data=$(tempfile 2>/dev/null)
1366
+        trap "rm -f $data" 0 1 2 5 15
1367
+        dialog --backtitle $"Freedombone Control Panel" \
1368
+               --title $"SIP/VoIP Menu" \
1369
+               --radiolist $"Choose an operation:" 13 70 2 \
1370
+               1 $"Mumble via onion service" off \
1371
+               2 $"Exit" on 2> $data
1372
+        sel=$?
1373
+        case $sel in
1374
+            1) break;;
1375
+            255) break;;
1376
+        esac
1377
+        case $(cat $data) in
1378
+            1) mumble_via_onion;;
1379
+            2) break;;
1380
+        esac
1381
+    done
1382
+}
1383
+
1325
 function menu_irc {
1384
 function menu_irc {
1326
     while true
1385
     while true
1327
     do
1386
     do
1351
         trap "rm -f $data" 0 1 2 5 15
1410
         trap "rm -f $data" 0 1 2 5 15
1352
         dialog --backtitle $"Freedombone Control Panel" \
1411
         dialog --backtitle $"Freedombone Control Panel" \
1353
                --title $"Control Panel" \
1412
                --title $"Control Panel" \
1354
-               --radiolist $"Choose an operation:" 25 70 18 \
1413
+               --radiolist $"Choose an operation:" 26 70 19 \
1355
                1 $"About this system" off \
1414
                1 $"About this system" off \
1356
                2 $"Backup and Restore" off \
1415
                2 $"Backup and Restore" off \
1357
                3 $"Reset Tripwire" off \
1416
                3 $"Reset Tripwire" off \
1362
                8 $"Security Settings" off \
1421
                8 $"Security Settings" off \
1363
                9 $"Hubzilla" off \
1422
                9 $"Hubzilla" off \
1364
                10 $"Media menu" off \
1423
                10 $"Media menu" off \
1365
-               11 $"IRC menu" off \
1366
-               12 $"Change the name of this system" off \
1367
-               13 $"Set the TLS date/time source" off \
1368
-               14 $"Set a static local IP address" off \
1369
-               15 $"Check for updates" off \
1370
-               16 $"Power off the system" off \
1371
-               17 $"Restart the system" off \
1372
-               18 $"Exit" on 2> $data
1424
+               11 $"SIP/VoIP menu" off \
1425
+               12 $"IRC menu" off \
1426
+               13 $"Change the name of this system" off \
1427
+               14 $"Set the TLS date/time source" off \
1428
+               15 $"Set a static local IP address" off \
1429
+               16 $"Check for updates" off \
1430
+               17 $"Power off the system" off \
1431
+               18 $"Restart the system" off \
1432
+               19 $"Exit" on 2> $data
1373
         sel=$?
1433
         sel=$?
1374
         case $sel in
1434
         case $sel in
1375
             1) exit 1;;
1435
             1) exit 1;;
1386
             8) security_settings;;
1446
             8) security_settings;;
1387
             9) menu_hubzilla;;
1447
             9) menu_hubzilla;;
1388
             10) menu_media;;
1448
             10) menu_media;;
1389
-            11) menu_irc;;
1390
-            12) change_system_name;;
1391
-            13) set_tls_time_source;;
1392
-            14) set_static_IP;;
1393
-            15) check_for_updates;;
1394
-            16) shut_down_system;;
1395
-            17) restart_system;;
1396
-            18) break;;
1449
+            11) menu_voip;;
1450
+            12) menu_irc;;
1451
+            13) change_system_name;;
1452
+            14) set_tls_time_source;;
1453
+            15) set_static_IP;;
1454
+            16) check_for_updates;;
1455
+            17) shut_down_system;;
1456
+            18) restart_system;;
1457
+            19) break;;
1397
         esac
1458
         esac
1398
     done
1459
     done
1399
 }
1460
 }