Module: kamailio
Branch: master
Commit: 926a97f4eb741401b193fb711e6c439555c646ab
URL: 
https://github.com/kamailio/kamailio/commit/926a97f4eb741401b193fb711e6c439555c646ab

Author: Marco Capetta <mcape...@sipwise.com>
Committer: Victor Seva <linuxman...@torreviejawireless.org>
Date: 2019-05-06T16:29:48+02:00

dialplan: add reload_delta parameter

- make the rate limit of maximum allowed dialplan reload configurable
using the new 'reload_delta' paramenter.

---

Modified: src/modules/dialplan/dialplan.c
Modified: src/modules/dialplan/doc/dialplan_admin.xml

---

Diff:  
https://github.com/kamailio/kamailio/commit/926a97f4eb741401b193fb711e6c439555c646ab.diff
Patch: 
https://github.com/kamailio/kamailio/commit/926a97f4eb741401b193fb711e6c439555c646ab.patch

---

diff --git a/src/modules/dialplan/dialplan.c b/src/modules/dialplan/dialplan.c
index d8685d52f2..20b7744e21 100644
--- a/src/modules/dialplan/dialplan.c
+++ b/src/modules/dialplan/dialplan.c
@@ -87,6 +87,7 @@ dp_param_p default_par2 = NULL;
 int dp_fetch_rows = 1000;
 int dp_match_dynamic = 0;
 int dp_append_branch = 1;
+int dp_reload_delta = 5;
 
 static time_t *dp_rpc_reload_time = NULL;
 
@@ -105,6 +106,7 @@ static param_export_t mod_params[]={
        { "fetch_rows",         PARAM_INT,      &dp_fetch_rows },
        { "match_dynamic",      PARAM_INT,      &dp_match_dynamic },
        { "append_branch",      PARAM_INT,      &dp_append_branch },
+       { "reload_delta",       PARAM_INT,      &dp_reload_delta },
        {0,0,0}
 };
 
@@ -182,6 +184,9 @@ static int mod_init(void)
        if(dp_fetch_rows<=0)
                dp_fetch_rows = 1000;
 
+       if(dp_reload_delta<0)
+               dp_reload_delta = 5;
+
        if(init_data() != 0) {
                LM_ERR("could not initialize data\n");
                return -1;
@@ -619,7 +624,7 @@ static void dialplan_rpc_reload(rpc_t* rpc, void* ctx)
                rpc->fault(ctx, 500, "Not ready for reload");
                return;
        }
-       if(*dp_rpc_reload_time!=0 && *dp_rpc_reload_time > time(NULL) - 5) {
+       if(*dp_rpc_reload_time!=0 && *dp_rpc_reload_time > time(NULL) - 
dp_reload_delta) {
                LM_ERR("ongoing reload\n");
                rpc->fault(ctx, 500, "ongoing reload");
                return;
diff --git a/src/modules/dialplan/doc/dialplan_admin.xml 
b/src/modules/dialplan/doc/dialplan_admin.xml
index 371120fac4..e524524fb8 100644
--- a/src/modules/dialplan/doc/dialplan_admin.xml
+++ b/src/modules/dialplan/doc/dialplan_admin.xml
@@ -410,6 +410,33 @@ modparam("dialplan", "append_branch", 0)
                </example>
        </section>
 
+       <section id="dialplan.p.reload_delta">
+               <title><varname>reload_delta</varname> (int)</title>
+               <para>
+               The number of seconds that have to be waited before executing a 
new reload
+               of dialplan rules. By default there is a rate limiting of 
maximum one reload
+               in five seconds.
+               </para>
+               <para>
+               If set to 0, no rate limit is configured. Note carefully: use 
this configuration
+               only in tests environments because executing two dialplan 
reloads at the same
+               time can cause to kamailio to crash.
+               </para>
+               <para>
+               <emphasis>
+                       Default value is <quote>5</quote>.
+               </emphasis>
+               </para>
+               <example>
+               <title>Set <varname>reload_delta</varname> parameter</title>
+               <programlisting format="linespecific">
+...
+modparam("dialplan", "reload_delta", 1)
+...
+               </programlisting>
+               </example>
+       </section>
+
        </section>
 
 
@@ -620,8 +647,9 @@ xlog("translated to var $var(y) \n");
                <function moreinfo="none">dp_reload()</function>
                </title>
                <para>
-               Reload the translation rules from the database. Note that there 
is
-               a rate limiting of maximum one reload in five seconds.
+               Reload the translation rules from the database. Note that there 
is a
+               rate limiting defined by 'reload_delta' paramenter. By default 
is allowed
+               maximum one reload in five seconds.
                </para>
                <para>
                Name: <emphasis>dp_reload</emphasis>


_______________________________________________
Kamailio (SER) - Development Mailing List
sr-dev@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to