[SR-Users] Need help with route statement

Nelson Pereira npereira at protus.com
Fri May 21 14:33:02 CEST 2010


Hi all...

Well I have made some progress... Bellow is my routing statement:


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) {
                append_hf("P-hint: outbound\r\n");
                route(1);
                break;
        };
        if (uri==myself) {

                if (method=="REGISTER") {

                        save("location");
                        break;
                };

                lookup("aliases");
                if (!uri==myself) {
                        append_hf("P-hint: outbound alias\r\n");
                        route(1);
                        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");
        };
}


When asterisk sends a call to kamailio, Kamailio then sends the invite to 10.98.118.20 via TCP on port 5061.
INVITE sip:1989 at 10.98.6.5:5061 SIP/2.0
Record-Route: <sip:10.98.6.5:5065;transport=tcp;r2=on;lr=on>
Record-Route: <sip:10.98.6.5:5061;r2=on;lr=on>
Via: SIP/2.0/TCP 10.98.6.5:5065;branch=z9hG4bK74fd.a4578a84.0
Via: SIP/2.0/UDP 10.98.6.5:5060;branch=z9hG4bK7b9bb22d;rport=5060
From: "1103" <sip:1103 at 10.98.6.5>;tag=as4ae41ccf
To: <sip:1989 at 10.98.6.5:5061>
Contact: <sip:1103 at 10.98.6.5>
Call-ID: 44073b911e86b0a96c9104cb7a5ec389 at 10.98.6.5
CSeq: 102 INVITE
User-Agent: Asterisk PBX
Max-Forwards: 69
Date: Fri, 21 May 2010 12:23:58 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces
Content-Type: application/sdp
Content-Length: 232
P-hint: usrloc applied

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?


Nelson Pereira
Senior Network Specialist

Protus<http://www.protus.com/>
npereira at protus.com<mailto:name at protus.com>
phone: 613.733.0000 ext.528
MyFax: 613.822.5083

MyFax.com<http://www.myfax.com/> | my1voice.com<http://www.my1voice.com/> | Campaigner.com<http://www.campaigner.com/>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100521/70f1ade7/attachment.htm>


More information about the sr-users mailing list