Why the kamailio remove two route header?

672 Views Asked by At

There is such a scenario:

u1(10.35.146.155) ---- kam proxy1(10.35.148.211) ---- kama proxy2 ---- u2(10.35.148.233, u2 is registered on kam proxy2)

The problem occurs in the forwarded ACK. After the ACK is forwarded, there is only one route header left. If such a message is forwarded to proxy2, it will not be routed. Why are two route headers removed at the same time? i don't understand.

kam proxy2 print error: kamailio[23404]: DEBUG: {1 20 ACK [email protected]} rr [loose.c:182]: find_next_route(): No next Route HF found

kamailio[23404]: DEBUG: {1 20 ACK [email protected]} rr [loose.c:623]: after_strict(): after_strict: No next URI found

Part of the sip message flow is as follows:

The reason why request uri is written is because proxy1 may be deployed on the public network, and proxy2 on the internal network.

u1 send INVITE:
Internet Protocol Version 4, Src: 10.35.146.155, Dst: 10.35.148.211
User Datagram Protocol, Src Port: 5060, Dst Port: 5060
Session Initiation Protocol (INVITE)
    Request-Line: INVITE sip:[email protected];user=phone SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 10.35.146.155:5060;rport;branch=z9hG4bK325475974
        From: "elink11" <sip:[email protected]>;tag=264218750
        To: <sip:[email protected];user=phone>
        Call-ID: [email protected]
        [Generated Call-ID: [email protected]]
        CSeq: 20 INVITE
        Contact: <sip:[email protected]:5060>;video;audio
        Max-Forwards: 70
        User-Agent: Alaudae
        Subject: SIP/2.0
        Session-Expires: 1800
        Min-SE: 90
        Supported: timer,path,outbound,replaces
        Organization: localtest
        Allow: INVITE,ACK,BYE,CANCEL,UPDATE,INFO,SUBSCRIBE,NOTIFY,MESSAGE,OPTIONS
        Content-Type: application/sdp
        Content-Length:  1999
    Message Body

proxy1 send INVITE:
Internet Protocol Version 4, Src: 10.35.148.211, Dst: 10.35.148.233
User Datagram Protocol, Src Port: 5060, Dst Port: 5060
Session Initiation Protocol (INVITE)
    Request-Line: INVITE sip:[email protected];user=phone SIP/2.0
    Message Header
        Record-Route: <sip:10.35.148.211;lr;nat=yes>
        Via: SIP/2.0/UDP 10.35.148.211;branch=z9hG4bK4dc4.11c3814fdb0005a93b411d530dae0e9b.0
        Via: SIP/2.0/UDP 10.35.146.155:5060;received=10.35.146.155;rport=5060;branch=z9hG4bK325475974
        From: "elink11" <sip:[email protected]>;tag=264218750
        To: <sip:[email protected];user=phone>
        Call-ID: [email protected]
        [Generated Call-ID: [email protected]]
        CSeq: 20 INVITE
        Contact: <sip:[email protected]:5060;alias=10.35.146.155~5060~1>;video;audio
        Max-Forwards: 69
        User-Agent: Alaudae
        Subject: SIP/2.0
        Session-Expires: 1800
        Min-SE: 90
        Supported: timer,path,outbound,replaces
        Organization: localtest
        Allow: INVITE,ACK,BYE,CANCEL,UPDATE,INFO,SUBSCRIBE,NOTIFY,MESSAGE,OPTIONS
        Content-Type: application/sdp
        Content-Length:  2017
        P-hint: outbound


proxy1 recv 200 OK:
Internet Protocol Version 4, Src: 10.35.148.233, Dst: 10.35.148.211
User Datagram Protocol, Src Port: 5060, Dst Port: 5060
Session Initiation Protocol (200)
    Status-Line: SIP/2.0 200 OK
    Message Header
        Via: SIP/2.0/UDP 10.35.148.211;branch=z9hG4bK4dc4.11c3814fdb0005a93b411d530dae0e9b.0
        Via: SIP/2.0/UDP 10.35.146.155:5060;received=10.35.146.155;rport=5060;branch=z9hG4bK325475974
        From: "elink11" <sip:[email protected]>;tag=264218750
        To: "PVS2803841713" <sip:[email protected];user=phone>;tag=211199AF-D02E39DC
        CSeq: 20 INVITE
        Call-ID: [email protected]
        [Generated Call-ID: [email protected]]
        Contact: <sip:[email protected]:5060;transport=tcp>;+sip.instance="<urn:uuid:cea31ad7-d73c-4e2c-b9e6-d2530239f3dd>"
        Record-Route: <sip:10.35.148.233;transport=tcp;r2=on;lr>, <sip:10.35.148.233;r2=on;lr>, <sip:10.35.148.211;lr;nat=yes>
        Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,INFO,MESSAGE,SUBSCRIBE,NOTIFY,PRACK,UPDATE,REFER
        MRD: MRE; MRC-V=1.0.1
        Multiplexing: EP
        User-Agent: Polycom RealPresence Desktop for Windows (3.10.0.71107)
        Session-Expires: 1800;refresher=uac
        Content-Type: application/sdp
        Content-Length: 3126
        SrcAddr: 10.34.80.132-64999

