diff -r 8f552d1cd671 -r 67e813202d53 opensips/rc.opensips --- a/opensips/rc.opensips Wed Sep 21 14:02:13 2011 +0200 +++ b/opensips/rc.opensips Wed Sep 21 14:04:16 2011 +0200 @@ -5,8 +5,8 @@ %config opensips_enable="$openpkg_rc_def" - opensips_flags="" opensips_rtpproxy="yes" + opensips_rtpproxy_addr="127.0.0.1:12345" opensips_log_prolog="true" opensips_log_epilog="true" opensips_log_numfiles="10" @@ -18,7 +18,9 @@ opensips_pidfile="@l_prefix@/var/opensips/opensips.pid" opensips_rtpproxy_pidfile="@l_prefix@/var/opensips/opensips_rtpproxy.pid" opensips_rtpproxy_socket="@l_prefix@/var/opensips/opensips_rtpproxy.sock" - opensips_rtpproxy_listen=`grep '^listen=' $opensips_cfgfile | sed -e 's/^listen="\(.*\)".*/\1/'` + opensips_signal () { + [ -f $opensips_pidfile ] && kill -$1 `cat $opensips_pidfile` + } opensips_rtpproxy_signal () { [ -f $opensips_rtpproxy_pidfile ] && kill -$1 `cat $opensips_rtpproxy_pidfile` } @@ -29,7 +31,7 @@ if @l_prefix@/sbin/opensips -c >/dev/null 2>&1; then opensips_usable="yes" fi - if @l_prefix@/sbin/opensipsctl ps >/dev/null 2>&1; then + if rcService opensips enable yes && opensips_signal 0; then opensips_active="yes" fi echo "opensips_enable=\"$opensips_enable\"" @@ -40,20 +42,20 @@ rcService opensips enable yes || exit 0 rcService opensips active yes && exit 0 if rcVarIsYes opensips_rtpproxy; then - cmd="@l_prefix@/sbin/opensips_rtpproxy" \ - cmd="$cmd -l $opensips_rtpproxy_listen" + cmd="@l_prefix@/sbin/rtpproxy" \ + cmd="$cmd -u @l_rusr@" + cmd="$cmd -l $opensips_rtpproxy_addr" cmd="$cmd -s unix:$opensips_rtpproxy_socket" cmd="$cmd -p $opensips_rtpproxy_pidfile" su @l_rusr@ -c "$cmd" fi - @l_prefix@/sbin/opensips \ - -P $opensips_pidfile \ - ${opensips_flags} + @l_prefix@/sbin/opensipsctl start %stop -u @l_susr@ rcService opensips enable yes || exit 0 rcService opensips active no && exit 0 @l_prefix@/sbin/opensipsctl stop + rm -f $opensips_pidfile 2>/dev/null || true if rcVarIsYes opensips_rtpproxy; then opensips_rtpproxy_signal TERM fi