[Asterisk-cvs] asterisk/channels chan_sip.c,1.884,1.885

markster markster
Wed Oct 12 01:48:34 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv4233/channels

Modified Files:
	chan_sip.c 
Log Message:
Do *not* default to a max number of registration attempts


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.884
retrieving revision 1.885
diff -u -d -r1.884 -r1.885
--- chan_sip.c	12 Oct 2005 04:59:58 -0000	1.884
+++ chan_sip.c	12 Oct 2005 05:43:21 -0000	1.885
@@ -95,7 +95,6 @@
 #define DEFAULT_DEFAULT_EXPIRY  120
 #define DEFAULT_MAX_EXPIRY	3600
 #define DEFAULT_REGISTRATION_TIMEOUT	20
-#define DEFAULT_REGATTEMPTS_MAX	10
 
 /* guard limit must be larger than guard secs */
 /* guard min must be < 1000, and should be >= 250 */
@@ -360,7 +359,7 @@
 static int global_rtpkeepalive = 0;
 
 static int global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;	
-static int global_regattempts_max = DEFAULT_REGATTEMPTS_MAX;
+static int global_regattempts_max = 0;
 
 /* Object counters */
 static int suserobjs = 0;
@@ -5219,7 +5218,7 @@
 		__sip_pretend_ack(p);
 	}
 	/* If we have a limit, stop registration and give up */
-	if (global_regattempts_max && r->regattempts > global_regattempts_max) {
+	if (global_regattempts_max && (r->regattempts > global_regattempts_max)) {
 		/* Ok, enough is enough. Don't try any more */
 		/* We could add an external notification here... 
 			steal it from app_voicemail :-) */
@@ -9493,13 +9492,15 @@
 		break;
 	case 403:	/* Forbidden */
 		ast_log(LOG_WARNING, "Forbidden - wrong password on authentication for REGISTER for '%s' to '%s'\n", p->registry->username, p->registry->hostname);
-		p->registry->regattempts = global_regattempts_max+1;
+		if (global_regattempts_max)
+			p->registry->regattempts = global_regattempts_max+1;
 		ast_sched_del(sched, r->timeout);
 		ast_set_flag(p, SIP_NEEDDESTROY);	
 		break;
 	case 404:	/* Not found */
 		ast_log(LOG_WARNING, "Got 404 Not found on SIP register to service %s@%s, giving up\n", p->registry->username,p->registry->hostname);
-		p->registry->regattempts = global_regattempts_max+1;
+		if (global_regattempts_max)
+			p->registry->regattempts = global_regattempts_max+1;
 		ast_set_flag(p, SIP_NEEDDESTROY);	
 		r->call = NULL;
 		ast_sched_del(sched, r->timeout);
@@ -9512,7 +9513,8 @@
 		break;
 	case 479:	/* SER: Not able to process the URI - address is wrong in register*/
 		ast_log(LOG_WARNING, "Got error 479 on register to %s@%s, giving up (check config)\n", p->registry->username,p->registry->hostname);
-		p->registry->regattempts = global_regattempts_max+1;
+		if (global_regattempts_max)
+			p->registry->regattempts = global_regattempts_max+1;
 		ast_set_flag(p, SIP_NEEDDESTROY);	
 		r->call = NULL;
 		ast_sched_del(sched, r->timeout);
@@ -12123,7 +12125,7 @@
 	global_rtpkeepalive = 0;
 	pedanticsipchecking = 0;
 	global_reg_timeout = DEFAULT_REGISTRATION_TIMEOUT;
-	global_regattempts_max = DEFAULT_REGATTEMPTS_MAX;
+	global_regattempts_max = 0;
 	ast_clear_flag(&global_flags, AST_FLAGS_ALL);
 	ast_set_flag(&global_flags, SIP_DTMF_RFC2833);
 	ast_set_flag(&global_flags, SIP_NAT_RFC3581);




More information about the svn-commits mailing list