Skip to content
Snippets Groups Projects
Commit df8c7737 authored by Olle Johansson's avatar Olle Johansson
Browse files

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: https://origsvn.digium.com/svn/asterisk/trunk@48216 65c4cc65-6c06-0410-ace0-fbb531ad65f3
parent fc6de9e9
No related branches found
No related tags found
No related merge requests found
...@@ -242,15 +242,15 @@ enum sip_result { ...@@ -242,15 +242,15 @@ enum sip_result {
\note this is for the INVITE that sets up the dialog \note this is for the INVITE that sets up the dialog
*/ */
enum invitestates { enum invitestates {
INV_NONE = 0, /*!< No state at all, maybe not an INVITE dialog */ INV_NONE = 0, /*!< No state at all, maybe not an INVITE dialog */
INV_CALLING, /*!< Invite sent, no answer */ INV_CALLING = 1, /*!< Invite sent, no answer */
INV_PROCEEDING, /*!< We got/sent 1xx message */ INV_PROCEEDING = 2, /*!< We got/sent 1xx message */
INV_EARLY_MEDIA, /*!< We got 18x message with to-tag back */ INV_EARLY_MEDIA = 3, /*!< We got 18x message with to-tag back */
INV_COMPLETED, /*!< Got final response with error. Wait for ACK, then CONFIRMED */ INV_COMPLETED = 4, /*!< Got final response with error. Wait for ACK, then CONFIRMED */
INV_CONFIRMED, /*!< Confirmed response - we've got an ack (Incoming calls only) */ INV_CONFIRMED = 5, /*!< Confirmed response - we've got an ack (Incoming calls only) */
INV_TERMINATED, /*!< Transaction done - either successful (AST_STATE_UP) or failed, but done 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 */ 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_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; /* 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) ...@@ -3413,7 +3413,7 @@ static int sip_hangup(struct ast_channel *ast)
return 0; return 0;
} }
/* If the call is not UP, we need to send CANCEL instead of BYE */ /* 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; needcancel = TRUE;
if (option_debug > 3) if (option_debug > 3)
ast_log(LOG_DEBUG, "Hanging up channel in state %s (not UP)\n", ast_state2str(ast->_state)); 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) ...@@ -3434,7 +3434,7 @@ static int sip_hangup(struct ast_channel *ast)
*/ */
if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE)) if (ast_test_flag(&p->flags[0], SIP_ALREADYGONE))
needdestroy = 1; /* Set destroy flag at end of this function */ needdestroy = 1; /* Set destroy flag at end of this function */
else else if (p->invitestate != INV_CALLING)
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
   
/* Start the process if it's not already started */ /* Start the process if it's not already started */
...@@ -3496,6 +3496,7 @@ static int sip_hangup(struct ast_channel *ast) ...@@ -3496,6 +3496,7 @@ static int sip_hangup(struct ast_channel *ast)
but we can't send one while we have "INVITE" outstanding. */ but we can't send one while we have "INVITE" outstanding. */
ast_set_flag(&p->flags[0], SIP_PENDINGBYE); ast_set_flag(&p->flags[0], SIP_PENDINGBYE);
ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE); ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);
sip_cancel_destroy(p);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment