Browse code

max_expires parameter, contributed by Jamey Hicks <jamey.hicks@hp.com>

Jan Janak authored on 18/05/2004 16:35:13
Showing 4 changed files
... ...
@@ -73,6 +73,46 @@ modparam("registrar", "default_expires", 1800)
73 73
 </programlisting>
74 74
 	    </example>
75 75
 	</section>
76
+	<section>
77
+	    <title><varname>min_expires</varname> (integer)</title>
78
+	    <para>
79
+		The minimum expires value of a Contact, values lower than this minimum will be
80
+		automatically set to the minimum. Value 0 disables the checking.
81
+	    </para>
82
+	    <para>
83
+		<emphasis>
84
+		    Default value is 60.
85
+		</emphasis>
86
+	    </para>
87
+	    <example>
88
+		<title>Set <varname>min_expires</varname> parameter</title>
89
+		<programlisting format="linespecific">
90
+...
91
+modparam("registrar", "min_expires", 60)
92
+...
93
+</programlisting>
94
+	    </example>
95
+	</section>
96
+	<section>
97
+	    <title><varname>max_expires</varname> (integer)</title>
98
+	    <para>
99
+		The maximum expires value of a Contact, values higher than this maximum will be
100
+		automatically set to the maximum. Value 0 disables the checking.
101
+	    </para>
102
+	    <para>
103
+		<emphasis>
104
+		    Default value is 0.
105
+		</emphasis>
106
+	    </para>
107
+	    <example>
108
+		<title>Set <varname>max_expires</varname> parameter</title>
109
+		<programlisting format="linespecific">
110
+...
111
+modparam("registrar", "max_expires", 120)
112
+...
113
+</programlisting>
114
+	    </example>
115
+	</section>
76 116
 
77 117
 	<section>
78 118
 	    <title><varname>default_q</varname> (integer)</title>
... ...
@@ -62,6 +62,8 @@ int desc_time_order = 0;              /* By default do not order according to th
62 62
 int nat_flag        = 4;              /* SER flag marking contacts behind NAT */
63 63
 int min_expires     = 60;             /* Minimum expires the phones are allowed to use in seconds,
64 64
 			               * use 0 to switch expires checking off */
65
+int max_expires     = 0;              /* Minimum expires the phones are allowed to use in seconds,
66
+			               * use 0 to switch expires checking off */
65 67
 char* realm_pref    = "";   /* Realm prefix to be removed */
66 68
 str realm_prefix;
67 69
 
... ...
@@ -95,6 +97,7 @@ static param_export_t params[] = {
95 95
 	{"nat_flag",        INT_PARAM, &nat_flag       },
96 96
 	{"realm_prefix",    STR_PARAM, &realm_pref     },
97 97
 	{"min_expires",     INT_PARAM, &min_expires    },
98
+	{"max_expires",     INT_PARAM, &max_expires    },
98 99
 	{0,0,0}
99 100
 };
100 101
 
... ...
@@ -42,6 +42,7 @@ extern int case_sensitive;
42 42
 extern int desc_time_order;
43 43
 extern int nat_flag;
44 44
 extern int min_expires;
45
+extern int max_expires;
45 46
 extern str realm_prefix;
46 47
 
47 48
 extern float def_q;
... ...
@@ -236,6 +236,10 @@ int calc_contact_expires(struct sip_msg* _m, param_t* _ep, int* _e)
236 236
 		*_e = min_expires + act_time;
237 237
 	}
238 238
 
239
+	if ((*_e != 0) && max_expires && ((*_e - act_time) > max_expires)) {
240
+		*_e = max_expires + act_time;
241
+	}
242
+
239 243
 	return 0;
240 244
 }
241 245