Hi List,

I have some weird  multipart/mixed;boundary issues.
I use kamailio 5.3.6 with rtpengine 7.x.x (same with 8.x.x).

If i try to remove a multipart/mixed and leave only the sdp with filter_body() that works except one thing.

The sender used IMHO an non RFC compliant version of rfc5621 and wrote the Content-Length Header twice (one in the header, one in the sdp).
After manipulating the SDP filter_body() lets Content-Length in the sdp (i guess).
And rtpengine is not happy with the sdp after that.
rtpengine [rtpengine.c:2588]: rtpp_function_call(): proxy replied with error: Failed to parse SDP

Any ideas how to solve this?

Kind regards
Karsten Horsmann

https://tools.ietf.org/html/rfc5621#section-3.1

route[REMOVE_MULTIPART] {
        if (has_body("multipart/mixed")) {
                if ($sel(cfg_get.remove.multipart) == 1) {
                        if (filter_body("application/sdp")) {
                                remove_hf("Content-Type");
                                append_hf("Content-Type: application/sdp\r\n");
                                msg_apply_changes();
                                xlog("L_WARN", "[$cfg(route)] Body part multipart/mixed with application/sdp found\n");
                        } else {
                                xlog("L_ERROR", "[$cfg(route)] Body part multipart/mixed without application/sdp found\n");
                        }
                } else {
                        xlog("L_INFO", "[$cfg(route)] Body part multipart/mixed found - manipulation disabled\n");
                }
        }
}

-------------------
INVITE sip:+49XXXXXXXX@172.20.120.57:5060 SIP/2.0
Via: SIP/2.0/UDP 172.20.120.51:5061;branch=z9hG4bK-6589-1-0
From: sipp <sip:sipp@172.20.120.51:5061>;tag=6589SIPpTag001
To: sut <sip:+49XXXXXXXXX@172.20.120.57:5060>
Call-ID: 1-6589@172.20.120.51
CSeq: 1 INVITE
Contact: sip:sipp@172.20.120.51:5061
Max-Forwards: 70
Subject: Performance Test
Content-Type: multipart/mixed;boundary=sonus-content-delim
Content-Length:  1185

--sonus-content-delim
Content-Type: application/sdp
Content-Length: 305

v=0
o=Sonus_UAC 895311 862130 IN IP4 8.8.8.8
s=SIP Media Capabilities
c=IN IP4 8.8.8.8
t=0 0
m=audio 26088 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=sendrecv
a=rtcp:26089
a=ptime:20

--sonus-content-delim
Content-Type: application/pidf+xml

<?xml version="1.0" encoding="UTF-8"?><presence xmlns="urn:ietf:params:xml:ns:pidf" xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10" xmlns:cl="urn:ietf:params:xml:ns:pidf:geopriv10:civicLoc"
mlns:btd="http://btd.orange-business.com" entity="pres:geotarget@btip.orange-business.com"><tuple id="XXXX"><status><gp:geopriv><gp:location-info><cl:civicAddress><cl:country>DE</cl:countr
<cl:A1>Some State</cl:A1><cl:A3>Somewhere</cl:A3><cl:A4>Somewhere</cl:A4><cl:A6>Somestreet</cl:A6><cl:YYY>1</cl:YYY><cl:PC>9999</cl:PC><cl:EMERGENCYZONE>XXXXXXX</cl:EMERG
CYZONE></cl:civicAddress></gp:location-info><gp:usage-rules></gp:usage-rules></gp:geopriv></status></tuple></presence>
--sonus-content-delim--

---------------------
INVITE sip:+49XXXXXXXX@foo SIP/2.0
Via: SIP/2.0/TCP 212.XX.XX.XX;branch=z9hG4bKc228.6b8fdf20d79998d1d355feb2dcf5ba63.0
From: sipp <sip:sipp@foo>;tag=6589SIPpTag001
To: sut <sip:+49XXXXXXXX@foo>
Call-ID: 1-6589@172.20.120.51
CSeq: 1 INVITE
Max-Forwards: 69
Content-Length:  347
Content-Type: application/sdp
P-Asserted-Identity: <sip:+49XXXXXXXX@212.XX.XX.XX>
Contact: <sip:btpsh-60211bbe-674b-1@212.XX.XX.XX;transport=tcp>

Content-Length: 305

v=0
o=Sonus_UAC 895311 862130 IN IP4 8.8.8.8
s=SIP Media Capabilities
c=IN IP4 8.8.8.8
t=0 0
m=audio 26088 RTP/AVP 8 0 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:18 annexb=no
a=fmtp:101 0-15
a=sendrecv
a=rtcp:26089
a=ptime:20


--
Mit freundlichen Grüßen
*Karsten Horsmann*