From 089b8e204bdbbc4e3728e35d66b7b99511d8454f Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 4 Jul 2016 13:11:14 +0100 Subject: [PATCH] Function to remove sip --- src/freedombone-app-sip | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/freedombone-app-sip b/src/freedombone-app-sip index 10f7b305..3eee1ced 100755 --- a/src/freedombone-app-sip +++ b/src/freedombone-app-sip @@ -35,6 +35,36 @@ VOIP_TURN_PORT=3478 VOIP_TURN_TLS_PORT=5349 VOIP_TURN_NONCE= +function remove_sip { + if ! grep -Fxq "install_sip" $COMPLETION_FILE; then + return + fi + iptables -D INPUT -p udp --dport $VOIP_TURN_PORT -j ACCEPT + iptables -D INPUT -p tcp --dport $VOIP_TURN_PORT -j ACCEPT + iptables -D INPUT -p tcp --dport $VOIP_TURN_TLS_PORT -j ACCEPT + iptables -D INPUT -p udp --dport $SIP_PORT -j ACCEPT + iptables -D INPUT -p tcp --dport $SIP_PORT -j ACCEPT + iptables -D INPUT -p udp --dport $SIP_TLS_PORT -j ACCEPT + iptables -D INPUT -p tcp --dport $SIP_TLS_PORT -j ACCEPT + function_check save_firewall_settings + save_firewall_settings + + function_check remove_onion_service + remove_onion_service sip ${SIP_PORT} + + apt-get -y remove --purge sipwitch + apt-get -y remove --purge turnserver + if [ -f /etc/sipwitch.conf ]; then + rm /etc/sipwitch.conf + fi + if [ -d /etc/turnserver ]; then + rm -rf /etc/turnserver + fi + sed -i '/install_sip/d' $COMPLETION_FILE + sed -i '/configure_firewall_for_voip_turn/d' $COMPLETION_FILE + sed -i '/configure_firewall_for_sip4/d' $COMPLETION_FILE +} + function configure_firewall_for_voip_turn { 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 return