为什么kamailio删除两个路由头?

发布于 2025-01-19 14:26:33 字数 12874 浏览 0 评论 0原文

有这样一个场景:

u1(10.35.146.155) ---- kam proxy1(10.35.148.211) ---- kama proxy2 ---- u2(10.35.148.233, u2注册在kam proxy2上)

问题出现在转发的ACK。 ACK转发后,只剩下一个路由头。如果这样的消息被转发到proxy2,则不会被路由。为什么两个路由头同时被删除?我不明白。

kam proxy2 打印错误: kamailio[23404]:调试:{1 20 ACK [电子邮件受保护]} rr [loose.c:182]:find_next_route():没有找到下一条路由 HF

kamailio[23404]:调试: {1 20 ACK [电子邮件受保护]} rr [loose.c:623]: after_strict(): after_strict: No next URI found

部分sip消息流程如下:

之所以写request uri是因为proxy1可能部署在公网,而proxy2部署在内网。

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

傲性难收 2025-01-26 14:26:34

这是 SIP 的正常行为:
路由集是:

    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>

因此,当绑定到 sip:10.35.148.233 的路由器收到 ACK 时,它会删除它自己的地址的两个路由条目。 10.35.148.233 上存在不可见的循环路由。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文