From 1cbe183e8d7c355373c17e4e9ce3b0955e76bc38 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 26 Jun 2008 19:47:23 +0000 Subject: Fixed assertion in invite session when INVITE has bad SDP because the SDP is given without having been validated first git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2065 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsua-lib/pjsua_call.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsua-lib/pjsua_call.c b/pjsip/src/pjsua-lib/pjsua_call.c index d12ea9d2..53035f5f 100644 --- a/pjsip/src/pjsua-lib/pjsua_call.c +++ b/pjsip/src/pjsua-lib/pjsua_call.c @@ -721,12 +721,27 @@ pj_bool_t pjsua_call_on_incoming(pjsip_rx_data *rdata) status = pjmedia_sdp_parse(rdata->tp_info.pool, (char*)rdata->msg_info.msg->body->data, rdata->msg_info.msg->body->len, &offer); + if (status == PJ_SUCCESS) { + /* Validate */ + status = pjmedia_sdp_validate(offer); + } + if (status != PJ_SUCCESS) { const pj_str_t reason = pj_str("Bad SDP"); - pjsua_perror(THIS_FILE, "Error parsing SDP in incoming INVITE", + pjsip_hdr hdr_list; + pjsip_warning_hdr *w; + + pjsua_perror(THIS_FILE, "Bad SDP in incoming INVITE", status); + + w = pjsip_warning_hdr_create_from_status(rdata->tp_info.pool, + pjsip_endpt_name(pjsua_var.endpt), + status); + pj_list_init(&hdr_list); + pj_list_push_back(&hdr_list, w); + pjsip_endpt_respond(pjsua_var.endpt, NULL, rdata, 400, - &reason, NULL, NULL, NULL); + &reason, &hdr_list, NULL, NULL); PJSUA_UNLOCK(); return PJ_TRUE; } -- cgit v1.2.3