MT#56146 refresh patches and remove already applied upstream

Change-Id: Idbfff94f077cf99abb803b203620918aba795810
mr11.1
Victor Seva 3 years ago
parent cdf863d1ab
commit 4f2dc60b86

@ -7,7 +7,7 @@ Subject: no_lib64_on_64_bits
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/Makefile.defs b/src/Makefile.defs
index d8887dc..0809daa 100644
index 2697e5c..380762a 100644
--- a/src/Makefile.defs
+++ b/src/Makefile.defs
@@ -458,15 +458,7 @@ endif

@ -40,17 +40,13 @@ upstream/dialog-reworked-kemi-export-for-dlg_get_var.patch
upstream/dialog-fix-ki_dlg_get_var-introduced-previously.patch
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
sipwise/pua_dialoginfo-use-lock-when-use_puburi_avps-is-set.patch
sipwise/pua_dialoginfo-local_identity_dlg_var.patch
sipwise/dialplan-don-t-stop-loading-rules-on-error.patch
sipwise/cfgt-skip_unknown.patch
sipwise/topos-don-t-insert-contact-header-for-4xx-replies.patch
sipwise/db_redis_skip_empty_keys.patch
sipwise/db_redis_graceful_scan.patch
sipwise/db_redis_sscan.patch
@ -59,10 +55,7 @@ sipwise/kamctl-TMPDIR-config.patch
sipwise/lcr-stopper_mode-parameter.patch
sipwise/dialog-support-profile_get_size-for-all-profiles.patch
sipwise/dialog-dlg_set_var-support-empty-totag-param.patch
sipwise/pv_headers-rework-pvh_remove_header_param.patch
### active development
sipwise/presence-be-more-resilient-doing-clean-up.patch
sipwise/tm-check-again-T-just-in-case-before-UNREF.patch
upstream/tm-new-inter-module-API-function-t_find.patch
upstream/pv_headers-use-tm.t_find-API.patch
upstream/tm-added-t_unset-intermodule-API-function.patch

@ -13,7 +13,7 @@ Subject: add_lcr_rate_module
create mode 100644 src/modules/lcr_rate/lcr_rate_mod.c
diff --git a/src/Makefile.groups b/src/Makefile.groups
index 3a10601..77a3881 100644
index e2d72c5..4837390 100644
--- a/src/Makefile.groups
+++ b/src/Makefile.groups
@@ -109,6 +109,9 @@ mod_list_sctp=sctp

@ -17,7 +17,7 @@ Subject: add_pcem_module
create mode 100644 src/modules/pcem/pcem_mod.h
diff --git a/src/Makefile.groups b/src/Makefile.groups
index c388489..3a10601 100644
index bd111ca..e2d72c5 100644
--- a/src/Makefile.groups
+++ b/src/Makefile.groups
@@ -30,8 +30,8 @@ mod_list_db=acc alias_db auth_db avpops cfg_db db_text db_flatstore \

@ -22,7 +22,7 @@ Subject: add_presence_dfks_module
create mode 100644 src/modules/presence_dfks/presence_dfks.h
diff --git a/src/Makefile.groups b/src/Makefile.groups
index 197b6a9..6d31c8c 100644
index 6b9e3b5..b357a3f 100644
--- a/src/Makefile.groups
+++ b/src/Makefile.groups
@@ -118,7 +118,7 @@ mod_list_presence=presence presence_conference presence_dialoginfo \

@ -11,7 +11,7 @@ Subject: add_tcap_module
create mode 100644 src/modules/tcap/tcap_mod.c
diff --git a/src/Makefile.groups b/src/Makefile.groups
index 77a3881..197b6a9 100644
index 4837390..6b9e3b5 100644
--- a/src/Makefile.groups
+++ b/src/Makefile.groups
@@ -214,6 +214,9 @@ mod_list_erlang=erlang

@ -1,30 +0,0 @@
From: Victor Seva <vseva@sipwise.com>
Date: Wed, 22 Jun 2022 12:26:46 +0200
Subject: core: fix freeaddrinfo coredump
> #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
> #1 0x00007fbb5e515537 in __GI_abort () at abort.c:79
> #2 0x00007fbb5e56e768 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fbb5e67ce2d "%s\n") at ../sysdeps/posix/libc_fatal.c:155
> #3 0x00007fbb5e575a5a in malloc_printerr (str=str@entry=0x7fbb5e67b05a "free(): invalid pointer") at malloc.c:5347
> #4 0x00007fbb5e576c14 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:4173
> #5 0x00007fbb5e5d8da0 in __GI_freeaddrinfo (ai=ai@entry=0x7fbb5e83ba10) at ../sysdeps/posix/getaddrinfo.c:2520
> #6 0x000055ba099dcd0b in log_init () at core/dprint.c:482
> #7 0x000055ba09970d7a in main (argc=10, argv=0x7ffde85a1788) at main.c:2055
---
src/core/dprint.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/core/dprint.c b/src/core/dprint.c
index 9b01dc8..f4780bb 100644
--- a/src/core/dprint.c
+++ b/src/core/dprint.c
@@ -459,7 +459,8 @@ static str log_prefix_str = STR_NULL;
void log_init(void)
{
- struct addrinfo hints, *info;
+ struct addrinfo hints;
+ struct addrinfo *info = NULL;
int gai_result;
char hostname[1024];

@ -8,10 +8,10 @@ Subject: MT#55631 dialog: dlg_set_var() support empty totag parameter
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 3ffcd36..a377515 100644
index e9ed5d9..90a20f6 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -1660,7 +1660,7 @@ static int ki_dlg_set_var(sip_msg_t *msg, str *sc, str *sf, str *st, str *key, s
@@ -1663,7 +1663,7 @@ static int ki_dlg_set_var(sip_msg_t *msg, str *sc, str *sf, str *st, str *key, s
LM_ERR("invalid From tag parameter\n");
return -1;
}
@ -20,7 +20,7 @@ index 3ffcd36..a377515 100644
LM_ERR("invalid To tag parameter\n");
return -1;
}
@@ -1704,11 +1704,7 @@ static int w_dlg_set_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
@@ -1707,11 +1707,7 @@ static int w_dlg_set_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
LM_ERR("unable to get To Tag\n");
return -1;
}

