mirror of https://github.com/sipwise/kamailio.git
Change-Id: I32f93d7505394b2f9bd751268af547fd45af9d70mr10.5.4
parent
4d081fbd4e
commit
b532e74f5b
@ -1,109 +0,0 @@
|
||||
From: Victor Seva <vseva@sipwise.com>
|
||||
Date: Mon, 5 Dec 2022 12:43:11 +0100
|
||||
Subject: pv_headers: fix t_resume scenario
|
||||
|
||||
---
|
||||
src/modules/pv_headers/pv_headers.c | 49 +++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 49 insertions(+)
|
||||
|
||||
diff --git a/src/modules/pv_headers/pv_headers.c b/src/modules/pv_headers/pv_headers.c
|
||||
index fd9a619..5afe2dc 100644
|
||||
--- a/src/modules/pv_headers/pv_headers.c
|
||||
+++ b/src/modules/pv_headers/pv_headers.c
|
||||
@@ -65,6 +65,7 @@ static void mod_destroy(void);
|
||||
static int mod_init(void);
|
||||
|
||||
static void handle_tm_t(tm_cell_t *t, int type, struct tmcb_params *params);
|
||||
+static int handle_msg_failed_cb(struct sip_msg *msg, unsigned int flags, void *cb);
|
||||
static int handle_msg_cb(struct sip_msg *msg, unsigned int flags, void *cb);
|
||||
static int handle_msg_branch_cb(
|
||||
struct sip_msg *msg, unsigned int flags, void *cb);
|
||||
@@ -395,6 +396,12 @@ int mod_init(void)
|
||||
LM_ERR("cannot register PRE_SCRIPT_CB ONREPLY_CB callbacks\n");
|
||||
return -1;
|
||||
}
|
||||
+ if(register_script_cb(
|
||||
+ handle_msg_failed_cb, PRE_SCRIPT_CB | FAILURE_CB, 0)
|
||||
+ < 0) {
|
||||
+ LM_ERR("cannot register PRE_SCRIPT_CB FAILURE_CB callbacks\n");
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
|
||||
pvh_str_hash_init(&skip_headers, &skip_headers_param, "skip_headers");
|
||||
@@ -472,6 +479,29 @@ static inline char *tm_type_to_string(int type)
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
+static inline void print_cb_flags(unsigned int flags)
|
||||
+{
|
||||
+ LM_DBG("flags:");
|
||||
+ if(flags & REQUEST_CB)
|
||||
+ LM_DBG("REQUEST_CB");
|
||||
+ if(flags & FAILURE_CB)
|
||||
+ LM_DBG("FAILURE_CB");
|
||||
+ if(flags & ONREPLY_CB)
|
||||
+ LM_DBG("ONREPLY_CB");
|
||||
+ if(flags & BRANCH_CB)
|
||||
+ LM_DBG("BRANCH_CB");
|
||||
+ if(flags & ONSEND_CB)
|
||||
+ LM_DBG("ONSEND_CB");
|
||||
+ if(flags & ERROR_CB)
|
||||
+ LM_DBG("ERROR_CB");
|
||||
+ if(flags & LOCAL_CB)
|
||||
+ LM_DBG("LOCAL_CB");
|
||||
+ if(flags & EVENT_CB)
|
||||
+ LM_DBG("EVENT_CB");
|
||||
+ if(flags & BRANCH_FAILURE_CB)
|
||||
+ LM_DBG("BRANCH_FAILURE_CB");
|
||||
+}
|
||||
+
|
||||
void handle_tm_t(tm_cell_t *t, int type, struct tmcb_params *params)
|
||||
{
|
||||
struct sip_msg *msg = NULL;
|
||||
@@ -501,11 +531,25 @@ void handle_tm_t(tm_cell_t *t, int type, struct tmcb_params *params)
|
||||
return;
|
||||
}
|
||||
|
||||
+int handle_msg_failed_cb(struct sip_msg *msg, unsigned int flags, void *cb)
|
||||
+{
|
||||
+ print_cb_flags(flags);
|
||||
+
|
||||
+ if(pvh_parse_msg(msg) != 0)
|
||||
+ return 1;
|
||||
+
|
||||
+ _branch = 0;
|
||||
+ LM_DBG("msg:%p set branch:%d\n", msg, _branch);
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static int msg_cbs =
|
||||
TMCB_REQUEST_FWDED | TMCB_RESPONSE_FWDED | TMCB_ON_BRANCH_FAILURE;
|
||||
|
||||
int handle_msg_cb(struct sip_msg *msg, unsigned int flags, void *cb)
|
||||
{
|
||||
+ print_cb_flags(flags);
|
||||
+
|
||||
if(pvh_parse_msg(msg) != 0)
|
||||
return 1;
|
||||
|
||||
@@ -524,6 +568,7 @@ int handle_msg_branch_cb(struct sip_msg *msg, unsigned int flags, void *cb)
|
||||
{
|
||||
|
||||
LM_DBG("msg:%p previous branch:%d\n", msg, _branch);
|
||||
+ print_cb_flags(flags);
|
||||
|
||||
if(flags & PRE_SCRIPT_CB) {
|
||||
pvh_get_branch_index(msg, &_branch);
|
||||
@@ -543,7 +588,11 @@ int handle_msg_reply_cb(struct sip_msg *msg, unsigned int flags, void *cb)
|
||||
|
||||
if(pvh_parse_msg(msg) != 0)
|
||||
return 1;
|
||||
+ if(msg == FAKED_REPLY) {
|
||||
+ LM_DBG("FAKED_REPLY\n");
|
||||
+ }
|
||||
LM_DBG("msg:%p previous branch:%d\n", msg, _branch);
|
||||
+ print_cb_flags(flags);
|
||||
|
||||
t = tmb.t_find(msg, &_branch, &vref);
|
||||
if(t != NULL && t != T_UNDEFINED) {
|
||||
@ -1,97 +0,0 @@
|
||||
From: Victor Seva <vseva@sipwise.com>
|
||||
Date: Thu, 9 Feb 2023 11:45:29 +0100
|
||||
Subject: usrloc: correct AOR value on usrloc:contact-expired
|
||||
|
||||
previously $ulc(x=>aor) had only the user part even with use_domain set
|
||||
---
|
||||
src/modules/usrloc/udomain.c | 39 +++++++++++++++++++++++++++++++--------
|
||||
1 file changed, 31 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c
|
||||
index 4025cc5..d7b9e8a 100644
|
||||
--- a/src/modules/usrloc/udomain.c
|
||||
+++ b/src/modules/usrloc/udomain.c
|
||||
@@ -956,7 +956,7 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
|
||||
db_val_t query_vals[3];
|
||||
int key_num = 2;
|
||||
db1_res_t* res = NULL;
|
||||
- str user, contact;
|
||||
+ str user, contact, domain;
|
||||
int i;
|
||||
int n;
|
||||
urecord_t r;
|
||||
@@ -964,6 +964,9 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
|
||||
#define RUIDBUF_SIZE 128
|
||||
char ruidbuf[RUIDBUF_SIZE];
|
||||
str ruid;
|
||||
+#define AORBUF_SIZE 512
|
||||
+ char aorbuf[AORBUF_SIZE];
|
||||
+ str aor;
|
||||
|
||||
if (ul_db_mode!=DB_ONLY) {
|
||||
return 0;
|
||||
@@ -1058,6 +1061,14 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
|
||||
continue;
|
||||
}
|
||||
user.len = strlen(user.s);
|
||||
+ if(user.len < AORBUF_SIZE ) {
|
||||
+ memcpy(aorbuf, user.s, user.len);
|
||||
+ aor.s = aorbuf;
|
||||
+ aor.len = user.len;
|
||||
+ } else {
|
||||
+ LM_ERR("user is too long %d\n", user.len);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
ci = dbrow2info(ROW_VALUES(row)+1, &contact, 0);
|
||||
if (ci==0) {
|
||||
@@ -1066,18 +1077,30 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
|
||||
continue;
|
||||
}
|
||||
|
||||
- lock_udomain(_d, &user);
|
||||
+ if(ul_use_domain) {
|
||||
+ domain.s = (char*)VAL_STRING(ROW_VALUES(row)+20);
|
||||
+ domain.len = strlen(domain.s);
|
||||
+ if(domain.len + aor.len < AORBUF_SIZE) {
|
||||
+ aorbuf[aor.len] = '@';
|
||||
+ memcpy(aorbuf+aor.len+1, domain.s, domain.len);
|
||||
+ aor.len += domain.len + 1;
|
||||
+ } else {
|
||||
+ LM_ERR("aor too long, using user part only\n");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ lock_udomain(_d, &aor);
|
||||
/* don't use the same static value from get_static_urecord() */
|
||||
memset( &r, 0, sizeof(struct urecord) );
|
||||
- r.aor = user;
|
||||
- r.aorhash = ul_get_aorhash(&user);
|
||||
+ r.aor = aor;
|
||||
+ r.aorhash = ul_get_aorhash(&aor);
|
||||
r.domain = _d->name;
|
||||
|
||||
if ( (c=mem_insert_ucontact(&r, &contact, ci)) == 0) {
|
||||
LM_ERR("inserting temporary contact failed for %.*s\n",
|
||||
- user.len, user.s);
|
||||
+ aor.len, aor.s);
|
||||
release_urecord(&r);
|
||||
- unlock_udomain(_d, &user);
|
||||
+ unlock_udomain(_d, &aor);
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -1096,11 +1119,11 @@ int udomain_contact_expired_cb(db1_con_t* _c, udomain_t* _d)
|
||||
ruid.len = c->ruid.len;
|
||||
} else {
|
||||
LM_ERR("ruid is too long %d for %.*s\n", c->ruid.len,
|
||||
- user.len, user.s);
|
||||
+ aor.len, aor.s);
|
||||
}
|
||||
}
|
||||
release_urecord(&r);
|
||||
- unlock_udomain(_d, &user);
|
||||
+ unlock_udomain(_d, &aor);
|
||||
if(ruid.len > 0 && ul_xavp_contact_name.s != NULL) {
|
||||
/* delete attributes by ruid */
|
||||
uldb_delete_attrs_ruid(_d->name, &ruid);
|
||||
@ -1,117 +0,0 @@
|
||||
From: Henning Westerholt <hw@gilawa.com>
|
||||
Date: Wed, 16 Nov 2022 15:33:06 +0000
|
||||
Subject: dialog: deactivate print variable function which is only used for
|
||||
debugging
|
||||
|
||||
- deactivate print variable function which is only used for debugging
|
||||
- this function is not good for performance and might also cause race conditions
|
||||
---
|
||||
src/modules/dialog/dialog.c | 3 +++
|
||||
src/modules/dialog/dlg_var.c | 12 +++++++++---
|
||||
src/modules/dialog/dlg_var.h | 2 ++
|
||||
src/modules/dialog/doc/dialog_admin.xml | 21 +++++++++++++++++++++
|
||||
4 files changed, 35 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
|
||||
index 25f3ca1..49888ec 100644
|
||||
--- a/src/modules/dialog/dialog.c
|
||||
+++ b/src/modules/dialog/dialog.c
|
||||
@@ -141,6 +141,8 @@ stat_var *expired_dlgs = 0;
|
||||
stat_var *failed_dlgs = 0;
|
||||
stat_var *early_dlgs = 0;
|
||||
|
||||
+int debug_variables_list = 0;
|
||||
+
|
||||
struct tm_binds d_tmb;
|
||||
struct rr_binds d_rrb;
|
||||
pv_spec_t timeout_avp;
|
||||
@@ -338,6 +340,7 @@ static param_export_t mod_params[]={
|
||||
{ "h_id_step", PARAM_INT, &dlg_h_id_step },
|
||||
{ "keep_proxy_rr", INT_PARAM, &dlg_keep_proxy_rr },
|
||||
{ "dlg_filter_mode", INT_PARAM, &dlg_filter_mode },
|
||||
+ { "debug_variables", PARAM_INT, &debug_variables_list },
|
||||
{ 0,0,0 }
|
||||
};
|
||||
|
||||
diff --git a/src/modules/dialog/dlg_var.c b/src/modules/dialog/dlg_var.c
|
||||
index 473736b..0e165c5 100644
|
||||
--- a/src/modules/dialog/dlg_var.c
|
||||
+++ b/src/modules/dialog/dlg_var.c
|
||||
@@ -449,7 +449,9 @@ int set_dlg_variable(struct dlg_cell *dlg, str *key, str *val)
|
||||
if ( dlg_db_mode==DB_MODE_REALTIME )
|
||||
update_dialog_dbinfo(dlg);
|
||||
|
||||
- print_lists(dlg);
|
||||
+ if(unlikely(debug_variables_list)) {
|
||||
+ print_lists(dlg);
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -510,7 +512,9 @@ int pv_get_dlg_variable(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
|
||||
}
|
||||
}
|
||||
|
||||
- print_lists(dlg);
|
||||
+ if(unlikely(debug_variables_list)) {
|
||||
+ print_lists(dlg);
|
||||
+ }
|
||||
|
||||
/* unlock dialog */
|
||||
if (dlg) {
|
||||
@@ -584,7 +588,9 @@ int pv_set_dlg_variable(struct sip_msg* msg, pv_param_t *param, int op, pv_value
|
||||
}
|
||||
dlg_unlock(d_table, &(d_table->entries[dlg->h_entry]));
|
||||
}
|
||||
- print_lists(dlg);
|
||||
+ if(unlikely(debug_variables_list)) {
|
||||
+ print_lists(dlg);
|
||||
+ }
|
||||
|
||||
dlg_release(dlg);
|
||||
return 0;
|
||||
diff --git a/src/modules/dialog/dlg_var.h b/src/modules/dialog/dlg_var.h
|
||||
index 292e9f7..44bd6ec 100644
|
||||
--- a/src/modules/dialog/dlg_var.h
|
||||
+++ b/src/modules/dialog/dlg_var.h
|
||||
@@ -89,6 +89,8 @@ extern stat_var *processed_dlgs; /*!< number of processed dialogs */
|
||||
extern stat_var *expired_dlgs; /*!< number of expired dialogs */
|
||||
extern stat_var *failed_dlgs; /*!< number of failed dialogs */
|
||||
|
||||
+extern int debug_variables_list;
|
||||
+
|
||||
int pv_get_dlg_ctx(sip_msg_t *msg, pv_param_t *param,
|
||||
pv_value_t *res);
|
||||
int pv_set_dlg_ctx(sip_msg_t *msg, pv_param_t *param,
|
||||
diff --git a/src/modules/dialog/doc/dialog_admin.xml b/src/modules/dialog/doc/dialog_admin.xml
|
||||
index 6fcaaf7..185c53a 100644
|
||||
--- a/src/modules/dialog/doc/dialog_admin.xml
|
||||
+++ b/src/modules/dialog/doc/dialog_admin.xml
|
||||
@@ -1663,6 +1663,27 @@ modparam("dialog", "h_id_step", 10)
|
||||
...
|
||||
modparam("dialog", "keep_proxy_rr", 1)
|
||||
...
|
||||
+</programlisting>
|
||||
+ </example>
|
||||
+ </section>
|
||||
+ <section id="dialog.p.debug_variables">
|
||||
+ <title><varname>debug_variables</varname> (int)</title>
|
||||
+ <para>
|
||||
+ Activate additional debugging for printing internal lists for dialog variables.
|
||||
+ This output is only visible at debug log level and should only be used for
|
||||
+ debugging. By default its deactivated.
|
||||
+ </para>
|
||||
+ <para>
|
||||
+ <emphasis>
|
||||
+ Default value is <quote>0</quote>.
|
||||
+ </emphasis>
|
||||
+ </para>
|
||||
+ <example>
|
||||
+ <title>Set <varname>debug_variables</varname> parameter</title>
|
||||
+ <programlisting format="linespecific">
|
||||
+...
|
||||
+modparam("dialog", "debug_variables", 1)
|
||||
+...
|
||||
</programlisting>
|
||||
</example>
|
||||
</section>
|
||||
@ -1,22 +0,0 @@
|
||||
From: Henning Westerholt <hw@gilawa.com>
|
||||
Date: Wed, 14 Dec 2022 08:38:12 +0000
|
||||
Subject: [PATCH] utils/kamcmd: add missing USE_READLINE define for pkg-config
|
||||
build, related to #3284
|
||||
|
||||
(cherry picked from commit a70b6bf09c73d961ebea1947216757fafb951c24)
|
||||
---
|
||||
utils/kamcmd/Makefile | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/utils/kamcmd/Makefile b/utils/kamcmd/Makefile
|
||||
index f12306b..1fd923d 100644
|
||||
--- a/utils/kamcmd/Makefile
|
||||
+++ b/utils/kamcmd/Makefile
|
||||
@@ -80,6 +80,7 @@ endif
|
||||
# detect libreadline
|
||||
ifneq ($(BUILDER),)
|
||||
DEFS += $(shell $(BUILDER) --cflags readline)
|
||||
+ DEFS+=-DUSE_READLINE
|
||||
LIBS += $(shell $(BUILDER) --libs readline)
|
||||
use_readline := 1
|
||||
else
|
||||
Loading…
Reference in new issue