On 01/12/2016 02:05, Mikko Lehto wrote:
Helio Okuyama hok.sh10@gmail.com wrote:
Local messages are malformed in Kamailio 4.4.X. For example after receiving an error response (603) to an INVITE message, the ACK is generated with header Max-Forwards concatenated to header CSeq and double CRLF, which is wrong.
Funny thing, I just discovered something with line endings as well when replying locally from config file.
Kamailio seems to reply with mixed line terminators when flag --no-crlf is used with sipsak.
The specs require to be \r\n. Accepting only \n is and SER-time-propagated extension in Kamailio from the early days of the project when a lot of tests during the development was done by building messages inside a text file and injecting it into the network. When a response is built by kamailio, the needed headers from request that are not changed are just copied. Everything else will get the standard \r\n.
So this is due to that flexibility and I think we are fine with this behaviour given it happens only on very specific corner cases, mainly for the testing.
Cheers, Daniel
How to repeat:
kamailio.cfg
debug=2 fork=yes log_stderror=no children=1 disable_tcp=yes listen=udp:127.0.0.1:5060 auto_aliases=no loadpath "modules/" loadmodule "sl.so" loadmodule "pv.so" loadmodule "textops.so" modparam("sl", "bind_tm", 0) request_route { set_reply_body($rb,"application/sdp"); sl_send_reply(200,"OK"); exit; }
$ sipsak -H localhost -s sip:127.0.0.1:5060 -v -f test/unit/60-message-sdp9.sip --no-crlf
tcpdump shows following headers and line terminators:
200 OKCRLF Via...CRLF From...LF To...LF Call-ID...LF CSeq...LF Content-Type...CRLF Server...CRLF Content-Length...CRLF CRLF
Maybe these two findings are related. I tested with master version.