[SR-Users] caching 404 responses

Voip support voipexpert0 at gmail.com
Fri Jan 10 11:38:21 CET 2020

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",

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) =

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 ) {

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

Greetings from Poland

pt., 10 sty 2020 o 08:10 Krzysztof Drewicz <kdrewicz at 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 at cludo.pl | www.cludo.pl <http://www.cludo.pl/>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200110/06ae8a05/attachment.html>

More information about the sr-users mailing list