@ -3,18 +3,21 @@ Date: Mon, 27 Jun 2022 21:04:29 +0200
Subject: dialog: support profile_get_size for all profiles
---
src/modules/dialog/dialog.c | 35 ++++++++++++++++++++++++++++++++
src/modules/dialog/dlg_profile.c | 8 +++++++
src/modules/dialog/dlg_profile.h | 5 ++++
src/modules/dialog/doc/dialog_admin.xml | 22 ++++++++++++++++++++
src/modules/dialog/dialog.c | 35 +++++++++++++++++++++++++++++++++
src/modules/dialog/dlg_profile.c | 8 ++++++++
src/modules/dialog/dlg_profile.h | 5 +++++
src/modules/dialog/doc/dialog_admin.xml | 22 +++++++++++++++++++++
4 files changed, 70 insertions(+)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 6545444..e9ed5d9 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -2756,6 +2756,33 @@ static void internal_rpc_profile_get_siz
@@ -2758,6 +2758,33 @@ static void internal_rpc_profile_get_size(rpc_t *rpc, void *c, str *profile_name
return;
}
/*!
+/*!
+ * \brief Helper function that outputs the sizes of all profiles via the RPC interface
+ * \see rpc_profile_get_sizes
+ * \see rpc_profile_w_value_get_sizes
@ -41,11 +44,10 @@ Subject: dialog: support profile_get_size for all profiles
+ return;
+}
+
+/*!
/*!
* \brief Helper function that outputs the dialogs belonging to a given profile via the RPC interface
* \see rpc_profile_print_dlgs
* \see rpc_profile_w_value_print_dlgs
@@ -2847,6 +2874,9 @@ static const char *rpc_dlg_set_state_doc
@@ -2850,6 +2877,9 @@ static const char *rpc_dlg_set_state_doc[3] = {
static const char *rpc_profile_get_size_doc[2] = {
"Returns the number of dialogs belonging to a profile", 0
};
@ -55,7 +57,7 @@ Subject: dialog: support profile_get_size for all profiles
static const char *rpc_profile_print_dlgs_doc[2] = {
"Lists all the dialogs belonging to a profile", 0
};
@@ -3052,6 +3082,10 @@ static void rpc_profile_get_size(rpc_t *
@@ -3055,6 +3085,10 @@ static void rpc_profile_get_size(rpc_t *rpc, void *c) {
}
return;
}
@ -66,7 +68,7 @@ Subject: dialog: support profile_get_size for all profiles
static void rpc_profile_print_dlgs(rpc_t *rpc, void *c) {
str profile_name = {NULL,0};
str value = {NULL,0};
@@ -3469,6 +3503,7 @@ static rpc_export_t rpc_methods[] = {
@@ -3472,6 +3506,7 @@ static rpc_export_t rpc_methods[] = {
{"dlg.dlg_list_ctx", rpc_print_dlg_ctx, rpc_print_dlg_ctx_doc, 0},
{"dlg.end_dlg", rpc_end_dlg_entry_id, rpc_end_dlg_entry_id_doc, 0},
{"dlg.profile_get_size", rpc_profile_get_size, rpc_profile_get_size_doc, 0},
@ -74,9 +76,11 @@ Subject: dialog: support profile_get_size for all profiles
{"dlg.profile_list", rpc_profile_print_dlgs, rpc_profile_print_dlgs_doc, RET_ARRAY},
{"dlg.bridge_dlg", rpc_dlg_bridge, rpc_dlg_bridge_doc, 0},
{"dlg.terminate_dlg", rpc_dlg_terminate_dlg, rpc_dlg_terminate_dlg_doc, 0},
diff --git a/src/modules/dialog/dlg_profile.c b/src/modules/dialog/dlg_profile.c
index f9ad20f..0d3e62f 100644
--- a/src/modules/dialog/dlg_profile.c
+++ b/src/modules/dialog/dlg_profile.c
@@ -126,6 +126,14 @@ int add_profile_definitions( char* profi
@@ -126,6 +126,14 @@ int add_profile_definitions( char* profiles, unsigned int has_value)
return 0;
}
@ -91,9 +95,11 @@ Subject: dialog: support profile_get_size for all profiles
/*!
* \brief Search a dialog profile in the global list
diff --git a/src/modules/dialog/dlg_profile.h b/src/modules/dialog/dlg_profile.h
index 3dc7be8..7a4f8b0 100644
--- a/src/modules/dialog/dlg_profile.h
+++ b/src/modules/dialog/dlg_profile.h
@@ -108,6 +108,11 @@ int add_profile_definitions( char* profi
@@ -108,6 +108,11 @@ int add_profile_definitions( char* profiles, unsigned int has_value);
*/
void destroy_dlg_profiles(void);
@ -105,6 +111,8 @@ Subject: dialog: support profile_get_size for all profiles
/*!
* \brief Search a dialog profile in the global list
diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml
index 6fcaaf7..906151d 100644
--- a/src/modules/dialog/doc/dialog_admin.xml
+++ b/src/modules/dialog/doc/dialog_admin.xml
@@ -2856,6 +2856,28 @@ dlg_reset_property("timeout-noreset");

@ -1,209 +0,0 @@
From: Victor Seva <vseva@sipwise.com>
Date: Wed, 29 Jun 2022 09:03:14 +0200
Subject: presence: be more resilient doing clean up of presentity values
previously if an error was found we were bailing out and the value
was kept so at next round the value will be there and no more values
where removed
---
src/modules/presence/publish.c | 97 +++++++++++++++++++++++++-----------------
1 file changed, 58 insertions(+), 39 deletions(-)
diff --git a/src/modules/presence/publish.c b/src/modules/presence/publish.c
index 8889a2e..480ac7b 100644
--- a/src/modules/presence/publish.c
+++ b/src/modules/presence/publish.c
@@ -69,6 +69,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
int n_db_cols = 0, n_result_cols = 0;
int event_col, etag_col, user_col, domain_col;
int i = 0, num_watchers = 0;
+ pres_ev_t fake;
presentity_t pres;
str uri = {0, 0}, event, *rules_doc = NULL;
static str query_str;
@@ -121,6 +122,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
rows = RES_ROWS(result);
for(i = 0; i < RES_ROW_N(result); i++) {
+ num_watchers = 0;
values = ROW_VALUES(&rows[i]);
memset(&pres, 0, sizeof(presentity_t));
@@ -134,28 +136,33 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
event.len = strlen(event.s);
pres.event = contains_event(&event, NULL);
if(pres.event == NULL || pres.event->evp == NULL) {
- LM_ERR("event not found\n");
- goto error;
+ LM_ERR("event[%.*s] not found\n", STR_FMT(&event));
+ memset(&fake, 0, sizeof(pres_ev_t));
+ fake.name = event;
+ pres.event = &fake;
+ goto simple_error;
}
if(uandd_to_uri(pres.user, pres.domain, &uri) < 0) {
- LM_ERR("constructing uri\n");
- goto error;
+ LM_ERR("constructing uri from [user]=%.*s [domain]=%.*s\n",
+ STR_FMT(&pres.user), STR_FMT(&pres.domain));
+ goto simple_error;
}
/* delete from hash table */
if(publ_cache_mode==PS_PCACHE_HYBRID
&& delete_phtable(&uri, pres.event->evp->type) < 0) {
- LM_ERR("deleting from presentity hash table\n");
- goto error;
+ LM_ERR("deleting uri[%.*s] event[%.*s] from presentity hash table\n",
+ STR_FMT(&uri), STR_FMT(&event));
+ goto simple_error;
}
- LM_DBG("found expired publish for [user]=%.*s [domanin]=%.*s\n",
+ LM_DBG("found expired publish for [user]=%.*s [domain]=%.*s\n",
pres.user.len, pres.user.s, pres.domain.len, pres.domain.s);
if(pres_force_delete == 1) {
if(delete_presentity(&pres, NULL) < 0) {
- LM_ERR("Deleting presentity\n");
+ LM_ERR("Deleting presentity uri[%.*s]\n", STR_FMT(&uri));
goto error;
}
} else if(pres_notifier_processes > 0) {
@@ -171,7 +178,7 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
if(pa_dbf.abort_transaction(pa_db) < 0)
LM_ERR("in abort_transaction\n");
}
- goto error;
+ goto next;
}
if(num_watchers > 0) {
@@ -181,12 +188,12 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
if(pa_dbf.abort_transaction(pa_db) < 0)
LM_ERR("in abort_transaction\n");
}
- goto error;
+ goto next;
}
} else {
if(delete_presentity(&pres, NULL) < 0) {
- LM_ERR("Deleting presentity\n");
- goto error;
+ LM_ERR("Deleting presentity uri[%.*s]\n", STR_FMT(&uri));
+ goto next;
}
}
if(pa_dbf.end_transaction) {
@@ -201,22 +208,30 @@ void ps_presentity_db_timer_clean(unsigned int ticks, void *param)
&pres.user, &pres.domain, &rules_doc)
< 0) {
LM_ERR("getting rules doc\n");
- goto error;
+ goto simple_error;
}
if(publ_notify(&pres, uri, NULL, &pres.etag, rules_doc) < 0) {
LM_ERR("sending Notify request\n");
- goto error;
- }
- if(rules_doc) {
- if(rules_doc->s)
- pkg_free(rules_doc->s);
- pkg_free(rules_doc);
- rules_doc = NULL;
+ goto simple_error;
}
}
- pkg_free(uri.s);
- uri.s = NULL;
+simple_error:
+ if(num_watchers == 0 && delete_presentity(&pres, NULL) < 0) {
+ LM_ERR("Deleting presentity\n");
+ }
+next:
+ if(uri.s) {
+ pkg_free(uri.s);
+ uri.s = NULL;
+ }
+ if(rules_doc) {
+ if(rules_doc->s) {
+ pkg_free(rules_doc->s);
+ }
+ pkg_free(rules_doc);
+ rules_doc = NULL;
+ }
}
} while(db_fetch_next(&pa_dbf, pres_fetch_rows, pa_db, &result) == 1
&& RES_ROW_N(result) > 0);
@@ -277,22 +292,23 @@ void ps_ptable_timer_clean(unsigned int ticks, void *param)
pres.etag = ptn->etag;
pres.event = contains_event(&ptn->event, NULL);
if(pres.event == NULL || pres.event->evp == NULL) {
- LM_ERR("event not found\n");
- goto error;
+ LM_ERR("event[%.*s] not found\n", STR_FMT(&ptn->event));
+ goto next;
}
if(uandd_to_uri(pres.user, pres.domain, &uri) < 0) {
- LM_ERR("constructing uri\n");
- goto error;
+ LM_ERR("constructing uri from [user]=%.*s [domain]=%.*s\n",
+ STR_FMT(&pres.user), STR_FMT(&pres.domain));
+ goto next;
}
- LM_DBG("found expired publish for [user]=%.*s [domanin]=%.*s\n",
+ LM_DBG("found expired publish for [user]=%.*s [domain]=%.*s\n",
pres.user.len, pres.user.s, pres.domain.len, pres.domain.s);
if(pres_force_delete == 1) {
if(ps_ptable_remove(ptn) <0) {
LM_ERR("Deleting presentity\n");
- goto error;
+ goto next;
}
} else {
if(pres.event->get_rules_doc
@@ -300,25 +316,28 @@ void ps_ptable_timer_clean(unsigned int ticks, void *param)
&pres.user, &pres.domain, &rules_doc)
< 0) {
LM_ERR("getting rules doc\n");
- goto error;
+ goto next;
}
if(publ_notify(&pres, uri, NULL, &pres.etag, rules_doc) < 0) {
LM_ERR("sending Notify request\n");
- goto error;
- }
- if(rules_doc) {
- if(rules_doc->s)
- pkg_free(rules_doc->s);
- pkg_free(rules_doc);
- rules_doc = NULL;
+ goto next;
}
}
- pkg_free(uri.s);
- uri.s = NULL;
+next:
+ if(uri.s) {
+ pkg_free(uri.s);
+ uri.s = NULL;
+ }
+ if(rules_doc) {
+ if(rules_doc->s) {
+ pkg_free(rules_doc->s);
+ }
+ pkg_free(rules_doc);
+ rules_doc = NULL;
+ }
}
-error:
for(ptn = ptlist; ptn != NULL; ptn = ptn->next) {
if(ps_ptable_remove(ptn) <0) {
LM_ERR("failed deleting presentity item\n");

@ -38,7 +38,7 @@ index 7c4f08d..3f6a639 100644
<title><varname>attribute_display</varname> (int)</title>
<para>
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index 83c4f2c..1e4f171 100644
index 8848033..fe5dc8a 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -87,6 +87,7 @@ static str caller_dlg_var = {0, 0}; /* pubruri_caller */

@ -39,7 +39,7 @@ index 191ee5f..7c4f08d 100644
<title><varname>pubruri_caller_avp</varname> (str)</title>
<para>
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index 2dae4d4..a705ed3 100644
index 1765734..9d9de31 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -41,6 +41,7 @@
@ -146,7 +146,7 @@ index 2dae4d4..a705ed3 100644
switch (type) {
case DLGCB_FAILED:
case DLGCB_TERMINATED:
@@ -884,6 +946,19 @@ void free_dlginfo_cell(void *param) {
@@ -892,6 +954,19 @@ void free_dlginfo_cell(void *param) {
}

@ -8,7 +8,7 @@ Subject: pua_dialoginfo: use lock when use_puburi_avps is set
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/modules/pua_dialoginfo/pua_dialoginfo.c b/src/modules/pua_dialoginfo/pua_dialoginfo.c
index a705ed3..83c4f2c 100644
index 9d9de31..8848033 100644
--- a/src/modules/pua_dialoginfo/pua_dialoginfo.c
+++ b/src/modules/pua_dialoginfo/pua_dialoginfo.c
@@ -353,6 +353,7 @@ __dialog_sendpublish(struct dlg_cell *dlg, int type, struct dlg_cb_params *_para
@ -45,7 +45,7 @@ index a705ed3..83c4f2c 100644
/* copy from dlg structure to dlginfo structure */
dlginfo->lifetime = override_lifetime ? override_lifetime : dlg->lifetime;
dlginfo->disable_caller_publish = disable_caller_publish;
@@ -756,20 +769,24 @@ __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
@@ -764,20 +777,24 @@ __dialog_created(struct dlg_cell *dlg, int type, struct dlg_cb_params *_params)
if ((!disable_caller_publish) && (disable_caller_publish_flag == -1 || !(request
&& (request->flags & (1<<disable_caller_publish_flag))))) {
@ -70,7 +70,7 @@ index a705ed3..83c4f2c 100644
}
}
@@ -939,9 +956,7 @@ void free_dlginfo_cell(void *param) {
@@ -947,9 +964,7 @@ void free_dlginfo_cell(void *param) {
free_str_list_all(cell->pubruris_caller);
free_str_list_all(cell->pubruris_callee);

@ -12,7 +12,7 @@ Subject: pv_headers: rework pvh_remove_header_param, take two
4 files changed, 38 insertions(+), 28 deletions(-)
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
index 7da426c..a41658e 100644
index b900ae5..fd9a619 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -222,12 +222,15 @@ static int w_pvh_header_param_exists(
@ -65,7 +65,7 @@ index 7da426c..a41658e 100644
return 1;
}
diff --git a/src/modules/pv_headers/pvh_func.c b/src/modules/pv_headers/pvh_func.c
index a6adaa1..0eddeea 100644
index 918733c..09f70ba 100644
--- a/src/modules/pv_headers/pvh_func.c
+++ b/src/modules/pv_headers/pvh_func.c
@@ -325,12 +325,16 @@ int pvh_check_header(struct sip_msg *msg, str *hname)

@ -1,238 +0,0 @@
From: Victor Seva <vseva@sipwise.com>
Date: Wed, 22 Jun 2022 15:12:33 +0200
Subject: pv_headers: rework pvh_remove_header_param
* fix KEMI interface, this is suppose to be called
like pvh_remove_header_param(header_name, string_to_remove)
* use pv buffer for temporal value
* use xavi interface to set the new value
---
src/modules/pv_headers/pv_headers.c | 63 +++++++++++++++---------
src/modules/pv_headers/pvh_func.c | 96 +++++++++++++------------------------
src/modules/pv_headers/pvh_func.h | 2 +-
3 files changed, 76 insertions(+), 85 deletions(-)
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
index fb20dfc..e555e02 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -220,15 +220,47 @@ static int w_pvh_header_param_exists(
return pvh_header_param_exists(msg, &hname, &value);
}
+static int ki_pvh_remove_header_param(struct sip_msg *msg, str *hname, str *toRemove)
+{
+ int idx;
+ int new_size;
+ str dst = STR_NULL;
+ sr_xavp_t *avi = pvh_xavi_get_child(msg, &xavi_name, hname);
+
+ for(idx=0; avi != NULL; avi = xavi_get_next(avi)) {
+ if (avi->val.type == SR_XTYPE_STR && avi->val.v.s.s != NULL) {
+ if(str_casesearch(&avi->val.v.s, toRemove) != NULL) {
+ new_size = pvh_remove_header_param_helper(&avi->val.v.s, toRemove, &dst);
+ if(dst.len == 0) {
+ LM_DBG("nothing left in the header:%.*s, remove it[%d]\n",
+ STR_FMT(hname), idx);
+ if(pvh_remove_header(msg, hname, idx) < 0)
+ return -1;
+ } else if(dst.len < 0 || new_size == avi->val.v.s.len) {
+ LM_DBG("'%.*s' not found at '%.*s'\n", STR_FMT(toRemove),
+ STR_FMT(&avi->val.v.s));
+ } else {
+ LM_DBG("old_value:'%.*s' new_value:'%.*s'\n",
+ STR_FMT(&avi->val.v.s), STR_FMT(&dst));
+ if(pvh_set_xavi(msg, &xavi_name, hname, &dst, SR_XTYPE_STR, idx, 0) < 0) {
+ LM_ERR("can't set new value\n");
+ return -1;
+ }
+ }
+ } else {
+ LM_DBG("'%.*s' not found at '%.*s'\n", STR_FMT(toRemove),
+ STR_FMT(&avi->val.v.s));
+ }
+ }
+ idx++;
+ }
+ return 1;
+}
+
static int w_pvh_remove_header_param(struct sip_msg *msg, char *p1, char *p2)
{
- int ret = -1;
- int idx = 0;
str hname = STR_NULL;
str value = STR_NULL;
- sr_xavp_t *avi=NULL;
- char tt[header_name_size];
- str br_xname = {tt, header_name_size};
if(fixup_get_svalue(msg, (gparam_p)p1, &hname) < 0)
return -1;
@@ -236,20 +268,7 @@ static int w_pvh_remove_header_param(struct sip_msg *msg, char *p1, char *p2)
if(p2 && fixup_get_svalue(msg, (gparam_p)p2, &value) < 0)
return -1;
- pvh_get_branch_xname(msg, &xavi_name, &br_xname);
-
- avi = xavi_get_child(&br_xname, &hname);
-
- while(avi)
- {
- if (avi->val.type == SR_XTYPE_STR && avi->val.v.s.s != NULL && _strnstr(avi->val.v.s.s, value.s, avi->val.v.s.len) != NULL) {
- ret = pvh_remove_header_param(msg, idx, &hname, &avi->val.v.s, &value) && ret;
- }
- idx++;
- avi = xavi_get_next(avi);
- }
-
- return ret;
+ return ki_pvh_remove_header_param(msg, &hname, &value);
}
/* clang-format off */
@@ -594,9 +613,9 @@ static sr_kemi_t pvh_kemi_exports[] = {
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE}
},
{ str_init("pv_headers"), str_init("pvh_remove_header_param"),
- SR_KEMIP_INT, pvh_remove_header_param,
- { SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_STR,
- SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE}
+ SR_KEMIP_INT, ki_pvh_remove_header_param,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE}
},
{{0, 0}, {0, 0}, 0, NULL, {0, 0, 0, 0, 0, 0}}
};
diff --git a/src/modules/pv_headers/pvh_func.c b/src/modules/pv_headers/pvh_func.c
index dde1b83..a6adaa1 100644
--- a/src/modules/pv_headers/pvh_func.c
+++ b/src/modules/pv_headers/pvh_func.c
@@ -22,7 +22,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
-
+#include "../../core/pvapi.h"
#include "../../core/strutils.h"
#include "pv_headers.h"
@@ -381,73 +381,45 @@ int pvh_header_param_exists(struct sip_msg *msg, str *hname, str *hvalue)
return -1;
}
-int pvh_remove_header_param(struct sip_msg *msg, int idx, str *hname, str *elements, str *toRemove)
+int pvh_remove_header_param_helper(str *orig, const str *toRemove, str *dst)
{
- int notTarget, writtenChars;
+ int notTarget;
+ int writtenChars = 0;
int offset = 0;
- int ret = -1;
- char *next_token;
+ char *saveptr = NULL;
char *token;
- char *result = (char*)pkg_malloc(elements->len - toRemove->len);
- char *t = (char*)pkg_malloc(elements->len+1);
-
- if (result == NULL || t == NULL)
- {
- PKG_MEM_ERROR;
- goto clean;
- }
-
- snprintf(t, elements->len+1, "%s", elements->s);
-
- token = strtok_r(t, ", ", &next_token);
- while(token)
- {
- notTarget = strncmp(token, toRemove->s, toRemove->len);
- if (notTarget)
- {
- writtenChars = snprintf(result + offset, elements->len - offset, "%s", token);
- if (writtenChars < 0 || writtenChars >= elements->len - offset)
- {
- break;
- }
- offset += writtenChars;
- }
- token = strtok_r(NULL, ", ", &next_token);
- if (token && notTarget && elements->len - offset - toRemove->len > 2)
- {
- writtenChars = snprintf(result + offset, elements->len - offset, ", ");
- if (writtenChars < 0 || writtenChars >= elements->len - offset)
- {
- break;
- }
+ char t[header_value_size];
+ char *result = pv_get_buffer();
+ int maxSize = pv_get_buffer_size();
+
+ memset(result, 0, maxSize);
+ LM_DBG("orig:'%.*s' toRemove:'%.*s'\n", STR_FMT(orig), STR_FMT(toRemove));
+ strncpy(t, orig->s, orig->len);
+ t[orig->len] = '\0';
+ token = strtok_r(t, ", ", &saveptr);
+ dst->s = NULL; dst->len = -1;
+ while(token) {
+ notTarget = strncasecmp(token, toRemove->s, toRemove->len);
+ LM_DBG("offset:%d token:%s notTarget:%d\n", offset, token, notTarget);
+ if(notTarget) {
+ writtenChars = snprintf(result + offset, maxSize - offset, "%s, ", token);
+ if(writtenChars < 0) break;
offset += writtenChars;
+ } else {
+ dst->len = 0; /* we found a token */
}
+ token = strtok_r(NULL, ", ", &saveptr);
}
- if (elements->len-toRemove->len > 0)
- {
- snprintf(elements->s, (strlen(result)%elements->len)+1, "%s", result);
- elements->len = strlen(result);
- ret = 1;
- }
- else
- {
- ret = pvh_remove_header(msg, hname, idx);
- }
-
-clean:
-
- if(t != NULL)
- {
- pkg_free(t);
- t = NULL;
- }
-
- if(result != NULL)
- {
- pkg_free(result);
- result = NULL;
+ if(offset > 0) {
+ dst->s = result;
+ if(offset > 2 && result[offset-2] == ',' && result[offset-1] == ' ') {
+ LM_DBG("remove last separator\n");
+ offset = offset - 2;
+ result[offset] = '\0';
+ }
+ dst->len = offset;
+ LM_DBG("offset:%d result:'%.*s'[%d]\n", offset, STR_FMT(dst), dst->len);
}
-
- return ret;
+ return offset;
}
diff --git a/src/modules/pv_headers/pvh_func.h b/src/modules/pv_headers/pvh_func.h
index a4e0bfa..737212c 100644
--- a/src/modules/pv_headers/pvh_func.h
+++ b/src/modules/pv_headers/pvh_func.h
@@ -39,6 +39,6 @@ int pvh_append_header(struct sip_msg *msg, str *hname, str *hvalue);
int pvh_modify_header(struct sip_msg *msg, str *hname, str *hvalue, int indx);
int pvh_remove_header(struct sip_msg *msg, str *hname, int indx);
int pvh_header_param_exists(struct sip_msg *msg, str *hname, str *hvalue);
-int pvh_remove_header_param(struct sip_msg *msg, int idx, str *hname, str *elements, str *toRemove);
+int pvh_remove_header_param_helper(str *orig, const str *toRemove, str *dst);
#endif /* PV_FUNC_H */

@ -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,25 +0,0 @@
From: Victor Seva <vseva@sipwise.com>
Date: Wed, 7 Oct 2020 15:35:50 +0200
Subject: topos: don't insert contact header for 4xx replies
unless original msg has contact
---
src/modules/topos/tps_msg.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index c01dde7..a3f123b 100644
--- a/src/modules/topos/tps_msg.c
+++ b/src/modules/topos/tps_msg.c
@@ -1167,6 +1167,11 @@ int tps_response_sent(sip_msg_t *msg)
&& msg->contact==NULL) {
contact_keep = 1;
}
+ if(contact_keep==0 && msg->first_line.u.reply.statuscode>=400
+ && msg->first_line.u.reply.statuscode<500
+ && msg->contact==NULL) {
+ contact_keep = 1;
+ }
if(contact_keep==0) {
tps_remove_headers(msg, HDR_CONTACT_T);
if(direction==TPS_DIR_DOWNSTREAM) {

@ -7,10 +7,10 @@ Subject: usrloc_dbro_pinger
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index 252bb8b..0743bc5 100644
index 4e54f96..bca621d 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -301,6 +301,8 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
@@ -305,6 +305,8 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
db_op_t ops1[4];
db_key_t keys2[6]; /* select */
int n[2] = {2,6}; /* number of dynamic values used on key1/key2 */
@ -19,7 +19,7 @@ index 252bb8b..0743bc5 100644
cp = buf;
shortage = 0;
@@ -347,22 +349,26 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
@@ -351,22 +353,26 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
vals1[n[0]].nul = 0;
vals1[n[0]].val.int_val = server_id;
n[0]++;
@ -49,7 +49,7 @@ index 252bb8b..0743bc5 100644
continue;
}
@@ -485,7 +491,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
@@ -489,7 +495,7 @@ static inline int get_all_db_ucontacts(void *buf, int len, unsigned int flags,
len -= needed;
} /* row cycle */

@ -7,10 +7,10 @@ Subject: [PATCH] dialog: dlg_get_var assure return null on error
1 file changed, 20 insertions(+), 11 deletions(-)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 6668712..767e6ef 100644
index 628dc4d..61bf03b 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -1570,53 +1570,62 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
@@ -1573,53 +1573,62 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
str k = STR_NULL;
str *val = NULL;
pv_value_t dst_val;

@ -8,7 +8,7 @@ Subject: [PATCH] dialog: dlg_get_var(ci, ft, tt, key, dst_var)
2 files changed, 160 insertions(+), 1 deletion(-)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 4d30b27..058d42a 100644
index 9f9f647..25584b5 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -194,7 +194,9 @@ static int w_is_known_dlg(struct sip_msg *);
@ -31,7 +31,7 @@ index 4d30b27..058d42a 100644
{"load_dlg", (cmd_function)load_dlg, 0, 0, 0, 0},
{0,0,0,0,0,0}
@@ -1502,6 +1506,108 @@ static int fixup_dlg_bridge(void** param, int param_no)
@@ -1505,6 +1509,108 @@ static int fixup_dlg_bridge(void** param, int param_no)
return 0;
}
@ -140,7 +140,7 @@ index 4d30b27..058d42a 100644
static int ki_dlg_get(sip_msg_t *msg, str *sc, str *sf, str *st)
{
dlg_cell_t *dlg = NULL;
@@ -2087,6 +2193,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
@@ -2090,6 +2196,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},

@ -8,7 +8,7 @@ Subject: [PATCH] dialog: dlg_set_var(callid, ft, tt, key, value)
2 files changed, 148 insertions(+)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 058d42a..b169dc2 100644
index 25584b5..fec9f5e 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -197,6 +197,9 @@ static int w_dlg_db_load_extra(sip_msg_t *msg, char *p1, char *p2);
@ -30,7 +30,7 @@ index 058d42a..b169dc2 100644
{"load_dlg", (cmd_function)load_dlg, 0, 0, 0, 0},
{0,0,0,0,0,0}
@@ -1608,6 +1613,96 @@ static int fixup_dlg_get_var_free(void** param, int param_no)
@@ -1611,6 +1616,96 @@ static int fixup_dlg_get_var_free(void** param, int param_no)
return -1;
}
@ -127,7 +127,7 @@ index 058d42a..b169dc2 100644
static int ki_dlg_get(sip_msg_t *msg, str *sc, str *sf, str *st)
{
dlg_cell_t *dlg = NULL;
@@ -2198,6 +2293,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
@@ -2201,6 +2296,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
},

@ -7,10 +7,10 @@ Subject: [PATCH] dialog: fix ki_dlg_get_var() introduced previously
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 5347c0f..6668712 100644
index 623db59..628dc4d 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -1549,14 +1549,14 @@ static sr_kemi_xval_t *ki_dlg_get_var(sip_msg_t *msg, str *sc, str *sf, str *st,
@@ -1552,14 +1552,14 @@ static sr_kemi_xval_t *ki_dlg_get_var(sip_msg_t *msg, str *sc, str *sf, str *st,
memset(&_sr_kemi_dialog_xval, 0, sizeof(sr_kemi_xval_t));

@ -8,10 +8,10 @@ Subject: [PATCH] dialog: reworked kemi export for dlg_get_var()
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index b169dc2..5347c0f 100644
index fec9f5e..623db59 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -1511,7 +1511,7 @@ static int fixup_dlg_bridge(void** param, int param_no)
@@ -1514,7 +1514,7 @@ static int fixup_dlg_bridge(void** param, int param_no)
return 0;
}
@ -20,7 +20,7 @@ index b169dc2..5347c0f 100644
{
dlg_cell_t *dlg = NULL;
unsigned int dir = 0;
@@ -1538,6 +1538,30 @@ static str *ki_dlg_get_var(sip_msg_t *msg, str *sc, str *sf, str *st, str *key)
@@ -1541,6 +1541,30 @@ static str *ki_dlg_get_var(sip_msg_t *msg, str *sc, str *sf, str *st, str *key)
return val;
}
@ -51,7 +51,7 @@ index b169dc2..5347c0f 100644
static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char *key, char *pv)
{
str sc = STR_NULL;
@@ -1582,7 +1606,7 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
@@ -1585,7 +1609,7 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
return -1;
}
dst_pv = (pv_spec_t *)pv;
@ -60,7 +60,7 @@ index b169dc2..5347c0f 100644
if(val) {
memset(&dst_val, 0, sizeof(pv_value_t));
dst_val.flags |= PV_VAL_STR;
@@ -2155,11 +2179,6 @@ static int ki_dlg_var_sets(sip_msg_t *msg, str *name, str *val)
@@ -2158,11 +2182,6 @@ static int ki_dlg_var_sets(sip_msg_t *msg, str *name, str *val)
return (ret==0)?1:ret;
}
@ -72,7 +72,7 @@ index b169dc2..5347c0f 100644
/**
*
*/
@@ -2289,7 +2308,7 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
@@ -2292,7 +2311,7 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("dialog"), str_init("dlg_get_var"),

@ -11,10 +11,10 @@ Subject: [PATCH] dialog: w_dlg_get_var, fix incompatible pointer
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 767e6ef..2082a41 100644
index 61bf03b..6545444 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -1568,7 +1568,7 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
@@ -1571,7 +1571,7 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
str sf = STR_NULL;
str st = STR_NULL;
str k = STR_NULL;
@ -23,7 +23,7 @@ index 767e6ef..2082a41 100644
pv_value_t dst_val;
pv_spec_t* dst_pv = (pv_spec_t *)pv;
@@ -1606,11 +1606,11 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
@@ -1609,11 +1609,11 @@ static int w_dlg_get_var(struct sip_msg *msg, char *ci, char *ft, char *tt, char
goto error;
}
val = ki_dlg_get_var(msg, &sc, &sf, &st, &k);

@ -1,4 +1,3 @@
From c80cccd996dcc3b91d4f0f68a2de51104a16d1a5 Mon Sep 17 00:00:00 2001
From: Alessio Garzi <agarzi@sipwise.com>
Date: Thu, 7 Jul 2022 15:22:12 +0200
Subject: [PATCH] presence: No autocommit+rollback if no active watchers
@ -15,7 +14,7 @@ Subject: [PATCH] presence: No autocommit+rollback if no active watchers
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/src/modules/presence/notify.c b/src/modules/presence/notify.c
index cf52c21c22..4980dc4b0a 100644
index cf52c21..4980dc4 100644
--- a/src/modules/presence/notify.c
+++ b/src/modules/presence/notify.c
@@ -2867,6 +2867,7 @@ int process_dialogs(int round, int presence_winfo)
@ -67,6 +66,3 @@ index cf52c21c22..4980dc4b0a 100644
if(pa_dbf.abort_transaction(pa_db) < 0)
LM_ERR("in abort_transaction\n");
}
--
2.25.1

@ -1,4 +1,3 @@
From 72234f9efbb5b299823b33dc4eda84a43d5f6384 Mon Sep 17 00:00:00 2001
From: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue, 30 Aug 2022 10:58:39 +0200
Subject: [PATCH] pv_headers: use t_unset() based on vref instead of resetting
@ -9,7 +8,7 @@ Subject: [PATCH] pv_headers: use t_unset() based on vref instead of resetting
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
index 7da426c184..b900ae5be6 100644
index 7da426c..b900ae5 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -555,12 +555,12 @@ int handle_msg_reply_cb(struct sip_msg *msg, unsigned int flags, void *cb)
@ -29,6 +28,3 @@ index 7da426c184..b900ae5be6 100644
return 1;
}
--
2.30.2

@ -1,4 +1,3 @@
From 836d122af8575c66651232f3ad25bad085bfb972 Mon Sep 17 00:00:00 2001
From: Victor Seva <linuxmaniac@torreviejawireless.org>
Date: Sun, 28 Aug 2022 22:59:44 +0200
Subject: [PATCH] pv_headers: use tm.t_find API
@ -8,7 +7,7 @@ Subject: [PATCH] pv_headers: use tm.t_find API
1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
index e555e0265b..7da426c184 100644
index e555e02..7da426c 100644
--- a/src/modules/pv_headers/pv_headers.c
+++ b/src/modules/pv_headers/pv_headers.c
@@ -526,6 +526,7 @@ int handle_msg_branch_cb(struct sip_msg *msg, unsigned int flags, void *cb)
@ -53,6 +52,3 @@ index e555e0265b..7da426c184 100644
tmb.unref_cell(t);
LM_DBG("T:%p unref\n", t);
}
--
2.30.2

