From 80f696b267d1e51585a24aa29f4d098fab6943a0 Mon Sep 17 00:00:00 2001 From: Fred Posner Date: Fri, 27 Oct 2023 09:52:27 -0400 Subject: [PATCH] README.md: update Kamailio example --- README.md | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bb39cec..96f9d4a 100644 --- a/README.md +++ b/README.md @@ -68,11 +68,11 @@ loadmodule "jansson.so" loadmodule "rtimer.so" ``` -The following htables should be created (you can increase the size of `apiban` as needed): +The following htables should be created (you can increase the size of `apiban` as needed). The autoexpire field allows apiban entries to expire as normal (from the banned check): ``` -modparam("htable", "htable", "apiban=>size=11;") -modparam("htable", "htable", "apibanctl=>size=1;initval=0;") +modparam("htable", "htable", "apiban=>size=14;autoexpire=604800;") +modparam("htable", "htable", "apibanctl=>size=1;initval=100;") ``` In this example, let's set an rtimer to run every 5 minutes: @@ -91,12 +91,7 @@ route[APIBAN] { // replace MYAPIKEY with your apiban.org API key. $var(apikey) = "MYAPIKEY"; - - if($sht(apibanctl=>ID) == 0) { - $var(apiget) = "https://apiban.org/api/" + $var(apikey) + "/banned"; - } else { - $var(apiget) = "https://apiban.org/api/" + $var(apikey) + "/banned/" + $sht(apibanctl=>ID); - } + $var(apiget) = "https://apiban.org/api/" + $var(apikey) + "/banned/" + $sht(apibanctl=>ID); xlog("L_INFO","APIBAN: Sending API request to $var(apiget)\n"); http_client_query("$var(apiget)", "$var(banned)");