summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip/src/pjsua-lib/pjsua_im.c46
-rw-r--r--tests/pjsua/scripts-sipp/uac-message-no-body.xml32
2 files changed, 62 insertions, 16 deletions
diff --git a/pjsip/src/pjsua-lib/pjsua_im.c b/pjsip/src/pjsua-lib/pjsua_im.c
index eba2925a..a727d5da 100644
--- a/pjsip/src/pjsua-lib/pjsua_im.c
+++ b/pjsip/src/pjsua-lib/pjsua_im.c
@@ -127,7 +127,7 @@ pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata,
return PJ_FALSE;
}
-#else
+#elif 0
pjsip_msg *msg;
msg = rdata->msg_info.msg;
@@ -138,6 +138,10 @@ pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata,
return PJ_FALSE;
}
+#else
+ /* Ticket #693: allow incoming MESSAGE without message body */
+ PJ_UNUSED_ARG(rdata);
+ PJ_UNUSED_ARG(p_accept_hdr);
#endif
return PJ_TRUE;
@@ -154,8 +158,11 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from,
pj_str_t contact;
pjsip_msg_body *body = rdata->msg_info.msg->body;
+#if 0
+ /* Ticket #693: allow incoming MESSAGE without message body */
/* Body MUST have been checked before */
pj_assert(body != NULL);
+#endif
/* Build remote contact */
@@ -172,7 +179,7 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from,
contact.slen = 0;
}
- if (pj_stricmp(&body->content_type.type, &STR_MIME_APP)==0 &&
+ if (body && pj_stricmp(&body->content_type.type, &STR_MIME_APP)==0 &&
pj_stricmp(&body->content_type.subtype, &STR_MIME_ISCOMPOSING)==0)
{
/* Expecting typing indication */
@@ -214,20 +221,27 @@ void pjsua_im_process_pager(int call_id, const pj_str_t *from,
pj_str_t text_body;
/* Save text body */
- text_body.ptr = (char*)rdata->msg_info.msg->body->data;
- text_body.slen = rdata->msg_info.msg->body->len;
-
- /* Get mime type */
- m = &rdata->msg_info.msg->body->content_type;
- mime_type.ptr = buf;
- mime_type.slen = pj_ansi_snprintf(buf, sizeof(buf),
- "%.*s/%.*s",
- (int)m->type.slen,
- m->type.ptr,
- (int)m->subtype.slen,
- m->subtype.ptr);
- if (mime_type.slen < 1)
- mime_type.slen = 0;
+ if (body) {
+ text_body.ptr = (char*)rdata->msg_info.msg->body->data;
+ text_body.slen = rdata->msg_info.msg->body->len;
+
+ /* Get mime type */
+ m = &rdata->msg_info.msg->body->content_type;
+ mime_type.ptr = buf;
+ mime_type.slen = pj_ansi_snprintf(buf, sizeof(buf),
+ "%.*s/%.*s",
+ (int)m->type.slen,
+ m->type.ptr,
+ (int)m->subtype.slen,
+ m->subtype.ptr);
+ if (mime_type.slen < 1)
+ mime_type.slen = 0;
+
+
+ } else {
+ text_body.ptr = mime_type.ptr = "";
+ text_body.slen = mime_type.slen = 0;
+ }
if (pjsua_var.ua_cfg.cb.on_pager) {
(*pjsua_var.ua_cfg.cb.on_pager)(call_id, from, to, &contact,
diff --git a/tests/pjsua/scripts-sipp/uac-message-no-body.xml b/tests/pjsua/scripts-sipp/uac-message-no-body.xml
new file mode 100644
index 00000000..1b7f0724
--- /dev/null
+++ b/tests/pjsua/scripts-sipp/uac-message-no-body.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="MESSAGE request without message body">
+ <send retrans="500">
+ <![CDATA[
+
+ MESSAGE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[call_number]
+ To: sut <sip:[service]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 MESSAGE
+ Contact: sip:sipp@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Message without body
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" rtd="true">
+ </recv>
+
+ <!-- definition of the response time repartition table (unit is ms) -->
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+ <!-- definition of the call length repartition table (unit is ms) -->
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+