@ -1,4 +1,3 @@
From f69c13a587df53fb93999d81cd02dc99ab223187 Mon Sep 17 00:00:00 2001
From: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue, 30 Aug 2022 10:53:15 +0200
Subject: [PATCH] tm: added t_unset() intermodule API function
@ -14,7 +13,7 @@ Subject: [PATCH] tm: added t_unset() intermodule API function
4 files changed, 18 insertions(+)
diff --git a/src/modules/tm/t_lookup.c b/src/modules/tm/t_lookup.c
index ad41f0de93..dd2ed6f0ae 100644
index ad41f0d..dd2ed6f 100644
--- a/src/modules/tm/t_lookup.c
+++ b/src/modules/tm/t_lookup.c
@@ -167,6 +167,19 @@ struct cell* t_find(struct sip_msg *msg, int *branch, int *vref)
@ -38,7 +37,7 @@ index ad41f0de93..dd2ed6f0ae 100644
{
if (parse_headers(msg, HDR_FROM_F | HDR_CSEQ_F | HDR_TO_F, 0)==-1) {
diff --git a/src/modules/tm/t_lookup.h b/src/modules/tm/t_lookup.h
index de65be8365..c4b5404cf8 100644
index de65be8..c4b5404 100644
--- a/src/modules/tm/t_lookup.h
+++ b/src/modules/tm/t_lookup.h
@@ -71,6 +71,9 @@ struct cell *get_t(void);
@ -52,7 +51,7 @@ index de65be8365..c4b5404cf8 100644
int get_t_branch(void);
diff --git a/src/modules/tm/tm_load.c b/src/modules/tm/tm_load.c
index c9f39b576e..d5fc6e7884 100644
index c9f39b5..d5fc6e7 100644
--- a/src/modules/tm/tm_load.c
+++ b/src/modules/tm/tm_load.c
@@ -93,6 +93,7 @@ int load_tm( struct tm_binds *tmb)
@ -64,7 +63,7 @@ index c9f39b576e..d5fc6e7884 100644
tmb->t_sett = set_t;
tmb->calculate_hooks = w_calculate_hooks;
diff --git a/src/modules/tm/tm_load.h b/src/modules/tm/tm_load.h
index 1f97061d1e..130d01503a 100644
index 1f97061..130d015 100644
--- a/src/modules/tm/tm_load.h
+++ b/src/modules/tm/tm_load.h
@@ -72,6 +72,7 @@ struct tm_binds {
@ -75,6 +74,3 @@ index 1f97061d1e..130d01503a 100644
tgett_branch_f t_gett_branch;
tsett_f t_sett;
calculate_hooks_f calculate_hooks;
--
2.30.2

@ -1,4 +1,3 @@
From a9cf4577c25d7933531b8969a1941bac4faf8d68 Mon Sep 17 00:00:00 2001
From: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Thu, 25 Aug 2022 14:51:23 +0200
Subject: [PATCH] tm: new inter-module API function t_find(...)
@ -13,7 +12,7 @@ Subject: [PATCH] tm: new inter-module API function t_find(...)
4 files changed, 27 insertions(+)
diff --git a/src/modules/tm/t_lookup.c b/src/modules/tm/t_lookup.c
index f041116bb8..ad41f0de93 100644
index f041116..ad41f0d 100644
--- a/src/modules/tm/t_lookup.c
+++ b/src/modules/tm/t_lookup.c
@@ -145,6 +145,28 @@ int get_t_branch()
@ -46,7 +45,7 @@ index f041116bb8..ad41f0de93 100644
{
if (parse_headers(msg, HDR_FROM_F | HDR_CSEQ_F | HDR_TO_F, 0)==-1) {
diff --git a/src/modules/tm/t_lookup.h b/src/modules/tm/t_lookup.h
index 1f6596a90d..de65be8365 100644
index 1f6596a..de65be8 100644
--- a/src/modules/tm/t_lookup.h
+++ b/src/modules/tm/t_lookup.h
@@ -68,6 +68,9 @@ int t_check_msg(struct sip_msg* , int *branch );
@ -60,7 +59,7 @@ index 1f6596a90d..de65be8365 100644
int get_t_branch(void);
diff --git a/src/modules/tm/tm_load.c b/src/modules/tm/tm_load.c
index 8635b90eae..c9f39b576e 100644
index 8635b90..c9f39b5 100644
--- a/src/modules/tm/tm_load.c
+++ b/src/modules/tm/tm_load.c
@@ -92,6 +92,7 @@ int load_tm( struct tm_binds *tmb)
@ -72,7 +71,7 @@ index 8635b90eae..c9f39b576e 100644
tmb->t_sett = set_t;
tmb->calculate_hooks = w_calculate_hooks;
diff --git a/src/modules/tm/tm_load.h b/src/modules/tm/tm_load.h
index 4695a8f7e1..1f97061d1e 100644
index 4695a8f..1f97061 100644
--- a/src/modules/tm/tm_load.h
+++ b/src/modules/tm/tm_load.h
@@ -71,6 +71,7 @@ struct tm_binds {
@ -83,6 +82,3 @@ index 4695a8f7e1..1f97061d1e 100644
tgett_branch_f t_gett_branch;
tsett_f t_sett;
calculate_hooks_f calculate_hooks;
--
2.30.2

@ -1,33 +0,0 @@
From: Daniel-Constantin Mierla <miconda@gmail.com>
Date: Tue, 21 Jun 2022 08:41:53 +0200
Subject: topos: skip adding contact header for BYE, CANCEL, PRACK
- GH #3149
---
src/modules/topos/tps_msg.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/modules/topos/tps_msg.c b/src/modules/topos/tps_msg.c
index 83d5f5f..c01dde7 100644
--- a/src/modules/topos/tps_msg.c
+++ b/src/modules/topos/tps_msg.c
@@ -46,6 +46,8 @@
#include "tps_msg.h"
#include "tps_storage.h"
+#define TPS_METHODS_NOCONTACT (METHOD_CANCEL|METHOD_BYE|METHOD_PRACK)
+
extern int _tps_param_mask_callid;
extern int _tps_contact_mode;
extern str _tps_cparam_name;
@@ -582,6 +584,10 @@ int tps_reinsert_contact(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
{
str hname = str_init("Contact");
+ if (get_cseq(msg)->method_id & TPS_METHODS_NOCONTACT) {
+ return 0;
+ }
+
if(tps_add_headers(msg, &hname, hbody, 0)<0) {
return -1;
}

@ -1,59 +0,0 @@
From 06679174fc3d9cc6a18bc3edc7f2fb985c50d27b Mon Sep 17 00:00:00 2001
From: Daniel-Constantin Mierla <miconda@gmail.com>
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
Loading…
Cancel
Save