summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2011-03-23 11:46:17 +0000
committerBenny Prijono <bennylp@teluu.com>2011-03-23 11:46:17 +0000
commite97f9bc0498fa880c3bb9d14c953d625bd6d2a58 (patch)
tree3a85ad89f55707980e4cce56575da878a884b4a3
parent4d29521bb80fc01db6cadcb6c02f999bf3461425 (diff)
Fix #1222: Assertion if BYE is received while callee is still in early state
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3481 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip-ua/sip_inv.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/pjsip/src/pjsip-ua/sip_inv.c b/pjsip/src/pjsip-ua/sip_inv.c
index e434a584..2a0e09dd 100644
--- a/pjsip/src/pjsip-ua/sip_inv.c
+++ b/pjsip/src/pjsip-ua/sip_inv.c
@@ -3692,10 +3692,30 @@ static void inv_on_state_early( pjsip_inv_session *inv, pjsip_event *e)
*/
inv_respond_incoming_bye(inv, tsx, e->body.tsx_state.src.rdata, e);
- /* Set timer just in case we will never get the final response
- * for INVITE.
- */
- pjsip_tsx_set_timeout(inv->invite_tsx, 64*pjsip_cfg()->tsx.t1);
+ if (inv->invite_tsx->role == PJSIP_ROLE_UAC) {
+ /* Set timer just in case we will never get the final response
+ * for INVITE.
+ */
+ pjsip_tsx_set_timeout(inv->invite_tsx, 64*pjsip_cfg()->tsx.t1);
+ } else if (inv->invite_tsx->status_code < 200) {
+ pjsip_tx_data *tdata;
+ pjsip_msg *msg;
+
+ /* For UAS, send a final response. */
+ tdata = inv->invite_tsx->last_tx;
+ PJ_ASSERT_ON_FAIL(tdata != NULL, return);
+
+ msg = tdata->msg;
+ msg->line.status.code = PJSIP_SC_REQUEST_TERMINATED;
+ msg->line.status.reason =
+ *pjsip_get_status_text(PJSIP_SC_REQUEST_TERMINATED);
+ msg->body = NULL;
+
+ pjsip_tx_data_invalidate_msg(tdata);
+ pjsip_tx_data_add_ref(tdata);
+
+ pjsip_dlg_send_response(inv->dlg, inv->invite_tsx, tdata);
+ }
}
}