From 6e609cb376bd29ad241c8bffd5571f0f98d128a7 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Wed, 23 Jun 2010 12:21:20 +0000 Subject: Another unterminated SDP offer/answer negotiation fix (Re: #1045): - fixed unterminated negotiation if our media transport rejects incoming offer (e.g. due to mismatch SRTP transport) with 488. - to fix the above, modified the SDP negotiator (sdp_neg.[hc])'s pjmedia_sdp_neg_cancel_offer() to also be able to cancel in remote offer state - also fixed the bug introduced previous Session Timer fix (Re: #1047), which cause SDP negotiator's state to be cleared after failed UAC UPDATE transaction is terminated, which means UPDATE can only be sent 5 seconds after the last UPDATE if the last UPDATE failed. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3217 74dad513-b988-da41-8d7b-12977e46ad98 --- pjmedia/include/pjmedia/sdp_neg.h | 8 +++++--- pjmedia/src/pjmedia/sdp_neg.c | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'pjmedia') diff --git a/pjmedia/include/pjmedia/sdp_neg.h b/pjmedia/include/pjmedia/sdp_neg.h index 8ea61879..70bfccfa 100644 --- a/pjmedia/include/pjmedia/sdp_neg.h +++ b/pjmedia/include/pjmedia/sdp_neg.h @@ -622,9 +622,11 @@ PJ_DECL(pj_bool_t) pjmedia_sdp_neg_has_local_answer(pjmedia_sdp_neg *neg); /** - * Cancel previously sent offer, and move negotiator state back to - * previous stable state (PJMEDIA_SDP_NEG_STATE_DONE). The negotiator - * must be in PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER state. + * Cancel any pending offer, whether the offer is initiated by local or + * remote, and move negotiator state back to previous stable state + * (PJMEDIA_SDP_NEG_STATE_DONE). The negotiator must be in + * PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER or PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER + * state. * * @param neg The negotiator. * diff --git a/pjmedia/src/pjmedia/sdp_neg.c b/pjmedia/src/pjmedia/sdp_neg.c index 3e6039ec..974809d9 100644 --- a/pjmedia/src/pjmedia/sdp_neg.c +++ b/pjmedia/src/pjmedia/sdp_neg.c @@ -1390,7 +1390,8 @@ PJ_DEF(pj_status_t) pjmedia_sdp_neg_cancel_offer(pjmedia_sdp_neg *neg) PJ_ASSERT_RETURN(neg, PJ_EINVAL); /* Must be in LOCAL_OFFER state. */ - PJ_ASSERT_RETURN(neg->state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER, + PJ_ASSERT_RETURN(neg->state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER || + neg->state == PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER, PJMEDIA_SDPNEG_EINSTATE); /* Reset state to done */ -- cgit v1.2.3