TT#185450 topos_redis: use tag based on direction for early dialog

"Use a tag based on the request direction, for an early
transaction record loading."

Important backport from the upstream which we lack in the 5.6.0
version of the kamailio, which is present in mr10.5 .

Without that UPDATE processing is still not working correctly
within an early stage of a dialog.

Change-Id: I61ba4251f395bf5e72aeab450b624cdfaaf9e06c
(cherry picked from commit 829ad5d76c)
mr10.5.1
dzenichev 4 years ago
parent 94a2ebf0c6
commit cf44b014af

@ -42,6 +42,7 @@ upstream/dialog-dlg_get_var-assure-return-null-on-error.patch
upstream/dialog-w_dlg_get_var-fix-incompatible-pointer.patch
upstream/topos-skip-adding-contact-header-for-BYE-CANCEL-PRAC.patch
upstream/presence-No-autocommit-rollback-if-no-active-watcher.patch
upstream/topos_redis_use_tag_based_on_direction_for_early_dialog_transaction_record_loading.patch
### relevant for upstream
sipwise/core-fix-freeaddrinfo-coredump.patch
sipwise/pua_dialoginfo-refresh_pubruri_avps_flag.patch

@ -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);
Loading…
Cancel
Save