mirror of https://github.com/sipwise/kamailio.git
Change-Id: I92c639c40ddcd83ed2db8ffcd54c31cd3675b3b6mr9.5.7
parent
5f936bbd82
commit
d90fb4f805
@ -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 57be587..8c7539d 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 204ddfd..534583e 100644
|
||||
--- a/src/modules/usrloc/udomain.c
|
||||
+++ b/src/modules/usrloc/udomain.c
|
||||
@@ -905,7 +905,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;
|
||||
@@ -913,6 +913,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;
|
||||
@@ -1007,6 +1010,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) {
|
||||
@@ -1015,18 +1026,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;
|
||||
}
|
||||
|
||||
@@ -1045,11 +1068,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,85 +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 ++
|
||||
3 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
|
||||
index 243bb9b..9823877 100644
|
||||
--- a/src/modules/dialog/dialog.c
|
||||
+++ b/src/modules/dialog/dialog.c
|
||||
@@ -140,6 +140,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;
|
||||
@@ -327,6 +329,7 @@ static param_export_t mod_params[]={
|
||||
{ "h_id_start", PARAM_INT, &dlg_h_id_start },
|
||||
{ "h_id_step", PARAM_INT, &dlg_h_id_step },
|
||||
{ "keep_proxy_rr", INT_PARAM, &dlg_keep_proxy_rr },
|
||||
+ { "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 b2a373a..311b3c0 100644
|
||||
--- a/src/modules/dialog/dlg_var.c
|
||||
+++ b/src/modules/dialog/dlg_var.c
|
||||
@@ -317,7 +317,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;
|
||||
|
||||
@@ -366,7 +368,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) {
|
||||
@@ -440,7 +444,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 f13fa45..dc7698d 100644
|
||||
--- a/src/modules/dialog/dlg_var.h
|
||||
+++ b/src/modules/dialog/dlg_var.h
|
||||
@@ -83,6 +83,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,
|
||||
@ -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