Module: kamailio
Branch: master
Commit: a4ec3b5baeb4b4fdce44dab0dc2e776d2e4fd595
URL:
https://github.com/kamailio/kamailio/commit/a4ec3b5baeb4b4fdce44dab0dc2e776…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: GitHub <noreply(a)github.com>
Date: 2016-06-14T15:02:50+02:00
Merge pull request #664 from kamailio/luismartingil/dispatcher_reload
Exporting ds_reload to cfg script
---
Modified: modules/dispatcher/dispatcher.c
Modified: modules/dispatcher/doc/dispatcher.xml
Modified: modules/dispatcher/doc/dispatcher_admin.xml
---
Diff:
https://github.com/kamailio/kamailio/commit/a4ec3b5baeb4b4fdce44dab0dc2e776…
Patch:
https://github.com/kamailio/kamailio/commit/a4ec3b5baeb4b4fdce44dab0dc2e776…
---
diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 5220fdb..69ba1ec 100644
--- a/modules/dispatcher/dispatcher.c
+++ b/modules/dispatcher/dispatcher.c
@@ -161,6 +161,7 @@ static int w_ds_is_from_list1(struct sip_msg*, char*, char*);
static int w_ds_is_from_list2(struct sip_msg*, char*, char*);
static int w_ds_is_from_list3(struct sip_msg*, char*, char*, char*);
static int w_ds_list_exist(struct sip_msg*, char*);
+static int w_ds_reload(struct sip_msg* msg);
static int fixup_ds_is_from_list(void** param, int param_no);
static int fixup_ds_list_exist(void** param,int param_no);
@@ -211,6 +212,8 @@ static cmd_export_t cmds[]={
0, 0, ANY_ROUTE},
{"bind_dispatcher", (cmd_function)bind_dispatcher, 0,
0, 0, 0},
+ {"ds_reload", (cmd_function)w_ds_reload, 0,
+ 0, 0, ANY_ROUTE},
{0,0,0,0,0,0}
};
@@ -822,6 +825,21 @@ static int ds_warn_fixup(void** param, int param_no)
return 0;
}
+static int w_ds_reload(struct sip_msg* msg)
+{
+ if(!ds_db_url.s) {
+ if (ds_load_list(dslistfile)!=0)
+ LM_ERR("Error reloading from list\n");
+ return -1;
+ } else {
+ if(ds_reload_db()<0)
+ LM_ERR("Error reloading from db\n");
+ return -1;
+ }
+ LM_DBG("reloaded dispatcher\n");
+ return 1;
+}
+
/************************** MI STUFF ************************/
static struct mi_root* ds_mi_set(struct mi_root* cmd_tree, void* param)
diff --git a/modules/dispatcher/doc/dispatcher.xml
b/modules/dispatcher/doc/dispatcher.xml
index 471ebbe..6e9212b 100644
--- a/modules/dispatcher/doc/dispatcher.xml
+++ b/modules/dispatcher/doc/dispatcher.xml
@@ -47,6 +47,13 @@
<email>alezzandro(a)gmail.com</email>
</address>
</editor>
+ <editor>
+ <firstname>Luis</firstname>
+ <surname>Martin</surname>
+ <address>
+ <email>martingil.luis(a)gmail.com</email>
+ </address>
+ </editor>
</authorgroup>
<copyright>
<year>2004</year>
diff --git a/modules/dispatcher/doc/dispatcher_admin.xml
b/modules/dispatcher/doc/dispatcher_admin.xml
index 8368bb7..c10b502 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -1350,6 +1350,21 @@ onreply_route {
</programlisting>
</example>
</section>
+ <section id="dispatcher.f.ds_reload">
+ <title>
+ <function moreinfo="none">ds_reload()</function>
+ </title>
+ <para>
+ Reloads the groups and included destinations.
+ </para>
+ <para>
+ Name: <emphasis>ds_reload</emphasis>
+ </para>
+ <para>Parameters: <emphasis>none</emphasis></para>
+ <para>
+ This function can be used from ANY_ROUTE.
+ </para>
+ </section>
</section>
<section>