[asterisk-commits] nadi: branch group/trunk-cm-csel-hash r47430 - in /team/group/trunk-cm-csel-h...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Nov 10 09:11:07 MST 2006


Author: nadi
Date: Fri Nov 10 10:11:06 2006
New Revision: 47430

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47430
Log:
Merged revisions 47415-47416,47419 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r47415 | oej | 2006-11-10 13:11:06 +0100 (Fr, 10 Nov 2006) | 2 lines

Small simplification and documentation correction.

........
r47416 | oej | 2006-11-10 13:22:44 +0100 (Fr, 10 Nov 2006) | 2 lines

Fix badly defined flag. Thanks fenlander!

........
r47419 | oej | 2006-11-10 14:14:44 +0100 (Fr, 10 Nov 2006) | 2 lines

Ripping out bad support for 491 replies to INVITE's. Let's try again properly later.

........

Modified:
    team/group/trunk-cm-csel-hash/   (props changed)
    team/group/trunk-cm-csel-hash/channels/chan_sip.c

Propchange: team/group/trunk-cm-csel-hash/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/group/trunk-cm-csel-hash/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Nov 10 10:11:06 2006
@@ -1,1 +1,1 @@
-/trunk:1-47411
+/trunk:1-47429

Modified: team/group/trunk-cm-csel-hash/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/trunk-cm-csel-hash/channels/chan_sip.c?view=diff&rev=47430&r1=47429&r2=47430
==============================================================================
--- team/group/trunk-cm-csel-hash/channels/chan_sip.c (original)
+++ team/group/trunk-cm-csel-hash/channels/chan_sip.c Fri Nov 10 10:11:06 2006
@@ -761,8 +761,8 @@
 #define SIP_PAGE2_T38SUPPORT_TCP	(4 << 20)	/*!< 22: T38 Fax Passthrough Support (not implemented) */
 #define SIP_PAGE2_CALL_ONHOLD		(3 << 23)	/*!< Call states */
 #define SIP_PAGE2_CALL_ONHOLD_ONEDIR	(1 << 23)	/*!< 23: One directional hold */
-#define SIP_PAGE2_CALL_ONHOLD_INACTIVE	(2 << 24)	/*!< 24: Inactive  */
-#define SIP_PAGE2_RFC2833_COMPENSATE    (1 << 26)
+#define SIP_PAGE2_CALL_ONHOLD_INACTIVE	(1 << 24)	/*!< 24: Inactive  */
+#define SIP_PAGE2_RFC2833_COMPENSATE    (1 << 25)
 
 #define SIP_PAGE2_FLAGS_TO_COPY \
 	(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | SIP_PAGE2_T38SUPPORT | SIP_PAGE2_RFC2833_COMPENSATE)
@@ -1259,7 +1259,7 @@
 static void sip_cancel_destroy(struct sip_pvt *p);
 static void sip_destroy(struct sip_pvt *p);
 static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist);
-static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int reset);
+static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
 static void __sip_pretend_ack(struct sip_pvt *p);
 static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
 static int auto_congest(void *nothing);
@@ -2054,7 +2054,7 @@
 }
 
 /*! \brief Acknowledges receipt of a packet and stops retransmission */
-static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod, int reset)
+static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
 {
 	struct sip_pkt *cur, *prev = NULL;
 
@@ -2082,8 +2082,7 @@
 					ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
 				ast_sched_del(sched, cur->retransid);
 			}
-			if (!reset)
-				free(cur);
+			free(cur);
 			break;
 		}
 	}
@@ -2106,7 +2105,7 @@
 		}
 		cur = p->packets;
 		method = (cur->method) ? cur->method : find_sip_method(cur->data);
-		__sip_ack(p, cur->seqno, ast_test_flag(cur, FLAG_RESPONSE), method, FALSE);
+		__sip_ack(p, cur->seqno, ast_test_flag(cur, FLAG_RESPONSE), method);
 	}
 }
 
@@ -6711,21 +6710,21 @@
 		add_header(req, "Remote-Party-ID", p->rpid);
 }
 
-/*! \brief Build REFER/INVITE/OPTIONS message and transmit it */
+/*! \brief Build REFER/INVITE/OPTIONS message and transmit it 
+	\param init 0 = Prepare request within dialog, 1= prepare request, new branch, 2= prepare new request and new dialog. do_proxy_auth calls this with init!=2
+	*/
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init)
 {
 	struct sip_request req;
 	
 	req.method = sipmethod;
-	if (init) {		/* Seems like init always is 2 */
-		/* Bump branch even on initial requests */
+	if (init) {/* Bump branch even on initial requests */
 		p->branch ^= ast_random();
 		build_via(p);
-		if (init > 1)
-			initreqprep(&req, p, sipmethod);
-		else
-			reqprep(&req, p, sipmethod, 0, 1);
-	} else
+	}
+	if (init > 1)
+		initreqprep(&req, p, sipmethod);
+	else
 		reqprep(&req, p, sipmethod, 0, 1);
 		
 	if (p->options && p->options->auth)
@@ -11832,9 +11831,13 @@
 		break;
 
 	case 491: /* Pending */
-		/* we have to wait a while, then retransmit */
-		/* Transmission is rescheduled, so everything should be taken care of.
-			We should support the retry-after at some point */
+		/* we really should have to wait a while, then retransmit */
+			/* We should support the retry-after at some point */
+		/* At this point, we treat this as a congestion */
+		transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, FALSE);
+		if (p->owner && !ast_test_flag(req, SIP_PKT_IGNORE))
+			ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
+		ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 		break;
 
 	case 501: /* Not implemented */
@@ -12118,7 +12121,7 @@
 	if ((resp >= 100) && (resp <= 199))
 		__sip_semi_ack(p, seqno, 0, sipmethod);
 	else
-		__sip_ack(p, seqno, 0, sipmethod, resp == 491 ? TRUE : FALSE);
+		__sip_ack(p, seqno, 0, sipmethod);
 
 	/* Get their tag if we haven't already */
 	if (ast_strlen_zero(p->theirtag) || (resp >= 200)) {
@@ -14602,7 +14605,7 @@
 		/* Make sure we don't ignore this */
 		if (seqno == p->pendinginvite) {
 			p->pendinginvite = 0;
-			__sip_ack(p, seqno, FLAG_RESPONSE, 0, FALSE);
+			__sip_ack(p, seqno, FLAG_RESPONSE, 0);
 			if (find_sdp(req)) {
 				if (process_sdp(p, req))
 					return -1;



More information about the asterisk-commits mailing list