[asterisk-commits] oej: branch oej/invitestate-1.4 r48215 - /team/oej/invitestate-1.4/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Dec 2 13:17:07 MST 2006


Author: oej
Date: Sat Dec  2 14:17:06 2006
New Revision: 48215

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48215
Log:
Send CANCEL even if the outbound call has early media. (Many bug reports)

Thanks to Leif Madsen for letting me play with his server while he was
playing hockey...

Modified:
    team/oej/invitestate-1.4/channels/chan_sip.c

Modified: team/oej/invitestate-1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate-1.4/channels/chan_sip.c?view=diff&rev=48215&r1=48214&r2=48215
==============================================================================
--- team/oej/invitestate-1.4/channels/chan_sip.c (original)
+++ team/oej/invitestate-1.4/channels/chan_sip.c Sat Dec  2 14:17:06 2006
@@ -248,15 +248,15 @@
 	\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;
@@ -3293,7 +3293,7 @@
 		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 (ast->_state == AST_STATE_RING || ast->_state == AST_STATE_RINGING || 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));
@@ -3317,7 +3317,7 @@
 	*/
 	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 */
@@ -3379,6 +3379,7 @@
 				   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);
 			}
 		}
 	}



More information about the asterisk-commits mailing list