Hello guys,
Is it possible to call a failure_route like a normal route?
i.e.:
{ t_on_failure("myroute"); } ...
route("myroute");
failure_route[myroute] { ... }
Let me explain:
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:
- skip that gateway when dispatching to the setid - detect whether the domain is up and available
And failover to the next gateway.
I don't know of any other way so on the DISPATCH route, I'm doing:
route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n"); if(dns_query("$du", "xyz")) { t_on_failure("RTF_DISPATCH"); route(RELAY); } else { route(RTF_DISPATCH); } exit; }
to try to resolve and if it fails, it will just go to the failover route.
makes sense?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
Hello,
It should work out of the box with pinging the gateway. Why do you can not use this method?
Otherwise you can just use the appropriate dispatcher method to set the gateway state as inactive at dns failure.
Cheers,
Henning
________________________________ Von: sr-users sr-users-bounces@lists.kamailio.org im Auftrag von David Villasmil david.villasmil.work@gmail.com Gesendet: Donnerstag, 5. Mai 2022, 20:52 An: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Betreff: [SR-Users] calling failure_route
Hello guys,
Is it possible to call a failure_route like a normal route?
i.e.:
{ t_on_failure("myroute"); } ...
route("myroute");
failure_route[myroute] { ... }
Let me explain:
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:
- skip that gateway when dispatching to the setid - detect whether the domain is up and available
And failover to the next gateway.
I don't know of any other way so on the DISPATCH route, I'm doing:
route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n"); if(dns_query("$du", "xyz")) { t_on_failure("RTF_DISPATCH"); route(RELAY); } else { route(RTF_DISPATCH); } exit; }
to try to resolve and if it fails, it will just go to the failover route.
makes sense?
Regards,
David Villasmil email: david.villasmil.work@gmail.commailto:david.villasmil.work@gmail.com phone: +34669448337
Thanks Henning,
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 :)
David
On Thu, 5 May 2022 at 21:43, Henning Westerholt hw@gilawa.com wrote:
Hello,
It should work out of the box with pinging the gateway. Why do you can not use this method?
Otherwise you can just use the appropriate dispatcher method to set the gateway state as inactive at dns failure.
Cheers,
Henning
*Von:* sr-users sr-users-bounces@lists.kamailio.org im Auftrag von David Villasmil david.villasmil.work@gmail.com *Gesendet:* Donnerstag, 5. Mai 2022, 20:52 *An:* Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org *Betreff:* [SR-Users] calling failure_route
Hello guys,
Is it possible to call a failure_route like a normal route?
i.e.:
{ t_on_failure("myroute"); } ...
route("myroute");
failure_route[myroute] { ... }
Let me explain:
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:
- skip that gateway when dispatching to the setid
- detect whether the domain is up and available
And failover to the next gateway.
I don't know of any other way so on the DISPATCH route, I'm doing:
route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n"); if(dns_query("$du", "xyz")) { t_on_failure("RTF_DISPATCH"); route(RELAY); } else { route(RTF_DISPATCH); } exit; }
to try to resolve and if it fails, it will just go to the failover route.
makes sense?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
--
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
Hello,
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.
Cheers, Daniel
On 05.05.22 19:50, David Villasmil wrote:
Hello guys,
Is it possible to call a failure_route like a normal route?
i.e.:
{ t_on_failure("myroute"); } ...
route("myroute");
failure_route[myroute] { ... }
Let me explain:
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:
- skip that gateway when dispatching to the setid
- detect whether the domain is up and available
And failover to the next gateway.
I don't know of any other way so on the DISPATCH route, I'm doing:
route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n"); if(dns_query("$du", "xyz")) { t_on_failure("RTF_DISPATCH"); route(RELAY); } else { route(RTF_DISPATCH); } exit; }
to try to resolve and if it fails, it will just go to the failover route.
makes sense?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
Hello guys,
I ended up doing:
route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } if(!is_ip($(du{s.rm,sip:}{re.subst,/:.*//})) && !dns_query("$du", "xyz")) { xlog("L_DBG", "--- SCRIPT: Marking $du as Inactive/NotProbing!\n"); ds_mark_dst("ip"); route(DISPATCH); } route(RELAY); }
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.
Hope this makes sense.
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
On Fri, May 6, 2022 at 8:50 AM Daniel-Constantin Mierla miconda@gmail.com wrote:
Hello,
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.
Cheers, Daniel On 05.05.22 19:50, David Villasmil wrote:
Hello guys,
Is it possible to call a failure_route like a normal route?
i.e.:
{ t_on_failure("myroute"); } ...
route("myroute");
failure_route[myroute] { ... }
Let me explain:
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:
- skip that gateway when dispatching to the setid
- detect whether the domain is up and available
And failover to the next gateway.
I don't know of any other way so on the DISPATCH route, I'm doing:
route[DISPATCH] { # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xlog("L_DBG", "--- SCRIPT: going to <$ru> via <$du>\n"); if(dns_query("$du", "xyz")) { t_on_failure("RTF_DISPATCH"); route(RELAY); } else { route(RTF_DISPATCH); } exit; }
to try to resolve and if it fails, it will just go to the failover route.
makes sense?
Regards,
David Villasmil email: david.villasmil.work@gmail.com phone: +34669448337
Kamailio - Users Mailing List - Non Commercial Discussions
- sr-users@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender! Edit mailing list options or unsubscribe:
-- Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - Online