docker/mod/freeswitch/entrypoint.sh

26 lines
881 B
Bash
Raw Normal View History

2020-05-14 15:21:21 +02:00
#!/bin/bash
2020-06-23 00:21:24 +02:00
# remove all SIP (port 5060) iptable rules
iptables -S INPUT | grep "\-\-dport 5060 " | cut -d " " -f 2- | xargs -rL1 iptables -D
# block requests to 5060 (tcp/udp)
iptables -A INPUT -i "$NETWORK_INTERFACE" -p tcp --dport 5060 -s 0.0.0.0/0 -j REJECT
iptables -A INPUT -i "$NETWORK_INTERFACE" -p udp --dport 5060 -s 0.0.0.0/0 -j REJECT
# allow some IPs
IFS=',' read -ra ADDR <<< "$SIP_IP_ALLOWLIST"
for IP in "${ADDR[@]}"; do
# process "$i"
echo "allow port 5060/udp for $IP"
iptables -I INPUT -p udp --dport 5060 -s $IP -j ACCEPT
done
2020-07-13 16:34:09 +02:00
# remove English audio annoucements
if [ "$REMOVE_ENGLISH_FREESWITCH_AUDIO_ANNOUNCEMENS" == 'true' ]; then
rm -rf /usr/share/freeswitch/sounds/en/us/callie/conference/
fi
2020-05-14 15:21:21 +02:00
dockerize \
-template /etc/freeswitch/vars.xml.tmpl:/etc/freeswitch/vars.xml \
/usr/bin/freeswitch -u freeswitch -g daemon -nonat -nf