[SR-Users] Need help with route statement

Nelson Pereira npereira at protus.com
Fri May 21 16:18:07 CEST 2010


Im not a code expert or a kamailio expert, so where and how do I intergrate this function in my current routing logic?

# main request routing logic

route{
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                break;
        };
        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                break;
        };

        if (!method=="REGISTER") record_route();
        if (loose_route()) {
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
                break;
        };

        if (uri==myself) {

                if (method=="REGISTER") {

                        save("location");
                        break;
                };

        append_hf("P-hint: usrloc applied\r\n");
        route(1);
}

route[1]
{
        if (src_ip==10.98.6.5) {
                if (dst_port==5065) {
                        t_relay_to_tcp("10.98.118.20", "5065");
                }
                else if (dst_port==5066) {
                        t_relay_to_tcp("10.98.118.20", "5066");
                }
                else if (dst_port==5067) {
                        t_relay_to_tcp("10.98.118.20", "5067");
                }
                else {
                        t_relay_to_tcp("10.98.118.20", "5060");
                }
        }
        else {
                t_relay_to_udp("10.98.6.5", "5060");
        };
}
                                         



Nelson Pereira


-----Original Message-----
From: Klaus Darilion [mailto:klaus.mailinglists at pernau.at] 
Sent: Friday, May 21, 2010 9:20 AM
To: Nelson Pereira
Cc: users at lists.kamailio.org
Subject: Re: [SR-Users] Need help with route statement



Am 21.05.2010 14:33, schrieb Nelson Pereira:
> The problem is that the Kamailio receives a 302 Moved Temporarily with a
> contact field of CONTACT: <sip:1989 at 10.98.6.5:5065;transport=TCP>
>
> I need to have Kamailio, use this contact field and re-send the invite.
>
> How can this be done?
>

Use get_redirects() frunction

http://www.kamailio.org/docs/modules/3.0.x/modules_k/uac_redirect.html#id2943112

regards
klaus



More information about the sr-users mailing list