mirror of https://github.com/sipwise/kamailio.git
Change-Id: Ie7b9f1bd6ba89b3d696b04011854760fbfb71407mr9.5.7
parent
64d31156fa
commit
d5a53e8e0e
@ -1,24 +0,0 @@
|
||||
From: Victor Seva <vseva@sipwise.com>
|
||||
Date: Mon, 28 Feb 2022 15:24:21 +0100
|
||||
Subject: db_redis: clean previous connection before trying to reconnect
|
||||
|
||||
---
|
||||
src/modules/db_redis/redis_connection.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/src/modules/db_redis/redis_connection.c b/src/modules/db_redis/redis_connection.c
|
||||
index dd421a7..d6c2416 100644
|
||||
--- a/src/modules/db_redis/redis_connection.c
|
||||
+++ b/src/modules/db_redis/redis_connection.c
|
||||
@@ -112,6 +112,11 @@ int db_redis_connect(km_redis_con_t *con) {
|
||||
db = atoi(con->id->database);
|
||||
reply = NULL;
|
||||
|
||||
+ if(con->con) {
|
||||
+ LM_DBG("free old connection first\n");
|
||||
+ redisFree(con->con);
|
||||
+ }
|
||||
+
|
||||
// TODO: introduce require_master mod-param and check if we're indeed master
|
||||
// TODO: on carrier, if we have db fail-over, the currently connected
|
||||
// redis server will become slave without dropping connections?
|
||||
@ -1,21 +0,0 @@
|
||||
From: Victor Seva <vseva@sipwise.com>
|
||||
Date: Mon, 4 Jul 2022 15:49:20 +0200
|
||||
Subject: tm: check T just in case before UNREF
|
||||
|
||||
---
|
||||
src/modules/tm/t_funcs.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/modules/tm/t_funcs.h b/src/modules/tm/t_funcs.h
|
||||
index 6830b13..dbbdc19 100644
|
||||
--- a/src/modules/tm/t_funcs.h
|
||||
+++ b/src/modules/tm/t_funcs.h
|
||||
@@ -110,7 +110,7 @@ int send_pr_buffer( struct retr_buf *rb, void *buf, int len);
|
||||
|
||||
#define UNREF_NOSTATS(_T_cell) \
|
||||
do{\
|
||||
- if (atomic_dec_and_test(&(_T_cell)->ref_count)){ \
|
||||
+ if (_T_cell && atomic_dec_and_test(&(_T_cell)->ref_count)){ \
|
||||
unlink_timers((_T_cell)); \
|
||||
free_cell((_T_cell)); \
|
||||
}\
|
||||
@ -1,43 +0,0 @@
|
||||
--- a/src/modules/topos_redis/topos_redis_storage.c
|
||||
+++ b/src/modules/topos_redis/topos_redis_storage.c
|
||||
@@ -54,6 +54,10 @@ static str _tps_redis_dprefix = str_init
|
||||
|
||||
static char _tps_redis_cbuf[TPS_REDIS_DATA_SIZE];
|
||||
|
||||
+static str _tps_redis_empty = str_init("");
|
||||
+
|
||||
+#define TPS_REDIS_STRZ(_s) ((_s).s)?(_s):(_tps_redis_empty)
|
||||
+
|
||||
/**
|
||||
* storage keys
|
||||
*/
|
||||
@@ -594,6 +598,7 @@ int tps_redis_load_initial_method_branch
|
||||
str skey = STR_NULL;
|
||||
str sval = STR_NULL;
|
||||
str xuuid = str_init("");
|
||||
+ str xtag = str_init("");
|
||||
str smethod = str_init("INVITE");
|
||||
|
||||
if(msg==NULL || md==NULL || sd==NULL)
|
||||
@@ -615,6 +620,12 @@ int tps_redis_load_initial_method_branch
|
||||
memset(argvlen, 0, TPS_REDIS_NR_KEYS * sizeof(size_t));
|
||||
argc = 0;
|
||||
|
||||
+ if(md->direction==TPS_DIR_DOWNSTREAM) {
|
||||
+ xtag = TPS_REDIS_STRZ(md->b_tag);
|
||||
+ } else {
|
||||
+ xtag = TPS_REDIS_STRZ(md->a_tag);
|
||||
+ }
|
||||
+
|
||||
if(md->a_uuid.len>1) {
|
||||
xuuid.s = md->a_uuid.s + 1;
|
||||
xuuid.len = md->a_uuid.len - 1;
|
||||
@@ -641,7 +652,7 @@ int tps_redis_load_initial_method_branch
|
||||
_tps_redis_bprefix.len, _tps_redis_bprefix.s,
|
||||
smethod.len, smethod.s,
|
||||
md->a_callid.len, md->a_callid.s,
|
||||
- md->b_tag.len, md->b_tag.s,
|
||||
+ xtag.len, xtag.s,
|
||||
xuuid.len, xuuid.s);
|
||||
if(rkey.len<0 || rkey.len>=TPS_REDIS_DATA_SIZE) {
|
||||
LM_ERR("error or insufficient buffer size: %d\n", rkey.len);
|
||||
@ -1,20 +0,0 @@
|
||||
--- a/src/modules/topos/tps_msg.c
|
||||
+++ b/src/modules/topos/tps_msg.c
|
||||
@@ -866,7 +866,7 @@ int tps_request_received(sip_msg_t *msg,
|
||||
|
||||
tps_storage_lock_release(&lkey);
|
||||
|
||||
- if(use_branch) {
|
||||
+ if(use_branch && direction == TPS_DIR_DOWNSTREAM) {
|
||||
nuri = stsd.b_contact;
|
||||
} else {
|
||||
if(direction == TPS_DIR_UPSTREAM) {
|
||||
@@ -884,7 +884,7 @@ int tps_request_received(sip_msg_t *msg,
|
||||
}
|
||||
}
|
||||
|
||||
- if(use_branch) {
|
||||
+ if(use_branch && direction == TPS_DIR_DOWNSTREAM) {
|
||||
if(tps_reappend_route(msg, &stsd, &stsd.s_rr, 1) < 0) {
|
||||
LM_ERR("failed to reappend s-route\n");
|
||||
return -1;
|
||||
@ -1,49 +0,0 @@
|
||||
--- a/src/modules/topos/tps_msg.c
|
||||
+++ b/src/modules/topos/tps_msg.c
|
||||
@@ -803,6 +803,7 @@ int tps_request_received(sip_msg_t *msg,
|
||||
uint32_t direction = TPS_DIR_DOWNSTREAM;
|
||||
int ret;
|
||||
int use_branch = 0;
|
||||
+ unsigned int metid = 0;
|
||||
|
||||
LM_DBG("handling incoming request\n");
|
||||
|
||||
@@ -835,10 +836,11 @@ int tps_request_received(sip_msg_t *msg,
|
||||
if(tps_storage_load_dialog(msg, &mtsd, &stsd) < 0) {
|
||||
goto error;
|
||||
}
|
||||
- if(((get_cseq(msg)->method_id) & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
|
||||
- && stsd.b_contact.len <= 0) {
|
||||
+ metid = get_cseq(msg)->method_id;
|
||||
+ if((metid & (METHOD_BYE|METHOD_PRACK|METHOD_UPDATE))
|
||||
+ && stsd.b_contact.len <= 0) {
|
||||
/* no B-side contact, look for INVITE transaction record */
|
||||
- if((get_cseq(msg)->method_id) & (METHOD_UPDATE)) {
|
||||
+ if(metid & (METHOD_BYE|METHOD_UPDATE)) {
|
||||
/* detect direction - via from-tag */
|
||||
if(tps_dlg_detect_direction(msg, &stsd, &direction) < 0) {
|
||||
goto error;
|
||||
@@ -916,7 +918,7 @@ int tps_request_received(sip_msg_t *msg,
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
- if((get_cseq(msg)->method_id)&(METHOD_SUBSCRIBE)) {
|
||||
+ if(metid & METHOD_SUBSCRIBE) {
|
||||
if(tps_storage_update_dialog(msg, &mtsd, &stsd, TPS_DBU_CONTACT|TPS_DBU_TIME)<0) {
|
||||
goto error;
|
||||
}
|
||||
--- a/src/modules/topos/tps_storage.c
|
||||
+++ b/src/modules/topos/tps_storage.c
|
||||
@@ -1135,7 +1135,11 @@ int tps_db_load_branch(sip_msg_t *msg, t
|
||||
db_ops[nr_keys]=OP_EQ;
|
||||
db_vals[nr_keys].type = DB1_STR;
|
||||
db_vals[nr_keys].nul = 0;
|
||||
- db_vals[nr_keys].val.str_val = TPS_STRZ(md->b_tag);
|
||||
+ if(md->direction==TPS_DIR_DOWNSTREAM) {
|
||||
+ db_vals[nr_keys].val.str_val = TPS_STRZ(md->b_tag);
|
||||
+ } else {
|
||||
+ db_vals[nr_keys].val.str_val = TPS_STRZ(md->a_tag);
|
||||
+ }
|
||||
nr_keys++;
|
||||
|
||||
db_keys[nr_keys]=&tt_col_s_method;
|
||||
Loading…
Reference in new issue