diff --git a/kamailio/default.cfg b/kamailio/default.cfg index e9cb0a9..d2a605d 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -600,6 +600,7 @@ route[INTERNAL_TO_EXTERNAL_RELAY] #!endif t_on_reply("EXTERNAL_REPLY"); + t_on_failure("EXTERNAL_FAULT"); if($sel(cfg_get.kazoo.use_progressive_timers) == 1) { t_set_fr(0, $sel(cfg_get.kazoo.to_external_no_response_initial_timer)); @@ -715,9 +716,6 @@ onreply_route[INTERNAL_REPLY] setflag(FLAG_SESSION_PROGRESS); } - xlog("L_INFO", "$ci|pass|$T_req($si):$T_req($sp)\n"); - } - } failure_route[INTERNAL_FAULT] @@ -783,7 +781,24 @@ failure_route[INTERNAL_FAULT] xlog("L_INFO", "$ci|failure|internal reply $T_reply_code $T_reply_reason\n"); send_reply("$T_reply_code", "$T_reply_reason"); } - xlog("L_INFO", "$ci|pass|$si:$sp\n"); +} + + +failure_route[EXTERNAL_FAULT] +{ + # this branch handles failures (>=300) to external + + route_if_exists("CUSTOM_EXTERNAL_FAULT"); + + # if the failure cause was due to the transaction being + # cancelled then we are complete + if (t_is_canceled()) { + xlog("L_INFO", "$ci|log|transaction was cancelled\n"); + exit; + } + + xlog("L_INFO", "$ci|failure|external reply $T_reply_code $T_reply_reason\n"); + send_reply("$T_reply_code", "$T_reply_reason"); } @@ -808,20 +823,20 @@ route[INTERNAL_REDIRECT] } onsend_route { - if (isflagset(FLAG_ASSOCIATE_USER)) { + if (isflagset(FLAG_ASSOCIATE_USER) && is_request()) { $var(user_source) = $(ct{tobody.user}) + "@" + $si + ":" + $sp; xlog("L_INFO", "$ci|log|associate traffic from $var(user_source) with media server sip:$sndto(ip):$sndto(port)\n"); $sht(associations=>$var(user_source))= "sip:" + $sndto(ip) + ":" + $sndto(port); } #!ifdef SIP_TRACE_ROLE - if (is_method("ACK") && isflagset(FLAG_SIP_TRACE)) { + if (is_method("ACK") && isflagset(FLAG_SIP_TRACE) && is_request()) { sip_trace(); } #!endif if(!isflagset(FLAG_LOCAL_ROUTE)) { - xlog("L_INFO", "$ci|pass|$sndfrom(ip):$sndfrom(port) -> $sndto(ip):$sndto(port)\n"); + xlog("L_INFO", "$ci|pass|$snd(sproto)|$sndfrom(ip):$sndfrom(port) -> $sndto(ip):$sndto(port)\n"); } } diff --git a/kamailio/globals.cfg b/kamailio/globals.cfg index 7b423d9..fec92b0 100644 --- a/kamailio/globals.cfg +++ b/kamailio/globals.cfg @@ -93,3 +93,4 @@ disable_sctp = yes ####### multi homed ######### mhomed=KZ_MULTI_HOMED +onsend_route_reply=yes