<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 19/01/2017 22:56, Daniel-Constantin
      Mierla wrote:<br>
    </div>
    <blockquote
      cite="mid:b5fc8445-b427-bdc9-a5e3-e95991c1f4be@gmail.com"
      type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      <p>Hello,<br>
      </p>
      <br>
      <div class="moz-cite-prefix">On 19/01/2017 10:48, Hai Bui Duc Ha
        wrote:<br>
      </div>
      <blockquote
cite="mid:CA+Gtc=TjJwoWLOt2A4t8Sx2R5EZUhjr12sC15ryX381dq9=r8w@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div>
            <div>Hi Daniel,<br>
              <br>
            </div>
            Thank you for reply.<br>
          </div>
           <br>
          <div class="gmail_extra">
            <div class="gmail_quote">On Tue, Jan 17, 2017 at 6:05 PM,
              Daniel-Constantin Mierla <span dir="ltr"><<a
                  moz-do-not-send="true" href="mailto:miconda@gmail.com"
                  target="_blank">miconda@gmail.com</a>></span>
              wrote:<br>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                <div bgcolor="#FFFFFF">
                  <p>Hello,</p>
                  <p>apparently I missed the follow ups on this
                    discussion, dragged in by other topics on mailing
                    list. <br>
                  </p>
                </div>
              </blockquote>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                <div bgcolor="#FFFFFF">
                  <p>Can you get the pcap with all the traffic taken on
                    kamailio server for the call (from initial invite to
                    the end of the call)?</p>
                </div>
              </blockquote>
              <div>I send you the pcap at enclosed file. You can see the
                packet <b>No.5 </b>, it missing SIP message body:<br>
                <i><b>            Media Attribute (a): rtpmap:8
                    PCMA/8000</b></i>
                <div><i><b>            Media Attribute (a): rtpmap:101
                      telephone-event/8000</b></i></div>
                <div><i><b>            Media Attribute (a): fmtp:101
                      0-16</b></i></div>
              </div>
              <blockquote class="gmail_quote" style="margin:0px 0px 0px
                0.8ex;border-left:1px solid
                rgb(204,204,204);padding-left:1ex">
                <div bgcolor="#FFFFFF">
                  <p> I expect that content length is mismatching or
                    there is a '\0' inside the sdp.</p>
                </div>
              </blockquote>
              <div>Can you explain me more about this ? <br>
              </div>
            </div>
          </div>
        </div>
      </blockquote>
      TCP is a stream protocol, meaning that the application (kamailio)
      need to read and parse to figure out the end of a SIP message. The
      state machine as per RFC requires the application to read and
      identify the Content-Length header, take its value, read until the
      end of headers is found (an empty line) and from there on read as
      much as the value of Content-Length to get the body and consider
      the end of message there.<br>
      <br>
      If the sending application puts a lower value in the
      Content-Length than the number of chars in the body, the rest
      remains in the buffer and the receiving application (kamailio)
      attempts to parse a new SIP message.<br>
      <br>
      The other thing I was thinking of was the presence of '\0' which
      marks the end of string in C.<br>
      <br>
      I will look at the pcap very soon and see what I find there.<br>
      <br>
    </blockquote>
    The problem is the value of Content-Lenght set by the client -- it
    is set only to the size that it is view as part of the invite. A bit
    later the client sends more sdp, but exceeding the size sent in C-L
    header. That part of SDP remains as garbage.<br>
    <br>
    So there is a bug in client app.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio World Conference - May 8-10, 2017 - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
  </body>
</html>