summaryrefslogtreecommitdiff
path: root/res
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-07-25 20:54:17 +0000
committerJoshua Colp <jcolp@digium.com>2013-07-25 20:54:17 +0000
commitddd02c0303b281183c37db5617a2d9c78265492f (patch)
treee0df727f72738c6d480272fd84edb870b5db73cc /res
parent1aaa26796d6f56b7cd50a70854ccdaa021645be1 (diff)
Fix crash due to trying to send a re-invite while in the incorrect state.
This crash would occur if a re-invite was queued while the initial INVITE transaction was still occurring and the response to the INVITE was not ACKed. This lack of ACK would cause the INVITE session state to never reach confirmed. Once the transaction terminated, however, the queued re-invite would occur and cause a crash due to this lack of state change. This fix checks the INVITE session state before performing the re-invite to ensure it is in the required confirmed state. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395455 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res')
-rw-r--r--res/res_sip_session.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/res/res_sip_session.c b/res/res_sip_session.c
index 21308f8ad..402b791f2 100644
--- a/res/res_sip_session.c
+++ b/res/res_sip_session.c
@@ -716,11 +716,20 @@ int ast_sip_session_refresh(struct ast_sip_session *session,
return 0;
}
- if ((method == AST_SIP_SESSION_REFRESH_METHOD_INVITE) && inv_session->invite_tsx) {
- /* We can't send a reinvite yet, so delay it */
- ast_debug(3, "Delaying sending reinvite to %s because of outstanding transaction...\n",
- ast_sorcery_object_get_id(session->endpoint));
- return delay_request(session, on_request_creation, on_response, "INVITE", NULL);
+ if (method == AST_SIP_SESSION_REFRESH_METHOD_INVITE) {
+ if (inv_session->invite_tsx) {
+ /* We can't send a reinvite yet, so delay it */
+ ast_debug(3, "Delaying sending reinvite to %s because of outstanding transaction...\n",
+ ast_sorcery_object_get_id(session->endpoint));
+ return delay_request(session, on_request_creation, on_response, "INVITE", NULL);
+ } else if (inv_session->state != PJSIP_INV_STATE_CONFIRMED) {
+ /* Initial INVITE transaction failed to progress us to a confirmed state
+ * which means re-invites are not possible
+ */
+ ast_debug(3, "Not sending reinvite to %s because not in confirmed state...\n",
+ ast_sorcery_object_get_id(session->endpoint));
+ return 0;
+ }
}
if (generate_new_sdp) {