Browse code

rtpengine: adding aggressive_redetection param

Lucian Balaceanu authored on 12/01/2018 11:36:34
Showing 4 changed files
... ...
@@ -32,6 +32,7 @@
32 32
 
33 33
 struct cfg_group_rtpengine	default_rtpengine_cfg = {
34 34
 		60,	/* default disable timeout in seconds */
35
+		1,	/* default aggressive_redetection enabled */
35 36
 		1000,	/* default wait timeout in milliseconds */
36 37
 		MAX_RTPP_TRIED_NODES,
37 38
         5, /* rtprengine retries */
... ...
@@ -42,6 +43,8 @@ void	*rtpengine_cfg = &default_rtpengine_cfg;
42 43
 cfg_def_t	rtpengine_cfg_def[] = {
43 44
 	{"rtpengine_disable_tout",	CFG_VAR_INT | CFG_ATOMIC, 	0, 0, 0, 0,
44 45
 		"The time after which rtpengine will try to communicate to an RTP proxy after it has been marked disabled automatically. "},
46
+	{"aggressive_redetection",	CFG_VAR_INT | CFG_ATOMIC, 	0, 1, 0, 0,
47
+		"Determines if the sip proxy should force a query of all nodes when all RTP proxies seem unavailable."},
45 48
 	{"rtpengine_tout_ms",		CFG_VAR_INT | CFG_ATOMIC, 	0, 0, 0, 0,
46 49
 		"The total number of nodes inside a set to be queried before giving up establishing a session"},
47 50
 	{"queried_nodes_limit",     CFG_VAR_INT | CFG_ATOMIC,   0, MAX_RTPP_TRIED_NODES, 0, 0,
... ...
@@ -28,6 +28,7 @@
28 28
 
29 29
 struct cfg_group_rtpengine {
30 30
 	unsigned int	rtpengine_disable_tout;
31
+	unsigned int	aggressive_redetection;
31 32
 	unsigned int	rtpengine_tout_ms;
32 33
 	unsigned int    queried_nodes_limit;
33 34
 	unsigned int	rtpengine_retr;
... ...
@@ -194,6 +194,33 @@ modparam("rtpengine", "rtpengine_sock",
194 194
 ...
195 195
 modparam("rtpengine", "rtpengine_disable_tout", 20)
196 196
 ...
197
+</programlisting>
198
+		</example>
199
+	</section>
200
+	<section id="rtpengine.p.aggressive_redetection">
201
+		<title><varname>aggressive_redetection</varname> (integer)</title>
202
+		<para>
203
+		This parameter determines what happens when all potential rtpengines are found
204
+		to be unreachable. If enabled, the sip server will send pings to all rtpengines,
205
+		else no rtpengine will pe queried until its rtpengine_disable_tout timeout passes.
206
+		</para>
207
+		<para>
208
+		<emphasis>
209
+			Default value is <quote>1</quote>.
210
+		</emphasis>
211
+		</para>
212
+		<para>
213
+			Can be set at runtime, e.g.:
214
+			<programlisting>
215
+			$ &sercmd; cfg.set_now_int rtpengine aggressive_redetection 0
216
+			</programlisting>
217
+		</para>
218
+		<example>
219
+		<title>Set <varname>aggressive_redetection</varname> parameter</title>
220
+		<programlisting format="linespecific">
221
+...
222
+modparam("rtpengine", "aggressive_redetection", 0)
223
+...
197 224
 </programlisting>
198 225
 		</example>
199 226
 	</section>
... ...
@@ -336,6 +336,7 @@ static param_export_t params[] = {
336 336
 	{"rtpengine_sock",        PARAM_STRING|USE_FUNC_PARAM,
337 337
 	                         (void*)rtpengine_set_store          },
338 338
 	{"rtpengine_disable_tout",INT_PARAM, &default_rtpengine_cfg.rtpengine_disable_tout },
339
+	{"aggressive_redetection",INT_PARAM, &default_rtpengine_cfg.aggressive_redetection },
339 340
 	{"rtpengine_retr",        INT_PARAM, &default_rtpengine_cfg.rtpengine_retr         },
340 341
 	{"queried_nodes_limit",   INT_PARAM, &default_rtpengine_cfg.queried_nodes_limit    },
341 342
 	{"rtpengine_tout_ms",     INT_PARAM, &default_rtpengine_cfg.rtpengine_tout_ms      },
... ...
@@ -2610,6 +2611,10 @@ retry:
2610 2611
 
2611 2612
 	/* No proxies? Force all to be redetected, if not yet */
2612 2613
 	if (weight_sum == 0) {
2614
+		if (!cfg_get(rtpengine,rtpengine_cfg,aggressive_redetection)) {
2615
+			return NULL;
2616
+		}
2617
+
2613 2618
 		if (was_forced) {
2614 2619
 			return NULL;
2615 2620
 		}