Hey Everyone, I've been banging my head against the desk for days trying to get this working, and I'm sure it's something simple that I'm not doing, but maybe someone else can add some input.
Here is the best way to describe my call flow. Customer -> Kamailio -> Routing Server (302) -> Kamailio -> Vendors (from the 302 header)
I have tried to configure dispatch, but that hasn't worked out for me. My routing server does the authentication, LRN lookup, and provides the vendor routes in the sip header. So when I pass the call to the routing server, it has to contain the customer information. This setup has to be stateful so I can write CDRs for billing to MySQL.
The reason I tried using dispatch, is because I have multiple routing servers I would like to load balance across or even failover if one goes down.
Can anyone help me out, or at least help point me in the right direction?
Thanks! -Eric
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-w-external-routing-server-t... Sent from the Users mailing list archive at Nabble.com.
Hello Eric,
On 08/05/2015 01:08 PM, Eric Babcock wrote:
Hey Everyone, I've been banging my head against the desk for days trying to get this working, and I'm sure it's something simple that I'm not doing, but maybe someone else can add some input.
Here is the best way to describe my call flow. Customer -> Kamailio -> Routing Server (302) -> Kamailio -> Vendors (from the 302 header)
I have tried to configure dispatch, but that hasn't worked out for me. My routing server does the authentication, LRN lookup, and provides the vendor routes in the sip header. So when I pass the call to the routing server, it has to contain the customer information. This setup has to be stateful so I can write CDRs for billing to MySQL.
The reason I tried using dispatch, is because I have multiple routing servers I would like to load balance across or even failover if one goes down.
Can anyone help me out, or at least help point me in the right direction?
It's perfectly reasonable to use dispatcher to do round-robin request distribution and/or failover across > 1 redirect servers.
The normal process is to t_relay() the request to the redirect server, having first armed a failure_route (e.g. t_on_failure("CATCH_REDIRECT")) to catch the 302 message. In that scenario, the failure_route would look something like:
failure_route[CATCH_REDIRECT] { if(t_is_canceled()) exit;
if(t_branch_timeout() || $T_rpl($rs) != 302) { # Gateway timeout or unexpected non-302 response # received; roll over to another gateway with # ds_next_dst() or whatever.
t_on_failure("CATCH_REDIRECT"); t_relay();
exit; }
# Access Contact header(s) of 302 reply via $ct, # process them into a destination [set].
t_relay(); }
Thanks! Here is the config that I have right now....
request_route { sip_trace(); route(DISPATCH); }
failure_route[CATCH_REDIRECT] { if(t_is_canceled()) exit; if(t_branch_timeout() || $T_rpl($rs) != 302) { # Gateway timeout or unexpected non-302 response # received; roll over to another gateway with # ds_next_dst() or whatever. t_on_failure("CATCH_REDIRECT"); t_relay(); exit; } t_relay(); }
# Dispatch requests route[DISPATCH] { sip_trace(); # round robin dispatching on gateways group '1' if(!ds_select_dst("1", "4")) { send_reply("404", "No destination"); exit; } xlog("L_ALERT", "--- SCRIPT: going to <$ru> via <$du>\n"); t_on_failure("CATCH_REDIRECT"); t_relay(); exit; }
When I place a call it acts like it is going to go, but then I get a 503 back.
-- View this message in context: http://sip-router.1086192.n5.nabble.com/Kamailio-w-external-routing-server-t... Sent from the Users mailing list archive at Nabble.com.
Eric,
You'd benefit from peppering your route script with xlog() statements so that you can have some visibility into what's actually executing at various points and what the values are, e.g.
xlog("L_INFO", "Trying destination set/RURI: $du/$ru\n");
-- Alex
On Wednesday 05 August 2015 10:08:05 Eric Babcock wrote:
The reason I tried using dispatch, is because I have multiple routing servers I would like to load balance across or even failover if one goes down.
Like Alex mentioned, that is a correct way to handle calls. The way I do it is to have a dispatcher on in the kamailio server pointing to the redirectors/routing servers. The routing server has multiple dispatchers, 1 per vendor. If the vendor has multiple servers, they are just part of the dispatcher. The redirector knows which targets are up and running.
The dispatcher logic on the kamailio server is the "standard" kamailio config logic.
The redirector has the following logic:
//businesslogic setting $var(dispatcherid
if(!ds_select_domain($var(dispatcherid), 4)) { send_reply("503", "No dispatchers available"); exit; }
send_reply("302", "Redirect"); exit;
Alternative logic might be to implement all dispatchers targets on the kamailio server and have the redirector communicate which one to use, in the "failure route" of the 302, reset the dispatcher with the info from the redirector.
If you can't get it to work, use xlog and packet captures to debug the problem.