<div dir="ltr">Hello guys,<div><br></div><div>I ended up 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> if(!is_ip($(du{s.rm,sip:}{re.subst,/:.*//})) && !dns_query("$du", "xyz")) {<br> xlog("L_DBG", "--- SCRIPT: Marking $du as Inactive/NotProbing!\n");<br> ds_mark_dst("ip");<br> route(DISPATCH);<br> }<br> route(RELAY);<br>}</font><br></div><div><br></div><div>This will do a dns_query only if $du is not a valid ip address, and if the resolution fails, will mark the destination as INACTIVE and try again with the same route.</div><div><br></div><div>Hope this makes sense.</div><div><br><div><div><div><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></div><br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 6, 2022 at 8:50 AM Daniel-Constantin Mierla <<a href="mailto:miconda@gmail.com">miconda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>Hello,</p>
<p>you can put the group of actions inside a route block and then
execute that route block from failure_route and other locations in
your config.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<div>On 05.05.22 19:50, David Villasmil
wrote:<br>
</div>
<blockquote type="cite">
<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>
<fieldset></fieldset>
<pre>__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
* <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a>
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:
* <a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre cols="72">--
Daniel-Constantin Mierla -- <a href="http://www.asipto.com" target="_blank">www.asipto.com</a>
<a href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - Online
* <a href="https://www.asipto.com/sw/kamailio-advanced-training-online/" target="_blank">https://www.asipto.com/sw/kamailio-advanced-training-online/</a></pre>
</div>
</blockquote></div>