On Sun, Jul 22, 2018 at 11:11:12AM +0200, Pali Roh??r wrote:
Kamailio should try to send SIP messages directly to
foreign SIP domains
and when it fails (e.g. user not available or foreign SIP is not
running), then forward message to that my SIP <--> XMPP gateway which
will try to deliver it via XMPP.
There are more scenarios you need to keep in mind. A simple one is if
lookup() fails (not registered if you are running a registrar on this
instance) to just change the domain in the R-URI and relay it there:
if(!lookup("location"))
{
$rd="xmpp.example.org";
route(RELAY);
exit;
}
You can use a similar approach in failure routes primed:
failure_route[MANAGE_FAILURE] {
if (t_check_status("[456][0-9][0-9]"))
{
$rd="xmpp.example.org";
route(RELAY);
exit;
}
}
Be sure to use a different failure route (or add some logic to the if to
avoid infinite loops).