<div dir="ltr">Hello!<div><br></div><div>I have a simple config for routing requests with failover and blacklisting on 408, 480 and 503 codes from servers.</div><div><br></div><div>This is a part of config:</div><div><div style="color:rgb(51,51,51);background-color:rgb(245,245,245);font-family:"Droid Sans Mono",monospace,monospace,"Droid Sans Fallback";font-size:14px;line-height:19px;white-space:pre"><div><span style="color:rgb(170,170,170);font-style:italic"># Wrapper for relaying requests</span></div><div><span style="color:rgb(170,55,49);font-weight:bold">route[</span><span style="color:rgb(156,93,39);font-weight:bold">RELAY</span><span style="color:rgb(170,55,49);font-weight:bold">]</span> {</div><br><div>  <span style="color:rgb(170,170,170);font-style:italic"># the base event routes</span></div><div>  t_on_branch(<span style="color:rgb(68,140,39)">"MANAGE_BRANCH"</span>)<span style="color:rgb(119,119,119)">;</span></div><div>  t_on_reply(<span style="color:rgb(68,140,39)">"MANAGE_REPLY"</span>)<span style="color:rgb(119,119,119)">;</span></div><div>  t_on_failure(<span style="color:rgb(68,140,39)">"MANAGE_FAILURE"</span>)<span style="color:rgb(119,119,119)">;</span></div><br><div>  <span style="color:rgb(75,105,198)">if</span> (<span style="color:rgb(119,119,119)">!</span>t_relay()) {</div><div>    sl_reply_error()<span style="color:rgb(119,119,119)">;</span></div><div>  }</div><div>  <span style="color:rgb(170,55,49);font-weight:bold">exit</span><span style="color:rgb(119,119,119)">;</span></div><div>}</div><br><div><span style="color:rgb(170,170,170);font-style:italic"># Manage incoming replies</span></div><div><span style="color:rgb(170,55,49);font-weight:bold">onreply_route[</span><span style="color:rgb(156,93,39);font-weight:bold">MANAGE_REPLY</span><span style="color:rgb(170,55,49);font-weight:bold">]</span> {</div><div>  xlog(<span style="color:rgb(68,140,39)">"L_NOTICE"</span><span style="color:rgb(119,119,119)">,</span> <span style="color:rgb(68,140,39)">"$rr ($rs) [$cs] ($ci) $si:$sp - $ua</span><span style="color:rgb(119,119,119)">\n</span><span style="color:rgb(68,140,39)">"</span>)<span style="color:rgb(119,119,119)">;</span></div><div>  <span style="color:rgb(75,105,198)">if</span> ( t_check_status(<span style="color:rgb(68,140,39)">"(503)|(408)|(480)"</span>) ) {</div><div>    xlog(<span style="color:rgb(68,140,39)">"L_WARN"</span><span style="color:rgb(119,119,119)">,</span> <span style="color:rgb(68,140,39)">"Server will be blacklisted: $si:$sp ($rs)</span><span style="color:rgb(119,119,119)">\n</span><span style="color:rgb(68,140,39)">"</span>)<span style="color:rgb(119,119,119)">;</span></div><div>  }</div><div>}</div><br><div><span style="color:rgb(170,170,170);font-style:italic"># Manage failure routing cases</span></div><div><span style="color:rgb(170,55,49);font-weight:bold">failure_route[</span><span style="color:rgb(156,93,39);font-weight:bold">MANAGE_FAILURE</span><span style="color:rgb(170,55,49);font-weight:bold">]</span> {</div><br><div>  <span style="color:rgb(75,105,198)">if</span> ( <span style="color:rgb(119,119,119)">!</span>t_check_status(<span style="color:rgb(68,140,39)">"(503)|(408)|(480)"</span>) ) {</div><div>    <span style="color:rgb(170,55,49);font-weight:bold">exit</span><span style="color:rgb(119,119,119)">;</span></div><div>  }</div><br><div>  ds_mark_dst(<span style="color:rgb(68,140,39)">"IP"</span>)<span style="color:rgb(119,119,119)">;</span> <span style="color:rgb(170,170,170);font-style:italic"># blacklist</span></div><br><div>  <span style="color:rgb(75,105,198)">if</span> (t_is_canceled()) <span style="color:rgb(170,55,49);font-weight:bold">exit</span><span style="color:rgb(119,119,119)">;</span></div><br><div>  <span style="color:rgb(75,105,198)">if</span> (<span style="color:rgb(119,119,119)">!</span>ds_next_domain()) {</div><div>    send_reply(<span style="color:rgb(68,140,39)">"503"</span><span style="color:rgb(119,119,119)">,</span> <span style="color:rgb(68,140,39)">"Service Unavailable"</span>)<span style="color:rgb(119,119,119)">;</span></div><div>    <span style="color:rgb(170,55,49);font-weight:bold">exit</span><span style="color:rgb(119,119,119)">;</span></div><div>  }</div><br><div>  <span style="color:rgb(170,55,49);font-weight:bold">route(</span><span style="color:rgb(156,93,39);font-weight:bold">RELAY</span><span style="color:rgb(170,55,49);font-weight:bold">)</span><span style="color:rgb(119,119,119)">;</span></div><div>}</div></div></div><div><br></div><div>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?<br>I didn't find this on the module page:</div><div><a href="https://www.kamailio.org/docs/modules/stable/modules/tm.html">https://www.kamailio.org/docs/modules/stable/modules/tm.html</a><br></div><div><br></div></div>