diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-02-19 22:19:23 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-02-19 22:19:23 +0000 |
commit | d4fa893f4ecd9360699e2a9fdab6550d8ea9dec4 (patch) | |
tree | da5f4dce0db425833521fbde7fb006dfd4b823af | |
parent | b4363468b7fed4b36a45b5893ed475b1128fb4de (diff) |
Fixed ticket #113: INVITE transaction is not destroyed immediately when ACK has the same branch as the INVITE
git-svn-id: http://svn.pjsip.org/repos/pjproject/branches/pjproject-0.5-stable@981 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjsip/src/pjsip-ua/sip_inv.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c index 46ca408d..ceed8235 100644 --- a/pjsip/src/pjsip-ua/sip_inv.c +++ b/pjsip/src/pjsip-ua/sip_inv.c @@ -356,8 +356,12 @@ static void mod_inv_on_tsx_state(pjsip_transaction *tsx, pjsip_event *e) if (mod_inv.cb.on_tsx_state_changed && inv->notify) (*mod_inv.cb.on_tsx_state_changed)(inv, tsx, e); - /* Clear invite transaction when tsx is terminated. */ - if (tsx->state==PJSIP_TSX_STATE_TERMINATED && tsx == inv->invite_tsx) + /* Clear invite transaction when tsx is confirmed. + * Previously we set invite_tsx to NULL only when transaction has + * 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; } @@ -2375,10 +2379,13 @@ static void inv_on_state_confirmed( pjsip_inv_session *inv, pjsip_event *e) /* Check if we have INVITE pending. */ if (inv->invite_tsx && inv->invite_tsx!=tsx) { + pj_str_t reason; + + reason = pj_str("Another INVITE transaction in progress"); /* Can not receive re-INVITE while another one is pending. */ - status = pjsip_dlg_create_response( inv->dlg, rdata, 500, NULL, - &tdata); + status = pjsip_dlg_create_response( inv->dlg, rdata, 500, + &reason, &tdata); if (status != PJ_SUCCESS) return; |