浏览代码

Remove sip altogether

I've never been able to get sip to work, despite trying multiple apps and server software types, and this may be due to telco interference
Bob Mottram 7 年前
父节点
当前提交
457b4eabc6

+ 0
- 169
src/freedombone-addsipuser 查看文件

@@ -1,169 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-
12
-# Adds a SIP phone user to the system
13
-
14
-# License
15
-# =======
16
-#
17
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
18
-#
19
-# This program is free software: you can redistribute it and/or modify
20
-# it under the terms of the GNU Affero General Public License as published by
21
-# the Free Software Foundation, either version 3 of the License, or
22
-# (at your option) any later version.
23
-#
24
-# This program is distributed in the hope that it will be useful,
25
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
26
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
-# GNU Affero General Public License for more details.
28
-#
29
-# You should have received a copy of the GNU Affero General Public License
30
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
31
-
32
-PROJECT_NAME='freedombone'
33
-
34
-export TEXTDOMAIN=${PROJECT_NAME}-addsipuser
35
-export TEXTDOMAINDIR="/usr/share/locale"
36
-
37
-MY_USERNAME=
38
-EXTENSION=
39
-PASSWORD=
40
-CONFIG_FILE=/etc/sipwitch.conf
41
-USER_EXISTS="no"
42
-
43
-function show_help {
44
-    echo ''
45
-    echo $"${PROJECT_NAME}-addsipuser -u [username] -e [extension] -p [password]"
46
-    echo ''
47
-    exit 0
48
-}
49
-
50
-function sip_user_exists {
51
-    IFS=''
52
-    while read line; do
53
-    if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
54
-        USER_EXISTS="yes"
55
-        return
56
-    fi
57
-    done < $CONFIG_FILE
58
-}
59
-
60
-function update_sip_user {
61
-    USER_FOUND=
62
-    NEW_CONFIG_FILE="${CONFIG_FILE}.new"
63
-    if [ -f $NEW_CONFIG_FILE ]; then
64
-    rm -f $NEW_CONFIG_FILE
65
-    fi
66
-    touch $NEW_CONFIG_FILE
67
-    IFS=''
68
-    while read line; do
69
-    if [ ! $USER_FOUND ]; then
70
-        if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
71
-        USER_FOUND="yes"
72
-        fi
73
-    else
74
-        if [[ "$line" == *"<extension>"* ]]; then
75
-        line="      <extension>$EXTENSION</extension>"
76
-        fi
77
-        if [[ "$line" == *"<secret>"* ]]; then
78
-        line="      <secret>$PASSWORD</secret>"
79
-        fi
80
-        if [[ "$line" == *"<display>"* ]]; then
81
-        line="      <display>$MY_USERNAME $EXTENSION</display>"
82
-        USER_FOUND=
83
-        fi
84
-    fi
85
-    echo $line >> $NEW_CONFIG_FILE
86
-    done < $CONFIG_FILE
87
-    mv $NEW_CONFIG_FILE $CONFIG_FILE
88
-}
89
-
90
-function add_sip_user {
91
-    NEW_CONFIG_FILE="${CONFIG_FILE}.new"
92
-    if [ -f $NEW_CONFIG_FILE ]; then
93
-    rm -f $NEW_CONFIG_FILE
94
-    fi
95
-    touch $NEW_CONFIG_FILE
96
-    IFS=''
97
-    while read line; do
98
-    if [[ "$line" == *'</provision>' ]]; then
99
-        echo "    <user id=\"$MY_USERNAME\">" >> $NEW_CONFIG_FILE
100
-        echo "      <extension>$EXTENSION</extension>" >> $NEW_CONFIG_FILE
101
-        echo "      <secret>$PASSWORD</secret>" >> $NEW_CONFIG_FILE
102
-        echo "      <display>$MY_USERNAME $EXTENSION</display>" >> $NEW_CONFIG_FILE
103
-        echo '    </user>' >> $NEW_CONFIG_FILE
104
-    fi
105
-    echo $line >> $NEW_CONFIG_FILE
106
-    done < $CONFIG_FILE
107
-    mv $NEW_CONFIG_FILE $CONFIG_FILE
108
-    chmod 600 /etc/shadow
109
-    chmod 600 /etc/gshadow
110
-    usermod -aG sipwitch $MY_USERNAME
111
-    chmod 0000 /etc/shadow
112
-    chmod 0000 /etc/gshadow
113
-}
114
-
115
-while [[ $# > 1 ]]
116
-do
117
-    key="$1"
118
-
119
-    case $key in
120
-    -h|--help)
121
-        show_help
122
-        ;;
123
-    -u|--user)
124
-        shift
125
-        MY_USERNAME="$1"
126
-        ;;
127
-    -e|--extension)
128
-        shift
129
-        EXTENSION="$1"
130
-        ;;
131
-    -p|--password)
132
-        shift
133
-        PASSWORD="$1"
134
-        ;;
135
-    *)
136
-        # unknown option
137
-        ;;
138
-    esac
139
-    shift
140
-done
141
-
142
-if ! [[ $MY_USERNAME && $EXTENSION && $PASSWORD ]]; then
143
-    show_help
144
-fi
145
-
146
-if [ ! -f $CONFIG_FILE ]; then
147
-    echo $"SIP configuration file not found"
148
-    exit 1
149
-fi
150
-
151
-# the user must already exist on the system
152
-if [ ! -d /home/$MY_USERNAME ]; then
153
-    echo $"User $MY_USERNAME not found"
154
-    exit 2
155
-fi
156
-
157
-sip_user_exists
158
-
159
-if [[ $USER_EXISTS == "yes" ]]; then
160
-    update_sip_user
161
-    echo $"SIP user $MY_USERNAME amended"
162
-else
163
-    add_sip_user
164
-    echo $"SIP user $MY_USERNAME added"
165
-fi
166
-
167
-systemctl restart sipwitch
168
-
169
-exit 0

