From 02c6ed9eaa3751623f19ed160dc802e11862df3d Mon Sep 17 00:00:00 2001 From: Bogdan-Andrei Iancu Date: Wed, 15 Dec 2021 09:58:01 +0200 Subject: [PATCH] Solve the problem of recognizing the local SIP msg We need a consistent and solid way to recognize the internanlly generated SIP msg (as a result of t_uac) - these are msg structs resulted from the parsing of buffers with SIP msgs --- modules/tm/t_msgbuilder.h | 2 ++ modules/topology_hiding/topo_hiding_logic.c | 2 +- parser/msg_parser.h | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/tm/t_msgbuilder.h b/modules/tm/t_msgbuilder.h index 4c71854110c..f2d7833457d 100644 --- a/modules/tm/t_msgbuilder.h +++ b/modules/tm/t_msgbuilder.h @@ -124,6 +124,8 @@ static inline struct sip_msg* buf_to_sip_msg(char *buf, unsigned int len, req->rcv.src_port = req->rcv.dst_port = dialog->send_sock->port_no; req->rcv.bind_address = dialog->send_sock; + req->flags |= FL_IS_LOCAL; + return req; error1: diff --git a/modules/topology_hiding/topo_hiding_logic.c b/modules/topology_hiding/topo_hiding_logic.c index 76811e6ac90..84c4e03f1b3 100644 --- a/modules/topology_hiding/topo_hiding_logic.c +++ b/modules/topology_hiding/topo_hiding_logic.c @@ -1076,7 +1076,7 @@ static void topo_dlg_onroute (struct dlg_cell* dlg, int type, /* we also may end up here via TERMINATE event triggered by internal * dlg termination -> the requests we have here are dummy, so nothing * to be done */ - if (is_dummy_sip_msg(req)==0) { + if ((req->flags&FL_IS_LOCAL)!=0 || is_dummy_sip_msg(req)==0) { LM_DBG("dummy request identified, skipping...\n"); return; } diff --git a/parser/msg_parser.h b/parser/msg_parser.h index 912c2b176d5..a5352cab5a6 100644 --- a/parser/msg_parser.h +++ b/parser/msg_parser.h @@ -124,6 +124,8 @@ enum request_method { * route */ #define FL_TM_REPLICATED (1<<19) /* message received due to a tm replication */ #define FL_BODY_NO_SDP (1<<20) /* message does not have an SDP body */ +#define FL_IS_LOCAL (1<<21) /* the message is a locally generated + * one, not received */ /* define the # of unknown URI parameters to parse */ #define URI_MAX_U_PARAMS 10