Status: New
Owner: ----
Labels: Type-Defect Priority-Medium
New issue 2182 by horacimacias: Multipart SIP bodies are not parsed
correctly
http://code.google.com/p/mobicents/issues/detail?id=2182
What steps will reproduce the problem?
1. Send a message to MSS with a multipart body
2. Try to use any method from the request.getContent() object, which is a
MimeMultipart object, such as multipart.getBodyPart(String contentId)
3. The parsing done in SipServletMessageImpl is incorrect and so the
MimeMultipart object returned is not properly setup.
What is the expected output? What do you see instead?
Expect getBodyPart or other MimeMultipart methods to behave properly, but
because the object created in SipServletMessageImpl is not right, the
methods return invalid values.
What version of the product are you using? On what operating system?
Mobicents Sip Servlets 1.4 on linux
Please provide any additional information below.
I tested replacing
} else if(contentTypeHeader!= null &&
CONTENT_TYPE_MULTIPART.equals(contentTypeHeader.getContentType())) {
return getContentAsMimeMultipart(contentTypeHeader,
message.getRawContent());
} else {
return this.message.getRawContent();
}
} else if(contentTypeHeader!= null &&
CONTENT_TYPE_MULTIPART.equals(contentTypeHeader.getContentType())) {
try {
return new MimeMultipart(new
ByteArrayDataSource(message.getRawContent(),
contentTypeHeader.toString().replaceAll(ContentTypeHeader.NAME+": ", "")));
} catch (MessagingException e) {
logger.error(e, e);
return this.message.getRawContent();
}
} else {
and getting rid of the getContentAsMimeMultipart method (and imports, etc)
and things are working fine for me now.
I couldn't find an easy way to get the value part of the ContentTypeHeader,
that's why I use the replaceAll, but other than that the code should be
fine.
I can provide some sip messages for testing if needed.