[asterisk-commits] oej: branch oej/darjeeling-prack-1.8 r369463 - /team/oej/darjeeling-prack-1.8...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 28 08:00:59 CDT 2012


Author: oej
Date: Thu Jun 28 08:00:55 2012
New Revision: 369463

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369463
Log:
Now that we're getting PRACK messages from the other end we need to handle them

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

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=369463&r1=369462&r2=369463
==============================================================================
--- team/oej/darjeeling-prack-1.8/channels/chan_sip.c (original)
+++ team/oej/darjeeling-prack-1.8/channels/chan_sip.c Thu Jun 28 08:00:55 2012
@@ -4178,7 +4178,7 @@
 				ast_debug(3, "Found required response SIP option: %s\n", sip_options[i].text);
 			}
 		}
-		add_header(req, "Required", buf);
+		add_header(req, "Require", buf);
 	} else {
 		ast_debug(2, "=!=!=!=!= No required options for this message \n");
 	}
@@ -4195,8 +4195,8 @@
 			}
 			snprintf(buf, sizeof(buf), "%d", ++(p->rseq));
 			add_header(req, "Rseq", buf);
-			req->reqsipoptions &= SIP_OPT_100REL;
-			ast_debug(2, "=!=!=!=!=!=!=!= PRACK USED HERE. Rseq %d\n", p->rseq);
+			req->reqsipoptions |= SIP_OPT_100REL;
+			ast_debug(2, "=!=!=!=!=!=!=!= PRACK USED HERE. Rseq %d \n", p->rseq);
 		} else {
 			ast_debug(2, "=!=!=!=!=!=!=!= PRACK COULD BE USED HERE. Exactly HERE\n");
 		}
@@ -10337,7 +10337,7 @@
 		snprintf(se_hdr, sizeof(se_hdr), "%d;refresher=%s", p->stimer->st_interval,
 			strefresher2str(p->stimer->st_ref));
 		add_header(resp, "Session-Expires", se_hdr);
-		resp->reqsipoptions &= SIP_OPT_TIMER;
+		resp->reqsipoptions |= SIP_OPT_TIMER;
 	}
 
 	if (msg[0] == '2' && (p->method == SIP_SUBSCRIBE || p->method == SIP_REGISTER)) {
@@ -19998,7 +19998,7 @@
  */
 static void handle_response_prack(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno)
 {
-	ast_debug(2, "---> Got response on UPDATE :: %d \n", resp);
+	ast_debug(2, "---> Got response on PRACK :: %d \n", resp);
 	/* Handle authentication early */
 	if (resp == 401 || resp == 407) {
 		if (p->options) {
@@ -20012,6 +20012,8 @@
 
 	switch(resp) {
 	case 200:	/* 200 OK - all is fine in the kingdom of SIP */
+		/* Stop retransmission */
+
 	case 481:	/* Ok, they did not find our call ID. Let's die */
 	case 403: 	/* Forbidden */
 	case 415: /* Unsupported media type */
@@ -22440,7 +22442,19 @@
  */
 static int handle_request_prack(struct sip_pvt *p, struct sip_request *req)
 {
-	/* SKREP */
+	const char *rack = get_header(req, "RAck");
+	int rseq, cseq;
+
+	if(sscanf(rack, "%30d %30d", &rseq, &cseq) != 2) {
+		/* we did not get proper rseq/cseq */
+		transmit_response(p, "481 Could not get proper rseq/cseq in Rack", req);
+	}
+	ast_debug(3, "!=!=!=!=!=!= Got PRACK with rseq %d and cseq %d \n", rseq, cseq);
+	if (rseq <= p->rseq) {
+		/* Ack the retransmits */
+		int acked = __sip_ack(p, cseq, 1 /* response */, 0);
+		ast_debug(3, "!=!=!=!=!=! Tried acking the response - %s \n", acked ? "Sucess" : "Total utterly failure");
+	}
 	transmit_response(p, "200 OK", req);
 	return 0;
 }




More information about the asterisk-commits mailing list