diff --git a/src/freedombone b/src/freedombone index 820a82d4..b929039a 100755 --- a/src/freedombone +++ b/src/freedombone @@ -10218,6 +10218,42 @@ function install_voip { echo 'install_voip' >> $COMPLETION_FILE } +function update_sipwitch_daemon { + if [ ! -f /etc/init.d/sipwitch ]; then + return + fi + service sipwitch stop + + # remove the original sipwitch daemon if it exists + if [ -f /etc/init.d/sipwitch ]; then + rm -f /etc/init.d/sipwitch + fi + + # daemon + echo '[Unit]' > /etc/systemd/system/sipwitch.service + echo 'Description=GNU SIP Witch, a SIP telephony service daemon.' >> /etc/systemd/system/sipwitch.service + echo 'After=network.target' >> /etc/systemd/system/sipwitch.service + echo '' >> /etc/systemd/system/sipwitch.service + echo '[Service]' >> /etc/systemd/system/sipwitch.service + echo 'Type=simple' >> /etc/systemd/system/sipwitch.service + echo 'Group=sipwitch' >> /etc/systemd/system/sipwitch.service + echo 'PIDFile=/var/run/sipwitch/pidfile' >> /etc/systemd/system/sipwitch.service + echo 'EnvironmentFile=-/etc/conf.d/sipwitch' >> /etc/systemd/system/sipwitch.service + echo 'EnvironmentFile=-/etc/sipwitch.conf' >> /etc/systemd/system/sipwitch.service + echo 'EnvironmentFile=-/etc/default/sipwitch' >> /etc/systemd/system/sipwitch.service + echo 'ExecStartPre=-/bin/rm -f /var/run/sipwitch/control' >> /etc/systemd/system/sipwitch.service + echo 'ExecStart=/usr/sbin/sipw -f $OPTIONS' >> /etc/systemd/system/sipwitch.service + echo 'Restart=always' >> /etc/systemd/system/sipwitch.service + echo 'NotifyAccess=main' >> /etc/systemd/system/sipwitch.service + echo '' >> /etc/systemd/system/sipwitch.service + echo '[Install]' >> /etc/systemd/system/sipwitch.service + echo 'WantedBy=multi-user.target' >> /etc/systemd/system/sipwitch.service + + systemctl enable sipwitch + systemctl daemon-reload + systemctl start sipwitch +} + function install_sip { 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 @@ -10289,40 +10325,6 @@ function install_sip { echo "SIP onion domain:$SIP_ONION_HOSTNAME" >> $COMPLETION_FILE fi - systemctl stop sipwitch - - # Note: the existing sipwitch init daemon doesn't appear to work well - # so here we replace it with a systemd one - - # remove the original sipwitch daemon if it exists - if [ -f /etc/init.d/sipwitch ]; then - rm -f /etc/init.d/sipwitch - fi - - # daemon - echo '[Unit]' > /etc/systemd/system/sipwitch.service - echo 'Description=GNU SIP Witch, a SIP telephony service daemon.' >> /etc/systemd/system/sipwitch.service - echo 'After=network.target' >> /etc/systemd/system/sipwitch.service - echo '' >> /etc/systemd/system/sipwitch.service - echo '[Service]' >> /etc/systemd/system/sipwitch.service - echo 'Type=simple' >> /etc/systemd/system/sipwitch.service - echo 'Group=sipwitch' >> /etc/systemd/system/sipwitch.service - echo 'PIDFile=/var/run/sipwitch/pidfile' >> /etc/systemd/system/sipwitch.service - echo 'EnvironmentFile=-/etc/conf.d/sipwitch' >> /etc/systemd/system/sipwitch.service - echo 'EnvironmentFile=-/etc/sipwitch.conf' >> /etc/systemd/system/sipwitch.service - echo 'EnvironmentFile=-/etc/default/sipwitch' >> /etc/systemd/system/sipwitch.service - echo 'ExecStartPre=-/bin/rm -f /var/run/sipwitch/control' >> /etc/systemd/system/sipwitch.service - echo 'ExecStart=/usr/sbin/sipw -f $OPTIONS' >> /etc/systemd/system/sipwitch.service - echo 'Restart=always' >> /etc/systemd/system/sipwitch.service - echo 'NotifyAccess=main' >> /etc/systemd/system/sipwitch.service - echo '' >> /etc/systemd/system/sipwitch.service - echo '[Install]' >> /etc/systemd/system/sipwitch.service - echo 'WantedBy=multi-user.target' >> /etc/systemd/system/sipwitch.service - - systemctl enable sipwitch - systemctl daemon-reload - systemctl start sipwitch - if ! grep -q $"SIP Server" /home/$MY_USERNAME/README; then echo '' >> /home/$MY_USERNAME/README echo '' >> /home/$MY_USERNAME/README @@ -10491,6 +10493,7 @@ install_irc_server configure_firewall_for_irc install_voip install_sip +update_sipwitch_daemon install_wiki install_blog mark_blog_domain