<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
Hello, </div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
<br>
</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
It should work out of the box with pinging the gateway. Why do you can not use this method?</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
<br>
</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
Otherwise you can just use the appropriate dispatcher method to set the gateway state as inactive at dns failure.</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
<br>
</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
Cheers,</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
<br>
</div>
<div dir="auto" style="color: rgb(33, 33, 33); background-color: rgb(255, 255, 255);">
Henning</div>
<div dir="auto" id="mail-editor-reference-message-container"><br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" style="font-size: 11pt;"><strong>Von:</strong> sr-users <sr-users-bounces@lists.kamailio.org> im Auftrag von David Villasmil <david.villasmil.work@gmail.com><br>
<strong>Gesendet:</strong> Donnerstag, 5. Mai 2022, 20:52<br>
<strong>An:</strong> Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org><br>
<strong>Betreff:</strong> [SR-Users] calling failure_route<br>
</div>
<br>
<div dir="ltr">Hello guys,
<div><br>
</div>
<div>Is it possible to call a failure_route like a normal route?</div>
<div><br>
</div>
<div>i.e.:</div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">{</font></div>
<div><font face="monospace">  t_on_failure("myroute");</font></div>
<div><font face="monospace">}</font></div>
<div><font face="monospace">...</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">route("myroute");</font></div>
<div><font face="monospace"><br>
</font></div>
<div><font face="monospace">failure_route[myroute] {</font></div>
<div><font face="monospace">...</font></div>
<div><font face="monospace">}</font></div>
<div><br>
</div>
<div>Let me explain:</div>
<div><br>
</div>
<div>I have this scenario where a DNS name may get deleted and a dns resolution will fail. There's no pinging to that gateway so i need to:</div>
<div><br>
</div>
<div>- skip that gateway when dispatching to the setid</div>
<div>- detect whether the domain is up and available<br>
</div>
<div><br>
</div>
<div>And failover to the next gateway.</div>
<div><br>
</div>
<div>I don't know of any other way so on the DISPATCH route, I'm doing:</div>
<div><br>
</div>
<div><font face="monospace">route[DISPATCH] {<br>
  # round robin dispatching on gateways group '1'<br>
  if(!ds_select_dst("1", "4")) {<br>
    send_reply("404", "No destination");<br>
    exit;<br>
  }<br>
  xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n");<br>
    if(dns_query("$du", "xyz")) {<br>
      t_on_failure("RTF_DISPATCH");<br>
      route(RELAY);<br>
    } else {</font></div>
<div><font face="monospace">      </font><span style="font-family:monospace">route(</span><span style="font-family:monospace">RTF_DISPATCH</span><span style="font-family:monospace">);</span></div>
<div><font face="monospace">    }<br>
    exit;<br>
}<br>
</font></div>
<div><br>
</div>
<div>to try to resolve and if it fails, it will just go to the failover route.</div>
<div><br>
</div>
<div><br>
</div>
<div>makes sense?</div>
<div><br>
</div>
<div><br clear="all">
<div>
<div dir="ltr">
<div dir="ltr">
<div>Regards,</div>
<div><br>
</div>
David Villasmil
<div>email: <a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a></div>
<div>phone: +34669448337</div>
</div>
</div>
</div>
</div>
</div>
<br>
</div>
</body>
</html>