[asterisk-commits] kpfleming: branch 1.2 r38731 - /branches/1.2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Aug 2 12:29:57 MST 2006


Author: kpfleming
Date: Wed Aug  2 14:29:56 2006
New Revision: 38731

URL: http://svn.digium.com/view/asterisk?rev=38731&view=rev
Log:
fix brain-damage I introduced when trying to fix the CANCEL/BYE sending mechanism for pending INVITES
accept unknown 1xx responses as 183 responses (as RFC3261 mandates we should do)

Modified:
    branches/1.2/channels/chan_sip.c

Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?rev=38731&r1=38730&r2=38731&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Wed Aug  2 14:29:56 2006
@@ -9596,14 +9596,20 @@
 		return;
 	}
 
+	/* RFC3261 says we must treat every 1xx response (but not 100)
+	   that we don't recognize as if it was 183.
+	*/
+	if ((resp > 100) &&
+	    (resp < 200) &&
+	    (resp != 180) &&
+	    (resp != 183))
+		resp = 183;
+
 	switch (resp) {
 	case 100:	/* Trying */
 		if (!ignore)
 			sip_cancel_destroy(p);
-		/* must call check_pendings before setting CAN_BYE, so that
-		   if PENDINGBYE is set it will know to send CANCEL instead */
 		check_pendings(p);
-		ast_set_flag(p, SIP_CAN_BYE);
 		break;
 	case 180:	/* 180 Ringing */
 		if (!ignore)
@@ -9620,10 +9626,8 @@
 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
 			}
 		}
-		/* must call check_pendings before setting CAN_BYE, so that
-		   if PENDINGBYE is set it will know to send CANCEL instead */
+		ast_set_flag(p, SIP_CAN_BYE);
 		check_pendings(p);
-		ast_set_flag(p, SIP_CAN_BYE);
 		break;
 	case 183:	/* Session progress */
 		if (!ignore)
@@ -9636,10 +9640,8 @@
 				ast_queue_control(p->owner, AST_CONTROL_PROGRESS);
 			}
 		}
-		/* must call check_pendings before setting CAN_BYE, so that
-		   if PENDINGBYE is set it will know to send CANCEL instead */
+		ast_set_flag(p, SIP_CAN_BYE);
 		check_pendings(p);
-		ast_set_flag(p, SIP_CAN_BYE);
 		break;
 	case 200:	/* 200 OK on invite - someone's answering our call */
 		if (!ignore)
@@ -9678,6 +9680,7 @@
 		}
 		/* If I understand this right, the branch is different for a non-200 ACK only */
 		transmit_request(p, SIP_ACK, seqno, 0, 1);
+		ast_set_flag(p, SIP_CAN_BYE);
 		check_pendings(p);
 		break;
 	case 407: /* Proxy authentication */



More information about the asterisk-commits mailing list