Hello, can somebody help me how to configure Kamailio to route/forward requests to different (backup) server when Kamailio itself is not able to deliver them?
I have working SIP gateway (on different host/port) which deliver received SIP messages to XMPP network and I want to achieve:
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.
I guess that Kamailio should be able to configure for such custom routing/forwarding but I have not figured yet how to do it. I'm using Kamailio 4.4 with slightly modified default kamailio.cfg config.
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).