<div dir="auto">Thanks Henning,</div><div dir="auto"><br></div><div dir="auto">Between the time when the ping realizes it to the next ping, the scenario might happen. I don’t know the dns failure function, that’s my problem :)</div><div dir="auto"><br></div><div dir="auto">David</div><div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 5 May 2022 at 21:43, Henning Westerholt <<a href="mailto:hw@gilawa.com">hw@gilawa.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">



<div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
Hello, </div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
<br>
</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
It should work out of the box with pinging the gateway. Why do you can not use this method?</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
<br>
</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
Otherwise you can just use the appropriate dispatcher method to set the gateway state as inactive at dns failure.</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
<br>
</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
Cheers,</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
<br>
</div>
<div dir="auto" style="background-color:rgb(255,255,255);color:rgb(33,33,33)">
Henning</div>
<div dir="auto" id="m_-1308518599669561615mail-editor-reference-message-container"><br>
<hr style="display:inline-block;width:98%">
<div id="m_-1308518599669561615divRplyFwdMsg" style="font-size:11pt"><strong>Von:</strong> sr-users <<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists.kamailio.org</a>> im Auftrag von David Villasmil <<a href="mailto:david.villasmil.work@gmail.com" target="_blank">david.villasmil.work@gmail.com</a>><br>
<strong>Gesendet:</strong> Donnerstag, 5. Mai 2022, 20:52<br>
<strong>An:</strong> Kamailio (SER) - Users Mailing List <<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>><br>
<strong>Betreff:</strong> [SR-Users] calling failure_route<br>
</div></div></div><div><div dir="auto" id="m_-1308518599669561615mail-editor-reference-message-container">
<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" style="font-family:monospace;color:rgb(0,0,0)"><br>
</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">{</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">  t_on_failure("myroute");</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">}</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">...</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)"><br>
</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">route("myroute");</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)"><br>
</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">failure_route[myroute] {</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">...</font></div>
<div><font face="monospace" style="font-family:monospace;color:rgb(0,0,0)">}</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" style="font-family:monospace;color:rgb(0,0,0)">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" style="font-family:monospace;color:rgb(0,0,0)">      </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" style="font-family:monospace;color:rgb(0,0,0)">    }<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>
</div>

</blockquote></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><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>