From 883911360b9cb89f2b9da545a5745a34d1eaf6f4 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 2 Dec 2010 10:41:46 +0000 Subject: Fixed #1170 (Assertion when receiving updated SDP offer with all media lines removed): - pjsua_media.c checks if audio media is present in the offer; if not, do not set any answer - sip_inv.c checks if app has supplied an answer after on_rx_offer() callback is called, and returnd 488 (Not Acceptable) if not (previously, it will return 200/OK without SDP!) - added a SIPp scenario file to reproduce this git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3383 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip-ua/sip_inv.c | 8 +++++++- pjsip/src/pjsua-lib/pjsua_media.c | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'pjsip') diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index aebd3353..b9bfe896 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -1743,13 +1743,19 @@ static pj_status_t inv_check_sdp_in_incoming_msg( pjsip_inv_session *inv, } /* Inform application about remote offer. */ - if (mod_inv.cb.on_rx_offer && inv->notify) { (*mod_inv.cb.on_rx_offer)(inv, sdp_info->sdp); } + /* application must have supplied an answer at this point. */ + if (pjmedia_sdp_neg_get_state(inv->neg) != + PJMEDIA_SDP_NEG_STATE_WAIT_NEGO) + { + return PJ_EINVALIDOP; + } + } else if (pjmedia_sdp_neg_get_state(inv->neg) == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER) { diff --git a/pjsip/src/pjsua-lib/pjsua_media.c b/pjsip/src/pjsua-lib/pjsua_media.c index 8ede0f8c..47cf1e7d 100644 --- a/pjsip/src/pjsua-lib/pjsua_media.c +++ b/pjsip/src/pjsua-lib/pjsua_media.c @@ -1311,6 +1311,13 @@ pj_status_t pjsua_media_channel_create_sdp(pjsua_call_id call_id, #endif call->audio_idx = find_audio_index(rem_sdp, srtp_active); + if (call->audio_idx == -1) { + /* No audio in the offer. We can't accept this */ + PJ_LOG(4,(THIS_FILE, + "Unable to accept SDP offer without audio for call %d", + call_id)); + return PJMEDIA_SDP_EINMEDIA; + } } /* Media index must have been determined before */ -- cgit v1.2.3