aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-02 20:30:58 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-12-02 20:30:58 +0000
commit66c14bf0ffa551f2df13526c509cc0efb54089f5 (patch)
tree018fafb953da3fad82c0d520570c48319220847e /channels
parent6ce1ca0731690482d29dd90bdefb159802fd717d (diff)
Send CANCEL to call with early media (PROGRESS INBAND).
This is imported from branch "invitestate" and "invitestate-1.4" *** *** *** IF YOU HAVE ISSUES WITH BYEs/CANCELs - PLEASE UPDATE AND TEST AGAIN! *** Thank you! *** *** /Olle git-svn-id: http://svn.digium.com/svn/asterisk/trunk@48216 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index aa59b7038..3974620bd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -242,15 +242,15 @@ enum sip_result {
\note this is for the INVITE that sets up the dialog
*/
enum invitestates {
- INV_NONE = 0, /*!< No state at all, maybe not an INVITE dialog */
- INV_CALLING, /*!< Invite sent, no answer */
- INV_PROCEEDING, /*!< We got/sent 1xx message */
- INV_EARLY_MEDIA, /*!< We got 18x message with to-tag back */
- INV_COMPLETED, /*!< Got final response with error. Wait for ACK, then CONFIRMED */
- INV_CONFIRMED, /*!< Confirmed response - we've got an ack (Incoming calls only) */
- INV_TERMINATED, /*!< Transaction done - either successful (AST_STATE_UP) or failed, but done
- The only way out of this is a BYE from one side */
- INV_CANCELLED /*!< Transaction cancelled by client or server in non-terminated state */
+ INV_NONE = 0, /*!< No state at all, maybe not an INVITE dialog */
+ INV_CALLING = 1, /*!< Invite sent, no answer */
+ INV_PROCEEDING = 2, /*!< We got/sent 1xx message */
+ INV_EARLY_MEDIA = 3, /*!< We got 18x message with to-tag back */
+ INV_COMPLETED = 4, /*!< Got final response with error. Wait for ACK, then CONFIRMED */
+ INV_CONFIRMED = 5, /*!< Confirmed response - we've got an ack (Incoming calls only) */
+ INV_TERMINATED = 6, /*!< Transaction done - either successful (AST_STATE_UP) or failed, but done
+ The only way out of this is a BYE from one side */
+ INV_CANCELLED = 7, /*!< Transaction cancelled by client or server in non-terminated state */
};
/* Do _NOT_ make any changes to this enum, or the array following it;
@@ -3413,7 +3413,7 @@ static int sip_hangup(struct ast_channel *ast)
return 0;
}
/* If the call is not UP, we need to send CANCEL instead of BYE */
- if (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING) {
+ if (p->invitestate < INV_COMPLETED) {
needcancel = TRUE;
if (option_debug > 3)
ast_log(LOG_DEBUG, "Hanging up channel in state %s (not UP)\n", ast_state2str(ast->_state));
@@ -3434,7 +3434,7 @@ static int sip_hangup(struct ast_channel *ast)
*/
if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE))
needdestroy = 1; /* Set destroy flag at end of this function */
- else
+ else if (p->invitestate != INV_CALLING)
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
/* Start the process if it's not already started */
@@ -3496,6 +3496,7 @@ static int sip_hangup(struct ast_channel *ast)
but we can't send one while we have "INVITE" outstanding. */
ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
+ sip_cancel_destroy(p);
}
}
}