From 3bd699158160077187d26e9053f8084831e4f4cb Mon Sep 17 00:00:00 2001 From: karl anderson Date: Wed, 29 Apr 2015 11:01:55 -0700 Subject: [PATCH] KAZOO-3494: move the fast pickup handler for park in to the new role --- kamailio/default.cfg | 19 +++++++------------ kamailio/dispatcher-role.cfg | 1 - kamailio/fast-pickup-role.cfg | 25 +++++++++++++++++++++++-- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/kamailio/default.cfg b/kamailio/default.cfg index 5fe3bae..b942694 100644 --- a/kamailio/default.cfg +++ b/kamailio/default.cfg @@ -571,12 +571,9 @@ route[EXTERNAL_TO_INTERNAL_RELAY] } #!endif - ##### CALL-PARK #### - if(is_method("REFER")) { - $avp(refer_to) = $hdr(Refer-To); - $avp(refer_to_uri) = $rt; - $avp(referred_by) = $hdr(Referred-By); - } + #!ifdef FAST_PICKUP-ROLE + route(FAST_PICKUP_REFER); + #!endif remove_hf_re("^X-.*"); append_hf("X-AUTH-IP: $si\r\n"); @@ -633,6 +630,10 @@ onreply_route[INTERNAL_REPLY] route(DOS_PREVENTION); #!endif + #!ifdef FAST_PICKUP-ROLE + route(FAST_PICKUP_REPLY); + #!endif + if (is_method("INVITE") && !isflagset(FLAG_SESSION_PROGRESS) && t_check_status("(180)|(183)|(200)") @@ -647,12 +648,6 @@ onreply_route[INTERNAL_REPLY] setflag(FLAG_SESSION_PROGRESS); } - ##### CALL-PARK #### - if (is_method("REFER") && t_check_status("(200)|(202)") ) { - $sht(park=>$(avp(refer_to_uri){uri.user})@$(avp(refer_to_uri){uri.domain})) = "sip:" + $(ct{tobody.uri}{uri.host}) + ":" + $(ct{tobody.uri}{uri.port}); - xlog("L_INFO", "caching park info $(avp(refer_to_uri){uri.user})@$(avp(refer_to_uri){uri.domain}) = sip:$(ct{tobody.uri}{uri.host}):$(ct{tobody.uri}{uri.port})"); - } - if ($rs < 300) { xlog("L_INFO", "$ci|pass|$T_req($si):$T_req($sp)"); } diff --git a/kamailio/dispatcher-role.cfg b/kamailio/dispatcher-role.cfg index 8f8546c..73d6148 100644 --- a/kamailio/dispatcher-role.cfg +++ b/kamailio/dispatcher-role.cfg @@ -1,6 +1,5 @@ ######## Generic Hash Table container in shared memory ######## modparam("htable", "htable", "failover=>size=16;autoexpire=120") -modparam("htable", "htable", "park=>size=4;autoexpire=600") ####### Dispatcher module ######## loadmodule "dispatcher.so" diff --git a/kamailio/fast-pickup-role.cfg b/kamailio/fast-pickup-role.cfg index 042be7f..eabdb94 100644 --- a/kamailio/fast-pickup-role.cfg +++ b/kamailio/fast-pickup-role.cfg @@ -1,5 +1,5 @@ ######## FAST PICKUP ROLE ######## - +modparam("htable", "htable", "park=>size=4;autoexpire=600") modparam("htable", "htable", "fp=>size=32;autoexpire=3600;"); route[ATTEMPT_FAST_PICKUP] @@ -71,7 +71,28 @@ route[ATTEMPT_FAST_PICKUP] } } } - +} + +route[FAST_PICKUP_REFER] +{ + if(!is_method("REFER")) { + return; + } + + $avp(refer_to) = $hdr(Refer-To); + $avp(referred_by) = $hdr(Referred-By); + $avp(refer_to_uri) = $rt; +} + +route[FAST_PICKUP_REPLY] { + if (!is_method("REFER") || !t_check_status("(200)|(202)") ) { + return; + } + + $var(contact) = "sip:$(ct{tobody.uri}{uri.host}):$(ct{tobody.uri}{uri.port})"; + xlog("L_INFO", "caching park info $(avp(refer_to_uri){uri.user})@$(avp(refer_to_uri){uri.domain}) = $var(contact)"); + + $sht(park=>$(avp(refer_to_uri){uri.user})@$(avp(refer_to_uri){uri.domain})) = $var(contact); } route[FAST_PICKUP_INIT]