diff --git a/modules/dialplan/dialplan.c b/modules/dialplan/dialplan.c index d7c42e0bc4e..41e339f6ec8 100644 --- a/modules/dialplan/dialplan.c +++ b/modules/dialplan/dialplan.c @@ -61,7 +61,6 @@ static int mod_init(void); static int child_init(int rank); static void mod_destroy(); -static int mi_child_init(); static struct mi_root * mi_reload_rules(struct mi_root *cmd_tree,void *param); static struct mi_root * mi_translate(struct mi_root *cmd_tree, void *param); @@ -95,7 +94,7 @@ static param_export_t mod_params[]={ }; static mi_export_t mi_cmds[] = { - { "dp_reload", 0, mi_reload_rules, 0, 0, mi_child_init}, + { "dp_reload", 0, mi_reload_rules, 0, 0, 0}, { "dp_translate", 0, mi_translate, 0, 0, 0}, { "dp_show_partition", 0, mi_show_partition, 0, 0, 0}, { 0, 0, 0, 0, 0, 0} @@ -521,6 +520,22 @@ static int mod_init(void) static int child_init(int rank) { + dp_connection_list_p el; + + /* only process with rank 0 loads data */ + if (rank != 1) + return 0; + + /*Connect to DB s and get rules*/ + for(el = dp_conns; el; el = el->next){ + if (init_db_data(el) != 0) { + LM_ERR("Unable to init db data\n"); + shm_free(el); + return -1; + } + } + + return 0; } @@ -547,24 +562,6 @@ static void mod_destroy(void) } -static int mi_child_init(void) -{ - - dp_connection_list_p el; - - /*Connect to DB s and get rules*/ - for(el = dp_conns; el; el = el->next){ - if (init_db_data(el) != 0) { - LM_ERR("Unable to init db data\n"); - shm_free(el); - return -1; - } - } - - return 0; -} - - static int dp_get_ivalue(struct sip_msg* msg, dp_param_p dp, int *val) { pv_value_t value;