top hiding strange behavior

Anonymous
2012-05-22
2013-05-09

  • Anonymous
    2012-05-22

    Hello,
    I'm newbee in a Opensips and I tried to setup an installation with topology hiding. But it seems to me that I made some mistakes or there is an error in a top hiding scenario work.
    This is my configuration:

    modparam("b2b_logic", "server_address", "sip:sa@192.168.0.11:5060")
    route{
        if(src_ip==192.168.0.10)
        {
            rewritehostport("192.168.0.13:5060");
            forward();
        };
        if(src_ip==192.168.0.13)
        {
            b2b_init_request("top hiding");
            rewritehostport("192.168.0.10:5060");
            forward();
        };
    }

    In my  test environment I want to "hide"  ip address 192.168.0.13 in contact field in packects sent to 192.168.0.10. But I stil recieve at 192.168.0.10 packets with 192.168.0.13 in a contact field.

    Could anybody  please help me to understand and solve the problem?

     

  • Anonymous
    2012-05-22

    I couldn't attach dump file, so I'm attaching dump as a plain text:

    17:50:19.705902 IP 192.168.0.10.5060 > 192.168.0.11.5060: SIP, length: 850
    E..nbX..@……
    ………ZJ.INVITE sip:000@192.168.0.11 SIP/2.0
    Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK71d98ba2;rport
    Max-Forwards: 70
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as5c4b3974
    To: <sip:000@192.168.0.11>
    Contact: <sip:asterisk@192.168.0.10:5060>
    Call-ID: 1a2b4a9b33c661205dcd956a4b3193d4@192.168.0.10:5060
    CSeq: 102 INVITE
    User-Agent: Asterisk PBX 1.8.11.0
    Date: Sun, 20 May 2012 13:50:19 GMT
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Content-Type: application/sdp
    Content-Length: 282

    v=0
    o=root 659202704 659202704 IN IP4 192.168.0.10
    s=Asterisk PBX 1.8.11.0
    c=IN IP4 192.168.0.10
    t=0 0
    m=audio 13338 RTP/AVP 8 3 0 101
    a=rtpmap:8 PCMA/8000
    a=rtpmap:3 GSM/8000
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    a=sendrecv

    17:50:19.709147 IP 192.168.0.11.5060 > 192.168.0.10.5060: SIP, length: 481
    E…..@.@..z…….
    ……h.SIP/2.0 100 Trying
    Via: SIP/2.0/UDP 192.168.0.10:5060;received=192.168.0.10;branch=z9hG4bK71d98ba2;rport=5060
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as5c4b3974
    To: <sip:000@192.168.0.11>
    Call-ID: 1a2b4a9b33c661205dcd956a4b3193d4@192.168.0.10:5060
    CSeq: 102 INVITE
    Server: Asterisk PBX 1.8.11.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Contact: <sip:000@192.168.0.13:5060>
    Content-Length: 0

    17:50:19.709409 IP 192.168.0.11.5060 > 192.168.0.10.5060: SIP, length: 807
    E..C..@.@..4…….
    …../A.SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.0.10:5060;received=192.168.0.10;branch=z9hG4bK71d98ba2;rport=5060
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as5c4b3974
    To: <sip:000@192.168.0.11>;tag=as1254939c
    Call-ID: 1a2b4a9b33c661205dcd956a4b3193d4@192.168.0.10:5060
    CSeq: 102 INVITE
    Server: Asterisk PBX 1.8.11.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Contact: <sip:000@192.168.0.13:5060>
    Content-Type: application/sdp
    Content-Length: 282

    v=0
    o=root 753427453 753427453 IN IP4 192.168.0.13
    s=Asterisk PBX 1.8.11.0
    c=IN IP4 192.168.0.13
    t=0 0
    m=audio 15790 RTP/AVP 8 3 0 101
    a=rtpmap:8 PCMA/8000
    a=rtpmap:3 GSM/8000
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    a=sendrecv

    17:50:19.709654 IP 192.168.0.10.5060 > 192.168.0.11.5060: SIP, length: 401
    E…bY..@……
    …………ACK sip:000@192.168.0.13:5060 SIP/2.0
    Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK4b64098f;rport
    Max-Forwards: 70
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as5c4b3974
    To: <sip:000@192.168.0.11>;tag=as1254939c
    Contact: <sip:asterisk@192.168.0.10:5060>
    Call-ID: 1a2b4a9b33c661205dcd956a4b3193d4@192.168.0.10:5060
    CSeq: 102 ACK
    User-Agent: Asterisk PBX 1.8.11.0
    Content-Length: 0

    17:50:29.709672 IP 192.168.0.10.5060 > 192.168.0.11.5060: SIP, length: 431
    E…bZ..@..b…
    ………..oBYE sip:000@192.168.0.13:5060 SIP/2.0
    Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK5d9cba61;rport
    Max-Forwards: 70
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as5c4b3974
    To: <sip:000@192.168.0.11>;tag=as1254939c
    Call-ID: 1a2b4a9b33c661205dcd956a4b3193d4@192.168.0.10:5060
    CSeq: 103 BYE
    User-Agent: Asterisk PBX 1.8.11.0
    X-Asterisk-HangupCause: Normal Clearing
    X-Asterisk-HangupCauseCode: 16
    Content-Length: 0

    17:50:29.710688 IP 192.168.0.11.5060 > 192.168.0.10.5060: SIP, length: 451
    E…..@.@……….
    ……..SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.0.10:5060;received=192.168.0.10;branch=z9hG4bK5d9cba61;rport=5060
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as5c4b3974
    To: <sip:000@192.168.0.11>;tag=as1254939c
    Call-ID: 1a2b4a9b33c661205dcd956a4b3193d4@192.168.0.10:5060
    CSeq: 103 BYE
    Server: Asterisk PBX 1.8.11.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Content-Length: 0

     
  • Hi,

    1) when using b2b, you do not need to do forward, as the b2b will automatically to that for you.
    2) change the destination before the b2b function - if you do it after, is too late, as the request was already sent out.

    So correct way to do it:
    modparam("b2b_logic", "server_address", "sip:sa@192.168.0.11:5060")
    route{
         if(src_ip==192.168.0.10) {
               rewritehostport("192.168.0.13:5060");
               forward();
          };
          if(src_ip==192.168.0.13) {
               rewritehostport("192.168.0.10:5060");
               b2b_init_request("top hiding");
         };

    Regards,
    Bogdan

     

  • Anonymous
    2012-05-23

    Thanks for your reply,
    I've tried your configuration and have got simply the same result(Contact: <sip:000@192.168.0.13:5060>):

    Dump:
    12:56:46.778684 IP 192.168.0.10.5060 > 192.168.0.11.5060: SIP, length: 852
    E..p….@..(…
    ………\$.INVITE sip:000@192.168.0.11 SIP/2.0
    Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK6e87d77c;rport
    Max-Forwards: 70
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as457dbcb3
    To: <sip:000@192.168.0.11>
    Contact: <sip:asterisk@192.168.0.10:5060>
    Call-ID: 0494cba651bdef3c512c8aad099c5b49@192.168.0.10:5060
    CSeq: 102 INVITE
    User-Agent: Asterisk PBX 1.8.11.0
    Date: Mon, 21 May 2012 08:56:46 GMT
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Content-Type: application/sdp
    Content-Length: 284

    v=0
    o=root 1981124545 1981124545 IN IP4 192.168.0.10
    s=Asterisk PBX 1.8.11.0
    c=IN IP4 192.168.0.10
    t=0 0
    m=audio 19096 RTP/AVP 8 3 0 101
    a=rtpmap:8 PCMA/8000
    a=rtpmap:3 GSM/8000
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    a=sendrecv

    12:56:46.779839 IP 192.168.0.11.5060 > 192.168.0.10.5060: SIP, length: 481
    E…..@.@..z…….
    ……..SIP/2.0 100 Trying
    Via: SIP/2.0/UDP 192.168.0.10:5060;received=192.168.0.10;branch=z9hG4bK6e87d77c;rport=5060
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as457dbcb3
    To: <sip:000@192.168.0.11>
    Call-ID: 0494cba651bdef3c512c8aad099c5b49@192.168.0.10:5060
    CSeq: 102 INVITE
    Server: Asterisk PBX 1.8.11.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Contact: <sip:000@192.168.0.13:5060>
    Content-Length: 0

    12:56:46.779928 IP 192.168.0.11.5060 > 192.168.0.10.5060: SIP, length: 809
    E..E..@.@..2…….
    …..13.SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.0.10:5060;received=192.168.0.10;branch=z9hG4bK6e87d77c;rport=5060
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as457dbcb3
    To: <sip:000@192.168.0.11>;tag=as6ce124a8
    Call-ID: 0494cba651bdef3c512c8aad099c5b49@192.168.0.10:5060
    CSeq: 102 INVITE
    Server: Asterisk PBX 1.8.11.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Contact: <sip:000@192.168.0.13:5060>
    Content-Type: application/sdp
    Content-Length: 284

    v=0
    o=root 1085781221 1085781221 IN IP4 192.168.0.13
    s=Asterisk PBX 1.8.11.0
    c=IN IP4 192.168.0.13
    t=0 0
    m=audio 18376 RTP/AVP 8 3 0 101
    a=rtpmap:8 PCMA/8000
    a=rtpmap:3 GSM/8000
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    a=sendrecv

    12:56:46.780053 IP 192.168.0.10.5060 > 192.168.0.11.5060: SIP, length: 401
    E…….@……
    …………ACK sip:000@192.168.0.13:5060 SIP/2.0
    Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK1f75dfbf;rport
    Max-Forwards: 70
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as457dbcb3
    To: <sip:000@192.168.0.11>;tag=as6ce124a8
    Contact: <sip:asterisk@192.168.0.10:5060>
    Call-ID: 0494cba651bdef3c512c8aad099c5b49@192.168.0.10:5060
    CSeq: 102 ACK
    User-Agent: Asterisk PBX 1.8.11.0
    Content-Length: 0

    12:56:56.779487 IP 192.168.0.10.5060 > 192.168.0.11.5060: SIP, length: 431
    E…….@……
    …………BYE sip:000@192.168.0.13:5060 SIP/2.0
    Via: SIP/2.0/UDP 192.168.0.10:5060;branch=z9hG4bK7dc345a4;rport
    Max-Forwards: 70
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as457dbcb3
    To: <sip:000@192.168.0.11>;tag=as6ce124a8
    Call-ID: 0494cba651bdef3c512c8aad099c5b49@192.168.0.10:5060
    CSeq: 103 BYE
    User-Agent: Asterisk PBX 1.8.11.0
    X-Asterisk-HangupCause: Normal Clearing
    X-Asterisk-HangupCauseCode: 16
    Content-Length: 0

    12:56:56.780260 IP 192.168.0.11.5060 > 192.168.0.10.5060: SIP, length: 451
    E…..@.@……….
    ……^.SIP/2.0 200 OK
    Via: SIP/2.0/UDP 192.168.0.10:5060;received=192.168.0.10;branch=z9hG4bK7dc345a4;rport=5060
    From: "asterisk" <sip:asterisk@192.168.0.10>;tag=as457dbcb3
    To: <sip:000@192.168.0.11>;tag=as6ce124a8
    Call-ID: 0494cba651bdef3c512c8aad099c5b49@192.168.0.10:5060
    CSeq: 103 BYE
    Server: Asterisk PBX 1.8.11.0
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
    Supported: replaces, timer
    Content-Length: 0

     
  • Your config, in order to do b2b, expects a call from .13 IP. Your B2B seats on .11, and sends forward to .10.

    The dump you posted shows an invite from .10 to .11 …..this does not match the config you have :(…

     

  • Anonymous
    2012-05-29

    Thans for your reply,
    It works!

    Could you please help me with another question?
    Is it possible to hide both sides from each other?
    I tried something like this:

    modparam("b2b_logic", "server_address", "sip:sa@192.168.0.11:5060")

    ####### Routing Logic ########
    # main request routing logic
    route{
        if(src_ip==192.168.0.13)
        {
            rewritehostport("192.168.0.10:5060");
            b2b_init_request("top hiding");
        };
        if(src_ip==192.168.0.10)
        {
            rewritehostport("192.168.0.13:5060");
            b2b_init_request("top hiding");
        };
    }

    And this configuration doesn't work as I expected. I dumped traffic on '192.168.0.13' and I've seen 192.168.0.10 in a from field.

    Thanks

     

  • Anonymous
    2012-05-29

    I even tried to add uac_replace_from into configuration file, but  this configuration didn't work.

    ####### Routing Logic ########
    # main request routing logic
    route{
        if(src_ip==192.168.0.13)
        {
            rewritehostport("192.168.0.10:5060");
            b2b_init_request("top hiding");
        };
        if(src_ip==192.168.0.10)
        {
            uac_replace_from("sip:sa@192.168.0.11");
            rewritehostport("192.168.0.13:5060");
            b2b_init_request("top hiding");
        };
    }