Browse Source

allow optional dispatcher server add

KAZOO-5650
lazedo 9 years ago
parent
commit
c85d954316
2 changed files with 16 additions and 8 deletions
  1. +4
    -0
      kamailio/defs.cfg
  2. +12
    -8
      kamailio/dispatcher-role.cfg

+ 4
- 0
kamailio/defs.cfg View File

@ -55,4 +55,8 @@
#!substdef "!MY_AMQP_ZONE!local!g"
#!endif
#!ifndef DISPATCHER_ADD_SERVERS
#!define DISPATCHER_ADD_SERVERS 1
#!endif
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab

+ 12
- 8
kamailio/dispatcher-role.cfg View File

@ -1,6 +1,8 @@
######## Generic Hash Table container in shared memory ########
modparam("htable", "htable", "failover=>size=16;autoexpire=120")
kazoo.dispatcher_auto_add = DISPATCHER_ADD_SERVERS descr "adds media servers reported by ecallmgr"
####### Dispatcher module ########
loadmodule "dispatcher.so"
modparam("dispatcher", "db_url", "KAZOO_DB_URL")
@ -214,14 +216,16 @@ event_route[dispatcher:dst-up]
route[DISPATCHER_CHECK_MEDIA_SERVER]
{
$var(SetId) = 1;
if($var(Zone) != "MY_AMQP_ZONE") {
$var(SetId) = 2;
}
sql_query("exec", "insert into dispatcher (setid, destination) select $var(SetId), \"$var(MediaUrl)\" where not exists(select * from dispatcher where destination = \"$var(MediaUrl)\")");
if($sqlrows(exec) > 0) {
xlog("L_WARNING", "reloading dispatcher table\n");
ds_reload();
if(@cfg_get.kazoo.dispatcher_auto_add == 1) {
$var(SetId) = 1;
if($var(Zone) != "MY_AMQP_ZONE") {
$var(SetId) = 2;
}
sql_query("exec", "insert into dispatcher (setid, destination) select $var(SetId), \"$var(MediaUrl)\" where not exists(select * from dispatcher where destination = \"$var(MediaUrl)\")");
if($sqlrows(exec) > 0) {
xlog("L_WARNING", "reloading dispatcher table\n");
ds_reload();
}
}
}


Loading…
Cancel
Save