[SR-Users] Manage blacklisting on network errors

Marat Gareev maratkin94 at gmail.com
Thu Sep 9 20:02:09 CEST 2021


Hello!

I have a simple config for routing requests with failover and blacklisting
on 408, 480 and 503 codes from servers.

This is a part of config:
# Wrapper for relaying requests
route[RELAY] {

# the base event routes
t_on_branch("MANAGE_BRANCH");
t_on_reply("MANAGE_REPLY");
t_on_failure("MANAGE_FAILURE");

if (!t_relay()) {
sl_reply_error();
}
exit;
}

# Manage incoming replies
onreply_route[MANAGE_REPLY] {
xlog("L_NOTICE", "$rr ($rs) [$cs] ($ci) $si:$sp - $ua\n");
if ( t_check_status("(503)|(408)|(480)") ) {
xlog("L_WARN", "Server will be blacklisted: $si:$sp ($rs)\n");
}
}

# Manage failure routing cases
failure_route[MANAGE_FAILURE] {

if ( !t_check_status("(503)|(408)|(480)") ) {
exit;
}

ds_mark_dst("IP"); # blacklist

if (t_is_canceled()) exit;

if (!ds_next_domain()) {
send_reply("503", "Service Unavailable");
exit;
}

route(RELAY);
}

If there is a timeout or network error on the server side, it is
blacklisted. How can such cases be managed and how can they be logged?
I didn't find this on the module page:
https://www.kamailio.org/docs/modules/stable/modules/tm.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20210909/652a8cfb/attachment.htm>


More information about the sr-users mailing list