summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsua-lib/pjsua_im.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2009-04-27 14:30:10 +0000
committerBenny Prijono <bennylp@teluu.com>2009-04-27 14:30:10 +0000
commit92a5b6b430b52abbdfa255c3e74eb5bf7fda0866 (patch)
treebd2ab3d4d1e3693dc777ed203a92eada4453ce3a /pjsip/src/pjsua-lib/pjsua_im.c
parent2a3362d1b960f0533552b8cfba0c6a4fff4ba147 (diff)
Ticket #693: Allow incoming MESSAGE request without message body
- also added SIPp scenario to test this git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2651 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsua-lib/pjsua_im.c')
-rw-r--r--pjsip/src/pjsua-lib/pjsua_im.c46
1 files changed, 30 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,