[asterisk-commits] oej: branch oej/invitestate r48214 - /team/oej/invitestate/channels/chan_sip.c

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


Author: oej
Date: Sat Dec  2 14:07:18 2006
New Revision: 48214

URL: http://svn.digium.com/view/asterisk?view=rev&rev=48214
Log:
In the case of early media, we did not hang the call up properly. AST_STATE does not
cover that state, so the state is "down"...

Many thanks to Leif Madsen for giving me access to a system and placing many, many
test calls so I could trace this bug.

The call was killed before we had closed the dialog properly... Bad.

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

Modified: team/oej/invitestate/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/invitestate/channels/chan_sip.c?view=diff&rev=48214&r1=48213&r2=48214
==============================================================================
--- team/oej/invitestate/channels/chan_sip.c (original)
+++ team/oej/invitestate/channels/chan_sip.c Sat Dec  2 14:07:18 2006
@@ -153,15 +153,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;
@@ -1381,7 +1381,7 @@
 {
 	if (p->autokillid > -1)
 		ast_sched_del(sched, p->autokillid);
-	append_history(p, "CancelDestroy", "");
+	append_history(p, "CancelDestroy", "------ ");
 	p->autokillid = -1;
 	return 0;
 }
@@ -2462,7 +2462,7 @@
 		return 0;
 	}
 	/* If the call is not UP, we need to send CANCEL instead of BYE */
-	if (ast->_state != AST_STATE_UP)
+	if (ast->_state != AST_STATE_UP || p->invitestate < INV_COMPLETED)
 		needcancel = 1;
 
 	/* Disconnect */
@@ -2485,7 +2485,7 @@
 	*/
 	if (ast_test_flag(p, SIP_ALREADYGONE))
 		needdestroy = 1;	/* Set destroy flag at end of this function */
-	else
+	else if (p->invitestate != INV_CALLING)
 		sip_scheddestroy(p, 32000);
 
 	/* Start the process if it's not already started */
@@ -2528,6 +2528,7 @@
 				   but we can't send one while we have "INVITE" outstanding. */
 				ast_set_flag(p, SIP_PENDINGBYE);	
 				ast_clear_flag(p, SIP_NEEDREINVITE);	
+				sip_cancel_destroy(p);
 			}
 		}
 	}



More information about the asterisk-commits mailing list