diff --git a/modules/rtpengine/doc/rtpengine_admin.xml b/modules/rtpengine/doc/rtpengine_admin.xml index 96a490d2ad7..34e197fa2ce 100644 --- a/modules/rtpengine/doc/rtpengine_admin.xml +++ b/modules/rtpengine/doc/rtpengine_admin.xml @@ -207,6 +207,30 @@ modparam("rtpengine", "rtpengine_disable_tout", 20) ... modparam("rtpengine", "rtpengine_tout_ms", 2000) ... + + + +
+ <varname>rtpengine_allow_op</varname> (integer) + + Enable this to allow finishing the current sessions while denying new sessions for the + manually deactivated nodes via kamctl command i.e. "disabled(permanent)" nodes. + Probably the manually deactivated machine is still running(did not crash). + + + This is useful when deactivating a node for maintanance and reject new sessions but allow current ones to finish. + + + + Default value is 0 to keep the current behaviour. + + + + Set <varname>rtpengine_allow_op</varname> parameter + +... +modparam("rtpengine", "rtpengine_allow_op", 1) +...
diff --git a/modules/rtpengine/rtpengine.c b/modules/rtpengine/rtpengine.c index b3ca0110b92..042c477da14 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); }