diff --git a/.gitignore b/.gitignore index 5a34212..8af13bd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ opensips-1.6.3-tls_src.tar.gz /opensips-1.8.0-beta_src.tar.gz /opensips-1.8.1_src.tar.gz /opensips-1.8.2_src.tar.gz +/opensips-1.9.1_src.tar.gz diff --git a/opensips-0001-Consistently-use-rtpproxy-switches.patch b/opensips-0001-Consistently-use-rtpproxy-switches.patch index 88048c1..c17027d 100644 --- a/opensips-0001-Consistently-use-rtpproxy-switches.patch +++ b/opensips-0001-Consistently-use-rtpproxy-switches.patch @@ -1,7 +1,7 @@ -From c9c84b8bba4ce4804fb017df49bcc8afa854ef89 Mon Sep 17 00:00:00 2001 +From 099792fd2bdca396965d75f4d0e92fbdd0aed19b Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Thu, 11 Aug 2011 16:37:04 +0400 -Subject: [PATCH 1/8] Consistently use rtpproxy switches +Subject: [PATCH 1/5] Consistently use rtpproxy switches Signed-off-by: Peter Lemenkov --- @@ -10,10 +10,10 @@ Signed-off-by: Peter Lemenkov 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/rtpproxy/doc/rtpproxy_admin.xml b/modules/rtpproxy/doc/rtpproxy_admin.xml -index d54c1dc..5c735f2 100644 +index fc947d9..958611f 100644 --- a/modules/rtpproxy/doc/rtpproxy_admin.xml +++ b/modules/rtpproxy/doc/rtpproxy_admin.xml -@@ -545,7 +545,7 @@ rtpproxy_offer(); +@@ -552,7 +552,7 @@ rtpproxy_offer(); connection information. @@ -23,10 +23,10 @@ index d54c1dc..5c735f2 100644 diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c -index 7fc8d89..a9539be 100644 +index 45dbbe1..99f83a1 100644 --- a/modules/rtpproxy/rtpproxy.c +++ b/modules/rtpproxy/rtpproxy.c -@@ -3058,8 +3058,6 @@ force_rtp_proxy_body(struct sip_msg* msg, struct force_rtpp_args *args) +@@ -3118,8 +3118,6 @@ force_rtp_proxy_body(struct sip_msg* msg, struct force_rtpp_args *args) enable_notification = 1; break; @@ -36,5 +36,5 @@ index 7fc8d89..a9539be 100644 case 'S': if (append_opts(&opts, 'S') == -1) { -- -1.8.1 +1.8.3.1 diff --git a/opensips-0002-Cleanup-Oracle-s-makefiles.patch b/opensips-0002-Cleanup-Oracle-s-makefiles.patch index ad086cb..d218e6e 100644 --- a/opensips-0002-Cleanup-Oracle-s-makefiles.patch +++ b/opensips-0002-Cleanup-Oracle-s-makefiles.patch @@ -1,7 +1,7 @@ -From c062ab4950e9894f6dc8188b1516ade92267654b Mon Sep 17 00:00:00 2001 +From a197a6cfb69acdcaa0a10dff6dbf1abced221892 Mon Sep 17 00:00:00 2001 From: Peter Lemenkov Date: Thu, 14 Jun 2012 11:38:48 +0400 -Subject: [PATCH 2/8] Cleanup Oracle's makefiles +Subject: [PATCH 2/5] Cleanup Oracle's makefiles Signed-off-by: Peter Lemenkov --- @@ -137,5 +137,5 @@ index b1c8231..9565134 100644 include ../../Makefile.rules -- -1.8.1 +1.8.3.1 diff --git a/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch b/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch new file mode 100644 index 0000000..51dc728 --- /dev/null +++ b/opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch @@ -0,0 +1,610 @@ +From 215d1977c93ffee4de9197785868e309d9d35309 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A1=D0=B0=D0=BC?= + =?UTF-8?q?=D1=83=D1=81=D0=B5=D0=BD=D0=BA=D0=BE?= +Date: Mon, 25 Jun 2012 17:54:27 +0400 +Subject: [PATCH 3/5] Removed all async Oracle operations - they didn't work + well anyway + +--- + modules/db_oracle/asynch.c | 270 ------------------------------------------ + modules/db_oracle/asynch.h | 62 ---------- + modules/db_oracle/db_oracle.c | 2 +- + modules/db_oracle/dbase.c | 53 +++------ + modules/db_oracle/ora_con.c | 73 ++++-------- + modules/db_oracle/ora_con.h | 3 +- + modules/db_oracle/res.c | 110 +++++++++-------- + modules/db_oracle/timer.c | 131 ++++++++++++++++++++ + modules/db_oracle/timer.h | 22 ++++ + 9 files changed, 256 insertions(+), 470 deletions(-) + delete mode 100644 modules/db_oracle/asynch.c + delete mode 100644 modules/db_oracle/asynch.h + create mode 100644 modules/db_oracle/timer.c + create mode 100644 modules/db_oracle/timer.h + +diff --git a/modules/db_oracle/db_oracle.c b/modules/db_oracle/db_oracle.c +index 70cfe40..40c7692 100644 +--- a/modules/db_oracle/db_oracle.c ++++ b/modules/db_oracle/db_oracle.c +@@ -31,7 +31,7 @@ + #include "../../sr_module.h" + #include "../../db/db.h" + #include "dbase.h" +-#include "asynch.h" ++#include "timer.h" + + static int oracle_mod_init(void); + static void destroy(void); +diff --git a/modules/db_oracle/dbase.c b/modules/db_oracle/dbase.c +index d129e11..be2352e 100644 +--- a/modules/db_oracle/dbase.c ++++ b/modules/db_oracle/dbase.c +@@ -36,7 +36,7 @@ + #include "val.h" + #include "ora_con.h" + #include "res.h" +-#include "asynch.h" ++#include "timer.h" + #include "dbase.h" + + +@@ -212,7 +212,6 @@ static int db_oracle_submit_query(const db_con_t* _h, const str* _s) + OCIDate odt[sizeof(bind)/sizeof(bind[0])]; + str tmps; + sword status; +- int pass; + ora_con_t* con = CON_ORA(_h); + query_data_t* pqd = con->pqdata; + size_t hc = pqd->_n + pqd->_nw; +@@ -223,32 +222,16 @@ static int db_oracle_submit_query(const db_con_t* _h, const str* _s) + (unsigned)hc); + return -1; + } +- +- if (!pqd->_rs) { +- /* +- * This method is at ~25% faster as set OCI_COMMIT_ON_SUCCESS +- * in StmtExecute +- */ +- tmps.len = snprintf(st_buf, sizeof(st_buf), +- "begin %.*s; commit write batch nowait; end;", +- _s->len, _s->s); +- if ((unsigned)tmps.len >= sizeof(st_buf)) +- return sql_buf_small(); +- tmps.s = st_buf; +- _s = &tmps; +- } + +- pass = 1; +- if (!con->connected) { ++ if (con->connected != 2) { + status = db_oracle_reconnect(con); + if (status != OCI_SUCCESS) { + LM_ERR("can't restore connection: %s\n", db_oracle_error(con, status)); + return -2; + } + LM_INFO("connection restored\n"); +- --pass; + } +-repeat: ++ + stmthp = NULL; + status = OCIHandleAlloc(con->envhp, (dvoid**)(dvoid*)&stmthp, + OCI_HTYPE_STMT, 0, NULL); +@@ -291,14 +274,10 @@ bind_err: + } + } + +- // timelimited operation +- status = begin_timelimit(con, 0); +- if (status != OCI_SUCCESS) goto ora_err; +- do status = OCIStmtExecute(con->svchp, stmthp, con->errhp, +- !pqd->_rs, 0, NULL, NULL, +- pqd->_rs ? OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT); +- while (wait_timelimit(con, status)); +- if (done_timelimit(con, status)) goto stop_exec; ++ request_timer(); ++ status = OCIStmtExecute(con->svchp, stmthp, con->errhp, ++ !pqd->_rs, 0, NULL, NULL, pqd->_rs ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS); ++ timer_stop(); + switch (status) { + case OCI_SUCCESS_WITH_INFO: + LM_WARN("driver: %s\n", db_oracle_errorinfo(con)); +@@ -310,8 +289,8 @@ bind_err: + OCIHandleFree(stmthp, OCI_HTYPE_STMT); + return 0; + default: +- pass = -pass; +- break; ++ LM_ERR("timeout/not connected to oracle\n"); ++ break; + } + + ora_err: +@@ -319,15 +298,13 @@ ora_err: + stop_exec: + if (stmthp) + OCIHandleFree(stmthp, OCI_HTYPE_STMT); +- if (pass == -1 && !con->connected) { +- /* Attemtp to reconnect */ +- if (db_oracle_reconnect(con) == OCI_SUCCESS) { +- LM_NOTICE("attempt repeat after reconnect\n"); +- pass = 0; +- goto repeat; +- } ++ LM_INFO("reconnecting to oracle...\n"); ++ /* Attempt to reconnect */ ++ if (db_oracle_reconnect(con) == OCI_SUCCESS) ++ LM_INFO("connection restored\n"); ++ else + LM_ERR("connection loss\n"); +- } ++ + return -4; + } + +diff --git a/modules/db_oracle/ora_con.c b/modules/db_oracle/ora_con.c +index 73ced27..f03f753 100644 +--- a/modules/db_oracle/ora_con.c ++++ b/modules/db_oracle/ora_con.c +@@ -22,9 +22,10 @@ + + #include + #include ++#include + #include "../../mem/mem.h" + #include "../../dprint.h" +-#include "asynch.h" ++#include "timer.h" + #include "ora_con.h" + + /*************************************************************************/ +@@ -105,6 +106,12 @@ bad_param: + status = OCIAttrSet(con->svchp, OCI_HTYPE_SVCCTX, con->authp, 0, + OCI_ATTR_SESSION, con->errhp); + if (status != OCI_SUCCESS) goto connect_err; ++ ++ if (init_ora_timer(con) != 0) { ++ LM_ERR("can't start oracle timer thread\n"); ++ goto drop_connection; ++ } ++ + status = db_oracle_reconnect(con); + if (status != OCI_SUCCESS) { + connect_err: +@@ -122,12 +129,11 @@ drop_connection: + } + + // timelimited operation +- status = begin_timelimit(con, 0); +- if (status != OCI_SUCCESS) goto connect_err; +- do status = OCIServerVersion(con->svchp, con->errhp, (OraText*)buf, ++ request_timer(); ++ status = OCIServerVersion(con->svchp, con->errhp, (OraText*)buf, + (ub4)sizeof(buf), OCI_HTYPE_SVCCTX); +- while (wait_timelimit(con, status)); +- if (done_timelimit(con, status)) goto drop_connection; ++ timer_stop(); ++ + if (status != OCI_SUCCESS) goto connect_err; + LM_INFO("server version is %s\n", buf); + return con; +@@ -139,6 +145,7 @@ drop_connection: + */ + void db_oracle_free_connection(ora_con_t* con) + { ++ destroy_ora_timer(con); + if (!con) return; + + if (con->connected) +@@ -164,20 +171,17 @@ void db_oracle_free_connection(ora_con_t* con) + void db_oracle_disconnect(ora_con_t* con) + { + sword status; +- +- switch (con->connected) { +- default: +- status = OCISessionEnd(con->svchp, con->errhp, con->authp, +- OCI_DEFAULT); +- if (status != OCI_SUCCESS) +- LM_ERR("driver: %s\n", db_oracle_error(con, status)); +- case 1: ++ if (con->connected > 0) { ++ if (con->connected > 1) { ++ status = OCISessionEnd(con->svchp, con->errhp, con->authp, ++ OCI_DEFAULT); ++ if (status != OCI_SUCCESS) ++ LM_ERR("driver: %s\n", db_oracle_error(con, status)); ++ } + status = OCIServerDetach(con->srvhp, con->errhp, OCI_DEFAULT); + if (status != OCI_SUCCESS) + LM_ERR("driver: %s\n", db_oracle_error(con, status)); + con->connected = 0; +- case 0: +- break; + } + } + +@@ -192,48 +196,19 @@ sword db_oracle_reconnect(ora_con_t* con) + if (con->connected) + db_oracle_disconnect(con); + +- /* timelimited operation, but OCI tcp-network does not support it :( */ ++ restore_timer(); + status = OCIServerAttach(con->srvhp, con->errhp, (OraText*)con->uri, + con->uri_len, 0); ++ timer_stop(); + if (status == OCI_SUCCESS) { + ++con->connected; +- /* +- * timelimited operation, but OCI has BUG in asynch +- * implementation of OCISessionBegin :(. +- * +- * Next code is 'empiric hack' that work (tested) in v10/v11. +- */ +- status = begin_timelimit(con, 1); +- if (status != OCI_SUCCESS) goto done; ++ request_timer(); + status = OCISessionBegin(con->svchp, con->errhp, con->authp, + OCI_CRED_RDBMS, OCI_DEFAULT); +- while (wait_timelimit(con, status)) { +- sword code; +- +- status = OCIServerVersion(con->svchp, con->errhp, NULL, +- 0, OCI_HTYPE_SVCCTX); +- +- if ( status != OCI_ERROR +- || OCIErrorGet(con->errhp, 1, NULL, &code, NULL, 0, +- OCI_HTYPE_ERROR) != OCI_SUCCESS) break; +- switch (code) { +- case 24909: /* other call in progress */ +- status = OCI_STILL_EXECUTING; +- continue; +- +- case 3127: /* no new operation until active ends */ +- status = OCISessionBegin(con->svchp, con->errhp, +- con->authp, OCI_CRED_RDBMS, OCI_DEFAULT); +- default: +- break; +- } +- break; +- } +- if (done_timelimit(con, status)) goto done; ++ timer_stop(); + + if (status == OCI_SUCCESS) + ++con->connected; + } +-done: + return status; + } +diff --git a/modules/db_oracle/ora_con.h b/modules/db_oracle/ora_con.h +index 5835ffe..7267bee 100644 +--- a/modules/db_oracle/ora_con.h ++++ b/modules/db_oracle/ora_con.h +@@ -50,7 +50,8 @@ struct ora_con { + + int connected; /* Authorized session started */ + int bindpos; /* Last Bind handle position */ +- ++ pthread_t timer; ++ + query_data_t* pqdata; /* Temporary: cb data for submit_query/store_result */ + + int uri_len; +diff --git a/modules/db_oracle/res.c b/modules/db_oracle/res.c +index e9e6233..2c625f8 100644 +--- a/modules/db_oracle/res.c ++++ b/modules/db_oracle/res.c +@@ -32,7 +32,7 @@ + #include "../../dprint.h" + #include "ora_con.h" + #include "dbase.h" +-#include "asynch.h" ++#include "timer.h" + #include "res.h" + + +@@ -54,6 +54,10 @@ struct dmap { + }; + typedef struct dmap dmap_t; + ++typedef struct ora_row { ++ struct db_row hdr; ++ struct ora_row* next; ++} ora_row_t; + + /* + * Get and convert columns from a result. Define handlers and buffers +@@ -362,66 +366,74 @@ static int convert_row(db_res_t* _res, db_row_t* _r, dmap_t* _d) + */ + static int get_rows(ora_con_t* con, db_res_t* _r, OCIStmt* _c, dmap_t* _d) + { +- ub4 rcnt; ++ ub4 i = 0, rcnt = 0; + sword status; + unsigned n = RES_COL_N(_r); +- ++ // Since OCI have not "mysql_num_rows()", sequentialy fetch all rows into tmp area orow_list. ++ // Then call db_allocate_rows() and copy tmp to db module. ++ ora_row_t *orow_list = NULL, *orow_it, *orow_tail; ++ + memcpy(_d->len, _d->ilen, sizeof(_d->len[0]) * n); +- +- // timelimited operation +- status = begin_timelimit(con, 0); +- if (status != OCI_SUCCESS) goto ora_err; +- do status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_NEXT, 0, +- OCI_DEFAULT); +- while (wait_timelimit(con, status)); +- if (done_timelimit(con, status)) goto stop_load; +- if (status != OCI_SUCCESS) { +- if (status != OCI_NO_DATA) +- goto ora_err; +- +- RES_ROW_N(_r) = 0; +- RES_ROWS(_r) = NULL; +- return 0; +- } +- +- status = OCIAttrGet(_c, OCI_HTYPE_STMT, &rcnt, NULL, +- OCI_ATTR_CURRENT_POSITION, con->errhp); +- if (status != OCI_SUCCESS) goto ora_err; +- if (!rcnt) { +- LM_ERR("lastpos==0\n"); +- goto stop_load; ++ ++ request_timer(); ++ while ((status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_NEXT, 0, ++ OCI_DEFAULT)) == OCI_SUCCESS) { ++ timer_stop(); ++ ++ orow_it = (ora_row_t*) pkg_malloc(sizeof(ora_row_t) + sizeof(db_val_t)*RES_COL_N(_r)); ++ if (orow_it == NULL) { ++ LM_ERR("no private memory left\n"); ++ goto stop_load; ++ } ++ memset(orow_it, 0, sizeof(ora_row_t) + sizeof(db_val_t)*RES_COL_N(_r)); ++ orow_it->hdr.values = (db_val_t*)(orow_it+1); ++ ++ if (orow_list == NULL) ++ orow_list = orow_it; ++ else ++ orow_tail->next = orow_it; ++ orow_tail = orow_it; ++ ++ if (convert_row(_r, &orow_it->hdr, _d) < 0) { ++ LM_ERR("erroc convert row\n"); ++ goto stop_load; ++ } ++ memcpy(_d->len, _d->ilen, sizeof(_d->len[0]) * n); ++ ++rcnt; ++ request_timer(); + } +- ++ timer_stop(); ++ if (status != OCI_NO_DATA) ++ goto ora_err; ++ + RES_ROW_N(_r) = rcnt; + if (db_allocate_rows( _r, rcnt)!=0) { + LM_ERR("no private memory left\n"); +- return -1; ++ goto stop_load; + } +- +- while ( 1 ) { +- if (convert_row(_r, &RES_ROWS(_r)[--rcnt], _d) < 0) { +- LM_ERR("error convert row\n"); +- goto stop_load; +- } +- +- if (!rcnt) +- return 0; +- +- memcpy(_d->len, _d->ilen, sizeof(_d->len[0]) * n); +- // timelimited operation +- status = begin_timelimit(con, 0); +- if (status != OCI_SUCCESS) goto ora_err; +- do status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_PRIOR, 0, +- OCI_DEFAULT); +- while (wait_timelimit(con, status)); +- if (done_timelimit(con, status)) goto stop_load; +- if (status != OCI_SUCCESS) break; ++ ++ for (orow_it = orow_list; orow_it; orow_it = orow_it->next) { ++ memcpy(ROW_VALUES(&RES_ROWS(_r)[i]), ROW_VALUES(&orow_it->hdr), sizeof(db_val_t)*RES_COL_N(_r)); ++ ROW_N(&RES_ROWS(_r)[i]) = ROW_N(&orow_it->hdr); ++ ++i; ++ } ++ ++ for (orow_it = orow_list; orow_it; orow_it = orow_list) { ++ orow_list = orow_it->next; ++ pkg_free(orow_it); ++ orow_it = NULL; + } ++ return 0; ++ + ora_err: + LM_ERR("driver: %s\n", db_oracle_error(con, status)); + stop_load: +- db_free_rows(_r); +- RES_ROW_N(_r) = 0; /* TODO: skipped in db_res.c :) */ ++ for (orow_it = orow_list; orow_it; orow_it = orow_list) { ++ orow_list = orow_it->next; ++ db_free_row(&orow_it->hdr); ++ pkg_free(orow_it); ++ orow_it = NULL; ++ } + return -3; + } + +diff --git a/modules/db_oracle/timer.c b/modules/db_oracle/timer.c +new file mode 100644 +index 0000000..50484f4 +--- /dev/null ++++ b/modules/db_oracle/timer.c +@@ -0,0 +1,131 @@ ++#include "timer.h" ++#include "../../dprint.h" ++#include "../../sr_module.h" ++ ++#include ++#include ++#include ++#include ++ ++#define MAX_TIMEOUT_S 10 ++#define MIN_TIMEOUT_MCS 100000 ++ ++/* Default is 3.0 second */ ++struct itimerval request_tm = {{0,0}, {3,0}}; ++// unsigned request_tm; ++ ++/* Default is 0.2 second */ ++struct itimerval restore_tm = {{0,0}, {0,200000}}; ++ ++struct itimerval stop_tm = {{0,0}, {0,0}}; ++ ++/* Simple error handling functions */ ++ ++#define handle_error_en(en, msg) \ ++ do { LM_ERR(msg": %s\n", strerror(en)); return 1; } while (0) ++ ++static ora_con_t *g_con; ++ ++static int set_tv(unsigned type, const char* val, struct timeval* tv) ++{ ++ char *eptr; ++ struct itimerval tt; ++ unsigned long s, ms; ++ double dv; ++ ++ if (type != STR_PARAM) { ++ LM_ERR("type of parameter is no STR\n"); ++ return -1; ++ } ++ ++ if (!val || !*val) { ++ LM_ERR("empty parameter\n"); ++ return -1; ++ } ++ ++ errno = 0; ++ dv = strtod(val, &eptr); ++ ++ if (*eptr) { ++ LM_ERR("invalid parameter string\n"); ++ return -2; ++ } ++ ++ if ( errno ++ || dv > (double)MAX_TIMEOUT_S ++ || (dv < ((double)MIN_TIMEOUT_MCS)/100000)) ++ { ++ LM_ERR("value must be between 0.%.6u and %u.0\n", ++ MIN_TIMEOUT_MCS, MAX_TIMEOUT_S); ++ return -3; ++ } ++ ++ s = (unsigned)dv; ++ dv -= (double)s; ++ ms = (unsigned)(dv * 1000000); ++ tv->tv_sec = (time_t)s; ++ tv->tv_usec = (suseconds_t)ms; ++ return 0; ++} ++ ++ ++/* ++ * set operation timeout ++ */ ++int set_timeout(unsigned type, const char* val) ++{ ++ return set_tv(type, val, &request_tm.it_value); ++} ++ ++ ++/* ++ * set (re)connect timeout ++ */ ++int set_reconnect(unsigned type, const char* val) ++{ ++ return set_tv(type, val, &restore_tm.it_value); ++} ++ ++void ora_alarm_handle(int sig) { ++ LM_INFO("ora_alarm_handle\n"); ++ sword status; ++ status = OCIBreak(g_con->svchp, g_con->errhp); ++ if (status != OCI_SUCCESS) { ++ LM_ERR("OCIBreak: %s\n", db_oracle_error(g_con, status)); ++ } ++} ++ ++int init_ora_timer(ora_con_t* con) { ++ g_con = con; ++ struct sigaction sa; ++ memset(&sa, 0, sizeof(sa)); ++ sa.sa_handler = ora_alarm_handle; ++ if (sigaction(SIGALRM, &sa, NULL) < -1) ++ handle_error_en(errno, "sigaction"); ++ ++ return 0; ++} ++ ++int destroy_ora_timer() ++{ ++ timer_stop(); ++} ++ ++void request_timer() ++{ ++ if (setitimer(ITIMER_REAL, &request_tm, NULL) < 0) ++ LM_ERR("setitimer: %s\n", strerror(errno)); ++} ++ ++void restore_timer() ++{ ++ if (setitimer(ITIMER_REAL, &restore_tm, NULL) < 0) ++ LM_ERR("setitimer: %s\n", strerror(errno)); ++} ++ ++void timer_stop() ++{ ++ if (setitimer(ITIMER_REAL, &stop_tm, NULL) < 0) ++ LM_ERR("setitimer: %s\n", strerror(errno)); ++} ++ +\ No newline at end of file +diff --git a/modules/db_oracle/timer.h b/modules/db_oracle/timer.h +new file mode 100644 +index 0000000..24aa4a9 +--- /dev/null ++++ b/modules/db_oracle/timer.h +@@ -0,0 +1,22 @@ ++#ifndef ORA_TIMER_H ++#define ORA_TIMER_H ++ ++#include "ora_con.h" ++ ++/* ++ * parse timeout value for operation in syntax: nnn.mmm (sec/ms) ++ */ ++int set_timeout(unsigned type, const char* val); ++ ++/* ++ * parse timeout value for reconnect in syntax: nnn.mmm (sec/ms) ++ */ ++int set_reconnect(unsigned type, const char* val); ++ ++int init_ora_timer(ora_con_t* con); ++int destroy_ora_timer(); ++ ++void request_timer(); ++void restore_timer(); ++void timer_stop(); ++#endif // ORA_TIMER_H +\ No newline at end of file +-- +1.8.3.1 + diff --git a/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch b/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch deleted file mode 100644 index c3a1b81..0000000 --- a/opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 232711c5bda3fe5b2680bbbaf6eb9a4b59e7b51b Mon Sep 17 00:00:00 2001 -From: vladut-paiu -Date: Tue, 3 Jul 2012 09:34:52 +0000 -Subject: [PATCH 3/8] Reset column types to NULL upon freeing resultset columns - Credit to Peter Lemenkov - ---- - db/db_res.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/db/db_res.c b/db/db_res.c -index 78868ec..cbba30f 100644 ---- a/db/db_res.c -+++ b/db/db_res.c -@@ -77,6 +77,7 @@ int db_free_columns(db_res_t* _r) - /* free names and types */ - if (RES_NAMES(_r)) { - LM_DBG("freeing result columns at %p\n", RES_NAMES(_r)); -+ RES_TYPES(_r) = NULL; - pkg_free(RES_NAMES(_r)); - RES_NAMES(_r) = NULL; - } --- -1.8.1 - diff --git a/opensips-0004-db_oracle-Fix-default-ret-result.patch b/opensips-0004-db_oracle-Fix-default-ret-result.patch new file mode 100644 index 0000000..19fb16e --- /dev/null +++ b/opensips-0004-db_oracle-Fix-default-ret-result.patch @@ -0,0 +1,28 @@ +From 872115af03cbceb9160a0b6af18fbefe94671a1d Mon Sep 17 00:00:00 2001 +From: Peter Lemenkov +Date: Tue, 14 Aug 2012 15:43:46 +0400 +Subject: [PATCH 4/5] [db_oracle] Fix default ret result + +Signed-off-by: Peter Lemenkov +--- + modules/db_oracle/res.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/modules/db_oracle/res.c b/modules/db_oracle/res.c +index 2c625f8..22f10ee 100644 +--- a/modules/db_oracle/res.c ++++ b/modules/db_oracle/res.c +@@ -215,8 +215,8 @@ set_int: + case SQLT_AFC: /* Ansi fixed char */ + case SQLT_AVC: /* Ansi Var char */ + // case SQLT_RID: /* rowid */ +- LM_DBG("use DB_STR result type\n"); +- RES_TYPES(_r)[i] = DB_STR; ++ LM_DBG("use DB_STRING result type\n"); ++ RES_TYPES(_r)[i] = DB_STRING; + dyn_str: + dtype = SQLT_CHR; + len = 0; /* DATA_SIZE is ub2 */ +-- +1.8.3.1 + diff --git a/opensips-0004-fixed-DB-type-inconsistency.patch b/opensips-0004-fixed-DB-type-inconsistency.patch deleted file mode 100644 index 5284b73..0000000 --- a/opensips-0004-fixed-DB-type-inconsistency.patch +++ /dev/null @@ -1,30 +0,0 @@ -From c9b560825a00f48edd81d380235aad0ff567232b Mon Sep 17 00:00:00 2001 -From: vladut-paiu -Date: Tue, 3 Jul 2012 10:01:52 +0000 -Subject: [PATCH 4/8] fixed DB type inconsistency Credits to Peter Lemenkov - ---- - modules/usrloc/ucontact.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/modules/usrloc/ucontact.c b/modules/usrloc/ucontact.c -index 17992d5..ea400d2 100644 ---- a/modules/usrloc/ucontact.c -+++ b/modules/usrloc/ucontact.c -@@ -605,11 +605,11 @@ int db_update_ucontact(ucontact_t* _c) - vals2[2].nul = 0; - vals2[2].val.int_val = _c->cseq; - -- vals2[3].type = DB_INT; -+ vals2[3].type = DB_BITMAP; - vals2[3].nul = 0; - vals2[3].val.bitmap_val = _c->flags; - -- vals2[4].type = DB_INT; -+ vals2[4].type = DB_BITMAP; - vals2[4].nul = 0; - vals2[4].val.bitmap_val = _c->cflags; - --- -1.8.1 - diff --git a/opensips-0005-Fix-for-old-Perl-in-RHEL5.patch b/opensips-0005-Fix-for-old-Perl-in-RHEL5.patch new file mode 100644 index 0000000..3284d7f --- /dev/null +++ b/opensips-0005-Fix-for-old-Perl-in-RHEL5.patch @@ -0,0 +1,87 @@ +From 3ea0233b4aa1d27bc575d60f98ed41eb6e493e3a Mon Sep 17 00:00:00 2001 +From: Peter Lemenkov +Date: Tue, 19 Mar 2013 13:36:44 +0400 +Subject: [PATCH 5/5] Fix for old Perl in RHEL5 + +Partially revert a3cec180516b16ac84fc7e457cec2a03039e04bf + +Signed-off-by: Peter Lemenkov +--- + modules/db_perlvdb/perlvdb_conv.c | 35 +++++++---------------------------- + 1 file changed, 7 insertions(+), 28 deletions(-) + +diff --git a/modules/db_perlvdb/perlvdb_conv.c b/modules/db_perlvdb/perlvdb_conv.c +index 511e076..ce1d45c 100644 +--- a/modules/db_perlvdb/perlvdb_conv.c ++++ b/modules/db_perlvdb/perlvdb_conv.c +@@ -215,7 +215,6 @@ SV *cond2perlcond(db_key_t key, db_op_t op, db_val_t* val) { + + int perlresult2dbres(SV *perlres, db_res_t **r) { + +- HV * result = NULL; + SV *colarrayref = NULL; + AV *colarray = NULL; + SV *acol = NULL; +@@ -253,14 +252,11 @@ int perlresult2dbres(SV *perlres, db_res_t **r) { + goto error; + } + +- result = (HV*)SvRV(perlres); +- + /* Memory allocation for C side result structure */ + *r = db_new_result(); + /* Fetch column definitions */ +- colarrayref = *hv_fetchs(result, PERL_VDB_COLDEFSMETHOD, 0); +- /* colarrayref = perlvdb_perlmethod(perlres, PERL_VDB_COLDEFSMETHOD, +- NULL, NULL, NULL, NULL); */ ++ colarrayref = perlvdb_perlmethod(perlres, PERL_VDB_COLDEFSMETHOD, ++ NULL, NULL, NULL, NULL); + if (!(SvROK(colarrayref))) goto error; + colarray = (AV *)SvRV(colarrayref); + +@@ -297,25 +293,9 @@ int perlresult2dbres(SV *perlres, db_res_t **r) { + + + } +- if(hv_exists(result, "rows", 4)){ +- rowarrayref =(SV*) hv_fetchs(result, "rows", 0); +- }else{ +- (*r)->n = 0; +- (*r)->res_rows = 0; +- (*r)->last_row = 0; +- goto end; ++ rowarrayref = perlvdb_perlmethod(perlres, PERL_VDB_ROWSMETHOD, ++ NULL, NULL, NULL, NULL); + +- } +- +- if(rowarrayref){ +- rowarrayref = *((SV**)rowarrayref); +- }else{ +- (*r)->n = 0; +- (*r)->res_rows = 0; +- (*r)->last_row = 0; +- goto end; +- +- } + if (!(SvROK(rowarrayref))) { /* Empty result set */ + (*r)->n = 0; + (*r)->res_rows = 0; +@@ -354,11 +334,10 @@ int perlresult2dbres(SV *perlres, db_res_t **r) { + cur_val.nul = 1; + continue; + } +- atypesv = *hv_fetchs((HV*)SvRV(aelement),PERL_VDB_TYPEMETHOD,0); /*aelement->{type} */ +- atype = SvIV(atypesv); +- /*atypesv = perlvdb_perlmethod(aelement, ++ atypesv = perlvdb_perlmethod(aelement, + PERL_VDB_TYPEMETHOD, +- NULL, NULL, NULL, NULL);*/ ++ NULL, NULL, NULL, NULL); ++ atype = SvIV(atypesv); + aval = perlvdb_perlmethod(aelement, PERL_VDB_DATAMETHOD, + NULL, NULL, NULL, NULL); + (*r)->rows[i].values[j].type = atype; +-- +1.8.3.1 + diff --git a/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch b/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch deleted file mode 100644 index 0102671..0000000 --- a/opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch +++ /dev/null @@ -1,610 +0,0 @@ -From 80847a3200e71f3d0aefcf4505a5988b56decf9f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A1=D0=B0=D0=BC?= - =?UTF-8?q?=D1=83=D1=81=D0=B5=D0=BD=D0=BA=D0=BE?= -Date: Mon, 25 Jun 2012 17:54:27 +0400 -Subject: [PATCH 5/8] Removed all async Oracle operations - they didn't work - well anyway - ---- - modules/db_oracle/asynch.c | 270 ------------------------------------------ - modules/db_oracle/asynch.h | 62 ---------- - modules/db_oracle/db_oracle.c | 2 +- - modules/db_oracle/dbase.c | 53 +++------ - modules/db_oracle/ora_con.c | 73 ++++-------- - modules/db_oracle/ora_con.h | 3 +- - modules/db_oracle/res.c | 110 +++++++++-------- - modules/db_oracle/timer.c | 131 ++++++++++++++++++++ - modules/db_oracle/timer.h | 22 ++++ - 9 files changed, 256 insertions(+), 470 deletions(-) - delete mode 100644 modules/db_oracle/asynch.c - delete mode 100644 modules/db_oracle/asynch.h - create mode 100644 modules/db_oracle/timer.c - create mode 100644 modules/db_oracle/timer.h - -diff --git a/modules/db_oracle/db_oracle.c b/modules/db_oracle/db_oracle.c -index 70cfe40..40c7692 100644 ---- a/modules/db_oracle/db_oracle.c -+++ b/modules/db_oracle/db_oracle.c -@@ -31,7 +31,7 @@ - #include "../../sr_module.h" - #include "../../db/db.h" - #include "dbase.h" --#include "asynch.h" -+#include "timer.h" - - static int oracle_mod_init(void); - static void destroy(void); -diff --git a/modules/db_oracle/dbase.c b/modules/db_oracle/dbase.c -index d129e11..be2352e 100644 ---- a/modules/db_oracle/dbase.c -+++ b/modules/db_oracle/dbase.c -@@ -36,7 +36,7 @@ - #include "val.h" - #include "ora_con.h" - #include "res.h" --#include "asynch.h" -+#include "timer.h" - #include "dbase.h" - - -@@ -212,7 +212,6 @@ static int db_oracle_submit_query(const db_con_t* _h, const str* _s) - OCIDate odt[sizeof(bind)/sizeof(bind[0])]; - str tmps; - sword status; -- int pass; - ora_con_t* con = CON_ORA(_h); - query_data_t* pqd = con->pqdata; - size_t hc = pqd->_n + pqd->_nw; -@@ -223,32 +222,16 @@ static int db_oracle_submit_query(const db_con_t* _h, const str* _s) - (unsigned)hc); - return -1; - } -- -- if (!pqd->_rs) { -- /* -- * This method is at ~25% faster as set OCI_COMMIT_ON_SUCCESS -- * in StmtExecute -- */ -- tmps.len = snprintf(st_buf, sizeof(st_buf), -- "begin %.*s; commit write batch nowait; end;", -- _s->len, _s->s); -- if ((unsigned)tmps.len >= sizeof(st_buf)) -- return sql_buf_small(); -- tmps.s = st_buf; -- _s = &tmps; -- } - -- pass = 1; -- if (!con->connected) { -+ if (con->connected != 2) { - status = db_oracle_reconnect(con); - if (status != OCI_SUCCESS) { - LM_ERR("can't restore connection: %s\n", db_oracle_error(con, status)); - return -2; - } - LM_INFO("connection restored\n"); -- --pass; - } --repeat: -+ - stmthp = NULL; - status = OCIHandleAlloc(con->envhp, (dvoid**)(dvoid*)&stmthp, - OCI_HTYPE_STMT, 0, NULL); -@@ -291,14 +274,10 @@ bind_err: - } - } - -- // timelimited operation -- status = begin_timelimit(con, 0); -- if (status != OCI_SUCCESS) goto ora_err; -- do status = OCIStmtExecute(con->svchp, stmthp, con->errhp, -- !pqd->_rs, 0, NULL, NULL, -- pqd->_rs ? OCI_STMT_SCROLLABLE_READONLY : OCI_DEFAULT); -- while (wait_timelimit(con, status)); -- if (done_timelimit(con, status)) goto stop_exec; -+ request_timer(); -+ status = OCIStmtExecute(con->svchp, stmthp, con->errhp, -+ !pqd->_rs, 0, NULL, NULL, pqd->_rs ? OCI_DEFAULT : OCI_COMMIT_ON_SUCCESS); -+ timer_stop(); - switch (status) { - case OCI_SUCCESS_WITH_INFO: - LM_WARN("driver: %s\n", db_oracle_errorinfo(con)); -@@ -310,8 +289,8 @@ bind_err: - OCIHandleFree(stmthp, OCI_HTYPE_STMT); - return 0; - default: -- pass = -pass; -- break; -+ LM_ERR("timeout/not connected to oracle\n"); -+ break; - } - - ora_err: -@@ -319,15 +298,13 @@ ora_err: - stop_exec: - if (stmthp) - OCIHandleFree(stmthp, OCI_HTYPE_STMT); -- if (pass == -1 && !con->connected) { -- /* Attemtp to reconnect */ -- if (db_oracle_reconnect(con) == OCI_SUCCESS) { -- LM_NOTICE("attempt repeat after reconnect\n"); -- pass = 0; -- goto repeat; -- } -+ LM_INFO("reconnecting to oracle...\n"); -+ /* Attempt to reconnect */ -+ if (db_oracle_reconnect(con) == OCI_SUCCESS) -+ LM_INFO("connection restored\n"); -+ else - LM_ERR("connection loss\n"); -- } -+ - return -4; - } - -diff --git a/modules/db_oracle/ora_con.c b/modules/db_oracle/ora_con.c -index 73ced27..f03f753 100644 ---- a/modules/db_oracle/ora_con.c -+++ b/modules/db_oracle/ora_con.c -@@ -22,9 +22,10 @@ - - #include - #include -+#include - #include "../../mem/mem.h" - #include "../../dprint.h" --#include "asynch.h" -+#include "timer.h" - #include "ora_con.h" - - /*************************************************************************/ -@@ -105,6 +106,12 @@ bad_param: - status = OCIAttrSet(con->svchp, OCI_HTYPE_SVCCTX, con->authp, 0, - OCI_ATTR_SESSION, con->errhp); - if (status != OCI_SUCCESS) goto connect_err; -+ -+ if (init_ora_timer(con) != 0) { -+ LM_ERR("can't start oracle timer thread\n"); -+ goto drop_connection; -+ } -+ - status = db_oracle_reconnect(con); - if (status != OCI_SUCCESS) { - connect_err: -@@ -122,12 +129,11 @@ drop_connection: - } - - // timelimited operation -- status = begin_timelimit(con, 0); -- if (status != OCI_SUCCESS) goto connect_err; -- do status = OCIServerVersion(con->svchp, con->errhp, (OraText*)buf, -+ request_timer(); -+ status = OCIServerVersion(con->svchp, con->errhp, (OraText*)buf, - (ub4)sizeof(buf), OCI_HTYPE_SVCCTX); -- while (wait_timelimit(con, status)); -- if (done_timelimit(con, status)) goto drop_connection; -+ timer_stop(); -+ - if (status != OCI_SUCCESS) goto connect_err; - LM_INFO("server version is %s\n", buf); - return con; -@@ -139,6 +145,7 @@ drop_connection: - */ - void db_oracle_free_connection(ora_con_t* con) - { -+ destroy_ora_timer(con); - if (!con) return; - - if (con->connected) -@@ -164,20 +171,17 @@ void db_oracle_free_connection(ora_con_t* con) - void db_oracle_disconnect(ora_con_t* con) - { - sword status; -- -- switch (con->connected) { -- default: -- status = OCISessionEnd(con->svchp, con->errhp, con->authp, -- OCI_DEFAULT); -- if (status != OCI_SUCCESS) -- LM_ERR("driver: %s\n", db_oracle_error(con, status)); -- case 1: -+ if (con->connected > 0) { -+ if (con->connected > 1) { -+ status = OCISessionEnd(con->svchp, con->errhp, con->authp, -+ OCI_DEFAULT); -+ if (status != OCI_SUCCESS) -+ LM_ERR("driver: %s\n", db_oracle_error(con, status)); -+ } - status = OCIServerDetach(con->srvhp, con->errhp, OCI_DEFAULT); - if (status != OCI_SUCCESS) - LM_ERR("driver: %s\n", db_oracle_error(con, status)); - con->connected = 0; -- case 0: -- break; - } - } - -@@ -192,48 +196,19 @@ sword db_oracle_reconnect(ora_con_t* con) - if (con->connected) - db_oracle_disconnect(con); - -- /* timelimited operation, but OCI tcp-network does not support it :( */ -+ restore_timer(); - status = OCIServerAttach(con->srvhp, con->errhp, (OraText*)con->uri, - con->uri_len, 0); -+ timer_stop(); - if (status == OCI_SUCCESS) { - ++con->connected; -- /* -- * timelimited operation, but OCI has BUG in asynch -- * implementation of OCISessionBegin :(. -- * -- * Next code is 'empiric hack' that work (tested) in v10/v11. -- */ -- status = begin_timelimit(con, 1); -- if (status != OCI_SUCCESS) goto done; -+ request_timer(); - status = OCISessionBegin(con->svchp, con->errhp, con->authp, - OCI_CRED_RDBMS, OCI_DEFAULT); -- while (wait_timelimit(con, status)) { -- sword code; -- -- status = OCIServerVersion(con->svchp, con->errhp, NULL, -- 0, OCI_HTYPE_SVCCTX); -- -- if ( status != OCI_ERROR -- || OCIErrorGet(con->errhp, 1, NULL, &code, NULL, 0, -- OCI_HTYPE_ERROR) != OCI_SUCCESS) break; -- switch (code) { -- case 24909: /* other call in progress */ -- status = OCI_STILL_EXECUTING; -- continue; -- -- case 3127: /* no new operation until active ends */ -- status = OCISessionBegin(con->svchp, con->errhp, -- con->authp, OCI_CRED_RDBMS, OCI_DEFAULT); -- default: -- break; -- } -- break; -- } -- if (done_timelimit(con, status)) goto done; -+ timer_stop(); - - if (status == OCI_SUCCESS) - ++con->connected; - } --done: - return status; - } -diff --git a/modules/db_oracle/ora_con.h b/modules/db_oracle/ora_con.h -index 5835ffe..7267bee 100644 ---- a/modules/db_oracle/ora_con.h -+++ b/modules/db_oracle/ora_con.h -@@ -50,7 +50,8 @@ struct ora_con { - - int connected; /* Authorized session started */ - int bindpos; /* Last Bind handle position */ -- -+ pthread_t timer; -+ - query_data_t* pqdata; /* Temporary: cb data for submit_query/store_result */ - - int uri_len; -diff --git a/modules/db_oracle/res.c b/modules/db_oracle/res.c -index e9e6233..2c625f8 100644 ---- a/modules/db_oracle/res.c -+++ b/modules/db_oracle/res.c -@@ -32,7 +32,7 @@ - #include "../../dprint.h" - #include "ora_con.h" - #include "dbase.h" --#include "asynch.h" -+#include "timer.h" - #include "res.h" - - -@@ -54,6 +54,10 @@ struct dmap { - }; - typedef struct dmap dmap_t; - -+typedef struct ora_row { -+ struct db_row hdr; -+ struct ora_row* next; -+} ora_row_t; - - /* - * Get and convert columns from a result. Define handlers and buffers -@@ -362,66 +366,74 @@ static int convert_row(db_res_t* _res, db_row_t* _r, dmap_t* _d) - */ - static int get_rows(ora_con_t* con, db_res_t* _r, OCIStmt* _c, dmap_t* _d) - { -- ub4 rcnt; -+ ub4 i = 0, rcnt = 0; - sword status; - unsigned n = RES_COL_N(_r); -- -+ // Since OCI have not "mysql_num_rows()", sequentialy fetch all rows into tmp area orow_list. -+ // Then call db_allocate_rows() and copy tmp to db module. -+ ora_row_t *orow_list = NULL, *orow_it, *orow_tail; -+ - memcpy(_d->len, _d->ilen, sizeof(_d->len[0]) * n); -- -- // timelimited operation -- status = begin_timelimit(con, 0); -- if (status != OCI_SUCCESS) goto ora_err; -- do status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_NEXT, 0, -- OCI_DEFAULT); -- while (wait_timelimit(con, status)); -- if (done_timelimit(con, status)) goto stop_load; -- if (status != OCI_SUCCESS) { -- if (status != OCI_NO_DATA) -- goto ora_err; -- -- RES_ROW_N(_r) = 0; -- RES_ROWS(_r) = NULL; -- return 0; -- } -- -- status = OCIAttrGet(_c, OCI_HTYPE_STMT, &rcnt, NULL, -- OCI_ATTR_CURRENT_POSITION, con->errhp); -- if (status != OCI_SUCCESS) goto ora_err; -- if (!rcnt) { -- LM_ERR("lastpos==0\n"); -- goto stop_load; -+ -+ request_timer(); -+ while ((status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_NEXT, 0, -+ OCI_DEFAULT)) == OCI_SUCCESS) { -+ timer_stop(); -+ -+ orow_it = (ora_row_t*) pkg_malloc(sizeof(ora_row_t) + sizeof(db_val_t)*RES_COL_N(_r)); -+ if (orow_it == NULL) { -+ LM_ERR("no private memory left\n"); -+ goto stop_load; -+ } -+ memset(orow_it, 0, sizeof(ora_row_t) + sizeof(db_val_t)*RES_COL_N(_r)); -+ orow_it->hdr.values = (db_val_t*)(orow_it+1); -+ -+ if (orow_list == NULL) -+ orow_list = orow_it; -+ else -+ orow_tail->next = orow_it; -+ orow_tail = orow_it; -+ -+ if (convert_row(_r, &orow_it->hdr, _d) < 0) { -+ LM_ERR("erroc convert row\n"); -+ goto stop_load; -+ } -+ memcpy(_d->len, _d->ilen, sizeof(_d->len[0]) * n); -+ ++rcnt; -+ request_timer(); - } -- -+ timer_stop(); -+ if (status != OCI_NO_DATA) -+ goto ora_err; -+ - RES_ROW_N(_r) = rcnt; - if (db_allocate_rows( _r, rcnt)!=0) { - LM_ERR("no private memory left\n"); -- return -1; -+ goto stop_load; - } -- -- while ( 1 ) { -- if (convert_row(_r, &RES_ROWS(_r)[--rcnt], _d) < 0) { -- LM_ERR("error convert row\n"); -- goto stop_load; -- } -- -- if (!rcnt) -- return 0; -- -- memcpy(_d->len, _d->ilen, sizeof(_d->len[0]) * n); -- // timelimited operation -- status = begin_timelimit(con, 0); -- if (status != OCI_SUCCESS) goto ora_err; -- do status = OCIStmtFetch2(_c, con->errhp, 1, OCI_FETCH_PRIOR, 0, -- OCI_DEFAULT); -- while (wait_timelimit(con, status)); -- if (done_timelimit(con, status)) goto stop_load; -- if (status != OCI_SUCCESS) break; -+ -+ for (orow_it = orow_list; orow_it; orow_it = orow_it->next) { -+ memcpy(ROW_VALUES(&RES_ROWS(_r)[i]), ROW_VALUES(&orow_it->hdr), sizeof(db_val_t)*RES_COL_N(_r)); -+ ROW_N(&RES_ROWS(_r)[i]) = ROW_N(&orow_it->hdr); -+ ++i; -+ } -+ -+ for (orow_it = orow_list; orow_it; orow_it = orow_list) { -+ orow_list = orow_it->next; -+ pkg_free(orow_it); -+ orow_it = NULL; - } -+ return 0; -+ - ora_err: - LM_ERR("driver: %s\n", db_oracle_error(con, status)); - stop_load: -- db_free_rows(_r); -- RES_ROW_N(_r) = 0; /* TODO: skipped in db_res.c :) */ -+ for (orow_it = orow_list; orow_it; orow_it = orow_list) { -+ orow_list = orow_it->next; -+ db_free_row(&orow_it->hdr); -+ pkg_free(orow_it); -+ orow_it = NULL; -+ } - return -3; - } - -diff --git a/modules/db_oracle/timer.c b/modules/db_oracle/timer.c -new file mode 100644 -index 0000000..50484f4 ---- /dev/null -+++ b/modules/db_oracle/timer.c -@@ -0,0 +1,131 @@ -+#include "timer.h" -+#include "../../dprint.h" -+#include "../../sr_module.h" -+ -+#include -+#include -+#include -+#include -+ -+#define MAX_TIMEOUT_S 10 -+#define MIN_TIMEOUT_MCS 100000 -+ -+/* Default is 3.0 second */ -+struct itimerval request_tm = {{0,0}, {3,0}}; -+// unsigned request_tm; -+ -+/* Default is 0.2 second */ -+struct itimerval restore_tm = {{0,0}, {0,200000}}; -+ -+struct itimerval stop_tm = {{0,0}, {0,0}}; -+ -+/* Simple error handling functions */ -+ -+#define handle_error_en(en, msg) \ -+ do { LM_ERR(msg": %s\n", strerror(en)); return 1; } while (0) -+ -+static ora_con_t *g_con; -+ -+static int set_tv(unsigned type, const char* val, struct timeval* tv) -+{ -+ char *eptr; -+ struct itimerval tt; -+ unsigned long s, ms; -+ double dv; -+ -+ if (type != STR_PARAM) { -+ LM_ERR("type of parameter is no STR\n"); -+ return -1; -+ } -+ -+ if (!val || !*val) { -+ LM_ERR("empty parameter\n"); -+ return -1; -+ } -+ -+ errno = 0; -+ dv = strtod(val, &eptr); -+ -+ if (*eptr) { -+ LM_ERR("invalid parameter string\n"); -+ return -2; -+ } -+ -+ if ( errno -+ || dv > (double)MAX_TIMEOUT_S -+ || (dv < ((double)MIN_TIMEOUT_MCS)/100000)) -+ { -+ LM_ERR("value must be between 0.%.6u and %u.0\n", -+ MIN_TIMEOUT_MCS, MAX_TIMEOUT_S); -+ return -3; -+ } -+ -+ s = (unsigned)dv; -+ dv -= (double)s; -+ ms = (unsigned)(dv * 1000000); -+ tv->tv_sec = (time_t)s; -+ tv->tv_usec = (suseconds_t)ms; -+ return 0; -+} -+ -+ -+/* -+ * set operation timeout -+ */ -+int set_timeout(unsigned type, const char* val) -+{ -+ return set_tv(type, val, &request_tm.it_value); -+} -+ -+ -+/* -+ * set (re)connect timeout -+ */ -+int set_reconnect(unsigned type, const char* val) -+{ -+ return set_tv(type, val, &restore_tm.it_value); -+} -+ -+void ora_alarm_handle(int sig) { -+ LM_INFO("ora_alarm_handle\n"); -+ sword status; -+ status = OCIBreak(g_con->svchp, g_con->errhp); -+ if (status != OCI_SUCCESS) { -+ LM_ERR("OCIBreak: %s\n", db_oracle_error(g_con, status)); -+ } -+} -+ -+int init_ora_timer(ora_con_t* con) { -+ g_con = con; -+ struct sigaction sa; -+ memset(&sa, 0, sizeof(sa)); -+ sa.sa_handler = ora_alarm_handle; -+ if (sigaction(SIGALRM, &sa, NULL) < -1) -+ handle_error_en(errno, "sigaction"); -+ -+ return 0; -+} -+ -+int destroy_ora_timer() -+{ -+ timer_stop(); -+} -+ -+void request_timer() -+{ -+ if (setitimer(ITIMER_REAL, &request_tm, NULL) < 0) -+ LM_ERR("setitimer: %s\n", strerror(errno)); -+} -+ -+void restore_timer() -+{ -+ if (setitimer(ITIMER_REAL, &restore_tm, NULL) < 0) -+ LM_ERR("setitimer: %s\n", strerror(errno)); -+} -+ -+void timer_stop() -+{ -+ if (setitimer(ITIMER_REAL, &stop_tm, NULL) < 0) -+ LM_ERR("setitimer: %s\n", strerror(errno)); -+} -+ -\ No newline at end of file -diff --git a/modules/db_oracle/timer.h b/modules/db_oracle/timer.h -new file mode 100644 -index 0000000..24aa4a9 ---- /dev/null -+++ b/modules/db_oracle/timer.h -@@ -0,0 +1,22 @@ -+#ifndef ORA_TIMER_H -+#define ORA_TIMER_H -+ -+#include "ora_con.h" -+ -+/* -+ * parse timeout value for operation in syntax: nnn.mmm (sec/ms) -+ */ -+int set_timeout(unsigned type, const char* val); -+ -+/* -+ * parse timeout value for reconnect in syntax: nnn.mmm (sec/ms) -+ */ -+int set_reconnect(unsigned type, const char* val); -+ -+int init_ora_timer(ora_con_t* con); -+int destroy_ora_timer(); -+ -+void request_timer(); -+void restore_timer(); -+void timer_stop(); -+#endif // ORA_TIMER_H -\ No newline at end of file --- -1.8.1 - diff --git a/opensips-0006-db_oracle-Fix-default-ret-result.patch b/opensips-0006-db_oracle-Fix-default-ret-result.patch deleted file mode 100644 index 4a81ef9..0000000 --- a/opensips-0006-db_oracle-Fix-default-ret-result.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 69108e1ee4727b4c70e76b6d97e3a9402a98711d Mon Sep 17 00:00:00 2001 -From: Peter Lemenkov -Date: Tue, 14 Aug 2012 15:43:46 +0400 -Subject: [PATCH 6/8] [db_oracle] Fix default ret result - -Signed-off-by: Peter Lemenkov ---- - modules/db_oracle/res.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/modules/db_oracle/res.c b/modules/db_oracle/res.c -index 2c625f8..22f10ee 100644 ---- a/modules/db_oracle/res.c -+++ b/modules/db_oracle/res.c -@@ -215,8 +215,8 @@ set_int: - case SQLT_AFC: /* Ansi fixed char */ - case SQLT_AVC: /* Ansi Var char */ - // case SQLT_RID: /* rowid */ -- LM_DBG("use DB_STR result type\n"); -- RES_TYPES(_r)[i] = DB_STR; -+ LM_DBG("use DB_STRING result type\n"); -+ RES_TYPES(_r)[i] = DB_STRING; - dyn_str: - dtype = SQLT_CHR; - len = 0; /* DATA_SIZE is ub2 */ --- -1.8.1 - diff --git a/opensips-0007-small-cleanup-on-STR-init-definition.patch b/opensips-0007-small-cleanup-on-STR-init-definition.patch deleted file mode 100644 index 3651428..0000000 --- a/opensips-0007-small-cleanup-on-STR-init-definition.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d59a54a6ba7390d44ad92979f2cf6e149192aba8 Mon Sep 17 00:00:00 2001 -From: bogdan_iancu -Date: Thu, 17 Jan 2013 10:46:49 +0000 -Subject: [PATCH 7/8] - small cleanup on STR init definition Credits go to - Peter Lemenkov Closes patch #3600350 - ---- - modules/sipmsgops/codecs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/modules/sipmsgops/codecs.c b/modules/sipmsgops/codecs.c -index f7cad95..480ebf3 100644 ---- a/modules/sipmsgops/codecs.c -+++ b/modules/sipmsgops/codecs.c -@@ -414,7 +414,7 @@ static int stream_process(struct sip_msg * msg, struct sdp_stream_cell *cell, - { NULL,0,{"32",2},{ "MPV",3},{"90000",5},{NULL,0},{NULL,0} }, /*32 - MPV/90000 */ - { NULL,0,{"33",2},{"MP2T",4},{"90000",5},{NULL,0},{NULL,0} }, /*33 - MP2T/90000 */ - { NULL,0,{"34",2},{"H263",4},{"90000",5},{NULL,0},{NULL,0} }, /*34 - H263/90000 */ -- { NULL,0,{NULL,1},{ NULL,3},{ NULL,0},{NULL,0},{NULL,0} } -+ { NULL,0,{NULL,0},{ NULL,0},{ NULL,0},{NULL,0},{NULL,0} } - }; - sdp_payload_attr_t *payload; - char *cur, *tmp, *buff, temp; --- -1.8.1 - diff --git a/opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch b/opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch deleted file mode 100644 index 887f0cf..0000000 --- a/opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch +++ /dev/null @@ -1,172 +0,0 @@ -From 9c24e98009e1988abe0d89a8d935e9ec28d2d404 Mon Sep 17 00:00:00 2001 -From: bogdan_iancu -Date: Thu, 17 Jan 2013 15:44:54 +0000 -Subject: [PATCH 8/8] - allow variables into both params of - rtpproxy_[answer|offer] Based on a patch contributed by Peter Lemenkov. - Closes patch #3600377 - ---- - modules/rtpproxy/rtpproxy.c | 88 ++++++++++++++++++++++++++++++++++----------- - 1 file changed, 68 insertions(+), 20 deletions(-) - -diff --git a/modules/rtpproxy/rtpproxy.c b/modules/rtpproxy/rtpproxy.c -index a9539be..f6ef948 100644 ---- a/modules/rtpproxy/rtpproxy.c -+++ b/modules/rtpproxy/rtpproxy.c -@@ -161,6 +161,7 @@ - #include "../../error.h" - #include "../../forward.h" - #include "../../mem/mem.h" -+#include "../../mod_fix.h" - #include "../../timer.h" - #include "../../parser/parse_from.h" - #include "../../parser/parse_to.h" -@@ -359,43 +360,43 @@ static cmd_export_t cmds[] = { - {"set_rtp_proxy_set", (cmd_function)set_rtp_proxy_set_f, 1, - fixup_set_id, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"unforce_rtp_proxy", (cmd_function)unforce_rtp_proxy_f, 0, -+ {"unforce_rtp_proxy", (cmd_function)unforce_rtp_proxy_f, 0, - 0, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy0_f, 0, -+ {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy0_f, 0, - fixup_engage, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy1_f, 1, -+ {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy1_f, 1, - fixup_engage, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy2_f, 2, -+ {"engage_rtp_proxy", (cmd_function)engage_rtp_proxy2_f, 2, - fixup_engage, 0, - REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"start_recording", (cmd_function)start_recording_f, 0, -+ {"start_recording", (cmd_function)start_recording_f, 0, - 0, 0, - REQUEST_ROUTE | ONREPLY_ROUTE }, -- {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 0, -+ {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 0, - 0, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 1, -- 0, 0, -+ {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 1, -+ fixup_spve_null, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 2, -- 0, 0, -+ {"rtpproxy_offer", (cmd_function)rtpproxy_offer2_f, 2, -+ fixup_spve_spve, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 0, -+ {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 0, - 0, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 1, -- 0, 0, -+ {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 1, -+ fixup_spve_null, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 2, -- 0, 0, -+ {"rtpproxy_answer", (cmd_function)rtpproxy_answer2_f, 2, -+ fixup_spve_spve, 0, - REQUEST_ROUTE|ONREPLY_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|LOCAL_ROUTE}, -- {"rtpproxy_stream2uac",(cmd_function)rtpproxy_stream2uac2_f, 2, -+ {"rtpproxy_stream2uac",(cmd_function)rtpproxy_stream2uac2_f, 2, - fixup_var_str_int, 0, - REQUEST_ROUTE | ONREPLY_ROUTE }, -- {"rtpproxy_stream2uas",(cmd_function)rtpproxy_stream2uas2_f, 2, -+ {"rtpproxy_stream2uas",(cmd_function)rtpproxy_stream2uas2_f, 2, - fixup_var_str_int, 0, - REQUEST_ROUTE | ONREPLY_ROUTE }, - {"rtpproxy_stop_stream2uac",(cmd_function)rtpproxy_stop_stream2uac2_f,0, -@@ -2335,9 +2336,33 @@ pkg_strdup(char *cp) - return (rval); - } - -+ -+static int rtpp_get_var_svalue(struct sip_msg *msg, gparam_p gp, str *val, int n) -+{ -+ #define MAX_BUF 64 -+ static char buf[2][MAX_BUF]; -+ str tmp; -+ -+ if (gp->type==GPARAM_TYPE_STR) { -+ *val = gp->v.sval; -+ return 0; -+ } -+ -+ if ( fixup_get_svalue(msg, gp, &tmp)!=0 ) -+ return -1; -+ val->s = buf[n]; -+ val->len = (tmp.len>MAX_BUF-1) ? MAX_BUF-1 : tmp.len ; -+ memcpy(val->s,tmp.s, val->len); -+ val->s[val->len] = 0; -+ return 0; -+} -+ - static int - rtpproxy_offer2_f(struct sip_msg *msg, char *param1, char *param2) - { -+ str flag_str; -+ str ip_str; -+ - if(rtpp_notify_socket.s) - { - if ( (!msg->to && parse_headers(msg, HDR_TO_F,0)<0) || !msg->to ) { -@@ -2345,24 +2370,47 @@ rtpproxy_offer2_f(struct sip_msg *msg, char *param1, char *param2) - return -1; - } - -- - /* if an initial request - create a new dialog */ - if(get_to(msg)->tag_value.s == NULL) - dlg_api.create_dlg(msg,0); - } - -- return force_rtp_proxy(msg, param1, param2, 1); -+ if (rtpp_get_var_svalue(msg, (gparam_p)param1, &flag_str, 0)<0) { -+ LM_ERR("bogus flags parameter\n"); -+ return -1; -+ } -+ if (param2!=NULL) { -+ if (rtpp_get_var_svalue(msg, (gparam_p)param2, &ip_str,1)<0) { -+ LM_ERR("bogus IP addr parameter\n"); -+ return -1; -+ } -+ return force_rtp_proxy(msg, flag_str.s, ip_str.s, 1); -+ } -+ return force_rtp_proxy(msg, flag_str.s, NULL, 1); - } - - static int - rtpproxy_answer2_f(struct sip_msg *msg, char *param1, char *param2) - { -+ str flag_str; -+ str ip_str; - - if (msg->first_line.type == SIP_REQUEST) - if (msg->first_line.u.request.method_value != METHOD_ACK) - return -1; - -- return force_rtp_proxy(msg, param1, param2, 0); -+ if (rtpp_get_var_svalue(msg, (gparam_p)param1, &flag_str, 0)<0) { -+ LM_ERR("bogus flags parameter\n"); -+ return -1; -+ } -+ if (param2!=NULL) { -+ if (rtpp_get_var_svalue(msg, (gparam_p)param2, &ip_str,1)<0) { -+ LM_ERR("bogus IP addr parameter\n"); -+ return -1; -+ } -+ return force_rtp_proxy(msg, flag_str.s, ip_str.s, 0); -+ } -+ return force_rtp_proxy(msg, flag_str.s, param2, 0); - } - - static void engage_callback(struct dlg_cell *dlg, int type, --- -1.8.1 - diff --git a/opensips.spec b/opensips.spec index 4ca1dfc..f7050ef 100644 --- a/opensips.spec +++ b/opensips.spec @@ -1,4 +1,6 @@ -%if 0%{?fedora} > 16 +%global _hardened_build 1 + +%if 0%{?el7}%{?fedora} %global opensips_user opensips %global opensips_group opensips %else @@ -6,30 +8,27 @@ %global opensips_group root %endif -%if 0%{?rhel} +%if 0%{?el5}%{?el6} # copied from lm_sensors exclusive arch %ifnarch alpha i386 i486 i586 i686 pentium3 pentium4 athlon x86_64 %global disable_snmpstats snmpstats %endif %endif -%global EXCLUDE_MODULES osp cachedb_cassandra %{?disable_snmpstats} %{!?_with_oracle:db_oracle} %{?el5:cachedb_redis} lua +%global EXCLUDE_MODULES cachedb_cassandra cachedb_couchbase cachedb_mongodb %{?el5:cachedb_redis} %{!?_with_oracle:db_oracle} lua osp %{?disable_snmpstats} Summary: Open Source SIP Server Name: opensips -Version: 1.8.2 -Release: 8%{?dist} +Version: 1.9.1 +Release: 1%{?dist} License: GPLv2+ Group: System Environment/Daemons Source0: http://opensips.org/pub/%{name}/%{version}/src/%{name}-%{version}_src.tar.gz Patch1: opensips-0001-Consistently-use-rtpproxy-switches.patch Patch2: opensips-0002-Cleanup-Oracle-s-makefiles.patch -Patch3: opensips-0003-Reset-column-types-to-NULL-upon-freeing-resultset-co.patch -Patch4: opensips-0004-fixed-DB-type-inconsistency.patch -Patch5: opensips-0005-Removed-all-async-Oracle-operations-they-didn-t-work.patch -Patch6: opensips-0006-db_oracle-Fix-default-ret-result.patch -Patch7: opensips-0007-small-cleanup-on-STR-init-definition.patch -Patch8: opensips-0008-allow-variables-into-both-params-of-rtpproxy_-answer.patch +Patch3: opensips-0003-Removed-all-async-Oracle-operations-they-didn-t-work.patch +Patch4: opensips-0004-db_oracle-Fix-default-ret-result.patch +Patch5: opensips-0005-Fix-for-old-Perl-in-RHEL5.patch URL: http://opensips.org BuildRequires: expat-devel @@ -52,7 +51,7 @@ BuildRequires: openssl-devel BuildRequires: expat-devel BuildRequires: xmlrpc-c-devel BuildRequires: libconfuse-devel -%if 0%{?rhel} +%if 0%{?el5}%{?el6} BuildRequires: db4-devel %else BuildRequires: libdb-devel @@ -62,7 +61,7 @@ BuildRequires: curl-devel BuildRequires: GeoIP-devel BuildRequires: pcre-devel BuildRequires: python-devel -%if 0%{?fedora} > 16 +%if 0%{?el7}%{?fedora} BuildRequires: systemd-units %endif BuildRequires: libxslt @@ -71,7 +70,7 @@ BuildRequires: ncurses-devel BuildRequireS: json-c-devel #Initscripts -%if 0%{?fedora} > 16 +%if 0%{?el7}%{?fedora} # Users and groups Requires(pre): shadow-utils Requires(post): systemd @@ -82,6 +81,7 @@ Requires(post): chkconfig Requires(preun):chkconfig Requires(preun):initscripts %endif +Obsoletes: %{name}-event_datagram BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %description @@ -180,15 +180,6 @@ Requires: %{name} = %{version}-%{release} This module provides access to a database that is implemented as a HTTP server. -%package event_datagram -Summary: Event datagram module -Group: System Environment/Daemons -Requires: %{name} = %{version}-%{release} - -%description event_datagram -This is a module which provides a UNIX/UDP SOCKET transport layer -implementation for the Event Interface. - %package event_rabbitmq Summary: Event RabbitMQ module Group: System Environment/Daemons @@ -311,7 +302,7 @@ Summary: Helps implement your own OpenSIPS extensions in Perl Group: System Environment/Daemons # require perl-devel for >F7 and perl for <=F6 BuildRequires: perl(ExtUtils::MakeMaker) -%if 0%{?rhel} +%if 0%{?el5}%{?el6} BuildRequires: perl(ExtUtils::Embed) %else BuildRequires: perl(ExtUtils::Embed), perl-devel @@ -342,6 +333,17 @@ The Perl Virtual Database (VDB) provides a virtualization framework for OpenSIPS's database access. It does not handle a particular database engine itself but lets the user relay database requests to arbitrary Perl functions. +%package pi_http +Summary: A HTTP provisioning interface for OpenSIPS +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} +Requires: %{name}-httpd = %{version}-%{release} + +%description pi_http +This module provides an HTTP provisioning interface for OpenSIPS. It is using +the OpenSIPS's internal database API to provide a simple way of manipulating +records inside OpenSIPS's tables. + %package postgresql Summary: PostgreSQL Storage Support for the OpenSIPS Group: System Environment/Daemons @@ -448,11 +450,10 @@ Requires: %{name} = %{version}-%{release} Requires: %{name}-pua %description pua_dialoginfo -The pua_dialoginfo retrieves dialog state information from the -dialog module and PUBLISHes the dialog-information using the -pua module. Thus, in combination with the presence_xml module -this can be used to derive dialog-info from the dialog module -and NOTIFY the subscribed watchers about dialog-info changes. +The pua_dialoginfo retrieves dialog state information from the dialog module +and PUBLISHes the dialog-information using the pua module. Thus, in combination +with the presence_xml module this can be used to derive dialog-info from the +dialog module and NOTIFY the subscribed watchers about dialog-info changes. %package pua_mi Summary: Connector between usrloc and MI interface @@ -528,6 +529,7 @@ Group: System Environment/Daemons Requires: %{name} = %{version}-%{release} Requires: %{name}-pua Requires: %{name}-presence +Requires: %{name}-xcap = %{version}-%{release} %description rls The modules is a Resource List Server implementation following the @@ -594,6 +596,15 @@ Requires: %{name} = %{version}-%{release} The %{name}-unixodbc package contains the unixODBC plugin for %{name}, which allows a unixODBC to be used for persistent storage +%package xcap +Summary: XCAP common functions +Group: System Environment/Daemons +Requires: %{name} = %{version}-%{release} + +%description xcap +The module contains several parameters and functions common to all modules +using XCAP capabilities. + %package xcap_client Summary: XCAP client Group: System Environment/Daemons @@ -628,25 +639,22 @@ clients. %setup -q -n %{name}-%{version}-tls %patch1 -p1 %patch2 -p1 -%patch3 -p1 -%patch4 -p1 # Fix for broken behaviour of a git/rpmbuild in EL5 rm -f modules/db_oracle/asynch.* +%patch3 -p1 +%patch4 -p1 %patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 %build -LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ +LOCALBASE=/usr NICER=0 CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \ exclude_modules="%EXCLUDE_MODULES" \ cfg-target=%{_sysconfdir}/opensips/ \ modules-prefix=%{buildroot}%{_prefix} \ modules-dir=%{_lib}/%{name}/modules %install -rm -rf $RPM_BUILD_ROOT -%{__make} install TLS=1 LIBDIR=%{_lib} \ +rm -rf %{buildroot} +make install TLS=1 LIBDIR=%{_lib} \ exclude_modules="%EXCLUDE_MODULES" \ basedir=%{buildroot} prefix=%{_prefix} \ cfg-prefix=%{buildroot} \ @@ -655,20 +663,20 @@ rm -rf $RPM_BUILD_ROOT DBTEXTON=yes # fixed dbtext documentation installation # clean some things -mkdir -p $RPM_BUILD_ROOT/%{perl_vendorlib} -if [ -d "$RPM_BUILD_ROOT/%{_prefix}/perl" ]; then +mkdir -p %{buildroot}/%{perl_vendorlib} +if [ -d "%{buildroot}/%{_prefix}/perl" ]; then # for fedora>=11 - mv $RPM_BUILD_ROOT/%{_prefix}/perl/* \ - $RPM_BUILD_ROOT/%{perl_vendorlib}/ + mv %{buildroot}/%{_prefix}/perl/* \ + %{buildroot}/%{perl_vendorlib}/ else # for fedora<=10 - mv $RPM_BUILD_ROOT/%{_libdir}/opensips/perl/* \ - $RPM_BUILD_ROOT/%{perl_vendorlib}/ + mv %{buildroot}/%{_libdir}/opensips/perl/* \ + %{buildroot}/%{perl_vendorlib}/ fi -mv $RPM_BUILD_ROOT/%{_sysconfdir}/opensips/tls/README \ - $RPM_BUILD_ROOT/%{_docdir}/opensips/README.tls -rm -f $RPM_BUILD_ROOT%{_docdir}/opensips/INSTALL -mv $RPM_BUILD_ROOT/%{_docdir}/opensips docdir +mv %{buildroot}/%{_sysconfdir}/opensips/tls/README \ + %{buildroot}/%{_docdir}/opensips/README.tls +rm -f %{buildroot}%{_docdir}/opensips/INSTALL +mv %{buildroot}/%{_docdir}/opensips docdir # recode documentation for i in docdir/*; do @@ -677,26 +685,26 @@ for i in docdir/*; do rm -f $i.old done -%if 0%{?fedora} > 16 -# install systemd files -install -D -m 0644 -p packaging/fedora/%{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service -install -D -m 0644 -p packaging/fedora/%{name}.tmpfiles.conf $RPM_BUILD_ROOT%{_sysconfdir}/tmpfiles.d/%{name}.conf -mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/%{name} +%if 0%{?el5}%{?el6} +install -p -D -m 755 packaging/fedora/opensips.init %{buildroot}%{_initrddir}/opensips %else -install -p -D -m 755 packaging/fedora/opensips.init $RPM_BUILD_ROOT%{_initrddir}/opensips +# install systemd files +install -D -m 0644 -p packaging/fedora/%{name}.service %{buildroot}%{_unitdir}/%{name}.service +install -D -m 0644 -p packaging/fedora/%{name}.tmpfiles.conf %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf +mkdir -p %{buildroot}%{_localstatedir}/run/%{name} %endif echo -e "\nETCDIR=\"%{_sysconfdir}/opensips\"\n" \ - >> $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/opensipsctlrc + >> %{buildroot}%{_sysconfdir}/%{name}/opensipsctlrc #install sysconfig file -install -D -p -m 644 packaging/fedora/%{name}.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} +install -D -p -m 644 packaging/fedora/%{name}.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/%{name} %clean -rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %pre -%if 0%{?fedora} > 16 +%if 0%{?el7}%{?fedora} getent group %{name} >/dev/null || groupadd -r %{name} getent passwd %{name} >/dev/null || \ useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ @@ -704,27 +712,20 @@ useradd -r -g %{name} -d %{_localstatedir}/run/%{name} -s /sbin/nologin \ %endif %post -%if 0%{?fedora} > 16 -if [ $1 -eq 1 ] ; then - # Initial installation - /bin/systemctl daemon-reload >/dev/null 2>&1 || : -fi -%else +%if 0%{?el5}%{?el6} /sbin/chkconfig --add %{name} +%else +%systemd_post %{name}.service %endif %preun -%if 0%{?fedora} > 16 -if [ $1 -eq 0 ] ; then - # Package removal, not upgrade - /bin/systemctl --no-reload disable %{name}.service > /dev/null 2>&1 || : - /bin/systemctl stop %{name}.service > /dev/null 2>&1 || : +%if 0%{?el5}%{?el6} +if [ $1 = 0 ] ; then +/sbin/service %{name} stop >/dev/null 2>&1 +/sbin/chkconfig --del %{name} fi %else -if [ $1 = 0 ]; then - /sbin/service %{name} stop > /dev/null 2>&1 - /sbin/chkconfig --del %{name} -fi +%systemd_preun %{name}.service %endif %if 0%{?fedora} > 16 @@ -761,12 +762,12 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %dir %{_libdir}/opensips/opensipsctl/ %dir %{_libdir}/opensips/opensipsctl/dbtextdb/ -%if 0%{?fedora} > 16 +%if 0%{?el5}%{?el6} +%attr(755,root,root) %{_initrddir}/opensips +%else %{_unitdir}/%{name}.service %{_sysconfdir}/tmpfiles.d/%{name}.conf %dir %attr(0755, opensips, opensips) %{_localstatedir}/run/%{name} -%else -%attr(755,root,root) %{_initrddir}/opensips %endif %config(noreplace) %{_sysconfdir}/opensips/dictionary.opensips @@ -826,6 +827,7 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/avpops.so %{_libdir}/opensips/modules/benchmark.so %{_libdir}/opensips/modules/cachedb_local.so +%{_libdir}/opensips/modules/cachedb_sql.so %{_libdir}/opensips/modules/call_control.so %{_libdir}/opensips/modules/closeddial.so %{_libdir}/opensips/modules/cfgutils.so @@ -841,6 +843,9 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/domainpolicy.so %{_libdir}/opensips/modules/drouting.so %{_libdir}/opensips/modules/enum.so +%{_libdir}/opensips/modules/event_datagram.so +%{_libdir}/opensips/modules/event_route.so +%{_libdir}/opensips/modules/event_xmlrpc.so %{_libdir}/opensips/modules/exec.so %{_libdir}/opensips/modules/gflags.so %{_libdir}/opensips/modules/group.so @@ -892,6 +897,7 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %doc docdir/README.avpops %doc docdir/README.benchmark %doc docdir/README.cachedb_local +%doc docdir/README.cachedb_sql %doc docdir/README.call_control %doc docdir/README.closeddial %doc docdir/README.cfgutils @@ -907,6 +913,9 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %doc docdir/README.domainpolicy %doc docdir/README.drouting %doc docdir/README.enum +%doc docdir/README.event_datagram +%doc docdir/README.event_route +%doc docdir/README.event_xmlrpc %doc docdir/README.exec %doc docdir/README.gflags %doc docdir/README.group @@ -995,10 +1004,6 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/db_http.so %doc docdir/README.db_http -%files event_datagram -%{_libdir}/opensips/modules/event_datagram.so -%doc docdir/README.event_datagram - %files event_rabbitmq %{_libdir}/opensips/modules/event_rabbitmq.so %doc docdir/README.event_rabbitmq @@ -1077,7 +1082,7 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %files perlvdb %dir %{perl_vendorlib}/OpenSIPS/VDB %dir %{perl_vendorlib}/OpenSIPS/VDB/Adapter -%{_libdir}/opensips/modules/perlvdb.so +%{_libdir}/opensips/modules/db_perlvdb.so %{perl_vendorlib}/OpenSIPS/VDB.pm %{perl_vendorlib}/OpenSIPS/VDB/Adapter/AccountingSIPtrace.pm %{perl_vendorlib}/OpenSIPS/VDB/Adapter/Alias.pm @@ -1091,7 +1096,12 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %{perl_vendorlib}/OpenSIPS/VDB/Result.pm %{perl_vendorlib}/OpenSIPS/VDB/VTab.pm %{perl_vendorlib}/OpenSIPS/VDB/Value.pm -%doc docdir/README.perlvdb +%doc docdir/README.db_perlvdb + +%files pi_http +%{_libdir}/opensips/modules/pi_http.so +%{_datadir}/opensips/pi_http/ +%doc docdir/README.pi_http %files postgresql %{_libdir}/opensips/modules/db_postgres.so @@ -1194,6 +1204,10 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %{_libdir}/opensips/modules/db_unixodbc.so %doc docdir/README.db_unixodbc +%files xcap +%{_libdir}/opensips/modules/xcap.so +%doc docdir/README.xcap + %files xcap_client %{_libdir}/opensips/modules/xcap_client.so %doc docdir/README.xcap_client @@ -1207,6 +1221,9 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} %doc docdir/README.xmpp %changelog +* Tue Aug 20 2013 Peter Lemenkov - 1.9.1-1 +- Ver. 1.9.1 + * Sat Aug 03 2013 Fedora Release Engineering - 1.8.2-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild @@ -1365,14 +1382,14 @@ chown -R %{opensips_user}:%{opensips_group} %{_sysconfdir}/%{name} * Sun Feb 07 2010 Remi Collet - 1.6.1-2 - rebuilt against new libmemcached -* Thu Dec 22 2009 John Khvatov - 1.6.1-1 +* Tue Dec 22 2009 John Khvatov - 1.6.1-1 - Updated to 1.6.1 - Dropped upstreamed patches * Wed Nov 04 2009 John Khvatov - 1.6.0-4 - Fixed typo: pia_mi to pua_mi in presence_xcapdiff dependencies -* Thu Nov 03 2009 John Khvatov - 1.6.0-3 +* Tue Nov 03 2009 John Khvatov - 1.6.0-3 - Added patch for compatibility with new openssl * Thu Oct 29 2009 John Khvatov - 1.6.0-2 diff --git a/sources b/sources index 83dfc66..20e3202 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -c466984e0afefdc7f93fbd63fe92b1f6 opensips-1.8.2_src.tar.gz +0b7b93f4df29a96daedf12e490e7ec86 opensips-1.9.1_src.tar.gz