opensips/rc.opensips

changeset 377
67e813202d53
parent 376
8f552d1cd671
     1.1 --- a/opensips/rc.opensips	Wed Sep 21 14:02:13 2011 +0200
     1.2 +++ b/opensips/rc.opensips	Wed Sep 21 14:04:16 2011 +0200
     1.3 @@ -5,8 +5,8 @@
     1.4  
     1.5  %config
     1.6      opensips_enable="$openpkg_rc_def"
     1.7 -    opensips_flags=""
     1.8      opensips_rtpproxy="yes"
     1.9 +    opensips_rtpproxy_addr="127.0.0.1:12345"
    1.10      opensips_log_prolog="true"
    1.11      opensips_log_epilog="true"
    1.12      opensips_log_numfiles="10"
    1.13 @@ -18,7 +18,9 @@
    1.14      opensips_pidfile="@l_prefix@/var/opensips/opensips.pid"
    1.15      opensips_rtpproxy_pidfile="@l_prefix@/var/opensips/opensips_rtpproxy.pid"
    1.16      opensips_rtpproxy_socket="@l_prefix@/var/opensips/opensips_rtpproxy.sock"
    1.17 -    opensips_rtpproxy_listen=`grep '^listen=' $opensips_cfgfile | sed -e 's/^listen="\(.*\)".*/\1/'`
    1.18 +    opensips_signal () {
    1.19 +        [ -f $opensips_pidfile ] && kill -$1 `cat $opensips_pidfile`
    1.20 +    }
    1.21      opensips_rtpproxy_signal () {
    1.22          [ -f $opensips_rtpproxy_pidfile ] && kill -$1 `cat $opensips_rtpproxy_pidfile`
    1.23      }
    1.24 @@ -29,7 +31,7 @@
    1.25      if @l_prefix@/sbin/opensips -c >/dev/null 2>&1; then
    1.26          opensips_usable="yes"
    1.27      fi
    1.28 -    if @l_prefix@/sbin/opensipsctl ps >/dev/null 2>&1; then
    1.29 +    if rcService opensips enable yes && opensips_signal 0; then
    1.30          opensips_active="yes"
    1.31      fi
    1.32      echo "opensips_enable=\"$opensips_enable\""
    1.33 @@ -40,20 +42,20 @@
    1.34      rcService opensips enable yes || exit 0
    1.35      rcService opensips active yes && exit 0
    1.36      if rcVarIsYes opensips_rtpproxy; then
    1.37 -        cmd="@l_prefix@/sbin/opensips_rtpproxy" \
    1.38 -        cmd="$cmd -l $opensips_rtpproxy_listen"
    1.39 +        cmd="@l_prefix@/sbin/rtpproxy" \
    1.40 +        cmd="$cmd -u @l_rusr@"
    1.41 +        cmd="$cmd -l $opensips_rtpproxy_addr"
    1.42          cmd="$cmd -s unix:$opensips_rtpproxy_socket"
    1.43          cmd="$cmd -p $opensips_rtpproxy_pidfile"
    1.44          su @l_rusr@ -c "$cmd"
    1.45      fi
    1.46 -    @l_prefix@/sbin/opensips \
    1.47 -        -P $opensips_pidfile \
    1.48 -        ${opensips_flags}
    1.49 +    @l_prefix@/sbin/opensipsctl start
    1.50  
    1.51  %stop -u @l_susr@
    1.52      rcService opensips enable yes || exit 0
    1.53      rcService opensips active no  && exit 0
    1.54      @l_prefix@/sbin/opensipsctl stop
    1.55 +    rm -f $opensips_pidfile 2>/dev/null || true
    1.56      if rcVarIsYes opensips_rtpproxy; then
    1.57          opensips_rtpproxy_signal TERM
    1.58      fi

mercurial