#! /bin/sh
#
### BEGIN INIT INFO
# Provides:          rtpengine
# Required-Start:    mysql $syslog $network $local_fs $time
# Required-Stop:     $syslog $network $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start rtpengine
# Description:       Start rtpengine
### END INIT INFO


PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/rtpengine
#PARAMS="-p /var/run/rtpengine.pid -i eth0/82.199.64.147 -u 127.0.0.1:60000 -c 127.0.0.1:60001 -m 50000 -M 55000 -L 7 --log-facility=local0"
#PARAMS="-p /var/run/rtpengine.pid -i eth0/82.199.64.147 -u 127.0.0.1:60000 -c 127.0.0.1:60001 -m 50000 -M 55000 -L 7 --log-facility=local0"
PARAMS="-p /var/run/rtpengine.pid -i 82.199.64.147 -u 82.199.64.147:60000 -c 82.199.64.147:60001 -m 50000 -M 55000 --log-facility=local1 -L 7"
NAME=rtpengine
DESC=rtpengine
PIDFILE=/var/run/rtpengine.pid

case "$1" in
  start)
              echo -n "Starting $DESC: $NAME"
              start-stop-daemon --start --quiet --pidfile $PIDFILE \
                             --exec $DAEMON -- $PARAMS || echo -n " already running"
              echo "."
              ;;
  stop)
              echo -n "Stopping $DESC: $NAME"
              start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \
                             --exec $DAEMON
              echo "."
              ;;
  *)
              N=/etc/init.d/$NAME
              echo "Usage: $N {start|stop}" >&2
              exit 1
              ;;
esac

exit 0

