From f97b5b7907ddc2e27c0b337657753bc62f1ef470 Mon Sep 17 00:00:00 2001 From: lazedo Date: Thu, 17 Jan 2019 12:45:22 +0000 Subject: [PATCH] handle sip trace from one place --- kamailio/default.cfg | 13 ++++++++++--- kamailio/presence-notify.cfg | 4 ---- kamailio/presence-role.cfg | 4 ---- kamailio/sip_trace-role.cfg | 14 +++++++++++++- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 68e372a..8882b79 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -12,6 +12,7 @@ #!trydef FLT_AOR 9 #!trydef FLT_T38 10 #!trydef FLT_NATS 11 +#!trydef FLAG_LOCAL_REQUEST 12 ####### Global Parameters ######### fork = yes @@ -345,6 +346,10 @@ route route(HANDLE_OPTIONS); + #!ifdef SIP_TRACE_ROLE + route(SIP_TRACE); + #!endif + route(HANDLE_NOTIFY); #!ifdef AUTHORIZATION_ROLE @@ -654,9 +659,6 @@ branch_route[MANAGE_BRANCH] { route[RELAY] { - #!ifdef SIP_TRACE_ROLE - route(SEND_SIP_TRACE); - #!endif if (is_method("INVITE|BYE|SUBSCRIBE|UPDATE")) { if(!t_is_set("branch_route")) t_on_branch("MANAGE_BRANCH"); @@ -952,11 +954,16 @@ route[ADD_AUTHORIZATION_HEADERS] event_route[tm:local-request] { + setflag(FLAG_LOCAL_REQUEST); xlog("L_DEBUG", "$ci|local|start $pr request $rm $ou\n"); xlog("L_DEBUG", "$ci|local|source $si:$sp -> $dd:$dp\n"); xlog("L_DEBUG", "$ci|local|from $fu\n"); xlog("L_DEBUG", "$ci|local|to $tu\n"); + #!ifdef SIP_TRACE_ROLE + route(SIP_TRACE); + #!endif + #!ifdef PRESENCE_ROLE route(PRESENCE_LOCAL_NOTIFY); #!endif diff --git a/kamailio/presence-notify.cfg b/kamailio/presence-notify.cfg index 51e961d..d196a60 100644 --- a/kamailio/presence-notify.cfg +++ b/kamailio/presence-notify.cfg @@ -38,10 +38,6 @@ route[PRESENCE_LOCAL_NOTIFY] } #!endif - #!ifdef SIP_TRACE_ROLE - route(SEND_SIP_TRACE); - #!endif - } modparam("mqueue","mqueue", "name=presence_last_notity") diff --git a/kamailio/presence-role.cfg b/kamailio/presence-role.cfg index 3fbdc83..785bdc0 100644 --- a/kamailio/presence-role.cfg +++ b/kamailio/presence-role.cfg @@ -109,10 +109,6 @@ route[HANDLE_SUBSCRIBE] exit; } - #!ifdef SIP_TRACE_ROLE - route(SEND_SIP_TRACE); - #!endif - #!ifdef NAT_TRAVERSAL_ROLE route(PRESENCE_NAT); #!endif diff --git a/kamailio/sip_trace-role.cfg b/kamailio/sip_trace-role.cfg index 70ae4a2..a2768c9 100644 --- a/kamailio/sip_trace-role.cfg +++ b/kamailio/sip_trace-role.cfg @@ -4,6 +4,7 @@ #!trydef KZ_TRACE 0 #!trydef KZ_TRACE_INTERNAL 1 #!trydef KZ_TRACE_EXTERNAL 1 +#!trydef KZ_TRACE_LOCAL 1 #!trydef KZ_TRACE_INTERNAL_INCOMING 1 #!trydef KZ_TRACE_INTERNAL_OUTGOING 1 #!trydef KZ_TRACE_EXTERNAL_INCOMING 1 @@ -19,6 +20,7 @@ kazoo.trace_external = KZ_TRACE_EXTERNAL descr "activates tracing from external sources" kazoo.trace_internal = KZ_TRACE_INTERNAL descr "activates tracing from internal sources" +kazoo.trace_local = KZ_TRACE_LOCAL descr "activates tracing for local requests" kazoo.trace_internal_incoming = KZ_TRACE_INTERNAL_INCOMING descr "traces the original request as received from internal sources" kazoo.trace_internal_outgoing = KZ_TRACE_INTERNAL_OUTGOING descr "traces the outgoing request to external sources after possible modification" @@ -63,10 +65,20 @@ route[SIP_TRACE_EXTERNAL] } } -route[SEND_SIP_TRACE] +route[SIP_TRACE_LOCAL] +{ + if($sel(cfg_get.kazoo.trace_local) == 0) { + return; + } + sip_trace(); +} + +route[SIP_TRACE] { if (isflagset(FLAG_INTERNALLY_SOURCED)) { route(SIP_TRACE_INTERNAL); + } else if (isflagset(FLAG_LOCAL_REQUEST)) { + route(SIP_TRACE_LOCAL); } else { route(SIP_TRACE_EXTERNAL); }