summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pjsip-apps/src/test-pjsua/scripts-sendto/999_message_no_body.py24
-rw-r--r--pjsip/src/pjsua-lib/pjsua_im.c12
2 files changed, 34 insertions, 2 deletions
diff --git a/pjsip-apps/src/test-pjsua/scripts-sendto/999_message_no_body.py b/pjsip-apps/src/test-pjsua/scripts-sendto/999_message_no_body.py
new file mode 100644
index 00000000..2e369edb
--- /dev/null
+++ b/pjsip-apps/src/test-pjsua/scripts-sendto/999_message_no_body.py
@@ -0,0 +1,24 @@
+# $Id$
+import inc_sip as sip
+import inc_sdp as sdp
+
+# There's some report that incoming MESSAGE without body will crash pjsua
+#
+complete_msg = \
+"""MESSAGE sip:localhost SIP/2.0
+Via: SIP/2.0/UDP 192.168.0.14:5060;rport;branch=z9hG4bKPj9db9
+Max-Forwards: 70
+From: <sip:192.168.0.14>;tag=08cd5bfc2d8a4fddb1f5e59c6961d298
+To: <sip:localhost>
+Call-ID: 3373d9eb32aa458db7e69c7ea51e0bd7
+CSeq: 23809 MESSAGE
+Contact: <sip:192.168.0.14:5060>
+User-Agent: PJSUA v0.8.0-trunk/win32
+Content-Type: text/plain
+Content-Length: 50
+"""
+
+
+sendto_cfg = sip.SendtoCfg( "empty MESSAGE", "--null-audio --auto-answer 200",
+ "", 488, complete_msg=complete_msg)
+
diff --git a/pjsip/src/pjsua-lib/pjsua_im.c b/pjsip/src/pjsua-lib/pjsua_im.c
index 509f15fd..f993ff90 100644
--- a/pjsip/src/pjsua-lib/pjsua_im.c
+++ b/pjsip/src/pjsua-lib/pjsua_im.c
@@ -127,8 +127,16 @@ pj_bool_t pjsua_im_accept_pager(pjsip_rx_data *rdata,
return PJ_FALSE;
}
#else
- PJ_UNUSED_ARG(rdata);
- PJ_UNUSED_ARG(p_accept_hdr);
+ pjsip_msg *msg;
+
+ msg = rdata->msg_info.msg;
+ if (msg->body == NULL) {
+ /* Create Accept header. */
+ if (p_accept_hdr)
+ *p_accept_hdr = pjsua_im_create_accept(rdata->tp_info.pool);
+
+ return PJ_FALSE;
+ }
#endif
return PJ_TRUE;