[SR-Users] Redirects - are q values required to implement serial forking?

Mike Montgomery mmontgomery at trust-tek.com
Mon Nov 12 15:50:53 CET 2018


We have a situation where we get a redirect from a carrier with a list of carriers to send the transaction to in the contact header. None of the carriers in the contact header have q values assigned. 

We have implemented our redirect handling logic using the UAC_REDIRECT module (get_redirects()) with help from TM module (t-load_contacts(), t_next_contact()). (failure_route code is at bottom of this note)

We find that when we receive a contact header with q values, we can launch requests serially using t_next_contact() and individually work through the contact list until we get a positive response. When we get a redirect with no q values in the contact header we find that all contacts get loaded and launched in parallel.

Although not stated in the documentation, it appears that in order to implement serial contact redirect handling, q values must be present in the contact header. Based on this assumption, and knowing that the redirecting carrier cannot include q values, we have attempted to modify the contact header and find that we are unable to add q values to the contact header.

We have attempted without success to use remove_hf("Contact”) followed by append_hf("Contact: $(avp(contact)) \r\n”); where $(avp(contact)) is the avp where we have rewritten the contact header to include q values.

Any guidance on how to handle this issue is appreciated.

_________________________________________________________-

Our failure route code:
        if (t_check_status("3[0-9][0-9]")) {
                xlog("L_INFO", "----> REDIRECT Contact Header --> $T_rpl($ct) --- Method $rm --- From $T_req($fu) --- To $T_req($tu) --- Destination $T_req($du) \n");
                get_redirects("*:*");

                if (!t_load_contacts()) {
                        xlog("L_INFO", "-t_load_contacts() FAILED /n");
                };

                        xlog("L_INFO", "####->LOAD CONTACT LIST $xavp(tm_contacts[0]=>uri) \n");

                if (t_next_contacts()) {
                        xlog("L_INFO", "-t_next_contact() loaded successfully /n");
                        xlog("L_INFO", "####-> NEXT CONTACT LIST $xavp(tm_contacts[0]=>uri) \n");
                };
                t_on_failure("serial");

                if(t_relay()){
                    xlog("L_INFO","----->Relayed in MANAGE_FAILURE --- Method $rm --- Contact Header $ct \n");
                 };
                exit;
        } else {
                xlog("L_INFO","-----> NO REDIRECT --- Method $rm --- Contact Header $ct \n");
                exit;
        }

failure_route["serial"] {
        xlog ("L_INFO", "Entered failure_route(serial) /n");
        if (t_check_status("3[0-9][0-9]")) {
                xlog("L_INFO", "----> DOUBLE REDIRECT Contact Header --> $T_rpl($ct) --- Method $rm --- From $T_req($fu) --- To $T_req($tu) --- Destination $T_req($du) \n");
                $xavp(tm_contacts[*]) = $null;
                xlog("L_INFO", "XXX-> tm_contacts reset to Null $xavp(tm_contacts[0]=>uri)\n");

                get_redirects("*:*");

                if (!t_load_contacts()) {
                        xlog("L_INFO", "-t_load_contacts() FAILED /n");
                };

                        xlog("L_INFO", "####-> LOAD 2 CONTACT LIST $xavp(tm_contacts[0]=>uri) \n");

        }
        if (!t_next_contacts()) {
                exit;
        }

        xlog("L_INFO", "-t_next_contact() loaded successfully /n");
        xlog("L_INFO", "####-> NEXT CONTACT LIST $xavp(tm_contacts[0]=>uri) \n");

        t_on_failure("serial");
        if(t_relay()){
            xlog("L_INFO","----->Relayed in failure_route(serial) --- Method $rm --- Contact Header $ct \n");
        };
}

Best Regards,

 Mike Montgomery
 Principal, Trusted Technical Services, Inc.
 o - 919 924 4703  x3000
 m - 919 539 6133



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181112/486d540b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: final_logo_for_email2.jpg
Type: image/jpeg
Size: 15301 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20181112/486d540b/attachment.jpg>


More information about the sr-users mailing list