Hi, According to RFC-3261 p.20.14, the Content-Length header field must be present only if a stream-base transport protocol (such as TCP) is used. Therefore, in the case of the UDP transport protocol, this field is optional. Unfortunately, the rtpproxy_manage() function in Kamailio v.5.2.5 doesn't recognize the SDP body when the Content-Length header field is not present: Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) WARNING: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} sanity [sanity.c:585]: check_cl(): content length header missing in request Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) INFO: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} <script>: rtproxy ei. (source:81.xxx.xxx.xxx, INVITE sip:098232787@xxx.xxx.xxx.xxx:5060;user=phone ) Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) ERROR: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} rtpproxy [rtpproxy_funcs.c:182]: extract_body(): failed to get the content length in message Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) ERROR: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} rtpproxy [rtpproxy.c:2271]: force_rtp_proxy(): can't extract body from the message Dec 22 08:58:34 pbx rtpproxy[1386]: DBUG:GLOBAL:get_command: received command "13498_4 LSEIc0,101 wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64 10.70.227.183 13592 d5k0w3ft-CC-1116-OFC-253;1 as0bf73ed7;1" Dec 22 08:58:34 pbx rtpproxy[1386]: INFO:GLOBAL:handle_command: lookup request failed: session wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64, tags d5k0w3ft-CC-1116-OFC-253;1/as0bf73ed7;1 not found Dec 22 08:58:34 pbx rtpproxy[1386]: DBUG:GLOBAL:rtpc_doreply: sending reply "0\n"
Also, the textops' has_body() function always checks the “Content-Length” presence that is not 100% correct behavior.
Just for your information, the problem was discovered in a system where Huawei SoftX3000 is used. It looks like the softswitch removes the “Content-Length” field in an attempt to decrease size of SIP message when it is too long. If the user disables some codecs in their SIP phone then SoftX3000 keeps the “Content-Length” untouched.
Should I open a bug regarding this matter?
Best regards, Leonid Fainshtein Xorcom Ltd
To be completely fair to these implementation decisions, 3261 says that Content-Length "SHOULD" be included over UDP; it just does not say that it "MUST" be.
However:
1. You can remove flag 128 from the sanity_check() headers and likely remove the complaint about the missing CL field (I would guess):
https://kamailio.org/docs/modules/5.3.x/modules/sanity.html#sanity.overview
2. Strictly speaking, it is the rtpproxy control module which complains about the lack of a CL header, not the SIP stack. No message parsing error or complaint about lack of message validity is being emitted from Kamailio.
This is likewise true of RTPEngine, in a quick test:
Dec 22 17:37:05 allegro-1.evaristesys.com /usr/local/sbin/kamailio[3785]: ERROR: rtpengine [rtpengine_funcs.c:181]: extract_body(): failed to get the content length in message
Dec 22 17:37:05 allegro-1.evaristesys.com /usr/local/sbin/kamailio[3785]: ERROR: rtpengine [rtpengine.c:2334]: rtpp_function_call(): can't extract body from the message
These modules and the rtpproxy control protocols they front-end are free to impose their own requirements above and beyond 3261, particularly if they are following RFC guidance that, while falling short of "MUST", is nevertheless a matter of "SHOULD".
One could argue that this is a problem for the rtpproxy/rtpengine module maintainers rather than Kamailio, and that the real problem is that the requirement of a CL header is not clearly documented, rather than that Kamailio does not recognise such a SIP message to be valid.
-- Alex
On Sun, Dec 22, 2019 at 01:29:02PM +0200, Leonid Fainshtein wrote:
Hi, According to RFC-3261 p.20.14, the Content-Length header field must be present only if a stream-base transport protocol (such as TCP) is used. Therefore, in the case of the UDP transport protocol, this field is optional. Unfortunately, the rtpproxy_manage() function in Kamailio v.5.2.5 doesn't recognize the SDP body when the Content-Length header field is not present: Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) WARNING: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} sanity [sanity.c:585]: check_cl(): content length header missing in request Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) INFO: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} <script>: rtproxy ei. (source:81.xxx.xxx.xxx, INVITE sip:098232787@xxx.xxx.xxx.xxx:5060;user=phone ) Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) ERROR: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} rtpproxy [rtpproxy_funcs.c:182]: extract_body(): failed to get the content length in message Dec 22 08:58:34 pbx kamailio[13456]: 4(13488) ERROR: {1 1 INVITE wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64} rtpproxy [rtpproxy.c:2271]: force_rtp_proxy(): can't extract body from the message Dec 22 08:58:34 pbx rtpproxy[1386]: DBUG:GLOBAL:get_command: received command "13498_4 LSEIc0,101 wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64 10.70.227.183 13592 d5k0w3ft-CC-1116-OFC-253;1 as0bf73ed7;1" Dec 22 08:58:34 pbx rtpproxy[1386]: INFO:GLOBAL:handle_command: lookup request failed: session wrjxwyuke5ukvvwwxd00zwtu0ktfuzuf@10.18.5.64, tags d5k0w3ft-CC-1116-OFC-253;1/as0bf73ed7;1 not found Dec 22 08:58:34 pbx rtpproxy[1386]: DBUG:GLOBAL:rtpc_doreply: sending reply "0\n"
Also, the textops' has_body() function always checks the “Content-Length” presence that is not 100% correct behavior.
Just for your information, the problem was discovered in a system where Huawei SoftX3000 is used. It looks like the softswitch removes the “Content-Length” field in an attempt to decrease size of SIP message when it is too long. If the user disables some codecs in their SIP phone then SoftX3000 keeps the “Content-Length” untouched.
Should I open a bug regarding this matter?
Best regards, Leonid Fainshtein Xorcom Ltd
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users