2
0
Эх сурвалжийг харах

rtpengine: adding aggressive_redetection param

Lucian Balaceanu 7 жил өмнө
parent
commit
cb6df95387

+ 3 - 0
src/modules/rtpengine/config.c

@@ -32,6 +32,7 @@
 
 struct cfg_group_rtpengine	default_rtpengine_cfg = {
 		60,	/* default disable timeout in seconds */
+		1,	/* default aggressive_redetection enabled */
 		1000,	/* default wait timeout in milliseconds */
 		MAX_RTPP_TRIED_NODES,
         5, /* rtprengine retries */
@@ -42,6 +43,8 @@ void	*rtpengine_cfg = &default_rtpengine_cfg;
 cfg_def_t	rtpengine_cfg_def[] = {
 	{"rtpengine_disable_tout",	CFG_VAR_INT | CFG_ATOMIC, 	0, 0, 0, 0,
 		"The time after which rtpengine will try to communicate to an RTP proxy after it has been marked disabled automatically. "},
+	{"aggressive_redetection",	CFG_VAR_INT | CFG_ATOMIC, 	0, 1, 0, 0,
+		"Determines if the sip proxy should force a query of all nodes when all RTP proxies seem unavailable."},
 	{"rtpengine_tout_ms",		CFG_VAR_INT | CFG_ATOMIC, 	0, 0, 0, 0,
 		"The total number of nodes inside a set to be queried before giving up establishing a session"},
 	{"queried_nodes_limit",     CFG_VAR_INT | CFG_ATOMIC,   0, MAX_RTPP_TRIED_NODES, 0, 0,

+ 1 - 0
src/modules/rtpengine/config.h

@@ -28,6 +28,7 @@
 
 struct cfg_group_rtpengine {
 	unsigned int	rtpengine_disable_tout;
+	unsigned int	aggressive_redetection;
 	unsigned int	rtpengine_tout_ms;
 	unsigned int    queried_nodes_limit;
 	unsigned int	rtpengine_retr;

+ 27 - 0
src/modules/rtpengine/doc/rtpengine_admin.xml

@@ -194,6 +194,33 @@ modparam("rtpengine", "rtpengine_sock",
 ...
 modparam("rtpengine", "rtpengine_disable_tout", 20)
 ...
+</programlisting>
+		</example>
+	</section>
+	<section id="rtpengine.p.aggressive_redetection">
+		<title><varname>aggressive_redetection</varname> (integer)</title>
+		<para>
+		This parameter determines what happens when all potential rtpengines are found
+		to be unreachable. If enabled, the sip server will send pings to all rtpengines,
+		else no rtpengine will pe queried until its rtpengine_disable_tout timeout passes.
+		</para>
+		<para>
+		<emphasis>
+			Default value is <quote>1</quote>.
+		</emphasis>
+		</para>
+		<para>
+			Can be set at runtime, e.g.:
+			<programlisting>
+			$ &sercmd; cfg.set_now_int rtpengine aggressive_redetection 0
+			</programlisting>
+		</para>
+		<example>
+		<title>Set <varname>aggressive_redetection</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("rtpengine", "aggressive_redetection", 0)
+...
 </programlisting>
 		</example>
 	</section>

+ 5 - 0
src/modules/rtpengine/rtpengine.c

@@ -336,6 +336,7 @@ static param_export_t params[] = {
 	{"rtpengine_sock",        PARAM_STRING|USE_FUNC_PARAM,
 	                         (void*)rtpengine_set_store          },
 	{"rtpengine_disable_tout",INT_PARAM, &default_rtpengine_cfg.rtpengine_disable_tout },
+	{"aggressive_redetection",INT_PARAM, &default_rtpengine_cfg.aggressive_redetection },
 	{"rtpengine_retr",        INT_PARAM, &default_rtpengine_cfg.rtpengine_retr         },
 	{"queried_nodes_limit",   INT_PARAM, &default_rtpengine_cfg.queried_nodes_limit    },
 	{"rtpengine_tout_ms",     INT_PARAM, &default_rtpengine_cfg.rtpengine_tout_ms      },
@@ -2610,6 +2611,10 @@ retry:
 
 	/* No proxies? Force all to be redetected, if not yet */
 	if (weight_sum == 0) {
+		if (!cfg_get(rtpengine,rtpengine_cfg,aggressive_redetection)) {
+			return NULL;
+		}
+
 		if (was_forced) {
 			return NULL;
 		}