add -i to sed instead of redirection fixing blank pjsip.conf
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
Alex 2022-09-12 19:56:23 -04:00
parent 313ad55670
commit 0256aa9c49
Signed by: technically
GPG Key ID: 46E0A080F69E83F1
2 changed files with 17 additions and 17 deletions

View File

@ -31,29 +31,29 @@ else
chown -R gonk:gonk /var/spool/asterisk chown -R gonk:gonk /var/spool/asterisk
echo " Pulling config files for the first time..." echo " Pulling config files for the first time..."
curl -so /etc/asterisk/asterisk.conf https://ap5.gonknet.org/asterisk/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/asterisk/$HOSTNAME/$GONK_KEY > /etc/asterisk/asterisk.conf
curl -so /etc/asterisk/pjsip.conf https://ap5.gonknet.org/pjsip/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/pjsip/$HOSTNAME/$GONK_KEY > /etc/asterisk/pjsip.conf
curl -so /etc/asterisk/modules.conf https://ap5.gonknet.org/modules/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/modules/$HOSTNAME/$GONK_KEY > /etc/asterisk/modules.conf
curl -so /etc/asterisk/logger.conf https://ap5.gonknet.org/logger/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/logger/$HOSTNAME/$GONK_KEY > /etc/asterisk/logger.conf
sed "s/##EXTERNAL_IP##/$(curl https://ipv4.myip.wtf/text)/g" /etc/asterisk/pjsip.conf sed -i "s/##EXTERNAL_IP##/$(curl -s https://ipv4.myip.wtf/text)/g" /etc/asterisk/pjsip.config
echo " Setting up auto reload config files..." echo " Setting up config updater cron..."
echo "26 * * * * /usr/bin/reload" >> /etc/cron.d/reload echo "26 * * * * gonk /usr/bin/reload" > /etc/cron.d/reload
echo " Setting up VOIPBL..." echo " Setting up VOIPBL..."
echo " Downloading script..." echo " Downloading script..."
curl -so /usr/bin/voipbl.sh https://gonknet.org/static/voipbl.sh curl -s https://gonknet.org/static/voipbl.sh > /usr/bin/voipbl.sh
chmod 700 /usr/bin/voipbl.sh chmod 700 /usr/bin/voipbl.sh
chmod +x /usr/bin/voipbl.sh chmod +x /usr/bin/voipbl.sh
echo " Setting up cron..." echo " Setting up VOIPBL cron..."
echo "13 */4 * * * /usr/bin/voipbl.sh" >> /etc/cron.d/voipbl echo "13 */4 * * * root /usr/bin/voipbl.sh" > /etc/cron.d/voipbl
echo " Setting up fail2ban" echo " Setting up fail2ban"
curl -so /etc/fail2ban/jail.d/asterisk.conf https://ap5.gonknet.org/f2b/asterisk/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/f2b/asterisk/$HOSTNAME/$GONK_KEY > /etc/fail2ban/jail.d/asterisk.conf
curl -so /etc/fail2ban/action.d/voipbl.conf https://ap5.gonknet.org/f2b/voipbl/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/f2b/voipbl/$HOSTNAME/$GONK_KEY > /etc/fail2ban/action.d/voipbl.conf
rm /etc/fail2ban/jail.d/defaults-debian.conf rm /etc/fail2ban/jail.d/defaults-debian.conf
asterisk -U gonk -G gonk asterisk -U gonk -G gonk

View File

@ -1,12 +1,12 @@
#! /bin/bash #! /bin/bash
echo "Reloading config files..." echo "Reloading config files..."
curl -so /etc/asterisk/asterisk.conf https://ap5.gonknet.org/asterisk/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/asterisk/$HOSTNAME/$GONK_KEY > /etc/asterisk/asterisk.conf
curl -so /etc/asterisk/pjsip.conf https://ap5.gonknet.org/pjsip/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/pjsip/$HOSTNAME/$GONK_KEY > /etc/asterisk/pjsip.conf
curl -so /etc/asterisk/modules.conf https://ap5.gonknet.org/modules/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/modules/$HOSTNAME/$GONK_KEY > /etc/asterisk/modules.conf
curl -so /etc/asterisk/logger.conf https://ap5.gonknet.org/logger/$HOSTNAME/$GONK_KEY curl -s https://ap5.gonknet.org/logger/$HOSTNAME/$GONK_KEY > /etc/asterisk/logger.conf
sed "s/##EXTERNAL_IP##/$(curl https://ipv4.myip.wtf/text)/g" /etc/asterisk/pjsip.conf sed -i "s/##EXTERNAL_IP##/$(curl https://ipv4.myip.wtf/text)/g" /etc/asterisk/pjsip.conf
asterisk -x "core restart when convenient" asterisk -x "core restart when convenient"