[SR-Users] get_redirects with t_next_contacts

Marrold kamailio at marrold.co.uk
Thu Mar 31 01:46:12 CEST 2016


Hi all,

I am having some issues using get_redirects() from the UAC_Redirect module
in conjunction with  t_next_contacts from the TM Module. I've searched
Google and the list but the only references I can find are several years
old.

I am attempting to configure Kamailio so it if receives a 3XX redirect
message, it will store the Contacts it contains, and attempt them in 'Q'
parameter order.

So for the Contact below-

Contact: <sip:10.0.97.21:5060>;q=0.2,<sip:5.29.13.139:5060>;q=0.5.

I want Kamailio to try 5.29.13.139, and if that times out, or is rejected
in someway, try 10.0.97.21.

If I use t_relay rather than t_next_contacts, kamailio branches the calls
and relays them in parallel regardless of Q value - this is not what I want.

If I use t_next_contacts, it attempts 5.29.13.139 which is rejected with a
401, but it doesn't attempt 5.29.13.139 and responds "408", "Request
Timeout MH 2"

Relevant script section is below, has anyone been able to get this working?

failure_route[302] {

    if (t_check_status("302")){
        xlog("L_ALERT","Failure Route: 302\n$mb");

        get_redirects("*");

        if (!t_load_contacts()) {
            send_reply("500", "Server Internal Error - Cannot load contacts
MH");
            exit;
        };

        if (!t_next_contacts()) {
            t_reply("408", "Request Timeout MH");
        } else {
            t_on_failure("302");
            t_relay();
            exit;
        };
    } else if (t_check_status("[456][0-9][0-9]")){

        if (!t_next_contacts()) {
            t_reply("408", "Request Timeout MH 2");
        } else {
            t_on_failure("302");
            t_relay();
            exit;
        }
    }
}

Thanks,

Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160331/4912bf8a/attachment.html>


More information about the sr-users mailing list