[sr-dev] [kamailio/kamailio] Problem parsing content-type with numbers in multipart INVITE (#1053)

Albert Petit notifications at github.com
Mon Apr 3 18:22:03 CEST 2017


### Description

When sending a multipart INVITE with a part having the following content type  **application/vnd.3gpp.mcptt-info+xml**  there is a parse error on content type header causing for eg we can't force rtpproxy to replace ports on a call leg. 

>From **parse_content.c** implementation It seems numbers are not accepted inside a content type header. (https://github.com/kamailio/kamailio/blob/master/src/core/parser/parse_content.c) 

This might cause issues  with MCPTT Rel 13 3GPP specs (http://www.arib.or.jp/english/html/overview/doc/STD-T63V12_20/5_Appendix/Rel13/24/24381-d20.pdf)  or other content type defined by 3gpp ( eg of other content types defined in iana like https://www.iana.org/assignments/media-types/application/3gpp-ims+xml , etc.)

See attached conversation in user-list http://lists.sip-router.org/pipermail/sr-users/2017-April/096594.html

### Troubleshooting
See below attached logs generated by Kamailio when processing that INVITE and a sample of  INVITE message causing the issue (cut&paste from wireshark)

#### Reproduction

See attached INVITE or just send a multipart INVITE with a body part that has content type  application/vnd.3gpp.mcptt-info+xml

#### Log Messages
See log messages generated when trying to force rtpproxy

Apr  3 18:31:21 mcptt /usr/sbin/kamailio[3232]: INFO: <script>: forcing RTP
proxy for INVITE message

Apr  3 18:31:21 mcptt /usr/sbin/kamailio[3232]: ERROR: <core>
[core/parser/parse_content.c:370]: decode_mime_type():
ERROR:decode_mime_type: parse error near in
[application/vnd.3gpp.mcptt-info+xml] char[51][3] offset=16

#### SIP Traffic
INVITE sip:mcpttparticipating at genaker.net SIP/2.0
Record-Route: <sip:10.1.1.123:6074;transport=tcp;lr=on;ftag=i3b01a;nat=yes>
Call-ID: db6b10362447354bc9819df9a9046ecb at 10.1.1.222
CSeq: 1 INVITE
From: <sip:blue1 at genaker.net>;tag=i3b01a
To: <sip:ccw at genaker.net;poc-group=blues>
Via: SIP/2.0/TCP 10.1.1.123:6074;branch=z9hG4bK15a9.1c063dec40e772152f44c026a1627082.0;i=f
Via: SIP/2.0/TCP 10.1.1.222:5070;received=10.1.1.222;rport=55173;branch=z9hG4bK-363135-1750dc6e97437e4788f446f2d818b60a
Max-Forwards: 69
Contact: <sip:blue1 at 10.1.1.222:55173>;transport=tcp;+g.3gpp.mcptt;+g.3gpp.icsi-ref="urn%3Aurn-7%3A3gpp-service.ims.icsi.mcptt";isfocus
Accept-Contact: *;+g.3gpp.mcptt;require;explicit
Accept-Contact: *;+g.3gpp.icsi-ref="urn:urn-7:3gpp-service.ims.icsi.mcptt";require;explicit
P-Preferred-Service: urn:urn-7:3gpp-service.ims.icsi.mcptt
P-Preferred-Identity: <sip:blue1 at genaker.net>
User-Agent: PoC-client/3GPP-Rel13 GenakerPTT/v2.03.01 - [f661833_334]d/BV6000/SDK23/FplatinumMcptt
Session-Expires: 3600
Min-SE: 90
Supported: replaces, 100rel, timer, norefersub, timer, answermode, eventlist
Resource-Priority: mcpttp.5
Content-Type: multipart/mixed;boundary=gnkboundary
Content-Length: 997

--gnkboundary
Content-Type: application/sdp

v=0
o=- 3626700268 3626700268 IN IP4 10.1.1.222
s=spimedia
c=IN IP4 10.1.1.222
t=0 0
a=X-nat:0
m=audio 10002 RTP/AVP 106
a=rtcp:10003 IN IP4 10.1.1.222
i=speech
a=rtpmap:106 AMR-WB/16000
a=fmtp:106 mode-change-period=1; mode-change-capability=2; mode-change-neighbor=0; max-red=0
a=sendrecv
a=ptime:100
a=maxptime:400
m=application 10003 udp MCPTT
a=fmtp:MCPTT mc_queueing;mc_priority=1

--gnkboundary
Content-Type: application/vnd.3gpp.mcptt-info+xml

<?xml version="1.0" encoding="UTF-8"?>
<mcpttinfo xmlns="urn:3gpp:ns:mcpttInfo:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mcptt-Params>
<session-type>chat</session-type>
<mcptt-request-uri type="Normal">
<mcpttURI>sip:ccw at genaker.net;poc-group=blues</mcpttURI>
</mcptt-request-uri>
<mcptt-client-id type="Normal">
<mcpttURI>urn:uuid:00000000-0000-1000-8000-AABBCCDDEEFF</mcpttURI>
</mcptt-client-id>
</mcptt-Params>
</mcpttinfo>

--gnkboundary--


### Possible Solutions
Accept numbers in the content type header 

Maybe accepting numbers on following definition at the same **parse_content.c** file:

#define is_mime_char(_c_) \
	(isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.' || (_c_)=='_')

### Additional Information
[root at mcptt ~]# kamailio -v
version: kamailio 5.0.0 (x86_64/linux) 
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535, DsEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown 
compiled on 19:22:29 Mar 16 2017 with gcc 4.8.5

* **Operating System**:
CentOS7 
Linux dev 3.10.0-514.10.2.el7.x86_64 #1 SMP Fri Mar 3 00:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux




-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1053
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20170403/197bc6b9/attachment-0001.html>


More information about the sr-dev mailing list