diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-02-09 12:28:03 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-02-09 12:28:03 +0000 |
commit | 1aa712645a86a6bfb23b61d10d435e7c77bff573 (patch) | |
tree | b9b914c56a3017fb2ff13d228b93c0bafb173b65 /pjsip | |
parent | 09ddedb2f17ff4c6259df504be09cb7efcefd623 (diff) |
Fixed ticket #1034: Crash on accepting a call with no codec in the SDP offer
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3091 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index e6e6d8a9..3afdeb68 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -244,7 +244,9 @@ void inv_set_state(pjsip_inv_session *inv, pjsip_inv_state state, /* Release the flip-flop pools */ pj_pool_release(inv->pool_prov); + inv->pool_prov = NULL; pj_pool_release(inv->pool_active); + inv->pool_active = NULL; } } @@ -1498,13 +1500,24 @@ static pj_status_t inv_negotiate_sdp( pjsip_inv_session *inv ) if (mod_inv.cb.on_media_update && inv->notify) (*mod_inv.cb.on_media_update)(inv, status); - /* Swap the flip-flop pool when SDP negotiation success. */ - if (status == PJ_SUCCESS) { - swap_pool(&inv->pool_prov, &inv->pool_active); - } + /* Invite session may have been terminated by the application even + * after a successful SDP negotiation, for example when no audio + * codec is present in the offer (see ticket #1034). + */ + if (inv->state != PJSIP_INV_STATE_DISCONNECTED) { + + /* Swap the flip-flop pool when SDP negotiation success. */ + if (status == PJ_SUCCESS) { + swap_pool(&inv->pool_prov, &inv->pool_active); + } + + /* Reset the provisional pool regardless SDP negotiation result. */ + pj_pool_reset(inv->pool_prov); - /* Reset the provisional pool regardless SDP negotiation result. */ - pj_pool_reset(inv->pool_prov); + } else { + + status = PJSIP_ERRNO_FROM_SIP_STATUS(inv->cause); + } return status; } |