<p>Hi,</p>

<p>Here is one example, the XML body is not standard (yet), so I had to remove it. Content-Length is to be checked</p>

<pre><code>2016/04/11 16:38:17.645936 192.168.2.2:5062 -> 192.168.100.1:5060
INVITE sip:bob@example.com SIP/2.0
via: SIP/2.0/UDP 192.168.2.2:5062;branch=z9hG4bK-18344-1-10
From: "alice" <sip:alice@example.com>;tag=183446416897
To: "bob" <sip:bob@example.com>
Call-ID: alice-bob-call
CSeq: 2 INVITE
Contact: <sip:alice@192.168.2.2:5062>
Max-Forwards: 70
Expires: 3600
Content-Type: multipart/mixed;boundary=8920nv9wiwdnnsrnia9buoyci39qsi6x
Content-Disposition: session
User-Agent: SIPp/Linux
Content-Length:   759


--8920nv9wiwdnnsrnia9buoyci39qsi6x
Content-Type: application/some-random-mime+xml
Content-Length: 290

<?xml version="1.0" encoding="UTF-8"?>
<xxxxxxxx>
<xxxxxxxxxxxxxxxx>
<xxxxxxxxx>yyyyyyyy</xxxxxxxxx>
<aaaaaaaaa>bbbbbbbb</aaaaaaaaa>
</xxxxxxxxxxxxxxxx>
</xxxxxxxx>
--8920nv9wiwdnnsrnia9buoyci39qsi6x
Content-Type: application/sdp
Content-Length: 479

v=0
o=- 3669370665 3669370665 IN IP4 192.168.2.2
s=application-media
t=0 0
c=IN IP4 192.168.2.2
m=audio 8000 RTP/AVP 106 96
a=rtcp:8001 IN IP4 192.168.2.2
a=sendrecv
a=rtpmap:106 AMR-WB/16000
a=fmtp:106 octet-align=0; mode-set=4
a=ptime:20
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
m=application 9000 udp XXXXX
8920nv9wiwdnnsrnia9buoyci39qsi6x--
</code></pre>

<p>The command get_body_part("application/sdp", "$var(sdp)"); writes the following content in $var(sdp):</p>

<pre><code>Content-Length: 479

v=0
o=- 3669370665 3669370665 IN IP4 192.168.2.2
s=application-media
t=0 0
c=IN IP4 192.168.2.2
m=audio 8000 RTP/AVP 106 96
a=rtcp:8001 IN IP4 192.168.2.2
a=sendrecv
a=rtpmap:106 AMR-WB/16000
a=fmtp:106 octet-align=0; mode-set=4
a=ptime:20
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
m=application 9000 udp XXXXX
</code></pre>

<p>But the expected content is:</p>

<pre><code>v=0
o=- 3669370665 3669370665 IN IP4 192.168.2.2
s=application-media
t=0 0
c=IN IP4 192.168.2.2
m=audio 8000 RTP/AVP 106 96
a=rtcp:8001 IN IP4 192.168.2.2
a=sendrecv
a=rtpmap:106 AMR-WB/16000
a=fmtp:106 octet-align=0; mode-set=4
a=ptime:20
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
m=application 9000 udp XXXXX
</code></pre>

<p>"Content-Length: 479" is a multipart header and should be ignored. From what I understand everything after a "Content-Type:" is considered as a body.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you commented.<br />Reply to this email directly or <a href="https://github.com/kamailio/kamailio/issues/564#issuecomment-208383612">view it on GitHub</a><img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZbEZgNUbugHolsdjuUJg9YMbuM_gks5p2mAWgaJpZM4IESnF.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/564#issuecomment-208383612"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>