[SR-Users] 200 OK with SDP got wrong Contact HF after fix_nated_contact()

Karsten Horsmann khorsmann at gmail.com
Fri Apr 13 14:10:56 CEST 2012


Hello!

I got the following problem. My 200 OK with SDP sends the private ip
of the B-Leg party.
Kamailio is multihomed (pulic/private address) in front of an ivr system.


222.222.222.222 public ip kamailio
172.20.100.74   private ip kamailio
172.20.100.61   private ip ivr
217.217.217.217 public ip uac
172.20.100.203   private ip uac

U 2012/04/13 13:56:57.307314 222.222.222.222:5060 -> 217.217.217.217:42885
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP
172.20.100.103:28472;rport=42885;branch=z9hG4bK-d8754z-824b81ca678a7de4-1---d8754z-;received=217.217.217.217.
From: <sip:4horsmann at 222.222.222.222>;tag=e9d1124c.
To: <sip:kalkbrenner at 222.222.222.222>;tag=ds-1c78ac-2ca01e29.
Call-ID: NjQ5YWU0NGYxZjM3YWJhYmE5ZWYxYmQzZjYzYzQyMzI..
CSeq: 2 INVITE.
Content-Length: 202.
Content-Type: application/sdp.
Record-Route: <sip:172.20.100.74;r2=on;lr=on;ftag=e9d1124c;nat=yes>.
Record-Route: <sip:222.222.222.222;r2=on;lr=on;ftag=e9d1124c;nat=yes>.
Supported: replaces.
Supported: 100rel.
Allow: INVITE.
Allow: ACK.
Allow: BYE.
Allow: CANCEL.
Allow: OPTIONS.
Allow: NOTIFY.
Allow: REFER.
Allow: PRACK.
Allow: INFO.
Allow: UPDATE.
Allow: MESSAGE.
Contact: <sip:172.20.100.61:5060>.
P-hint: NATMANAGE WITH SDP.
.
v=0.
o=aculab-04246C01 2060618394 2060618394 IN IP4 212.59.42.189.
s=-.
c=IN IP4 222.222.222.222.
t=0 0.
m=audio 40390 RTP/AVP 0 101.
a=rtpmap:101 telephone-event/8000.
a=fmtp:101 0-15.
a=nortpproxy:yes.

##############################################################
# RTPProxy control
route[NATMANAGE] {
#!ifdef WITH_NAT
        xlog("NATMANAGE M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");

        if(has_body("application/sdp")) {
                xlog("NATMANAGE M=$rm with SDP\n");
                append_hf("P-hint: NATMANAGE WITH SDP\r\n");
                fix_nated_contact();
        }


        if (is_request()) {
                if(has_totag()) {
                        if(check_route_param("nat=yes")) {
                                setbflag(FLB_NATB);
                        }
                }
        }

        if (isbflagset(FLB_NATB))
                return;

        if (dst_ip == 212.59.42.189) {
                xlog("rtpproxy_manage extern zu intern\n");
                #rtpproxy_manage("OCFEI","172.20.10.74");
                rtpproxy_manage("FWCEI","172.20.10.74");
                #xlog("e->i Body vor fix: $rb\n");
                #fix_nated_contact();
                #xlog("e->i Body nach fix: $rb\n");

                } else {
                xlog("rtpproxy_manage intern zu extern\n");
                #rtpproxy_manage("OCFIE","222.222.222.222");
                rtpproxy_manage("FWCIE","222.222.222.222");
                xlog("i->e Body vor fix: $rb\n");
                fix_nated_contact();
                xlog("i->e Body nach fix: $rb\n");
        }

        if (is_request()) {
                if (!has_totag()) {
                        add_rr_param(";nat=yes");
                }
        }
        if (is_reply()) {
               if(isbflagset(FLB_NATB)) {
                        fix_nated_contact();
                }
        }
#!endif
        return;
}

-- 
Mit freundlichen Grüßen
*Karsten Horsmann*



More information about the sr-users mailing list