[SR-Users] calling failure_route

Henning Westerholt hw at gilawa.com
Thu May 5 22:43:13 CEST 2022


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 at lists.kamailio.org> im Auftrag von David Villasmil <david.villasmil.work at gmail.com>
Gesendet: Donnerstag, 5. Mai 2022, 20:52
An: Kamailio (SER) - Users Mailing List <sr-users at 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 at gmail.com<mailto:david.villasmil.work at gmail.com>
phone: +34669448337

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220505/e4e9d823/attachment.htm>


More information about the sr-users mailing list