[asterisk-commits] trunk - r7731 in /trunk: channels/chan_sip.c configs/sip.conf.sample

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Jan 3 05:21:50 CST 2006


Author: oej
Date: Tue Jan  3 05:21:48 2006
New Revision: 7731

URL: http://svn.digium.com/view/asterisk?rev=7731&view=rev
Log:
Bug 5345; Add configuration option for minimum registration time. (folsson)

Modified:
    trunk/channels/chan_sip.c
    trunk/configs/sip.conf.sample

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=7731&r1=7730&r2=7731&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Jan  3 05:21:48 2006
@@ -104,6 +104,7 @@
 
 #define SIPDUMPER
 #define DEFAULT_DEFAULT_EXPIRY  120
+#define DEFAULT_MIN_EXPIRY	60
 #define DEFAULT_MAX_EXPIRY	3600
 #define DEFAULT_REGISTRATION_TIMEOUT	20
 #define DEFAULT_MAX_FORWARDS	"70"
@@ -120,6 +121,7 @@
 #define EXPIRY_GUARD_PCT	0.20	/* Percentage of expires timeout to use when 
 					   below EXPIRY_GUARD_LIMIT */
 
+static int min_expiry = DEFAULT_MIN_EXPIRY;
 static int max_expiry = DEFAULT_MAX_EXPIRY;
 static int default_expiry = DEFAULT_DEFAULT_EXPIRY;
 
@@ -5894,8 +5896,10 @@
 
 	if (p->expire > -1)
 		ast_sched_del(sched, p->expire);
-	if ((expiry < 1) || (expiry > max_expiry))
+	if (expiry > max_expiry)
 		expiry = max_expiry;
+	if (expiry < min_expiry)
+		expiry = min_expiry;
 	if (!ast_test_flag(p, SIP_REALTIME))
 		p->expire = ast_sched_add(sched, (expiry + 10) * 1000, expire_register, p);
 	else
@@ -8171,6 +8175,7 @@
 	ast_cli(fd, "  MWI NOTIFY mime type:   %s\n", default_notifymime);
 	ast_cli(fd, "  DNS SRV lookup:         %s\n", srvlookup ? "Yes" : "No");
 	ast_cli(fd, "  Pedantic SIP support:   %s\n", pedanticsipchecking ? "Yes" : "No");
+	ast_cli(fd, "  Reg. min duration       %d secs\n", min_expiry);
 	ast_cli(fd, "  Reg. max duration:      %d secs\n", max_expiry);
 	ast_cli(fd, "  Reg. default duration:  %d secs\n", default_expiry);
 	ast_cli(fd, "  Outbound reg. timeout:  %d secs\n", global_reg_timeout);
@@ -10766,6 +10771,8 @@
 		if (p->subscribed == DIALOG_INFO_XML) {  
 			if (p->expiry > max_expiry)
 				p->expiry = max_expiry;
+			if (p->expiry < min_expiry)
+				p->expiry = min_expiry;
 		}
 		if (sipdebug || option_debug > 1)
 			ast_log(LOG_DEBUG, "Adding subscription for extension %s context %s for peer %s\n", p->exten, p->context, p->username);
@@ -12395,6 +12402,10 @@
 			max_expiry = atoi(v->value);
 			if (max_expiry < 1)
 				max_expiry = DEFAULT_MAX_EXPIRY;
+		} else if (!strcasecmp(v->name, "minexpirey") || !strcasecmp(v->name, "minexpiry")) {
+			min_expiry = atoi(v->value);
+			if (min_expiry < 1)
+				min_expiry = DEFAULT_MIN_EXPIRY;
 		} else if (!strcasecmp(v->name, "defaultexpiry") || !strcasecmp(v->name, "defaultexpirey")) {
 			default_expiry = atoi(v->value);
 			if (default_expiry < 1)

Modified: trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/sip.conf.sample?rev=7731&r1=7730&r2=7731&view=diff
==============================================================================
--- trunk/configs/sip.conf.sample (original)
+++ trunk/configs/sip.conf.sample Tue Jan  3 05:21:48 2006
@@ -59,6 +59,7 @@
 ;tos=184			; Set IP QoS to either a keyword or numeric val
 ;tos=lowdelay			; lowdelay,throughput,reliability,mincost,none
 ;maxexpiry=3600			; Max length of incoming registration we allow
+;minexpiry=60			; Minimum length of registration (default 60)
 ;defaultexpiry=120		; Default length of incoming/outoing registration
 ;notifymimetype=text/plain	; Allow overriding of mime type in MWI NOTIFY
 ;checkmwi=10			; Default time between mailbox checks for peers



More information about the asterisk-commits mailing list