diff --git a/kamailio/registrar-role.cfg b/kamailio/registrar-role.cfg index 8052791..a3a455c 100644 --- a/kamailio/registrar-role.cfg +++ b/kamailio/registrar-role.cfg @@ -14,6 +14,8 @@ ######## Generic Hash Table container in shared memory ######## modparam("htable", "htable", "auth_cache=>size=16;autoexpire=7200;") +######## Hash table container for handling drop_on_failure feature ###### +modparam("htable", "htable", "dropped_reqs=>size=16;autoexpire=300;"); ####### Authentication Interface module ########## loadmodule "auth.so" @@ -77,6 +79,12 @@ kazoo.registrar_handle_expired_ws = REGISTRAR_HANDLE_EXPIRED_WS descr "handles e route[HANDLE_REGISTER] { if (is_method("REGISTER")) { + if ($sht(dropped_reqs=>$ci)) { + xlog("L_INFO", "$ci|log|dropping failed registration, see you in 5 minutes\n"); + t_release(); + drop(); + exit(); + } #!ifdef NAT_TRAVERSAL_ROLE if (nat_uac_test("3")) { @@ -173,6 +181,7 @@ route[KAZOO_AUTHORIZATION] } if(kazoo_async_query("callmgr", $var(amqp_routing_key), $var(amqp_payload_request), "KAZOO_AUTHORIZATION_OK", "KAZOO_AUTHORIZATION_ERROR") != 1) { xlog("L_INFO", "$ci|log|failed to send Kazoo query for authentication credentials for $Au $si:$sp - dropping request\n"); + $sht(dropped_reqs=>$ci) = 1; drop(); exit; } @@ -203,6 +212,7 @@ route[KAZOO_AUTHORIZATION_OK] route[KAZOO_AUTHORIZATION_ERROR] { xlog("L_INFO", "$ci|log|failed to query Kazoo for authentication credentials for $Au $si:$sp - dropping request\n"); + $sht(dropped_reqs=>$ci) = 1; drop(); exit; }