Module: kamailio Branch: master Commit: cb6df95387186fab8670d17cfd8040de1b7f641e URL: https://github.com/kamailio/kamailio/commit/cb6df95387186fab8670d17cfd8040de...
Author: Lucian Balaceanu lucian.balaceanu@1and1.ro Committer: Lucian Balaceanu lucian.balaceanu@1and1.ro Date: 2018-01-12T13:36:34+02:00
rtpengine: adding aggressive_redetection param
---
Modified: src/modules/rtpengine/config.c Modified: src/modules/rtpengine/config.h Modified: src/modules/rtpengine/doc/rtpengine_admin.xml Modified: src/modules/rtpengine/rtpengine.c
---
Diff: https://github.com/kamailio/kamailio/commit/cb6df95387186fab8670d17cfd8040de... Patch: https://github.com/kamailio/kamailio/commit/cb6df95387186fab8670d17cfd8040de...
---
diff --git a/src/modules/rtpengine/config.c b/src/modules/rtpengine/config.c index f2aa4efc0a..946df8a30c 100644 --- a/src/modules/rtpengine/config.c +++ b/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, diff --git a/src/modules/rtpengine/config.h b/src/modules/rtpengine/config.h index ab383bc69b..d6c35b71ac 100644 --- a/src/modules/rtpengine/config.h +++ b/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; diff --git a/src/modules/rtpengine/doc/rtpengine_admin.xml b/src/modules/rtpengine/doc/rtpengine_admin.xml index 4133eb93c2..bc31168f63 100644 --- a/src/modules/rtpengine/doc/rtpengine_admin.xml +++ b/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> diff --git a/src/modules/rtpengine/rtpengine.c b/src/modules/rtpengine/rtpengine.c index 5b82988229..6ad0c16d7e 100644 --- a/src/modules/rtpengine/rtpengine.c +++ b/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 @@ select_rtpp_node_new(str callid, str viabranch, int do_test, struct rtpp_node **
/* 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; }