Try to add it in onreply_route using htable but in-memory not in database.

Steps :

You have to initialize an htable by : 
modparam("htable", "htable", "counter_404=>size=32;initval=0;autoexpire=600;")

And you can increase counter like that (i did not test but i think should give you a clue how to proceed further, the initval is set to 0)
I used key as request uri + call-id to have an unique key and the value expired after 600sec. 

In onreply_route for $rs=="404" ( if response status is 404 add to htable the request uri with conjunction of call-id for allowing the values to expire ) 

$sht(counter_404=>$T_req($ru)::$ci) = $shtinc(counter_404=>$T_req($ru)::$ci); 

After that somewhere in beginning of request_route once you receive an INVITE you could check the $ru if its in htable counter_404 and if count is lets say higher than 10 (10 replies 404 in last 10 minutes) you can immediately reply 404.

if( $shtcn(counter_404=>$ru::.*) > 10 ) {
send_reply(404);
exit;
}

Hope it helps - you need to play a bit with it on test environment.

Greetings from Poland 
Tom



pt., 10 sty 2020 o 08:10 Krzysztof Drewicz <kdrewicz@cludo.pl> napisał(a):
Hello

would like to see if I'm not reinventing the wheel:
scenario: some old powerdialler/predictive calls  kamailio as call dispatcher, kamailio then dials carrier.

But this dialler does many calls to the same B number with 404 response (from carrier) in short (retry is < 600s) time, so no need to bother PSTN/carrier with retry.

Should I simply use htable, cache 404 hit, use some reasonable value
modparam("htable", "db_expires", 1)
put there like 600 s TTL 

or something like that?

Any hints/thoughts? Maybe this scenario is common and being used with success somewhere (and yes, this powerdialer is not very clever, and I do know it should not be needed for this) 

Thanks, 


--

 

Krzysztof Drewicz
Senior Infrastructure Administrator
CLUDO | ul. Grochowska 306/308, 03-840 Warszawa
t+48221223977
 
kdrewicz@cludo.plwww.cludo.pl

 

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users