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 --- pjsip/src/pjsip-ua/sip_inv.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'pjsip/src') diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index c58a92f7..dab68d4c 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -2789,7 +2789,14 @@ static void inv_respond_incoming_update(pjsip_inv_session *inv, if (neg_state != PJMEDIA_SDP_NEG_STATE_WAIT_NEGO || (status=inv_negotiate_sdp(inv)) != PJ_SUCCESS) { - /* Negotiation has failed */ + /* Negotiation has failed. If negotiator is still + * stuck at non-DONE state, cancel any ongoing offer. + */ + neg_state = pjmedia_sdp_neg_get_state(inv->neg); + if (neg_state != PJMEDIA_SDP_NEG_STATE_DONE) { + pjmedia_sdp_neg_cancel_offer(inv->neg); + } + status = pjsip_dlg_create_response(inv->dlg, rdata, PJSIP_SC_NOT_ACCEPTABLE_HERE, NULL, &tdata); @@ -2901,11 +2908,9 @@ static void inv_handle_update_response( pjsip_inv_session *inv, } } - /* Otherwise if we don't get successful response, cancel - * our negotiator. - */ - if (status != PJ_SUCCESS && - pjmedia_sdp_neg_get_state(inv->neg)==PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && + /* Cancel the negotiation if we don't get successful negotiation by now */ + if (pjmedia_sdp_neg_get_state(inv->neg) == + PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER && tsx_inv_data && tsx_inv_data->sdp_done == PJ_FALSE) { pjmedia_sdp_neg_cancel_offer(inv->neg); -- cgit v1.2.3