[SR-Users] Kamailio w/ external routing server

Alex Balashov abalashov at evaristesys.com
Wed Aug 5 22:25:26 CEST 2015


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();
}

-- 
Alex Balashov | Principal | Evariste Systems LLC
303 Perimeter Center North, Suite 300
Atlanta, GA 30346
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list