mirror of https://github.com/sipwise/kamailio.git
It's been noticed that older version of kamailio experience a list of issues related to the Topos module, which has been already fixed in the upstream master. We have to backport this in order to make possible normal usage of the Topos module, otherwise certain things such as processing of UPDATE during early-stage of the dialog will not work correct. List of commits: - ceb688b3d364bb7b8d9f52b7238d560cb4e30b3d (use direction for loading invite record for other early dialog requests) - c309122864eaa2bfa58253290bed49084ccc9302 (restore attributes based on direction for early dialog requests) - 06679174fc3d9cc6a18bc3edc7f2fb985c50d27b (use tag based on direction for early dialog transaction record loading) Change-Id: I2566698a518b467243fb57ea073e9010501fe750mr9.5.6
parent
b6244505f0
commit
069d5de22d
@ -0,0 +1,43 @@
|
||||
--- 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);
|
@ -0,0 +1,20 @@
|
||||
--- 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;
|
@ -0,0 +1,49 @@
|
||||
--- 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