diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-07-16 19:13:04 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-07-16 19:13:04 +0000 |
commit | 6bdd45316861a6b596e9acde49c272bb95da28c4 (patch) | |
tree | bb5da597b988c57fdbcf89b487da1047a0a2dc36 | |
parent | 6ba25dd3f2db1ceb8e71e5597bfd53bce00a418b (diff) |
Prevent crash from trying to end a session in an invalid way.
This ensures that code that was only meant to be run on a reinvite failure
only runs on a reinvite failure.
(closes issue ASTERISK-22061)
reported by Rusty Newton
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394473 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | res/res_sip_session.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/res/res_sip_session.c b/res/res_sip_session.c index 6cf63b883..0b0ebe531 100644 --- a/res/res_sip_session.c +++ b/res/res_sip_session.c @@ -1609,11 +1609,12 @@ static void session_inv_on_tsx_state_changed(pjsip_inv_session *inv, pjsip_trans if (tsx->status_code == PJSIP_SC_REQUEST_PENDING) { reschedule_reinvite(session, tsx->mod_data[session_module.id], tsx->last_tx); return; - } else { - /* Other failures result in destroying the session. */ + } else if (inv->state == PJSIP_INV_STATE_CONFIRMED) { + /* Other reinvite failures result in destroying the session. */ pjsip_tx_data *tdata; - pjsip_inv_end_session(inv, 500, NULL, &tdata); - ast_sip_session_send_request(session, tdata); + if (pjsip_inv_end_session(inv, 500, NULL, &tdata) == PJ_SUCCESS) { + ast_sip_session_send_request(session, tdata); + } } } } else { |