[sr-dev] [kamailio/kamailio] textops: get_body_part doesn't detect multipart headers ending properly (#564)

foucse notifications at github.com
Mon Apr 11 16:52:06 CEST 2016


Hi,

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

```
2016/04/11 16:38:17.645936 192.168.2.2:5062 -> 192.168.100.1:5060
INVITE sip:bob at example.com SIP/2.0
via: SIP/2.0/UDP 192.168.2.2:5062;branch=z9hG4bK-18344-1-10
From: "alice" <sip:alice at example.com>;tag=183446416897
To: "bob" <sip:bob at example.com>
Call-ID: alice-bob-call
CSeq: 2 INVITE
Contact: <sip:alice at 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--
```

The command get_body_part("application/sdp", "$var(sdp)"); writes the following content in $var(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
```

But the expected content is:

```
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
```

"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.

---
You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/564#issuecomment-208383612
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160411/9c27dcab/attachment.html>


More information about the sr-dev mailing list