diff options
author | Riza Sulistyo <riza@teluu.com> | 2014-01-07 10:55:10 +0000 |
---|---|---|
committer | Riza Sulistyo <riza@teluu.com> | 2014-01-07 10:55:10 +0000 |
commit | bd1c47e995a3a844868f1d4dcc8f77f163ae721b (patch) | |
tree | 6f0c2f8fc8a971575974b9c1c23922b812a8f1de | |
parent | 499bda86d351aed23348aa38103738231ae7d4c1 (diff) |
Re #1721: Clear invite transaction before calling on_call_tsx_state (on transaction terminated)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4703 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index cf3fc1ee..9778553c 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -655,6 +655,19 @@ static void mod_inv_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) /* Call state handler for the invite session. */ (*inv_state_handler[inv->state])(inv, e); + /* Clear invite transaction when tsx is terminated. + * Necessary for app that wants to send a new re-INVITE request immediately + * after the transaction is terminated. + */ + if (tsx->state==PJSIP_TSX_STATE_TERMINATED && tsx == inv->invite_tsx) { + inv->invite_tsx = NULL; + + if (inv->last_answer) { + pjsip_tx_data_dec_ref(inv->last_answer); + inv->last_answer = NULL; + } + } + /* Call on_tsx_state. CANCEL request is a special case and has been * reported earlier in inv_respond_incoming_cancel() */ @@ -670,8 +683,9 @@ static void mod_inv_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) * terminated, but this didn't work when ACK has the same Via branch * value as the INVITE (see http://www.pjsip.org/trac/ticket/113) */ - if (tsx->state>=PJSIP_TSX_STATE_CONFIRMED && tsx == inv->invite_tsx) { - inv->invite_tsx = NULL; + if (tsx->state>=PJSIP_TSX_STATE_CONFIRMED && tsx == inv->invite_tsx) { + inv->invite_tsx = NULL; + if (inv->last_answer) { pjsip_tx_data_dec_ref(inv->last_answer); inv->last_answer = NULL; |