+ 0
- 5
src/freedombone-app-mumble 查看文件

@@ -185,11 +185,6 @@ function restore_remote_mumble {
185 185
             rm -rf $temp_restore_dir
186 186
             exit 7823
187 187
         fi
188
-        if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
189
-            cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
190
-        else
191
-            cp -f $temp_restore_dir/sipwitch.conf /etc/sipwitch.conf
192
-        fi
193 188
         if [ ! "$?" = "0" ]; then
194 189
             rm -rf $temp_restore_dir
195 190
             exit 7823

+ 0
- 497
src/freedombone-app-sip 查看文件

@@ -1,497 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-# SIP functions
12
-#
13
-# License
14
-# =======
15
-#
16
-# Copyright (C) 2014-2016 Bob Mottram <bob@freedombone.net>
17
-#
18
-# This program is free software: you can redistribute it and/or modify
19
-# it under the terms of the GNU Affero General Public License as published by
20
-# the Free Software Foundation, either version 3 of the License, or
21
-# (at your option) any later version.
22
-#
23
-# This program is distributed in the hope that it will be useful,
24
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
25
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
-# GNU Affero General Public License for more details.
27
-#
28
-# You should have received a copy of the GNU Affero General Public License
29
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
30
-
31
-VARIANTS=''
32
-
33
-IN_DEFAULT_INSTALL=0
34
-SHOW_ON_ABOUT=0
35
-
36
-SIP_SERVER_PASSWORD=
37
-SIP_PORT=5060
38
-SIP_TLS_PORT=5061
39
-
40
-TURN_PORT=3478
41
-TURN_TLS_PORT=5349
42
-TURN_NONCE=
43
-
44
-sip_variables=(ONION_ONLY
45
-               MY_USERNAME
46
-               SIP_PORT
47
-               SIP_TLS_PORT
48
-               SIP_SERVER_PASSWORD
49
-               TURN_PORT
50
-               TURN_TLS_PORT
51
-               TURN_NONCE)
52
-
53
-function logging_on_sip {
54
-    echo -n ''
55
-}
56
-
57
-function logging_off_sip {
58
-    echo -n ''
59
-}
60
-
61
-function remove_user_sip {
62
-    remove_username="$1"
63
-    ${PROJECT_NAME}-rmsipuser ${remove_username}
64
-
65
-    ${PROJECT_NAME}-pass -u $remove_username --rmapp sip
66
-
67
-    # remove user from SIP TURN/STUN
68
-    if [ -f /etc/turnserver/turnusers.txt ]; then
69
-        sed -i "/${remove_username}:/d" /etc/turnserver/turnusers.txt
70
-    fi
71
-}
72
-
73
-function add_user_sip {
74
-    new_username="$1"
75
-    new_user_password="$2"
76
-
77
-    ${PROJECT_NAME}-pass -u $new_username -a sip -p "$new_user_password"
78
-
79
-    SIP_EXTENSION=$(${PROJECT_NAME}-sipfreeext)
80
-    ${PROJECT_NAME}-addsipuser -u $new_username -e $SIP_EXTENSION -p "$new_user_password"
81
-    if [ ! "$?" = "0" ]; then
82
-        echo '1'
83
-        return
84
-    fi
85
-
86
-    # add user to the sipwitch group
87
-    if [ -f /etc/sipwitch.conf ]; then
88
-        chmod 600 /etc/shadow
89
-        chmod 600 /etc/gshadow
90
-        usermod -aG sipwitch $new_username
91
-        chmod 0000 /etc/shadow
92
-        chmod 0000 /etc/gshadow
93
-    fi
94
-
95
-    # add user for SIP STUN/TURN
96
-    if [ -d /etc/turnserver ]; then
97
-        if grep -q "DEFAULT_DOMAIN_NAME" $CONFIGURATION_FILE; then
98
-            read_config_param "DEFAULT_DOMAIN_NAME"
99
-            echo "${new_username}:${new_user_password}:${DEFAULT_DOMAIN_NAME}:authorized" >> /etc/turnserver/turnusers.txt
100
-        fi
101
-    fi
102
-
103
-    echo '0'
104
-}
105
-
106
-function install_interactive_sip {
107
-    echo -n ''
108
-    APP_INSTALLED=1
109
-}
110
-
111
-function change_password_sip {
112
-    curr_username="$1"
113
-    new_user_password="$2"
114
-
115
-    #${PROJECT_NAME}-pass -u "$curr_username" -a sip -p "$new_user_password"
116
-}
117
-
118
-function reconfigure_sip {
119
-    echo -n ''
120
-}
121
-
122
-function upgrade_sip {
123
-    # remove the original sipwitch daemon if it exists
124
-    if [ -f /etc/init.d/sipwitch ]; then
125
-        rm -f /etc/init.d/sipwitch
126
-    fi
127
-}
128
-
129
-function backup_local_sip {
130
-    if [ -f /etc/sipwitch.conf ]; then
131
-        echo $"Backing up SIP settings"
132
-        temp_backup_dir=/root/tempsipbackup
133
-        if [ ! -d $temp_backup_dir ]; then
134
-            mkdir -p $temp_backup_dir
135
-        fi
136
-        cp -f /etc/sipwitch.conf $temp_backup_dir
137
-        backup_directory_to_usb $temp_backup_dir sip
138
-        echo $"SIP settings backup complete"
139
-    fi
140
-}
141
-
142
-function restore_local_sip {
143
-    if [ -d $USB_MOUNT/backup/sip ]; then
144
-        echo $"Restoring SIP settings"
145
-        temp_restore_dir=/root/tempsip
146
-        function_check restore_directory_from_usb
147
-        restore_directory_from_usb $temp_restore_dir sip
148
-        if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
149
-            cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
150
-        else
151
-            cp -f $temp_restore_dir/sipwitch.conf /etc/sipwitch.conf
152
-        fi
153
-        if [ ! "$?" = "0" ]; then
154
-            rm -rf $temp_restore_dir
155
-            function_check set_user_permissions
156
-            set_user_permissions
157
-            backup_unmount_drive
158
-            exit 3679
159
-        fi
160
-        rm -rf $temp_restore_dir
161
-        systemctl restart sipwitch
162
-        echo $"Restore of SIP settings complete"
163
-    fi
164
-}
165
-
166
-function backup_remote_sip {
167
-    if [ -f /etc/sipwitch.conf ]; then
168
-        echo $"Backing up SIP settings"
169
-        temp_backup_dir=/root/tempsipbackup
170
-        if [ ! -d $temp_backup_dir ]; then
171
-            mkdir -p $temp_backup_dir
172
-        fi
173
-        cp -f /etc/sipwitch.conf $temp_backup_dir
174
-        backup_directory_to_friend $temp_backup_dir sip
175
-        echo $"Backup SIP settings complete"
176
-    fi
177
-}
178
-
179
-function restore_remote_sip {
180
-    temp_restore_dir=/root/tempsip
181
-    function_check restore_directory_from_friend
182
-    restore_directory_from_friend $temp_restore_dir sip
183
-    if [ -d $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup ]; then
184
-        cp -f $temp_restore_dir/home/$ADMIN_USERNAME/tempbackup/sipwitch.conf /etc/sipwitch.conf
185
-    else
186
-        cp -f $temp_restore_dir/sipwitch.conf /etc/sipwitch.conf
187
-    fi
188
-    if [ ! "$?" = "0" ]; then
189
-        rm -rf $temp_restore_dir
190
-        function_check set_user_permissions
191
-        set_user_permissions
192
-        backup_unmount_drive
193
-        exit 3679
194
-    fi
195
-    rm -rf $temp_restore_dir
196
-    systemctl restart sipwitch
197
-}
198
-
199
-function remove_sip {
200
-    firewall_remove ${TURN_PORT}
201
-    firewall_remove ${TURN_TLS_PORT} tcp
202
-    firewall_remove ${SIP_PORT}
203
-    firewall_remove ${SIP_TLS_PORT}
204
-
205
-    function_check remove_onion_service
206
-    remove_onion_service sip ${SIP_PORT}
207
-
208
-    apt-get -yq remove --purge sipwitch
209
-    apt-get -yq remove --purge turnserver
210
-    if [ -f /etc/sipwitch.conf ]; then
211
-        rm /etc/sipwitch.conf
212
-    fi
213
-    if [ -d /etc/turnserver ]; then
214
-        rm -rf /etc/turnserver
215
-    fi
216
-    remove_completion_param install_sip
217
-    remove_completion_param configure_firewall_for_turn
218
-    remove_completion_param configure_firewall_for_sip4
219
-}
220
-
221
-function configure_firewall_for_turn {
222
-    if [[ $ONION_ONLY != "no" ]]; then
223
-        return
224
-    fi
225
-    firewall_add TURN ${TURN_PORT}
226
-    firewall_add "TURN TLS" ${TURN_TLS_PORT} tcp
227
-}
228
-
229
-
230
-function configure_firewall_for_sip4 {
231
-    if [[ $ONION_ONLY != "no" ]]; then
232
-        return
233
-    fi
234
-    firewall_add SIP ${SIP_PORT}
235
-    firewall_add "SIP TLS" ${SIP_TLS_PORT}
236
-}
237
-
238
-function update_sipwitch_daemon {
239
-    if [ ! -f /etc/init.d/sipwitch ]; then
240
-        return
241
-    fi
242
-
243
-    systemctl stop sipwitch
244
-
245
-    # remove the original sipwitch daemon if it exists
246
-    if [ -f /etc/init.d/sipwitch ]; then
247
-        rm -f /etc/init.d/sipwitch
248
-    fi
249
-
250
-    # daemon
251
-    echo '[Unit]' > /etc/systemd/system/sipwitch.service
252
-    echo 'Description=GNU SIP Witch, a SIP telephony service daemon.' >> /etc/systemd/system/sipwitch.service
253
-    echo 'After=network.target' >> /etc/systemd/system/sipwitch.service
254
-    echo '' >> /etc/systemd/system/sipwitch.service
255
-    echo '[Service]' >> /etc/systemd/system/sipwitch.service
256
-    echo 'Type=simple' >> /etc/systemd/system/sipwitch.service
257
-    echo 'Group=sipwitch' >> /etc/systemd/system/sipwitch.service
258
-    echo 'PIDFile=/var/run/sipwitch/pidfile' >> /etc/systemd/system/sipwitch.service
259
-    echo 'EnvironmentFile=-/etc/conf.d/sipwitch' >> /etc/systemd/system/sipwitch.service
260
-    echo 'EnvironmentFile=-/etc/sipwitch.conf' >> /etc/systemd/system/sipwitch.service
261
-    echo 'EnvironmentFile=-/etc/default/sipwitch' >> /etc/systemd/system/sipwitch.service
262
-    echo 'ExecStartPre=-/bin/rm -f /var/run/sipwitch/control' >> /etc/systemd/system/sipwitch.service
263
-    echo "ExecStart=/usr/sbin/sipw -f \$OPTIONS -P$SIP_PORT" >> /etc/systemd/system/sipwitch.service
264
-    echo 'Restart=always' >> /etc/systemd/system/sipwitch.service
265
-    echo 'NotifyAccess=main' >> /etc/systemd/system/sipwitch.service
266
-    echo '' >> /etc/systemd/system/sipwitch.service
267
-    echo '[Install]' >> /etc/systemd/system/sipwitch.service
268
-    echo 'WantedBy=multi-user.target' >> /etc/systemd/system/sipwitch.service
269
-
270
-    systemctl enable sipwitch
271
-    systemctl daemon-reload
272
-    systemctl start sipwitch
273
-}
274
-
275
-function install_sip_main {
276
-    if [[ $(app_is_installed sip_main) == "1" ]]; then
277
-        return
278
-    fi
279
-
280
-    apt-get -yq install sipwitch
281
-
282
-    if [ -f $IMAGE_PASSWORD_FILE ]; then
283
-        SIP_SERVER_PASSWORD="$(printf `cat $IMAGE_PASSWORD_FILE`)"
284
-    else
285
-        if [ ! $SIP_SERVER_PASSWORD ]; then
286
-            SIP_SERVER_PASSWORD="$(create_password ${MINIMUM_PASSWORD_LENGTH})"
287
-        fi
288
-    fi
289
-
290
-    echo '<?xml version="1.0"?>' > /etc/sipwitch.conf
291
-    echo '<sipwitch>' >> /etc/sipwitch.conf
292
-    echo '<provision>' >> /etc/sipwitch.conf
293
-
294
-    echo "<user id=\"$MY_USERNAME\">" >> /etc/sipwitch.conf
295
-    echo '<extension>201</extension>' >> /etc/sipwitch.conf
296
-    echo "<secret>$SIP_SERVER_PASSWORD</secret>" >> /etc/sipwitch.conf
297
-    echo "<display>$MY_USERNAME 201</display>" >> /etc/sipwitch.conf
298
-    echo '</user>' >> /etc/sipwitch.conf
299
-
300
-    echo '</provision>' >> /etc/sipwitch.conf
301
-    echo '<access>' >> /etc/sipwitch.conf
302
-    echo '</access>' >> /etc/sipwitch.conf
303
-    echo '<stack>' >> /etc/sipwitch.conf
304
-    echo "  <localnames>$DEFAULT_DOMAIN_NAME</localnames>" >> /etc/sipwitch.conf
305
-    echo '  <mapped>200</mapped>' >> /etc/sipwitch.conf
306
-    echo '  <threading>2</threading>' >> /etc/sipwitch.conf
307
-    echo '  <interface>*</interface>' >> /etc/sipwitch.conf
308
-    echo '  <dumping>false</dumping>' >> /etc/sipwitch.conf
309
-    echo '  <system>system</system>' >> /etc/sipwitch.conf
310
-    echo '  <anon>anonymous</anon>' >> /etc/sipwitch.conf
311
-    echo '</stack>' >> /etc/sipwitch.conf
312
-    echo '<timers>' >> /etc/sipwitch.conf
313
-    echo '  <!-- ring every 4 seconds -->' >> /etc/sipwitch.conf
314
-    echo '  <ring>4</ring>' >> /etc/sipwitch.conf
315
-    echo '  <!-- call forward no answer after x rings -->' >> /etc/sipwitch.conf
316
-    echo '  <cfna>4</cfna>' >> /etc/sipwitch.conf
317
-    echo '  <!-- call reset to clear cid in stack, 6 seconds -->' >> /etc/sipwitch.conf
318
-    echo '  <reset>6</reset>' >> /etc/sipwitch.conf
319
-    echo '</timers>' >> /etc/sipwitch.conf
320
-    echo '<!-- we have 2xx numbers plus space for external users -->' >> /etc/sipwitch.conf
321
-    echo '<registry>' >> /etc/sipwitch.conf
322
-    echo '  <prefix>200</prefix>' >> /etc/sipwitch.conf
323
-    echo '  <range>100</range>' >> /etc/sipwitch.conf
324
-    echo '  <keysize>77</keysize>' >> /etc/sipwitch.conf
325
-    echo '  <mapped>200</mapped>' >> /etc/sipwitch.conf
326
-    echo '  <!-- <realm>GNU Telephony</realm> -->' >> /etc/sipwitch.conf
327
-    echo '</registry>' >> /etc/sipwitch.conf
328
-    echo '<routing>' >> /etc/sipwitch.conf
329
-    echo '</routing>' >> /etc/sipwitch.conf
330
-    echo '</sipwitch>' >> /etc/sipwitch.conf
331
-
332
-    sed -i 's|#PLUGINS=|PLUGINS=|g' /etc/default/sipwitch
333
-    sed -i 's|PLUGINS=.*|PLUGINS="zeroconf subscriber forward"|g' /etc/default/sipwitch
334
-    groupadd sipwitch
335
-    chmod 600 /etc/shadow
336
-    chmod 600 /etc/gshadow
337
-    usermod -aG sipwitch $MY_USERNAME
338
-    chmod 0000 /etc/shadow
339
-    chmod 0000 /etc/gshadow
340
-
341
-    SIP_ONION_HOSTNAME=$(add_onion_service sip ${SIP_PORT} ${SIP_PORT})
342
-
343
-    ${PROJECT_NAME}-pass -u $MY_USERNAME -a sip -p "$SIP_SERVER_PASSWORD"
344
-
345
-    function_check configure_firewall_for_sip4
346
-    configure_firewall_for_sip4
347
-    install_completed sip_main
348
-}
349
-
350
-function install_sip_turn {
351
-    if [[ $(app_is_installed sip_turn) == "1" ]]; then
352
-        return
353
-    fi
354
-
355
-    apt-get -yq install turnserver
356
-
357
-    # create a nonce if needed
358
-    if [ ! $TURN_NONCE ]; then
359
-        TURN_NONCE="$(create_password 30)"
360
-    fi
361
-
362
-    function_check create_site_certificate
363
-    create_site_certificate $DEFAULT_DOMAIN_NAME 'yes'
364
-
365
-    echo '##' > /etc/turnserver/turnserver.conf
366
-    echo '# TurnServer configuration file.' >> /etc/turnserver/turnserver.conf
367
-    echo '#' >> /etc/turnserver/turnserver.conf
368
-    echo '' >> /etc/turnserver/turnserver.conf
369
-    echo '## Public IPv4 address of any relayed address (if not set, no relay for IPv4).' >> /etc/turnserver/turnserver.conf
370
-    echo '## To have multiple address, separate addresses with a comma' >> /etc/turnserver/turnserver.conf
371
-    echo '## (i.e. listen_address = { "172.16.0.1", "172.17.0.1" }).' >> /etc/turnserver/turnserver.conf
372
-    echo "listen_address = { \"192.168.0.1\" }" >> /etc/turnserver/turnserver.conf
373
-    echo '' >> /etc/turnserver/turnserver.conf
374
-    echo '## Public IPv6 address of any relayed address (if not set, no relay for IPv6).' >> /etc/turnserver/turnserver.conf
375
-    echo '## To have multiple address, separate address with a comma' >> /etc/turnserver/turnserver.conf
376
-    echo '## (i.e. listen_addressv6 = { "2001:db8:1::1", "2001:db8:2::1" }).' >> /etc/turnserver/turnserver.conf
377
-    echo "#listen_addressv6 = { \"2001:db8::1\" }" >> /etc/turnserver/turnserver.conf
378
-    echo '' >> /etc/turnserver/turnserver.conf
379
-    echo '## UDP listening port.' >> /etc/turnserver/turnserver.conf
380
-    echo "udp_port = $TURN_PORT" >> /etc/turnserver/turnserver.conf
381
-    echo '' >> /etc/turnserver/turnserver.conf
382
-    echo '## TCP listening port.' >> /etc/turnserver/turnserver.conf
383
-    echo "tcp_port = $TURN_PORT" >> /etc/turnserver/turnserver.conf
384
-    echo '' >> /etc/turnserver/turnserver.conf
385
-    echo '## TLS listening port.' >> /etc/turnserver/turnserver.conf
386
-    echo "tls_port = $TURN_TLS_PORT" >> /etc/turnserver/turnserver.conf
387
-    echo '' >> /etc/turnserver/turnserver.conf
388
-    echo '## TLS support.' >> /etc/turnserver/turnserver.conf
389
-    echo 'tls = true' >> /etc/turnserver/turnserver.conf
390
-    echo '' >> /etc/turnserver/turnserver.conf
391
-    echo '## DTLS support. It is an experimental feature and is not defined in TURN' >> /etc/turnserver/turnserver.conf
392
-    echo '## standard.' >> /etc/turnserver/turnserver.conf
393
-    echo 'dtls = false' >> /etc/turnserver/turnserver.conf
394
-    echo '' >> /etc/turnserver/turnserver.conf
395
-    echo '## Maximum allocation port number.' >> /etc/turnserver/turnserver.conf
396
-    echo 'max_port = 65535' >> /etc/turnserver/turnserver.conf
397
-    echo '' >> /etc/turnserver/turnserver.conf
398
-    echo '## Minimum allocation port number.' >> /etc/turnserver/turnserver.conf
399
-    echo '' >> /etc/turnserver/turnserver.conf
400
-    echo 'min_port = 49152' >> /etc/turnserver/turnserver.conf
401
-    echo '' >> /etc/turnserver/turnserver.conf
402
-    echo '## TURN-TCP support.' >> /etc/turnserver/turnserver.conf
403
-    echo '' >> /etc/turnserver/turnserver.conf
404
-    echo 'turn_tcp = true' >> /etc/turnserver/turnserver.conf
405
-    echo '' >> /etc/turnserver/turnserver.conf
406
-    echo '## TURN-TCP buffering mode:' >> /etc/turnserver/turnserver.conf
407
-    echo '## - true, use userspace buffering;' >> /etc/turnserver/turnserver.conf
408
-    echo '## - false, use kernel buffering.' >> /etc/turnserver/turnserver.conf
409
-    echo 'tcp_buffer_userspace = true' >> /etc/turnserver/turnserver.conf
410
-    echo '' >> /etc/turnserver/turnserver.conf
411
-    echo '## TURN-TCP maximum buffer size.' >> /etc/turnserver/turnserver.conf
412
-    echo 'tcp_buffer_size = 32768' >> /etc/turnserver/turnserver.conf
413
-    echo '' >> /etc/turnserver/turnserver.conf
414
-    echo '## Daemon mode.' >> /etc/turnserver/turnserver.conf
415
-    echo 'daemon = true' >> /etc/turnserver/turnserver.conf
416
-    echo '' >> /etc/turnserver/turnserver.conf
417
-    echo '## Unprivileged user.' >> /etc/turnserver/turnserver.conf
418
-    echo '## If you want to use this feature create a system user.' >> /etc/turnserver/turnserver.conf
419
-    echo '## On Linux: adduser --system --group turnserver' >> /etc/turnserver/turnserver.conf
420
-    echo 'unpriv_user = turnserver' >> /etc/turnserver/turnserver.conf
421
-    echo '' >> /etc/turnserver/turnserver.conf
422
-    echo '## Realm value.' >> /etc/turnserver/turnserver.conf
423
-    echo "realm = \"$DEFAULT_DOMAIN_NAME\"" >> /etc/turnserver/turnserver.conf
424
-    echo '' >> /etc/turnserver/turnserver.conf
425
-    echo '## Nonce key.' >> /etc/turnserver/turnserver.conf
426
-    echo "nonce_key = \"$TURN_NONCE\"" >> /etc/turnserver/turnserver.conf
427
-    echo '' >> /etc/turnserver/turnserver.conf
428
-    echo '## Max relay per username.' >> /etc/turnserver/turnserver.conf
429
-    echo 'max_relay_per_username = 5' >> /etc/turnserver/turnserver.conf
430
-    echo '' >> /etc/turnserver/turnserver.conf
431
-    echo '## Allocation lifetime.' >> /etc/turnserver/turnserver.conf
432
-    echo 'allocation_lifetime = 1800' >> /etc/turnserver/turnserver.conf
433
-    echo '' >> /etc/turnserver/turnserver.conf
434
-    echo '## Allocation bandwidth limitation (in KBytes/s).' >> /etc/turnserver/turnserver.conf
435
-    echo '## 0 value means bandwidth quota disabled.' >> /etc/turnserver/turnserver.conf
436
-    echo 'bandwidth_per_allocation = 150' >> /etc/turnserver/turnserver.conf
437
-    echo '' >> /etc/turnserver/turnserver.conf
438
-    echo '## Restricted user bandwidth (in KBytes/s).' >> /etc/turnserver/turnserver.conf
439
-    echo '## 0 value means bandwidth limitation disabled.' >> /etc/turnserver/turnserver.conf
440
-    echo 'restricted_bandwidth = 10' >> /etc/turnserver/turnserver.conf
441
-    echo '' >> /etc/turnserver/turnserver.conf
442
-    echo '## Denied addresses.' >> /etc/turnserver/turnserver.conf
443
-    echo '' >> /etc/turnserver/turnserver.conf
444
-    echo '# disallow relaying to localhost' >> /etc/turnserver/turnserver.conf
445
-    echo 'denied_address {' >> /etc/turnserver/turnserver.conf
446
-    echo '  address = "127.0.0.1"' >> /etc/turnserver/turnserver.conf
447
-    echo '  mask = "8"' >> /etc/turnserver/turnserver.conf
448
-    echo '  port = 0' >> /etc/turnserver/turnserver.conf
449
-    echo '}' >> /etc/turnserver/turnserver.conf
450
-    echo '' >> /etc/turnserver/turnserver.conf
451
-    echo '# disallow relaying to ip6-localhost' >> /etc/turnserver/turnserver.conf
452
-    echo 'denied_address {' >> /etc/turnserver/turnserver.conf
453
-    echo '  address = "::1"' >> /etc/turnserver/turnserver.conf
454
-    echo '  mask = "128"' >> /etc/turnserver/turnserver.conf
455
-    echo '  port = 0' >> /etc/turnserver/turnserver.conf
456
-    echo '}' >> /etc/turnserver/turnserver.conf
457
-    echo '' >> /etc/turnserver/turnserver.conf
458
-    echo '## Certification Authority file.' >> /etc/turnserver/turnserver.conf
459
-    echo "ca_file = \"/etc/ssl/certs/ca-certificates.crt\"" >> /etc/turnserver/turnserver.conf
460
-    echo '' >> /etc/turnserver/turnserver.conf
461
-    echo '## Server certificate file.' >> /etc/turnserver/turnserver.conf
462
-    if [ -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.pem ]; then
463
-        echo "cert_file = \"/etc/ssl/certs/$DEFAULT_DOMAIN_NAME.pem\"" >> /etc/turnserver/turnserver.conf
464
-    else
465
-        if [ -f /etc/ssl/certs/$DEFAULT_DOMAIN_NAME.crt ]; then
466
-            echo "cert_file = \"/etc/ssl/certs/$DEFAULT_DOMAIN_NAME.crt\"" >> /etc/turnserver/turnserver.conf
467
-        fi
468
-    fi
469
-    echo '' >> /etc/turnserver/turnserver.conf
470
-    echo '## Private key file.' >> /etc/turnserver/turnserver.conf
471
-    echo "private_key_file = \"/etc/ssl/certs/$DEFAULT_DOMAIN_NAME.key\"" >> /etc/turnserver/turnserver.conf
472
-    echo '' >> /etc/turnserver/turnserver.conf
473
-    echo '## Account method.' >> /etc/turnserver/turnserver.conf
474
-    echo "account_method = \"file\"" >> /etc/turnserver/turnserver.conf
475
-    echo '' >> /etc/turnserver/turnserver.conf
476
-    echo '## Account file (if account_method = file).' >> /etc/turnserver/turnserver.conf
477
-    echo "account_file = \"/etc/turnserver/turnusers.txt\"" >> /etc/turnserver/turnserver.conf
478
-    echo '' >> /etc/turnserver/turnserver.conf
479
-    echo '## mod_tmpuser.' >> /etc/turnserver/turnserver.conf
480
-    echo 'mod_tmpuser = false' >> /etc/turnserver/turnserver.conf
481
-
482
-    echo "${MY_USERNAME}:password:${DEFAULT_DOMAIN_NAME}:authorized" > /etc/turnserver/turnusers.txt
483
-
484
-    systemctl restart turnserver
485
-
486
-    function_check configure_firewall_for_turn
487
-    configure_firewall_for_turn
488
-    install_completed sip_turn
489
-}
490
-
491
-function install_sip {
492
-    install_sip_main
493
-    update_sipwitch_daemon
494
-    APP_INSTALLED=1
495
-}
496
-
497
-# NOTE: deliberately no exit 0

+ 0
- 23
src/freedombone-controlpanel 查看文件

@@ -76,7 +76,6 @@ done
76 76
 
77 77
 COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
78 78
 SELECTED_USERNAME=
79
-SIP_CONFIGURATION_FILE=/etc/sipwitch.conf
80 79
 ADMIN_USER=
81 80
 UPGRADE_SCRIPT_NAME="${PROJECT_NAME}-upgrade"
82 81
 UPDATE_DATE_SCRIPT=/usr/bin/updatedate
@@ -479,9 +478,6 @@ function show_users {
479 478
     echo '====='
480 479
     echo ''
481 480
     echo -n -e "$(pad_string 'Name')"
482
-    if [[ $(app_is_installed sip) == "1" ]]; then
483
-        echo -n -e "$(pad_string 'SIP ext')"
484
-    fi
485 481
     echo -n -e "$(pad_string 'Data')"
486 482
     echo ''
487 483
     echo '----------------------------------'
@@ -489,25 +485,6 @@ function show_users {
489 485
         USRNAME=$(echo "$d" | awk -F '/' '{print $3}')
490 486
         if [[ $(is_valid_user "$USRNAME") == "1" ]]; then
491 487
             echo -n -e "$(pad_string ${USRNAME})"
492
-            # get the SIP extension
493
-            SIPEXT=
494
-            if [ -f $SIP_CONFIGURATION_FILE ]; then
495
-                while read ext; do
496
-                    if [[ $ext == *"user id"* ]]; then
497
-                        CURR_UID=$(echo "$ext" | awk -F '"' '{print $2}' | awk -F '"' '{print $1}')
498
-                    fi
499
-                    if [[ $ext == *"extension"* ]]; then
500
-                        if [[ $CURR_UID == $USRNAME ]]; then
501
-                            SIPEXT=$(echo "$ext" | awk -F '>' '{print $2}' | awk -F '<' '{print $1}')
502
-                        fi
503
-                    fi
504
-                done < $SIP_CONFIGURATION_FILE
505
-            fi
506
-            if [ $SIPEXT ]; then
507
-                echo -n -e "$(pad_string SIP:${SIPEXT})"
508
-            else
509
-                echo -n -e "$(pad_string '')"
510
-            fi
511 488
 
512 489
             # size of the home directory
513 490
             echo "$(du -s -h /home/${USRNAME} | awk -F ' ' '{print $1}')"

+ 0
- 112
src/freedombone-rmsipuser 查看文件

@@ -1,112 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-
12
-# Removes a SIP phone user from the system
13
-
14
-# License
15
-# =======
16
-#
17
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
18
-#
19
-# This program is free software: you can redistribute it and/or modify
20
-# it under the terms of the GNU Affero General Public License as published by
21
-# the Free Software Foundation, either version 3 of the License, or
22
-# (at your option) any later version.
23
-#
24
-# This program is distributed in the hope that it will be useful,
25
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
26
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
-# GNU Affero General Public License for more details.
28
-#
29
-# You should have received a copy of the GNU Affero General Public License
30
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
31
-
32
-PROJECT_NAME='freedombone'
33
-
34
-export TEXTDOMAIN=${PROJECT_NAME}-rmsipuser
35
-export TEXTDOMAINDIR="/usr/share/locale"
36
-
37
-MY_USERNAME=$1
38
-CONFIG_FILE=/etc/sipwitch.conf
39
-USER_EXISTS="no"
40
-
41
-function show_help {
42
-    echo ''
43
-    echo $"${PROJECT_NAME}-rmsipuser [username]"
44
-    echo ''
45
-    exit 0
46
-}
47
-
48
-function sip_user_exists {
49
-    IFS=''
50
-    while read line; do
51
-        if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
52
-            USER_EXISTS="yes"
53
-            return
54
-        fi
55
-    done < $CONFIG_FILE
56
-}
57
-
58
-function remove_sip_user {
59
-    USER_FOUND=
60
-    NEW_CONFIG_FILE="${CONFIG_FILE}.new"
61
-    if [ -f $NEW_CONFIG_FILE ]; then
62
-        rm -f $NEW_CONFIG_FILE
63
-    fi
64
-    touch $NEW_CONFIG_FILE
65
-    IFS=''
66
-    while read line; do
67
-        if [ ! $USER_FOUND ]; then
68
-            if [[ "$line" == *"<user id=\"$MY_USERNAME\">" ]]; then
69
-                USER_FOUND="yes"
70
-            fi
71
-        fi
72
-        if [ ! $USER_FOUND ]; then
73
-            echo "$line" >> $NEW_CONFIG_FILE
74
-        else
75
-            if [[ "$line" == *'</user>' ]]; then
76
-                USER_FOUND=
77
-            fi
78
-        fi
79
-    done < $CONFIG_FILE
80
-    mv $NEW_CONFIG_FILE $CONFIG_FILE
81
-}
82
-
83
-if [ ! $MY_USERNAME ]; then
84
-    show_help
85
-fi
86
-
87
-if [ ! -f $CONFIG_FILE ]; then
88
-    echo $"SIP configuration file not found"
89
-    exit 1
90
-fi
91
-
92
-# the user must already exist on the system
93
-if [ ! -d /home/$MY_USERNAME ]; then
94
-    echo $"User $MY_USERNAME not found"
95
-    exit 2
96
-fi
97
-
98
-sip_user_exists
99
-
100
-if [[ $USER_EXISTS != "yes" ]]; then
101
-    echo $'User not found within SIP configuration file'
102
-    exit 3
103
-fi
104
-
105
-systemctl stop sipwitch
106
-
107
-remove_sip_user
108
-
109
-systemctl start sipwitch
110
-
111
-echo $"SIP user $MY_USERNAME removed"
112
-exit 0

+ 0
- 47
src/freedombone-sipfreeext 查看文件

@@ -1,47 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# .---.                  .              .
4
-# |                      |              |
5
-# |--- .--. .-.  .-.  .-.|  .-. .--.--. |.-.  .-. .--.  .-.
6
-# |    |   (.-' (.-' (   | (   )|  |  | |   )(   )|  | (.-'
7
-# '    '     --'  --'  -' -  -' '  '   -' -'   -' '   -  --'
8
-#
9
-#                    Freedom in the Cloud
10
-#
11
-
12
-# Returns the next free SIP extension number
13
-
14
-# License
15
-# =======
16
-#
17
-# Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
18
-#
19
-# This program is free software: you can redistribute it and/or modify
20
-# it under the terms of the GNU Affero General Public License as published by
21
-# the Free Software Foundation, either version 3 of the License, or
22
-# (at your option) any later version.
23
-#
24
-# This program is distributed in the hope that it will be useful,
25
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
26
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27
-# GNU Affero General Public License for more details.
28
-#
29
-# You should have received a copy of the GNU Affero General Public License
30
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
31
-
32
-PROJECT_NAME='freedombone'
33
-
34
-export TEXTDOMAIN=${PROJECT_NAME}-sipfreeext
35
-export TEXTDOMAINDIR="/usr/share/locale"
36
-
37
-CONFIG_FILE=/etc/sipwitch.conf
38
-
39
-maxnum=201
40
-while (( maxnum < 299 )); do
41
-    if ! grep -q "extension>$maxnum<" $CONFIG_FILE; then
42
-        break;
43
-    fi
44
-    maxnum=$((maxnum + 1))
45
-done
46
-echo $maxnum
47
-exit 0

+ 0
- 1
src/freedombone-utils-upgrade 查看文件

@@ -76,7 +76,6 @@ function upgrade_installation_from_previous_versions {
76 76
     sed -i 's|XMPP|xmpp|g' $COMPLETION_FILE
77 77
     sed -i 's|voip|mumble|g' $COMPLETION_FILE
78 78
     sed -i 's|VoIP|mumble|g' $COMPLETION_FILE
79
-    sed -i 's|SIP |sip |g' $COMPLETION_FILE
80 79
     sed -i 's|Blog|htmly|g' $COMPLETION_FILE
81 80
     sed -i 's|Hubzilla|hubzilla|g' $COMPLETION_FILE
82 81
     sed -i 's|Gogs|gogs|g' $COMPLETION_FILE