Import package vendor original specs for necessary manipulations.

Wed, 21 Sep 2011 14:02:13 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 21 Sep 2011 14:02:13 +0200
changeset 376
8f552d1cd671
parent 375
255a25bcf7b0
child 377
67e813202d53

Import package vendor original specs for necessary manipulations.

opensips/fsl.opensips file | annotate | diff | comparison | revisions
opensips/opensips.cfg file | annotate | diff | comparison | revisions
opensips/opensips.patch file | annotate | diff | comparison | revisions
opensips/opensips.schema-dbtext.txt file | annotate | diff | comparison | revisions
opensips/opensips.spec file | annotate | diff | comparison | revisions
opensips/rc.opensips file | annotate | diff | comparison | revisions
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/opensips/fsl.opensips	Wed Sep 21 14:02:13 2011 +0200
     1.3 @@ -0,0 +1,16 @@
     1.4 +##
     1.5 +##  fsl.opensips -- OSSP fsl configuration
     1.6 +##
     1.7 +
     1.8 +ident .*(opensips)/.+ q{
     1.9 +    prefix(
    1.10 +        prefix="%b %d %H:%M:%S %N <%L> $1[%P]: "
    1.11 +    )
    1.12 +    -> {
    1.13 +        debug: file(
    1.14 +            path="@l_prefix@/var/opensips/opensips.log",
    1.15 +            perm=0664
    1.16 +        )
    1.17 +    }
    1.18 +};
    1.19 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/opensips/opensips.cfg	Wed Sep 21 14:02:13 2011 +0200
     2.3 @@ -0,0 +1,198 @@
     2.4 +##
     2.5 +##  opensips.cfg -- OpenSIPS server configuration
     2.6 +##
     2.7 +
     2.8 +#
     2.9 +#   GLOBAL CONFIGURATION PARAMETERS
    2.10 +#
    2.11 +
    2.12 +#   process configuration
    2.13 +debug=1
    2.14 +log_stderror=no
    2.15 +fork=yes
    2.16 +check_via=no
    2.17 +dns=no
    2.18 +rev_dns=no
    2.19 +children=4
    2.20 +user="@l_rusr@"
    2.21 +group="@l_rgrp@"
    2.22 +fifo="@l_prefix@/var/opensips/opensips.fifo"
    2.23 +workdir="@l_prefix@/var/opensips"
    2.24 +
    2.25 +#   network configuration
    2.26 +alias="sip.example.com"
    2.27 +listen="127.0.0.1"
    2.28 +port=5060
    2.29 +
    2.30 +#
    2.31 +#   EXTENSION MODULE LOADING
    2.32 +#
    2.33 +
    2.34 +#loadmodule "@l_prefix@/lib/opensips/modules/dbtext.so"
    2.35 +
    2.36 +loadmodule "@l_prefix@/lib/opensips/modules/sl.so"
    2.37 +loadmodule "@l_prefix@/lib/opensips/modules/tm.so"
    2.38 +loadmodule "@l_prefix@/lib/opensips/modules/rr.so"
    2.39 +loadmodule "@l_prefix@/lib/opensips/modules/maxfwd.so"
    2.40 +loadmodule "@l_prefix@/lib/opensips/modules/usrloc.so"
    2.41 +loadmodule "@l_prefix@/lib/opensips/modules/registrar.so"
    2.42 +loadmodule "@l_prefix@/lib/opensips/modules/textops.so"
    2.43 +
    2.44 +#loadmodule "@l_prefix@/lib/opensips/modules/auth.so"
    2.45 +#loadmodule "@l_prefix@/lib/opensips/modules/auth_db.so"
    2.46 +
    2.47 +#loadmodule "@l_prefix@/lib/opensips/modules/nathelper.so"
    2.48 +
    2.49 +#
    2.50 +#   EXTENSION MODULE CONFIGURATION
    2.51 +#
    2.52 +
    2.53 +#   module rr:
    2.54 +modparam("rr", "enable_full_lr", 1)
    2.55 +
    2.56 +#   module usrloc:
    2.57 +modparam("usrloc", "db_mode", 0)
    2.58 +#modparam("usrloc", "db_mode", 2)
    2.59 +#modparam("usrloc|auth_db", "db_url", "dbtext://@l_prefix@/var/opensips/db")
    2.60 +
    2.61 +#   module auth:
    2.62 +#modparam("auth_db", "calculate_ha1", 1)
    2.63 +#modparam("auth_db", "password_column", "password")
    2.64 +#modparam("auth_db", "user_column", "username")
    2.65 +#modparam("auth_db", "domain_column", "domain")
    2.66 +
    2.67 +#   module nathelper:
    2.68 +#modparam("registrar", "nat_flag", 6)
    2.69 +#modparam("nathelper", "natping_interval", 30)
    2.70 +#modparam("nathelper", "ping_nated_only", 1)
    2.71 +#modparam("nathelper", "rtpproxy_sock", "unix:@l_prefix@/var/opensips/opensips_rtpproxy.sock")
    2.72 +#modparam("nathelper", "rtpproxy_disable", 0)
    2.73 +#modparam("nathelper", "rtpproxy_disable_tout", 20)
    2.74 +#modparam("nathelper", "sipping_from", "sip:pinger@sip.example.com")
    2.75 +
    2.76 +#
    2.77 +#   MAIN ROUTING LOGIC
    2.78 +#
    2.79 +
    2.80 +route{
    2.81 +    #   initial sanity checks -- messages with
    2.82 +    #   max_forwards==0, or excessively long requests
    2.83 +    if (!mf_process_maxfwd_header("10")) {
    2.84 +        sl_send_reply("483", "Too Many Hops");
    2.85 +        exit;
    2.86 +    };
    2.87 +    if (msg:len >= max_len) {
    2.88 +        sl_send_reply("513", "Message too big");
    2.89 +        exit;
    2.90 +    };
    2.91 +
    2.92 +    #if (method == "INVITE" && uri != myself) {
    2.93 +    #    sl_send_reply("403", "No relaying");
    2.94 +    #    exit;
    2.95 +    #};
    2.96 +
    2.97 +    #   NAT: special handling for NAT'ed clients; first, NAT test is
    2.98 +    #   executed: it looks for via!=received and RFC1918 addresses in
    2.99 +    #   Contact (may fail if line-folding is used); also, the received
   2.100 +    #   test should, if completed, should check all vias for presence of
   2.101 +    #   received.
   2.102 +    #if (nat_uac_test("3")) {
   2.103 +    #    #   allow RR-ed requests, as these may indicate that NAT-enabled
   2.104 +    #    #   aproxy takes care of it; unless it is REGISTER
   2.105 +    #    if (method == "REGISTER" || ! search("^Record-Route:")) {
   2.106 +    #        log("LOG: Someone trying to register from private IP, rewriting\n");
   2.107 +    #        fix_nated_contact(); # rewrite contact with source IP of signalling
   2.108 +    #        if (method == "INVITE") {
   2.109 +    #            fix_nated_sdp("1"); # add direction=active to SDP
   2.110 +    #        };
   2.111 +    #        force_rport(); # add rport parameter to topmost Via
   2.112 +    #        setflag(6);    # mark as NAT'ed
   2.113 +    #    };
   2.114 +    #};
   2.115 +
   2.116 +    #   we record-route all messages -- to make sure that
   2.117 +    #   subsequent messages will go through our proxy; that's
   2.118 +    #   particularly good if upstream and downstream entities
   2.119 +    #   use different transport protocol
   2.120 +    if (method != "REGISTER") {
   2.121 +        record_route();
   2.122 +    };
   2.123 +
   2.124 +    #   subsequent messages withing a dialog should take the
   2.125 +    #   path determined by record-routing
   2.126 +    if (loose_route()) {
   2.127 +        #   mark routing logic in request
   2.128 +        append_hf("P-hint: rr-enforced\r\n"); 
   2.129 +        route(1);
   2.130 +    };
   2.131 +
   2.132 +    if (uri != myself) {
   2.133 +        #   mark routing logic in request
   2.134 +        append_hf("P-hint: outbound\r\n"); 
   2.135 +        route(1);
   2.136 +    };
   2.137 +
   2.138 +    #   if the request is for other domain use USRLOC
   2.139 +    #   (in case, it does not work, use the following command
   2.140 +    #   with proper names and addresses in it)
   2.141 +    if (uri == myself) {
   2.142 +        if (method == "REGISTER") {
   2.143 +            #   uncomment this if you want to use digest authentication
   2.144 +            #if (!www_authorize("sip.example.com", "subscriber")) {
   2.145 +            #    www_challenge("sip.example.com", "0");
   2.146 +            #    exit;
   2.147 +            #};
   2.148 +            save("location");
   2.149 +            exit;
   2.150 +        };
   2.151 +
   2.152 +        lookup("aliases");
   2.153 +        if (uri != myself) {
   2.154 +            append_hf("P-hint: outbound alias\r\n"); 
   2.155 +            route(1);
   2.156 +        };
   2.157 +
   2.158 +        #   native SIP destinations are handled using our USRLOC DB
   2.159 +        if (!lookup("location")) {
   2.160 +            sl_send_reply("404", "Not Found");
   2.161 +            exit;
   2.162 +        };
   2.163 +        append_hf("P-hint: usrloc applied\r\n"); 
   2.164 +    };
   2.165 +
   2.166 +    route(1);
   2.167 +}
   2.168 +
   2.169 +route[1] {
   2.170 +    #   disable RFC1918 peers
   2.171 +    if (uri =~ "[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" && !search("^Route:")) {
   2.172 +        sl_send_reply("479", "We don't forward to RFC 1918 IPv4 addresses");
   2.173 +        exit;
   2.174 +    };
   2.175 +                                
   2.176 +    #   NAT: if client or server know to be behind a NAT, enable relay
   2.177 +    #if (isflagset(6)) {
   2.178 +    #    force_rtp_proxy();
   2.179 +    #};
   2.180 +                                                        
   2.181 +    #   NAT: processing of replies; apply to all transactions
   2.182 +    #t_on_reply("1");
   2.183 +                                                                        
   2.184 +    #   send it out now; use stateful forwarding as it works reliably even for UDP2TCP
   2.185 +    if (!t_relay()) {
   2.186 +        sl_reply_error();
   2.187 +    };
   2.188 +}
   2.189 +
   2.190 +#onreply_route[1] {
   2.191 +    #   NAT: is it a NAT'ed transaction ?
   2.192 +    #   otherwise, is it a transaction behind a NAT and we did not
   2.193 +    #   know at time of request processing ? (RFC1918 contacts)
   2.194 +    #if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
   2.195 +    #    fix_nated_contact();
   2.196 +    #    force_rtp_proxy();
   2.197 +    #} else if (nat_uac_test("1")) {
   2.198 +    #    fix_nated_contact();
   2.199 +    #};
   2.200 +#}
   2.201 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/opensips/opensips.patch	Wed Sep 21 14:02:13 2011 +0200
     3.3 @@ -0,0 +1,65 @@
     3.4 +Index: Makefile.defs
     3.5 +--- Makefile.defs.orig	2009-03-23 19:32:01 +0100
     3.6 ++++ Makefile.defs	2009-03-24 19:10:36 +0100
     3.7 +@@ -1161,6 +1161,8 @@
     3.8 + 
     3.9 + endif #mode=release
    3.10 + 
    3.11 ++LDFLAGS += -L$(prefix)/lib
    3.12 ++LIBS    += -lfsl
    3.13 + 
    3.14 + #*FLAGS used for compiling the modules
    3.15 + ifeq	($(CC_NAME), gcc)
    3.16 +@@ -1397,8 +1399,8 @@
    3.17 + 
    3.18 + #add libssl if needed
    3.19 + ifneq ($(TLS),)
    3.20 +-DEFS+= -I$(LOCALBASE)/ssl/include -I$(LOCALBASE)/include -I$(SYSBASE)/include/openssl
    3.21 +-LIBS+= -L$(LOCALBASE)/lib -L$(LOCALBASE)/ssl/lib -lssl  -lcrypto
    3.22 ++DEFS+= -I$(prefix)/include
    3.23 ++LIBS+= -L$(prefix)/lib -lssl -lcrypto
    3.24 + endif
    3.25 + 
    3.26 + #add libsctp if needed
    3.27 +Index: modules/permissions/parse_config.c
    3.28 +--- modules/permissions/parse_config.c.orig	2009-03-23 19:31:32 +0100
    3.29 ++++ modules/permissions/parse_config.c	2009-03-24 19:10:36 +0100
    3.30 +@@ -114,8 +114,11 @@
    3.31 + 	except = strstr(str, " EXCEPT ");
    3.32 + 	if (except) {
    3.33 + 		/* exception found */
    3.34 +-		strncpy(str2, str, except-str);
    3.35 +-		str2[except-str] = '\0';
    3.36 ++		int l = except - str;
    3.37 ++		if (l > sizeof(str2) - 1)
    3.38 ++			l = sizeof(str2) - 1;
    3.39 ++		strncpy(str2, str, l);
    3.40 ++		str2[l] = '\0';
    3.41 + 		/* except+8 points to the exception */
    3.42 + 		if (parse_expression_list(except+8, e_exceptions)) {
    3.43 + 			/* error */
    3.44 +@@ -124,7 +127,8 @@
    3.45 + 		}
    3.46 + 	} else {
    3.47 + 		/* no exception */
    3.48 +-		strcpy(str2, str);
    3.49 ++		strncpy(str2, str, sizeof(str2)-1);
    3.50 ++		str2[sizeof(str2)-1] = '\0';
    3.51 + 		*e_exceptions = NULL;
    3.52 + 	}
    3.53 + 
    3.54 +Index: rtpproxy-1.2.1/main.c
    3.55 +--- rtpproxy-1.2.1/main.c.orig	2009-03-24 05:46:13 +0100
    3.56 ++++ rtpproxy-1.2.1/main.c	2009-03-24 19:10:36 +0100
    3.57 +@@ -88,7 +88,11 @@
    3.58 + 	bindhost = NULL;
    3.59 + 
    3.60 +     if ((n = resolve(ia, pf, bindhost, servname, AI_PASSIVE)) != 0)
    3.61 ++#if defined(__sun__)
    3.62 ++	errx(1, "setbindhost");
    3.63 ++#else
    3.64 + 	errx(1, "setbindhost: %s", gai_strerror(n));
    3.65 ++#endif
    3.66 + }
    3.67 + 
    3.68 + static void
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/opensips/opensips.schema-dbtext.txt	Wed Sep 21 14:02:13 2011 +0200
     4.3 @@ -0,0 +1,8 @@
     4.4 +subscriber: username(str) domn(str) password(str) first_name(str) last_name(str) phone(str) email_address(str) datetime_created(int) datetime_modified(int) confirmation(str) flag(str) sendnotification(str) greeting(str) ha1(str) ha1b(str) perms(str) allow_find(str) timezone(str,null) rpid(str,null) uuid(str,null)
     4.5 +subscriber: admin:default:admin:Initial:Admin:123:root@localhost:::::::::::::
     4.6 +location: username(str) domain(str,null) contact(str,null) expires(int,null) q(double,null) callid(str,null) cseq(int,null) last_modified(str) replicate(int,null) state(int,null) flags(int) user_agent(str) received(str)
     4.7 +aliases: username(str) domain(str,null) contact(str,null) expires(int,null) q(double,null) callid(str,null) cseq(int,null) last_modified(str) replicate(int,null) state(int,null) flags(int) user_agent(str) received(str)
     4.8 +version: table_name(str) table_version(int)
     4.9 +version: subscriber:3
    4.10 +version: location:6
    4.11 +version: aliases:6
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/opensips/opensips.spec	Wed Sep 21 14:02:13 2011 +0200
     5.3 @@ -0,0 +1,248 @@
     5.4 +##
     5.5 +##  opensips.spec -- OpenPKG RPM Package Specification
     5.6 +##  Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
     5.7 +##
     5.8 +##  Permission to use, copy, modify, and distribute this software for
     5.9 +##  any purpose with or without fee is hereby granted, provided that
    5.10 +##  the above copyright notice and this permission notice appear in all
    5.11 +##  copies.
    5.12 +##
    5.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    5.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    5.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    5.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    5.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    5.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    5.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    5.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    5.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    5.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    5.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    5.24 +##  SUCH DAMAGE.
    5.25 +##
    5.26 +
    5.27 +#   package options
    5.28 +%define       V_opensips  1.6.4
    5.29 +%define       V_rtpproxy  1.2.1
    5.30 +
    5.31 +#   package information
    5.32 +Name:         opensips
    5.33 +Summary:      Open SIP Server
    5.34 +URL:          http://www.opensips.org/
    5.35 +Vendor:       FhG FOKUS et al.
    5.36 +Packager:     OpenPKG Foundation e.V.
    5.37 +Distribution: OpenPKG Community
    5.38 +Class:        PLUS
    5.39 +Group:        VoIP
    5.40 +License:      GPL
    5.41 +Version:      %{V_opensips}
    5.42 +Release:      20101221
    5.43 +
    5.44 +#   package options
    5.45 +%option       with_fsl  yes
    5.46 +%option       with_ssl  no
    5.47 +
    5.48 +#   list of sources
    5.49 +Source0:      http://www.opensips.org/pub/opensips/%{version}/src/opensips-%{V_opensips}-tls_src.tar.gz
    5.50 +Source1:      http://b2bua.org/chrome/site/rtpproxy-%{V_rtpproxy}.tar.gz
    5.51 +Source2:      rc.opensips
    5.52 +Source3:      fsl.opensips
    5.53 +Source4:      opensips.cfg
    5.54 +Source5:      opensips.schema-dbtext.txt
    5.55 +Patch0:       opensips.patch
    5.56 +
    5.57 +#   build information
    5.58 +BuildPreReq:  OpenPKG, openpkg >= 20100101, make, gcc, flex, bison, sed
    5.59 +PreReq:       OpenPKG, openpkg >= 20100101
    5.60 +BuildPreReq:  pcre
    5.61 +PreReq:       pcre
    5.62 +%if "%{with_fsl}" == "yes"
    5.63 +BuildPreReq:  fsl
    5.64 +PreReq:       fsl
    5.65 +%endif
    5.66 +%if "%{with_ssl}" == "yes"
    5.67 +BuildPreReq:  openssl
    5.68 +PreReq:       openssl
    5.69 +%endif
    5.70 +
    5.71 +%description
    5.72 +    OpenSIPS is (beside Kamailio) a successor to OpenSER, which in
    5.73 +    turn was spawned from FhG FOKUS' SIP Express Router (SER). It
    5.74 +    provides SIP (RFC3621) registrar, proxy and routing functionality.
    5.75 +    A C shell like scripting language provides full control over the
    5.76 +    server's behaviour. It's modular architecture allows only required
    5.77 +    functionality to be loaded.
    5.78 +
    5.79 +%track
    5.80 +    prog opensips = {
    5.81 +        version   = %{V_opensips}
    5.82 +        url       = http://www.opensips.org/pub/opensips/
    5.83 +        regex     = (\d+\.\d+\.\d+)/
    5.84 +        url       = http://www.opensips.org/pub/opensips/__NEWVER__/src/
    5.85 +        regex     = opensips-(__VER__)-tls_src\.tar\.gz
    5.86 +    }
    5.87 +    prog opensips:rtpproxy = {
    5.88 +        version   = %{V_rtpproxy}
    5.89 +        url       = http://www.rtpproxy.org/
    5.90 +        regex     = rtpproxy-(\d+(?:\.\d+)+)\.tar\.gz
    5.91 +    }
    5.92 +
    5.93 +%prep
    5.94 +    %setup -q -n opensips-%{version}-tls
    5.95 +    %setup -q -n opensips-%{version}-tls -T -D -a 1
    5.96 +    %patch -p0
    5.97 +
    5.98 +%build
    5.99 +    #   build dependencies
   5.100 +    %{l_make} %{l_mflags} \
   5.101 +        CC="%{l_cc} %{l_cflags} %{l_cppflags}" \
   5.102 +%if "%{with_ssl}" == "yes"
   5.103 +        TLS=1 \
   5.104 +%endif
   5.105 +        prefix=%{l_prefix} \
   5.106 +        dep >/dev/null 2>&1 || true
   5.107 +
   5.108 +    #   build program
   5.109 +    %{l_make} %{l_mflags} \
   5.110 +        CC="%{l_cc} %{l_cflags} %{l_cppflags}" \
   5.111 +%if "%{with_ssl}" == "yes"
   5.112 +        TLS=1 \
   5.113 +%endif
   5.114 +        prefix=%{l_prefix}
   5.115 +
   5.116 +    #   build modules
   5.117 +    %{l_make} %{l_mflags} \
   5.118 +        CC="%{l_cc} %{l_cflags} %{l_cppflags}" \
   5.119 +%if "%{with_ssl}" == "yes"
   5.120 +        TLS=1 \
   5.121 +%endif
   5.122 +        prefix=%{l_prefix} \
   5.123 +        modules \
   5.124 +        skip_modules="mysql jabber"
   5.125 +
   5.126 +    #   build rtpproxy extension
   5.127 +    ( cd rtpproxy-%{V_rtpproxy}
   5.128 +      export CC="%{l_cc}"
   5.129 +      export CFLAGS="%{l_cflags -O}"
   5.130 +      export LIBS=""
   5.131 +      case "%{l_platform -t}" in
   5.132 +          *-sunos* ) LIBS="$LIBS -lsocket -lnsl -lrt" ;;
   5.133 +      esac
   5.134 +      ./configure
   5.135 +      %{l_make} %{l_mflags}
   5.136 +    ) || exit $?
   5.137 +
   5.138 +%install
   5.139 +
   5.140 +    #   install program
   5.141 +    %{l_make} %{l_mflags} \
   5.142 +        INSTALL="%{l_shtool} install%{l_nil} -c" \
   5.143 +        basedir=$RPM_BUILD_ROOT \
   5.144 +        prefix=%{l_prefix} \
   5.145 +        cfg-prefix=$RPM_BUILD_ROOT \
   5.146 +        cfg-target=%{l_prefix}/etc/opensips/ \
   5.147 +        doc-dir=share/opensips/doc/ \
   5.148 +        man-dir=man/ \
   5.149 +        install
   5.150 +
   5.151 +    #   install modules
   5.152 +    %{l_make} %{l_mflags} \
   5.153 +        INSTALL="%{l_shtool} install%{l_nil} -c" \
   5.154 +        basedir=$RPM_BUILD_ROOT \
   5.155 +        prefix=%{l_prefix} \
   5.156 +        cfg-prefix=$RPM_BUILD_ROOT \
   5.157 +        cfg-target=%{l_prefix}/etc/opensips/ \
   5.158 +        doc-dir=share/opensips/doc/ \
   5.159 +        man-dir=man/ \
   5.160 +        install-modules \
   5.161 +        skip_modules="mysql jabber"
   5.162 +
   5.163 +    #   install rtpproxy extension
   5.164 +    %{l_shtool} install -c -s -m 755 \
   5.165 +        rtpproxy-%{V_rtpproxy}/rtpproxy $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_rtpproxy
   5.166 +
   5.167 +    #   strip down installation
   5.168 +    strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
   5.169 +    rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/opensips_mysql.sh
   5.170 +
   5.171 +    #   post-adjust installation
   5.172 +    %{l_shtool} subst \
   5.173 +        -e 's;/etc/opensips/opensipsctlrc;%{l_prefix}/etc/opensips/opensipsctlrc;g' \
   5.174 +        $RPM_BUILD_ROOT%{l_prefix}/sbin/opensipsctl
   5.175 +    %{l_shtool} mkdir -f -p -m 755 \
   5.176 +        $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
   5.177 +    %{l_shtool} install -c -m 644 \
   5.178 +        -e 's;^# \(PID_FILE\)=.*;\1=%{l_prefix}/var/opensips/opensips.pid;' \
   5.179 +        -e 's;^# \(OSIPS_FIFO\)=.*;\1=%{l_prefix}/var/opensips/opensips.fifo;' \
   5.180 +        scripts/opensipsctlrc \
   5.181 +        $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/opensipsctlrc
   5.182 +
   5.183 +    #   install default configuration
   5.184 +    %{l_shtool} mkdir -f -p -m 755 \
   5.185 +        $RPM_BUILD_ROOT%{l_prefix}/etc/opensips
   5.186 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   5.187 +        %{SOURCE opensips.cfg} \
   5.188 +        $RPM_BUILD_ROOT%{l_prefix}/etc/opensips/
   5.189 +
   5.190 +    #   install OSSP fsl configuration
   5.191 +    %{l_shtool} mkdir -f -p -m 755 \
   5.192 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
   5.193 +    %{l_shtool} install -c -m 644 %{l_value -s -a} \
   5.194 +        %{SOURCE fsl.opensips} \
   5.195 +        $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
   5.196 +
   5.197 +    #   install run-command script
   5.198 +    %{l_shtool} mkdir -f -p -m 755 \
   5.199 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
   5.200 +    %{l_shtool} install -c -m 755 %{l_value -s -a} \
   5.201 +        %{SOURCE rc.opensips} \
   5.202 +        $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
   5.203 +
   5.204 +    #   create database directory and install database schema definitions
   5.205 +    %{l_shtool} mkdir -f -p -m 755 \
   5.206 +        $RPM_BUILD_ROOT%{l_prefix}/var/opensips
   5.207 +    %{l_shtool} install -c -m 644 \
   5.208 +        %{SOURCE opensips.schema-dbtext.txt} \
   5.209 +        $RPM_BUILD_ROOT%{l_prefix}/share/opensips/
   5.210 +
   5.211 +    #   determine installation files
   5.212 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
   5.213 +        %{l_files_std} \
   5.214 +        '%config %{l_prefix}/etc/fsl/*' \
   5.215 +        '%config %{l_prefix}/etc/opensips/*' \
   5.216 +        '%doc %{l_prefix}/share/opensips/doc/*' \
   5.217 +        '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/opensips'
   5.218 +
   5.219 +%files -f files
   5.220 +
   5.221 +%clean
   5.222 +
   5.223 +%post
   5.224 +    #   on install, setup database
   5.225 +    if [ ! -d $RPM_INSTALL_PREFIX/var/opensips/db ]; then
   5.226 +        mkdir $RPM_INSTALL_PREFIX/var/opensips/db
   5.227 +        chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db
   5.228 +        chmod 755 $RPM_INSTALL_PREFIX/var/opensips/db
   5.229 +        schema="$RPM_INSTALL_PREFIX/share/opensips/opensips.schema-dbtext.txt"
   5.230 +        for table in `sed -e '/^#.*/d' -e '/^$/d' -e 's;\([^:]*\):.*;\1;' <$schema | sort -u`; do
   5.231 +            grep "^${table}:" $schema | sed -e "s;^${table}: *;;" \
   5.232 +                >$RPM_INSTALL_PREFIX/var/opensips/db/$table
   5.233 +        done
   5.234 +        chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true
   5.235 +        chmod 644 $RPM_INSTALL_PREFIX/var/opensips/db/* 2>/dev/null || true
   5.236 +    fi
   5.237 +
   5.238 +    #   after upgrade, restart service
   5.239 +    [ $1 -eq 2 ] || exit 0
   5.240 +    eval `%{l_rc} opensips status 2>/dev/null`
   5.241 +    [ ".$opensips_active" = .yes ] && %{l_rc} opensips restart
   5.242 +    exit 0
   5.243 +
   5.244 +%preun
   5.245 +    #   before erase, stop service and remove log files
   5.246 +    [ $1 -eq 0 ] || exit 0
   5.247 +    %{l_rc} opensips stop 2>/dev/null
   5.248 +    rm -rf $RPM_INSTALL_PREFIX/var/opensips/db 2>/dev/null || true
   5.249 +    rm -f  $RPM_INSTALL_PREFIX/var/opensips/*  2>/dev/null || true
   5.250 +    exit 0
   5.251 +
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/opensips/rc.opensips	Wed Sep 21 14:02:13 2011 +0200
     6.3 @@ -0,0 +1,75 @@
     6.4 +#!@l_prefix@/bin/openpkg rc
     6.5 +##
     6.6 +##  rc.opensips -- Run-Commands
     6.7 +##
     6.8 +
     6.9 +%config
    6.10 +    opensips_enable="$openpkg_rc_def"
    6.11 +    opensips_flags=""
    6.12 +    opensips_rtpproxy="yes"
    6.13 +    opensips_log_prolog="true"
    6.14 +    opensips_log_epilog="true"
    6.15 +    opensips_log_numfiles="10"
    6.16 +    opensips_log_minsize="1M"
    6.17 +    opensips_log_complevel="9"
    6.18 +
    6.19 +%common
    6.20 +    opensips_cfgfile="@l_prefix@/etc/opensips/opensips.cfg"
    6.21 +    opensips_pidfile="@l_prefix@/var/opensips/opensips.pid"
    6.22 +    opensips_rtpproxy_pidfile="@l_prefix@/var/opensips/opensips_rtpproxy.pid"
    6.23 +    opensips_rtpproxy_socket="@l_prefix@/var/opensips/opensips_rtpproxy.sock"
    6.24 +    opensips_rtpproxy_listen=`grep '^listen=' $opensips_cfgfile | sed -e 's/^listen="\(.*\)".*/\1/'`
    6.25 +    opensips_rtpproxy_signal () {
    6.26 +        [ -f $opensips_rtpproxy_pidfile ] && kill -$1 `cat $opensips_rtpproxy_pidfile`
    6.27 +    }
    6.28 +
    6.29 +%status -u @l_susr@ -o
    6.30 +    opensips_usable="no"
    6.31 +    opensips_active="no"
    6.32 +    if @l_prefix@/sbin/opensips -c >/dev/null 2>&1; then
    6.33 +        opensips_usable="yes"
    6.34 +    fi
    6.35 +    if @l_prefix@/sbin/opensipsctl ps >/dev/null 2>&1; then
    6.36 +        opensips_active="yes"
    6.37 +    fi
    6.38 +    echo "opensips_enable=\"$opensips_enable\""
    6.39 +    echo "opensips_usable=\"$opensips_usable\""
    6.40 +    echo "opensips_active=\"$opensips_active\""
    6.41 +
    6.42 +%start -u @l_susr@
    6.43 +    rcService opensips enable yes || exit 0
    6.44 +    rcService opensips active yes && exit 0
    6.45 +    if rcVarIsYes opensips_rtpproxy; then
    6.46 +        cmd="@l_prefix@/sbin/opensips_rtpproxy" \
    6.47 +        cmd="$cmd -l $opensips_rtpproxy_listen"
    6.48 +        cmd="$cmd -s unix:$opensips_rtpproxy_socket"
    6.49 +        cmd="$cmd -p $opensips_rtpproxy_pidfile"
    6.50 +        su @l_rusr@ -c "$cmd"
    6.51 +    fi
    6.52 +    @l_prefix@/sbin/opensips \
    6.53 +        -P $opensips_pidfile \
    6.54 +        ${opensips_flags}
    6.55 +
    6.56 +%stop -u @l_susr@
    6.57 +    rcService opensips enable yes || exit 0
    6.58 +    rcService opensips active no  && exit 0
    6.59 +    @l_prefix@/sbin/opensipsctl stop
    6.60 +    if rcVarIsYes opensips_rtpproxy; then
    6.61 +        opensips_rtpproxy_signal TERM
    6.62 +    fi
    6.63 +    sleep 2
    6.64 +
    6.65 +%restart -u @l_susr@
    6.66 +    rcService opensips enable yes || exit 0
    6.67 +    rcService opensips active no  && exit 0
    6.68 +    rc opensips stop start
    6.69 +
    6.70 +%daily -u @l_susr@
    6.71 +    rcService opensips enable yes || exit 0
    6.72 +    shtool rotate -f \
    6.73 +        -n ${opensips_log_numfiles} -s ${opensips_log_minsize} -d \
    6.74 +        -z ${opensips_log_complevel} -m 644 -o @l_rusr@ -g @l_rgrp@ \
    6.75 +        -P "${opensips_log_prolog}" \
    6.76 +        -E "${opensips_log_epilog}; rc opensips reload" \
    6.77 +        @l_prefix@/var/opensips/opensips.log
    6.78 +

mercurial