[sr-dev] git:master:7cf474fd: dispatcher: added ds_reload

Luis Martin Gil martingil.luis at gmail.com
Tue Jun 14 15:02:55 CEST 2016


Module: kamailio
Branch: master
Commit: 7cf474fdac56db2fcba80a45d99422bcc32c4c0a
URL: https://github.com/kamailio/kamailio/commit/7cf474fdac56db2fcba80a45d99422bcc32c4c0a

Author: Luis Martin Gil <martingil.luis at gmail.com>
Committer: Luis Martin Gil <martingil.luis at gmail.com>
Date: 2016-06-09T13:08:43+02:00

	dispatcher: added ds_reload

---

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/7cf474fdac56db2fcba80a45d99422bcc32c4c0a.diff
Patch: https://github.com/kamailio/kamailio/commit/7cf474fdac56db2fcba80a45d99422bcc32c4c0a.patch

---

diff --git a/modules/dispatcher/dispatcher.c b/modules/dispatcher/dispatcher.c
index 5220fdb..cc5ca26 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,20 @@ 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;
+	}
+	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 at gmail.com</email>
                 </address>
             </editor>
+            <editor>
+                <firstname>Luis</firstname>
+                <surname>Martin</surname>
+                <address>
+                <email>martingil.luis at 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..dc4dd9c 100644
--- a/modules/dispatcher/doc/dispatcher_admin.xml
+++ b/modules/dispatcher/doc/dispatcher_admin.xml
@@ -1350,6 +1350,20 @@ onreply_route {
 </programlisting>
 		</example>
  	</section>
+	<section id="dispatcher.f.reload">
+		<title>
+		<function moreinfo="none">ds_reload()</function>
+		</title>
+		<para>
+		Reloads the groups and included destinations. The command is
+		disabled for call load based dispatching (algorithm 10) since
+		removal of destinations may leave the list of active
+		calls with broken references.
+		</para>
+		<para>
+		Name: <emphasis>ds_reload</emphasis>
+		</para>
+		<para>Parameters: <emphasis>none</emphasis></para>
 	</section>
 
 	<section>




More information about the sr-dev mailing list