Browse code

min_expires parameter. If set to non-zero value then registrations with shorter expires will be not allowed.

Jan Janak authored on 06/02/2004 20:26:49
Showing 3 changed files
... ...
@@ -58,6 +58,8 @@ int append_branches = 1;    /* If set to 1, lookup will put all contacts found i
58 58
 int case_sensitive  = 0;    /* If set to 1, username in aor will be case sensitive */
59 59
 int desc_time_order = 0;    /* By default do not order according to the descending modification time */
60 60
 int nat_flag        = 4;    /* SER flag marking contacts behind NAT */
61
+int min_expires     = 60;   /* Minimum expires the phones are allowed to use in seconds,
62
+			     * use 0 to switch expires checking off */
61 63
 
62 64
 float def_q;                /* default_q converted to float in mod_init */
63 65
 
... ...
@@ -89,6 +91,7 @@ static param_export_t params[] = {
89 89
 	{"case_sensitive",  INT_PARAM, &case_sensitive },
90 90
 	{"desc_time_order", INT_PARAM, &desc_time_order},
91 91
 	{"nat_flag",        INT_PARAM, &nat_flag       },
92
+	{"min_expires",     INT_PARAM, &min_expires    },
92 93
 	{0, 0, 0}
93 94
 };
94 95
 
... ...
@@ -40,6 +40,7 @@ extern int append_branches;
40 40
 extern int case_sensitive;
41 41
 extern int desc_time_order;
42 42
 extern int nat_flag;
43
+extern int min_expires;
43 44
 
44 45
 extern float def_q;
45 46
 
... ...
@@ -230,6 +230,11 @@ int calc_contact_expires(struct sip_msg* _m, param_t* _ep, int* _e)
230 230
 		     /* Convert to absolute value */
231 231
 		if (*_e != 0) *_e += act_time;
232 232
 	}		
233
+
234
+	if ((*_e - act_time) < min_expires) {
235
+		*_e = min_expires + act_time;
236
+	}
237
+
233 238
 	return 0;
234 239
 }
235 240