[sr-dev] git:master:69c156f9: rtpengine: Add rtpengine_allow_op modparam

Stefan Mititelu stefan.mititelu at 1and1.ro
Mon Nov 23 11:39:31 CET 2015


Module: kamailio
Branch: master
Commit: 69c156f9c2d2c40faf61e2ebde9f98b933b87baf
URL: https://github.com/kamailio/kamailio/commit/69c156f9c2d2c40faf61e2ebde9f98b933b87baf

Author: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu at 1and1.ro>
Date: 2015-11-23T12:12:27+02:00

rtpengine: Add rtpengine_allow_op modparam

When the param is enabled, allow current sessions to finish and deny new
sessions for manually deactivated rtpengine nodes via kamctl i.e.
"disabled(permanent)" nodes.
This is useful when deactivating the nodes for maintenance.
Default value is 0, so the current behaviour is maintained
(e.g. don't send commands to any deactivated proxy).
Updated doku.

---

Modified: modules/rtpengine/doc/rtpengine_admin.xml
Modified: modules/rtpengine/rtpengine.c

---

Diff:  https://github.com/kamailio/kamailio/commit/69c156f9c2d2c40faf61e2ebde9f98b933b87baf.diff
Patch: https://github.com/kamailio/kamailio/commit/69c156f9c2d2c40faf61e2ebde9f98b933b87baf.patch

---

diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml
index 96a490d..34e197f 100644
--- a/modules/rtpengine/doc/rtpengine_admin.xml
+++ b/modules/rtpengine/doc/rtpengine_admin.xml
@@ -210,6 +210,30 @@ modparam("rtpengine", "rtpengine_tout_ms", 2000)
 </programlisting>
 		</example>
 	</section>
+	<section id="rtpengine.p.rtpengine_allow_op">
+		<title><varname>rtpengine_allow_op</varname> (integer)</title>
+		<para>
+		Enable this to allow finishing the current sessions while denying new sessions for the
+		<emphasis>manually deactivated nodes </emphasis> via kamctl command i.e. "disabled(permanent)" nodes.
+		Probably the manually deactivated machine is still running(did not crash).
+		</para>
+		<para>
+		This is <emphasis>useful</emphasis> when deactivating a node for maintanance and reject new sessions but allow current ones to finish.
+		</para>
+		<para>
+		<emphasis>
+		Default value is <quote>0</quote> to keep the current behaviour.
+		</emphasis>
+		</para>
+		<example>
+		<title>Set <varname>rtpengine_allow_op</varname> parameter</title>
+		<programlisting format="linespecific">
+...
+modparam("rtpengine", "rtpengine_allow_op", 1)
+...
+</programlisting>
+		</example>
+	</section>
 	<section id="rtpengine.p.queried_nodes_limit">
 		<title><varname>queried_nodes_limit</varname> (integer)</title>
 		<para>
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index b3ca011..042c477 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -227,6 +227,7 @@ static struct mi_root* mi_show_hash_total(struct mi_root* cmd_tree, void* param)
 
 
 static int rtpengine_disable_tout = 60;
+static int rtpengine_allow_op = 0;
 static int rtpengine_retr = 5;
 static int rtpengine_tout_ms = 1000;
 static int queried_nodes_limit = MAX_RTPP_TRIED_NODES;
@@ -334,6 +335,7 @@ static param_export_t params[] = {
 	{"rtpengine_disable_tout",INT_PARAM, &rtpengine_disable_tout },
 	{"rtpengine_retr",        INT_PARAM, &rtpengine_retr         },
 	{"rtpengine_tout_ms",     INT_PARAM, &rtpengine_tout_ms      },
+	{"rtpengine_allow_op",    INT_PARAM, &rtpengine_allow_op     },
 	{"queried_nodes_limit",   INT_PARAM, &queried_nodes_limit    },
 	{"db_url",                PARAM_STR, &rtpp_db_url },
 	{"table_name",            PARAM_STR, &rtpp_table_name },
@@ -2369,7 +2371,7 @@ select_rtpp_node_new(str callid, int do_test, int op)
 }
 
 /*
- * lookup the hastable (key=callid value=node) and get the old node
+ * lookup the hastable (key=callid value=node) and get the old node (e.g. for answer/delete)
  */
 static struct rtpp_node *
 select_rtpp_node_old(str callid, int do_test, int op)
@@ -2396,11 +2398,22 @@ select_rtpp_node_old(str callid, int do_test, int op)
 			node->rn_url.len, node->rn_url.s, callid.len, callid.len, callid.s);
 	}
 
-	// if node broke, don't send any message
+	// if node enabled, return it
 	if (!node->rn_disabled) {
 		return node;
+	}
+
+	// if node _manually_ disabled(e.g kamctl) and proper configuration, return it
+	if (node->rn_recheck_ticks == MI_MAX_RECHECK_TICKS) {
+		if (rtpengine_allow_op) {
+			LM_DBG("node=%.*s for calllen=%d callid=%.*s is disabled(permanent) (probably still UP)! Return it\n",
+				node->rn_url.len, node->rn_url.s, callid.len, callid.len, callid.s);
+			return node;
+		}
+		LM_DBG("node=%.*s for calllen=%d callid=%.*s is disabled(permanent) (probably still UP)! Return NULL\n",
+			node->rn_url.len, node->rn_url.s, callid.len, callid.len, callid.s);
 	} else {
-		LM_DBG("rtpengine hash table lookup find node=%.*s for calllen=%d callid=%.*s, which is disabled!\n",
+		LM_DBG("node=%.*s for calllen=%d callid=%.*s is disabled (probably BROKE)! Return NULL\n",
 			node->rn_url.len, node->rn_url.s, callid.len, callid.len, callid.s);
 	}
 




More information about the sr-dev mailing list