From cf44b014afe75d2ee8acc8f731cc30a3128182d5 Mon Sep 17 00:00:00 2001 From: dzenichev Date: Thu, 21 Jul 2022 15:23:13 +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 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 829ad5d76c50584299ddbd1604978fb546e0a300) --- debian/patches/series | 1 + ...ly_dialog_transaction_record_loading.patch | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+) 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..4a3864dc0 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 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..e3c381609 --- /dev/null +++ b/debian/patches/upstream/topos_redis_use_tag_based_on_direction_for_early_dialog_transaction_record_loading.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);