Browse Source

Function to remove sip

Bob Mottram 8 years ago
parent
commit
089b8e204b
1 changed files with 30 additions and 0 deletions
  1. 30
    0
      src/freedombone-app-sip

+ 30
- 0
src/freedombone-app-sip View File

35
 VOIP_TURN_TLS_PORT=5349
35
 VOIP_TURN_TLS_PORT=5349
36
 VOIP_TURN_NONCE=
36
 VOIP_TURN_NONCE=
37
 
37
 
38
+function remove_sip {
39
+	if ! grep -Fxq "install_sip" $COMPLETION_FILE; then
40
+		return
41
+	fi
42
+	iptables -D INPUT -p udp --dport $VOIP_TURN_PORT -j ACCEPT
43
+	iptables -D INPUT -p tcp --dport $VOIP_TURN_PORT -j ACCEPT
44
+	iptables -D INPUT -p tcp --dport $VOIP_TURN_TLS_PORT -j ACCEPT
45
+	iptables -D INPUT -p udp --dport $SIP_PORT -j ACCEPT
46
+	iptables -D INPUT -p tcp --dport $SIP_PORT -j ACCEPT
47
+	iptables -D INPUT -p udp --dport $SIP_TLS_PORT -j ACCEPT
48
+	iptables -D INPUT -p tcp --dport $SIP_TLS_PORT -j ACCEPT
49
+	function_check save_firewall_settings
50
+	save_firewall_settings
51
+
52
+	function_check remove_onion_service
53
+	remove_onion_service sip ${SIP_PORT}
54
+
55
+	apt-get -y remove --purge sipwitch
56
+	apt-get -y remove --purge turnserver
57
+	if [ -f /etc/sipwitch.conf ]; then
58
+		rm /etc/sipwitch.conf
59
+	fi
60
+	if [ -d /etc/turnserver ]; then
61
+		rm -rf /etc/turnserver
62
+	fi
63
+	sed -i '/install_sip/d' $COMPLETION_FILE
64
+	sed -i '/configure_firewall_for_voip_turn/d' $COMPLETION_FILE
65
+	sed -i '/configure_firewall_for_sip4/d' $COMPLETION_FILE
66
+}
67
+
38
 function configure_firewall_for_voip_turn {
68
 function configure_firewall_for_voip_turn {
39
 	if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" ]]; then
69
 	if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" || $SYSTEM_TYPE == "$VARIANT_MAILBOX" || $SYSTEM_TYPE == "$VARIANT_CLOUD" || $SYSTEM_TYPE == "$VARIANT_SOCIAL" || $SYSTEM_TYPE == "$VARIANT_MEDIA" || $SYSTEM_TYPE == "$VARIANT_DEVELOPER" ]]; then
40
 		return
70
 		return