From 05e93bb8cd297a97593a239efdda41ab4d6c1ea5 Mon Sep 17 00:00:00 2001 From: lazedo Date: Wed, 21 Nov 2018 10:18:24 +0000 Subject: [PATCH] indentation & remove rr in handle_in_dialog, settings for rr --- kamailio/default.cfg | 96 +++++++++++++++++++++++--------------------- kamailio/defs.cfg | 4 ++ 2 files changed, 54 insertions(+), 46 deletions(-) diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 7591f31..af3ace8 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -132,8 +132,9 @@ loadmodule "sl.so" ######## Record-Route and Route module ######## loadmodule "rr.so" -modparam("rr", "enable_full_lr", 1) -modparam("rr", "enable_double_rr", 1) +modparam("rr", "enable_full_lr", RR_FULL_LR) +modparam("rr", "enable_double_rr", RR_DOUBLE_RR) +modparam("rr", "force_send_socket", RR_FORCE_SOCKET) ######## Max-Forward processor module ######## loadmodule "maxfwd.so" @@ -172,6 +173,9 @@ loadmodule "xlog.so" ######## UAC ######## loadmodule "uac.so" +modparam("uac","restore_mode","manual") +modparam("uac","restore_from_avp","$avp(original_uri_from)") +modparam("uac","restore_to_avp","$avp(original_uri_to)") ######## AVP's ######## loadmodule "avp.so" @@ -456,8 +460,7 @@ route[HANDLE_OPTIONS] route[HANDLE_NOTIFY] { - if (has_totag()) - return; + if (has_totag()) return; if (is_method("NOTIFY")) { if (isflagset(FLAG_INTERNALLY_SOURCED)) { @@ -545,51 +548,52 @@ route[HANDLE_MESSAGE] route[HANDLE_IN_DIALOG_REQUESTS] { - if (has_totag()) { - if (is_method("INVITE")) { - setflag(FLAG_SESSION_PROGRESS); - record_route(); - } - if (loose_route()) { + if (!has_totag()) return; + + if (is_method("INVITE")) { + setflag(FLAG_SESSION_PROGRESS); +# record_route(); + } - #!ifdef ACCOUNTING_ROLE - if (is_method("BYE")) { - setflag(FLAG_ACC); - setflag(FLAG_ACCFAILED); - } - #!endif + if (loose_route()) { - #!ifdef NAT_TRAVERSAL_ROLE - if(!isdsturiset()) { - handle_ruri_alias(); - } - #!endif + #!ifdef ACCOUNTING_ROLE + if (is_method("BYE")) { + setflag(FLAG_ACC); + setflag(FLAG_ACCFAILED); + } + #!endif - xlog("L_INFO", "$ci|log|loose_route in-dialog message\n"); - # Called on in-dialog requests - # If the request in an Invite for on hold from external to internal, - # associate the contact with the media server - # if Invite for on hold, we need to associate the contact URI with the next hop - if (is_method("INVITE") && !isflagset(FLAG_INTERNALLY_SOURCED) && is_audio_on_hold()) { - setflag(FLAG_ASSOCIATE_USER); - } - if ( is_method("NOTIFY") ) { - # Add Record-Route for in-dialog NOTIFY as per RFC 6665. - record_route(); - } - route(RELAY); - } else if (isflagset(FLAG_INTERNALLY_SOURCED)) { - xlog("L_INFO", "$ci|log|relay internally sourced in-dialog message without loose_route\n"); - route(RELAY); - } else if (t_check_trans()) { - xlog("L_INFO", "$ci|log|allow message for a known transaction\n"); - route(RELAY); - } else { - xlog("L_INFO", "$ci|log|message had a to-tag but can't be loose routed\n"); - sl_send_reply("481", "Call Leg/Transaction Does Not Exist"); + #!ifdef NAT_TRAVERSAL_ROLE + if(!isdsturiset()) { + handle_ruri_alias(); } - exit(); + #!endif + + xlog("L_INFO", "$ci|log|loose_route in-dialog message\n"); + # Called on in-dialog requests + # If the request in an Invite for on hold from external to internal, + # associate the contact with the media server + # if Invite for on hold, we need to associate the contact URI with the next hop + if (is_method("INVITE") && !isflagset(FLAG_INTERNALLY_SOURCED) && is_audio_on_hold()) { + setflag(FLAG_ASSOCIATE_USER); + } + if ( is_method("NOTIFY") ) { + # Add Record-Route for in-dialog NOTIFY as per RFC 6665. + record_route(); + } + route(RELAY); + } else if (isflagset(FLAG_INTERNALLY_SOURCED)) { + xlog("L_INFO", "$ci|log|relay internally sourced in-dialog message without loose_route\n"); + route(RELAY); + } else if (t_check_trans()) { + xlog("L_INFO", "$ci|log|allow message for a known transaction\n"); + route(RELAY); + } else { + xlog("L_INFO", "$ci|log|message had a to-tag but can't be loose routed\n"); + sl_send_reply("481", "Call Leg/Transaction Does Not Exist"); } + exit(); } route[PREPARE_INITIAL_REQUESTS] @@ -718,8 +722,8 @@ route[EXTERNAL_TO_INTERNAL_RELAY] append_hf("X-AUTH-IP: $si\r\n"); append_hf("X-AUTH-PORT: $sp\r\n"); - #!ifdef REGISTRAR_ROLE - route(ADD_AUTHORIZATION_HEADERS); + #!ifdef REGISTRAR_ROLE + route(ADD_AUTHORIZATION_HEADERS); #!endif t_on_reply("INTERNAL_REPLY"); diff --git a/kamailio/defs.cfg b/kamailio/defs.cfg index 325e32d..f7eb69e 100644 --- a/kamailio/defs.cfg +++ b/kamailio/defs.cfg @@ -60,6 +60,10 @@ #!substdef "!NAT_UAC_TEST_LEVEL!3!g" #!endif +#!trydef RR_FULL_LR 1 +#!trydef RR_DOUBLE_RR 1 +#!trydef RR_FORCE_SOCKET 1 + ################################# ## Defs related to SIP_TRACE_ROLE ##