-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer_rst-sip-provider.sh
43 lines (36 loc) · 1.42 KB
/
installer_rst-sip-provider.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/sh
##
## Installer of the flush script SIP provider
##
## Copyleft : Fabien RIVIERE
[ -z "$1" ] && echo "Usage : $0 [SIP_PROVIDER_URL]" && exit 0
SIPPROVIDER=$1
shellCMDConfig=" <config>\\
<cmd>/usr/local/bin/rst-sip-provider.sh ${SIPPROVIDER}</cmd>\\
<cmdtype>afterfilterchangeshellcmd</cmdtype>\\
<description><![CDATA[Script reset states SIP PROVIDER]]></description>\\
</config>\\
</shellcmdsettings>"
systemCMDConfig=" <afterfilterchangeshellcmd>/usr/local/bin/rst-sip-provider.sh ${SIPPROVIDER}</afterfilterchangeshellcmd>\\
</system>"
# ShellCMD Installation for the WebUI
pkg install -qy pfSense-pkg-Shellcmd
# Script creation
cat <<- 'EOF' > /usr/local/bin/rst-sip-provider.sh
#!/bin/sh
##
## Reset States for SIP Provider
##
[ -z "$1" ] && echo "Usage : $0 [SIP_PROVIDER_URL]" && exit 0
SIPPROVIDER=$1
(echo -n "Reset States for SIP Provider (${SIPPROVIDER}) ";/sbin/pfctl -k 0.0.0.0/0 -k ${SIPPROVIDER} 2>&1) | /usr/bin/logger -p daemon.info -i -t $0
EOF
# Permissions
chmod 755 /usr/local/bin/rst-sip-provider.sh
# Replace configuration
sed -ie "s|</shellcmdsettings>|$shellCMDConfig|" /conf/config.xml
sed -ie "s|</system>|$systemCMDConfig|" /conf/config.xml
# Load new configuration
rm -f /tmp/config.cache
# First execution after filters are sync
/etc/rc.filter_configure_sync