Module: kamailio
Branch: master
Commit: 5a537506141027ca3d3ef87f49913ab628c30690
URL: https://github.com/kamailio/kamailio/commit/5a537506141027ca3d3ef87f49913ab…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Date: 2015-12-07T13:30:02+02:00
rtpengine: Allow op for all deactivated machines
If allow_op modparam enabled, send commands to the disabled machines for the
existing call. So far this was done only for manually deactivated machines.
This is useful because there might be cases of proxy timeout, cases when you
may want to still allow the operations for the existing calls.
---
Modified: modules/rtpengine/rtpengine.c
---
Diff: https://github.com/kamailio/kamailio/commit/5a537506141027ca3d3ef87f49913ab…
Patch: https://github.com/kamailio/kamailio/commit/5a537506141027ca3d3ef87f49913ab…
---
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c
index 893bc9d..bba10ef 100644
--- a/modules/rtpengine/rtpengine.c
+++ b/modules/rtpengine/rtpengine.c
@@ -2452,18 +2452,16 @@ select_rtpp_node(str callid, str viabranch, int do_test)
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) {
+ // if proper configuration and node manually or timeout disabled, return it
+ if (rtpengine_allow_op) {
+ if (node->rn_recheck_ticks == MI_MAX_RECHECK_TICKS) {
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;
+ } else {
+ LM_DBG("node=%.*s for calllen=%d callid=%.*s is disabled, either broke or timeout disabled! Return it\n",
+ node->rn_url.len, node->rn_url.s, callid.len, callid.len, callid.s);
}
- 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("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);
+ return node;
}
return NULL;
Module: kamailio
Branch: master
Commit: 7ad4dadcab841d191d5edc028a74cea7fe411450
URL: https://github.com/kamailio/kamailio/commit/7ad4dadcab841d191d5edc028a74cea…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Date: 2015-11-16T13:26:41+02:00
rtpengine: Fix comments for hastable
- shm NULL checks and free already alloc'ed shm
- default entry tout to 3600 sec
- return node only, not the whole entry
- zero shm hashtable parts
- lookup and select new node if lookup fails; this is done for all commands
and assures fallback behaviour
- change void to struct specific
- make set_rtp_inst_pvar() static -> used only in rtpengine.c
- fix typos rtpproxy vs rtpengine
---
Modified: modules/rtpengine/doc/rtpengine_admin.xml
Modified: modules/rtpengine/rtpengine.c
Modified: modules/rtpengine/rtpengine.h
Modified: modules/rtpengine/rtpengine_hash.c
Modified: modules/rtpengine/rtpengine_hash.h
---
Diff: https://github.com/kamailio/kamailio/commit/7ad4dadcab841d191d5edc028a74cea…
Patch: https://github.com/kamailio/kamailio/commit/7ad4dadcab841d191d5edc028a74cea…
Module: kamailio
Branch: master
Commit: d75bb85c4a03dedb33004fe04c447182fdf37f5c
URL: https://github.com/kamailio/kamailio/commit/d75bb85c4a03dedb33004fe04c44718…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Date: 2015-11-10T16:04:30+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/d75bb85c4a03dedb33004fe04c44718…
Patch: https://github.com/kamailio/kamailio/commit/d75bb85c4a03dedb33004fe04c44718…
---
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);
}
Module: kamailio
Branch: master
Commit: 02d8a62260fa1d1e98db4a9b5f4cdac8cab1ea4b
URL: https://github.com/kamailio/kamailio/commit/02d8a62260fa1d1e98db4a9b5f4cdac…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Date: 2015-11-06T17:17:00+02:00
rtpengine: Update doku for node enable/disable
This is my understanding of the current shared memory node list implementation.
Correct me if I'm wrong.
---
Modified: modules/rtpengine/doc/rtpengine_admin.xml
---
Diff: https://github.com/kamailio/kamailio/commit/02d8a62260fa1d1e98db4a9b5f4cdac…
Patch: https://github.com/kamailio/kamailio/commit/02d8a62260fa1d1e98db4a9b5f4cdac…
---
diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml
index bcb1c03..2454db2 100644
--- a/modules/rtpengine/doc/rtpengine_admin.xml
+++ b/modules/rtpengine/doc/rtpengine_admin.xml
@@ -73,6 +73,38 @@
If the set was selected using setid_avp, the avp needs to be
set only once before rtpengine_offer() or rtpengine_manage() call.
</para>
+ <para>
+ From the current implementation point of view, the sets of rtpproxy nodes
+ are shared memory(shm), so all processes can see a common list of nodes.
+ There is no locking when setting the nodes enabled/disabled (to keep the
+ memory access as fast as possible). Thus, problems related to node state
+ might appear for concurent processes that might set the nodes
+ enabled/disabled(e.g. by fifo command). This robustness problems are overcomed as follows.
+ </para>
+
+ <para>
+ If the current process sees the selected node as disabled, the node is
+ <emphasis>force tested</emphasis> before the current process actually
+ takes the disabled decision. If the test succeeds, the process will set
+ the node as enabled (but other concurrent process might still see it as disabled).
+.
+ </para>
+
+ <para>
+ If the current process sees the selected node as enabled, it does no additional checks
+ and sends the command which will fail in case the machine is actually broken.
+ The process will set the node as disabled (but other concurrent process might still see it as enabled).
+ </para>
+
+ <para>
+ The 'kamctl fifo' commands (including rtpengin ones) are executed by an exclusive
+ process which operate on the same shared memory node list.
+ </para>
+
+ <para>
+ All the nodes are pinged in the beginning by all the processes,
+ even if the node list is shared memory.
+ </para>
</section>
<section>
Module: kamailio
Branch: master
Commit: 2625ab3ccdafd8d474018516e6aa36ce48989db3
URL: https://github.com/kamailio/kamailio/commit/2625ab3ccdafd8d474018516e6aa36c…
Author: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Committer: Stefan Mititelu <stefan.mititelu(a)1and1.ro>
Date: 2015-11-05T17:09:53+02:00
rtpengine: hash table to keep the selected nodes
Shared memory hash table with global hashtable lock.
Add state maintaining the selected rtp node, for a given callid.
Hashtable entry expiration time configurable using hash_entry_tout modparam.
The actual deletion happens on the fly while insert/remove/lookup are called.
Updated doku.
---
Added: modules/rtpengine/rtpengine_hash.c
Added: modules/rtpengine/rtpengine_hash.h
Modified: modules/rtpengine/doc/rtpengine_admin.xml
Modified: modules/rtpengine/rtpengine.c
---
Diff: https://github.com/kamailio/kamailio/commit/2625ab3ccdafd8d474018516e6aa36c…
Patch: https://github.com/kamailio/kamailio/commit/2625ab3ccdafd8d474018516e6aa36c…
Shared memory hash table with global hashtable lock.
Add state maintaining the selected rtp node, for a given callid.
Hashtable entry expiration time configurable using hash_entry_tout modparam.
The actual deletion happens on the fly while insert/remove/lookup are called.
Updated doku.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/390
-- Commit Summary --
* rtpengine: hash table to keep the selected nodes
-- File Changes --
M modules/rtpengine/doc/rtpengine_admin.xml (26)
M modules/rtpengine/rtpengine.c (189)
A modules/rtpengine/rtpengine_hash.c (314)
A modules/rtpengine/rtpengine_hash.h (30)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/390.patchhttps://github.com/kamailio/kamailio/pull/390.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/390