[svn-commits] oej: branch oej/darjeeling-prack-1.8 r369533 - in /team/oej/darjeeling-prack-...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Jul 2 13:49:37 CDT 2012


Author: oej
Date: Mon Jul  2 13:49:33 2012
New Revision: 369533

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369533
Log:
Hold the answer until we have PRACK.

Works in theory, but what happens if we don't get the PRACK?
We will hangup the call...

Modified:
    team/oej/darjeeling-prack-1.8/channels/chan_sip.c
    team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h

Modified: team/oej/darjeeling-prack-1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/chan_sip.c?view=diff&rev=369533&r1=369532&r2=369533
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Mon Jul  2 13:49:33 2012
@@ -6523,6 +6523,10 @@
 	struct sip_pvt *p = ast->tech_pvt;
 
 	sip_pvt_lock(p);
+	if (ast_test_flag(&p->flags[2], SIP_PAGE3_INVITE_WAIT_FOR_PRACK)) {
+		ast_set_flag(&p->flags[2], SIP_PAGE3_ANSWER_WAIT_FOR_PRACK);
+		return 0;
+	}
 	if (ast->_state != AST_STATE_UP) {
 		try_suggested_sip_codec(p);	
 
@@ -11863,6 +11867,8 @@
 		reliable = XMIT_PRACK;
 	}
 	if (strncmp(msg, "100", 3)) {
+		/* If we send a resposne WITH sdp we are not allowed to respond before the PRACK is received */
+		ast_set_flag(&p->flags[2], SIP_PAGE3_INVITE_WAIT_FOR_PRACK);
 		add_prack_respheader(p, &resp, reliable);
 		add_required_respheader(&resp);
 	}
@@ -22515,6 +22521,7 @@
 		/* we did not get proper rseq/cseq */
 		transmit_response(p, "481 Could not get proper rseq/cseq in Rack", req);
 	}
+	ast_clear_flag(&p->flags[2], SIP_PAGE3_INVITE_WAIT_FOR_PRACK);	/* Clear flag */
 	ast_debug(3, "!=!=!=!=!=!= Got PRACK with rseq %d and cseq %d \n", rseq, cseq);
 	if (rseq <= p->rseq) {
 		/* Ack the retransmits */
@@ -22523,6 +22530,13 @@
 	}
 	append_history(p, "PRACK", "PRACK received Rseq %d", rseq);
 	transmit_response(p, "200 OK", req);
+	if (ast_test_flag(&p->flags[2], SIP_PAGE3_ANSWER_WAIT_FOR_PRACK)) {
+		/* If the response sent reliably contained an SDP, we're not allowed to  answer
+		   until we have a PRACK response 
+		 */
+		sip_answer(p->owner);
+		ast_clear_flag(&p->flags[2], SIP_PAGE3_ANSWER_WAIT_FOR_PRACK);
+	}
 	return 0;
 }
 

Modified: team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h
URL: http://svnview.digium.com/svn/asterisk/team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h?view=diff&rev=369533&r1=369532&r2=369533
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h (original)
+++ team/oej/darjeeling-prack-1.8/channels/sip/include/sip.h Mon Jul  2 13:49:33 2012
@@ -357,9 +357,11 @@
 	SIP_PAGE2_Q850_REASON | SIP_PAGE2_HAVEPEERCONTEXT | SIP_PAGE2_USE_SRTP)
 
 
-#define SIP_PAGE3_SNOM_AOC               (1 << 0)  /*!< DPG: Allow snom aoc messages */
-#define SIP_PAGE3_PRACK               (1 << 1)  /*!< DPG: Allow snom aoc messages */
-#define SIP_PAGE3_100REL               (1 << 2)  /*!< D: If PRACK is active for a specific dialog */
+#define SIP_PAGE3_SNOM_AOC              (1 << 0)  /*!< DPG: Allow snom aoc messages */
+#define SIP_PAGE3_PRACK               	(1 << 1)  /*!< DPG: Allow snom aoc messages */
+#define SIP_PAGE3_100REL               	(1 << 2)  /*!< D: If PRACK is active for a specific dialog */
+#define SIP_PAGE3_INVITE_WAIT_FOR_PRACK (1 << 3)  /*!< D: Wait for PRACK response before sending 200 OK */
+#define SIP_PAGE3_ANSWER_WAIT_FOR_PRACK	(1 << 4)  /*!< D: Send ANSWER when PRACK is received */
 
 #define SIP_PAGE3_FLAGS_TO_COPY \
 	(SIP_PAGE3_SNOM_AOC | SIP_PAGE3_PRACK)




More information about the svn-commits mailing list