From f9e93b90775ef039c13f77bc70ac2dcc92e9893b Mon Sep 17 00:00:00 2001 From: dzenichev Date: Fri, 15 Jul 2022 17:55:02 +0200 Subject: [PATCH] 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 out master. Without that UPDATE processing is still not working correctly within an early stage of a dialog. Change-Id: I3e151a604ea3ba7de9bb87e4f393cf9dae6120bf --- debian/patches/series | 2 +- ...ly_dialog_transaction_record_loading.patch | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 debian/patches/upstream/topos_redis_use_tag_based_on_direction_for_early_dialog_transaction_record_loading.patch diff --git a/debian/patches/series b/debian/patches/series index b8afd2bc3..60e01c8f9 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -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 @@ -78,4 +79,3 @@ sipwise/tm-check-again-T-just-in-case-before-UNREF.patch ## git checkout -- debian/ ### git commit + git-review as usual ### - diff --git a/debian/patches/upstream/topos_redis_use_tag_based_on_direction_for_early_dialog_transaction_record_loading.patch b/debian/patches/upstream/topos_redis_use_tag_based_on_direction_for_early_dialog_transaction_record_loading.patch new file mode 100644 index 000000000..7d66ecbef --- /dev/null +++ b/debian/patches/upstream/topos_redis_use_tag_based_on_direction_for_early_dialog_transaction_record_loading.patch @@ -0,0 +1,59 @@ +From 06679174fc3d9cc6a18bc3edc7f2fb985c50d27b Mon Sep 17 00:00:00 2001 +From: Daniel-Constantin Mierla +Date: Fri, 24 Jun 2022 10:50:08 +0200 +Subject: [PATCH] topos_redis: use tag based on direction for early dialog + transaction record loading + +- GH #3112 +--- + src/modules/topos_redis/topos_redis_storage.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/modules/topos_redis/topos_redis_storage.c b/src/modules/topos_redis/topos_redis_storage.c +index 456d54ebee..a1d6c85d01 100644 +--- a/src/modules/topos_redis/topos_redis_storage.c ++++ b/src/modules/topos_redis/topos_redis_storage.c +@@ -54,6 +54,11 @@ static str _tps_redis_dprefix = str_init("d:z:"); + + 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 +599,7 @@ int tps_redis_load_initial_method_branch(sip_msg_t *msg, tps_data_t *md, tps_dat + 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 +621,11 @@ int tps_redis_load_initial_method_branch(sip_msg_t *msg, tps_data_t *md, tps_dat + 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(sip_msg_t *msg, tps_data_t *md, tps_dat + _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); +-- +2.34.1 +