|
|
|
@ -31,24 +31,45 @@ rtpengine=/usr/sbin/rtpengine |
|
|
|
prog=rtpengine |
|
|
|
pidfile=${PIDFILE-/var/run/rtpengine.pid} |
|
|
|
lockfile=${LOCKFILE-/var/lock/subsys/rtpengine} |
|
|
|
configfile=${CONFIG_FILE-/etc/rtpengine/rtpengine.conf} |
|
|
|
cachefile=/var/lib/ngcp-rtpengine/rtpengine.cfg |
|
|
|
PIDFILE=${pidfile} |
|
|
|
RETVAL=0 |
|
|
|
OPTS="" |
|
|
|
|
|
|
|
build_opts() { |
|
|
|
# kernel table |
|
|
|
shopt -s nocasematch |
|
|
|
RPMS=$(rpm -qa | grep rtpengine-kernel) |
|
|
|
if [[ "$KERNEL" == "yes" && -n "$TABLE" && -n "$RPMS" ]];then |
|
|
|
MODULE=1 |
|
|
|
OPTS=" --table=$TABLE" |
|
|
|
MODULE=0 |
|
|
|
# variable from sysconfig is prefer then config |
|
|
|
if [[ -n "$TABLE" ]];then |
|
|
|
OPTS+=" --table=$TABLE" |
|
|
|
if [[ $TABLE -ge 0 ]];then |
|
|
|
MODULE=1 |
|
|
|
fi |
|
|
|
else |
|
|
|
MODULE=0 |
|
|
|
OPTS=" --table=-1" |
|
|
|
fi |
|
|
|
# configfile exists? |
|
|
|
if [ ! -f $configfile ];then |
|
|
|
echo "Error: $configfile not present" |
|
|
|
exit -1 |
|
|
|
fi |
|
|
|
|
|
|
|
# get table variable from config |
|
|
|
table="$(grep -Ei '^table' $configfile|cut -d\ -f3)" |
|
|
|
if [ -z $table ];then |
|
|
|
table="$(grep -Ei '^table' $configfile|cut -d= -f3)" |
|
|
|
fi |
|
|
|
|
|
|
|
[[ "$FALLBACK" != "yes" ]] && OPTS+=" --no-fallback" |
|
|
|
shopt -u nocasematch |
|
|
|
# error if directive is not presented in config |
|
|
|
if [ -z $table ];then |
|
|
|
echo "Error: directive table= is not present in $configfile" |
|
|
|
exit -1 |
|
|
|
fi |
|
|
|
|
|
|
|
# enable iptables module if derective set and positive |
|
|
|
if [[ $table -ge 0 ]];then |
|
|
|
MODULE=1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
# interfaces |
|
|
|
if [[ -n "$RTP_IP" ]];then |
|
|
|
@ -60,6 +81,7 @@ build_opts() { |
|
|
|
# options |
|
|
|
[[ "$FORK" == "no" ]] && OPTS+=" --foreground" |
|
|
|
[[ "$LOG_STDERR" == "yes" ]] && OPTS+=" --log-stderr" |
|
|
|
[[ "$FALLBACK" != "yes" ]] && OPTS+=" --no-fallback" |
|
|
|
[ -z "$CONFIG_FILE" ] || OPTS+=" --config-file=$CONFIG_FILE" |
|
|
|
[ -z "$CONFIG_SECTION" ] || OPTS+=" --config-section=$CONFIG_SECTION" |
|
|
|
[ -z "$ADDRESS" ] || OPTS+=" --interface=$ADDRESS" |
|
|
|
|