u1 recv 200 OK:
Frame 61: 1115 bytes on wire (8920 bits), 1115 bytes captured (8920 bits)
Ethernet II, Src: IntelCor_00:b2:eb (a4:bf:01:00:b2:eb), Dst: NewH3CTe_dd:b6:71 (b0:44:14:dd:b6:71)
Internet Protocol Version 4, Src: 10.35.148.211, Dst: 10.35.146.155
User Datagram Protocol, Src Port: 5060, Dst Port: 5060
Session Initiation Protocol (200)
    Status-Line: SIP/2.0 200 OK
    Message Header
        Via: SIP/2.0/UDP 10.35.146.155:5060;received=10.35.146.155;rport=5060;branch=z9hG4bK325475974
        From: "elink11" <sip:[email protected]>;tag=264218750
        To: "PVS2803841713" <sip:[email protected];user=phone>;tag=211199AF-D02E39DC
        CSeq: 20 INVITE
        Call-ID: [email protected]
        [Generated Call-ID: [email protected]]
        Contact: <sip:[email protected]:5060;transport=tcp>;+sip.instance="<urn:uuid:cea31ad7-d73c-4e2c-b9e6-d2530239f3dd>"
        Record-Route: <sip:10.35.148.233;transport=tcp;r2=on;lr>, <sip:10.35.148.233;r2=on;lr>, <sip:10.35.148.211;lr;nat=yes>
        Allow: INVITE,ACK,BYE,CANCEL,OPTIONS,INFO,MESSAGE,SUBSCRIBE,NOTIFY,PRACK,UPDATE,REFER
        MRD: MRE; MRC-V=1.0.1
        Multiplexing: EP
        User-Agent: Polycom RealPresence Desktop for Windows (3.10.0.71107)
        Session-Expires: 1800;refresher=uac
        Content-Type: application/sdp
        Content-Length: 3150


u1 send ACK:
Internet Protocol Version 4, Src: 10.35.146.155, Dst: 10.35.148.211
User Datagram Protocol, Src Port: 5060, Dst Port: 5060
Session Initiation Protocol (ACK)
    Request-Line: ACK sip:[email protected]:5060;transport=tcp SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 10.35.146.155:5060;rport;branch=z9hG4bK2104083668
        Route: <sip:10.35.148.211;lr;nat=yes>
        Route: <sip:10.35.148.233;r2=on;lr>
        Route: <sip:10.35.148.233;transport=tcp;r2=on;lr>
        From: "elink11" <sip:[email protected]>;tag=264218750
        To: "PVS2803841713" <sip:[email protected];user=phone>;tag=211199AF-D02E39DC
        Call-ID: [email protected]
        [Generated Call-ID: [email protected]]
        CSeq: 20 ACK
        Contact: <sip:[email protected]:5060>;video;audio
        Max-Forwards: 70
        User-Agent: Alaudae
        Supported: timer,path,outbound,replaces
        Allow: INVITE,ACK,BYE,CANCEL,UPDATE,INFO,SUBSCRIBE,NOTIFY,MESSAGE,OPTIONS
        Content-Length: 0

proxy2 send ACK:
Frame 63: 878 bytes on wire (7024 bits), 878 bytes captured (7024 bits)
Ethernet II, Src: IntelCor_00:b2:eb (a4:bf:01:00:b2:eb), Dst: AdlinkTe_4c:b1:3d (00:30:64:4c:b1:3d)
Internet Protocol Version 4, Src: 10.35.148.211, Dst: 10.35.148.233
User Datagram Protocol, Src Port: 5060, Dst Port: 5060
Session Initiation Protocol (ACK)
    Request-Line: ACK sip:10.35.148.233;transport=tcp;r2=on;lr SIP/2.0
    Message Header
        Via: SIP/2.0/UDP 10.35.148.211;branch=z9hG4bK4dc4.bf03454b05da12787ff6071b3c44764c.0
        Via: SIP/2.0/UDP 10.35.148.211;rport=5060;branch=z9hG4bK4dc4.bc5eb8ce444f77bbeb7254c2f131e5e4.0
        Via: SIP/2.0/UDP 10.35.146.155:5060;received=10.35.146.155;rport=5060;branch=z9hG4bK2104083668
        Route: <sip:10.35.148.233;r2=on;lr>
        From: "elink11" <sip:[email protected]>;tag=264218750
        To: "PVS2803841713" <sip:[email protected];user=phone>;tag=211199AF-D02E39DC
        Call-ID: [email protected]
        [Generated Call-ID: [email protected]]
        CSeq: 20 ACK
        Contact: <sip:[email protected]:5060;alias=10.35.146.155~5060~1>;video;audio
        Max-Forwards: 68
        User-Agent: Alaudae
        Supported: timer,path,outbound,replaces
        Allow: INVITE,ACK,BYE,CANCEL,UPDATE,INFO,SUBSCRIBE,NOTIFY,MESSAGE,OPTIONS
        Content-Length: 0
1

There are 1 best solutions below

1
tomrtc On

It is a normal behavior for SIP: The route-set is :

    Route: <sip:10.35.148.211;lr;nat=yes>
    Route: <sip:10.35.148.233;r2=on;lr>
    Route: <sip:10.35.148.233;transport=tcp;r2=on;lr>

So when the router bound to sip:10.35.148.233 receives the ACK, it removes the two route entries where it is it very own address. There is an invisible loop routing on 10.35.148.233.