When chan_sip processes incoming SIP message and its body contains NUL
characters (for example due to deflate encoding), reading body from buffer
stops at the NUL character, thus ignoring the rest of the buffer and waiting
for additional incoming data to catch up all data of size indicated in
the Content-Length header. Effectively this behavior causes breakup of
SIP communication - ignoring subsequent messages and returning errors
"method not implemented".
Steps to reproduce:
- set up Linhone for Android to register with Asterisk
- in rasterisk, turn on debugging for the new peer: "sip set debug peer
xxxx"
- in Linphone's settings, turn on Settings/Contacts/Friendlist subscribe
- in rasterisk, wait for the SUBSCRIBE message with deflated body
- in Linphone, try to place a call
- the INVITE message is not processed as chan_sip believes to be
continuation
of body belonging to the preceding SUBSCRIBE message