``` version: kamailio 5.0.0-dev0 (i386/linux) 00f108-dirty flags: STATS: Off, EXTRA_DEBUG, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, 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, DEFAULT PKG_SIZE 8MB poll method support: poll, epoll_lt, epoll_et, sigio_rt, select. id: 00f108 -dirty compiled on 16:25:22 Mar 29 2016 with gcc 4.9.3 ```
For my obscure reasons, I need to send an application/vnd.3gpp.pic-bw-small in a multipart body, in an INVITE.
While parsing the SDP, I have the following:
``` ERROR: <core> [parser/parse_content.c:370]: decode_mime_type(): ERROR:decode_mime_type: parse error near in [application/vnd.3gpp.pic-bw-small] char[51][3] offset=16 ERROR: sdpops [sdpops_mod.c:1659]: w_sdp_get_line_startswith(): Unable to parse sdp ```
I believe the application/vnd.3gpp.pic-bw-small is not recognized (not in the known MIME types tree: type_tree)
I think, I still should be able to parse the SDP even if the MIME type provided in the multipart message is unknown.
--- 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/561
I have taken some time to investigate this issue and the problem is that you use the "isalpha" function in the is_mime_char routine:
```C #define is_mime_char(_c_) \ (isalpha((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.' || (_c_)=='_') ```
But a MIME type can have digits in it (as you can see in some MIME types registered with IANA: http://www.iana.org/assignments/media-types/media-types.xhtml)
So a more convenient validation function would be "isalnum":
```C #define is_mime_char(_c_) \ (isalnum((int)_c_) || (_c_)=='-' || (_c_)=='+' || (_c_)=='.' || (_c_)=='_') ```
After changing this, there is no more parsing errors.
--- 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/561#issuecomment-205406611
Thanks for report and troubleshooting further. indeed it looks like the define for valid char check must be extended to isalnum. The function with mime check is quite old, maybe 2001-2003 timeframe...
Have you tested with isalnum()? If works fine then I will commit the change and backport.
--- 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/561#issuecomment-205663569
Hi Daniel,
Yes, it works with "isalnum" in my test, but another define, just below: is_char_equal is also using "isalpha" but I don't know if it needs modification:
```C #define is_char_equal(_c_,_cs_) \ ( (isalpha((int)_c_)?(((_c_)|0x20)==(_cs_)):((_c_)==(_cs_)))==1 ) ```
--- 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/561#issuecomment-205686132
This looks like the condition to match lower and upper case characters, which should apply only to alphabetic characters.
--- 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/561#issuecomment-205687079
Closed #561.
--- 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/561#event-615040164