Browse Source

Add db_queries_KAMAILIO_DBMS.cfg files, specify your DBMS in local.cfg otherwise it's "kazoo" from defs.cfg

KAZOO-5650
Daniel Finke 9 years ago
parent
commit
68f83a779a
5 changed files with 12 additions and 6 deletions
  1. +2
    -0
      kamailio/db_queries_kazoo.cfg
  2. +2
    -0
      kamailio/db_queries_mysql.cfg
  3. +4
    -0
      kamailio/defs.cfg
  4. +1
    -6
      kamailio/dispatcher-role.cfg
  5. +3
    -0
      kamailio/kamailio.cfg

+ 2
- 0
kamailio/db_queries_kazoo.cfg View File

@ -0,0 +1,2 @@
####### Database queries ########
#!substdef "!DISPATCHER_CHECK_MEDIA_SERVER_INSERT_QUERY!insert into dispatcher (setid, destination) select \$var(SetId), \"\$var(MediaUrl)\" where not exists(select * from dispatcher where destination = \"\$var(MediaUrl)\")!g"

+ 2
- 0
kamailio/db_queries_mysql.cfg View File

@ -0,0 +1,2 @@
####### Database queries ########
#!substdef "!DISPATCHER_CHECK_MEDIA_SERVER_INSERT_QUERY!insert into dispatcher (setid, destination) select \$var(SetId), \"\$var(MediaUrl)\" from DUAL where not exists(select * from dispatcher where destination = \"\$var(MediaUrl)\")!g"

+ 4
- 0
kamailio/defs.cfg View File

@ -7,6 +7,10 @@
#!define KAZOO_LOG_LEVEL L_INFO #!define KAZOO_LOG_LEVEL L_INFO
#!endif #!endif
#!ifndef KAMAILIO_DBMS
#!substdef "!KAMAILIO_DBMS!kazoo!g"
#!endif
#!ifndef KAZOO_DATA_DIR #!ifndef KAZOO_DATA_DIR
#!substdef "!KAZOO_DATA_DIR!/etc/kazoo/kamailio/db!g" #!substdef "!KAZOO_DATA_DIR!/etc/kazoo/kamailio/db!g"
#!endif #!endif


+ 1
- 6
kamailio/dispatcher-role.cfg View File

@ -221,12 +221,7 @@ route[DISPATCHER_CHECK_MEDIA_SERVER]
if($var(Zone) != "MY_AMQP_ZONE") { if($var(Zone) != "MY_AMQP_ZONE") {
$var(SetId) = 2; $var(SetId) = 2;
} }
if ("KAZOO_DB_URL" =~ "^mysql") {
sql_query("exec", "insert into dispatcher (setid, destination) select $var(SetId), \"$var(MediaUrl)\" from DUAL where not exists(select * from dispatcher where destination = \"$var(MediaUrl)\")");
}
else {
sql_query("exec", "insert into dispatcher (setid, destination) select $var(SetId), \"$var(MediaUrl)\" where not exists(select * from dispatcher where destination = \"$var(MediaUrl)\")");
}
sql_query("exec", "DISPATCHER_CHECK_MEDIA_SERVER_INSERT_QUERY");
if($sqlrows(exec) > 0) { if($sqlrows(exec) > 0) {
xlog("L_WARNING", "reloading dispatcher table\n"); xlog("L_WARNING", "reloading dispatcher table\n");
ds_reload(); ds_reload();


+ 3
- 0
kamailio/kamailio.cfg View File

@ -29,6 +29,9 @@ include_file "local.cfg"
####### defaults not configured in local ######## ####### defaults not configured in local ########
include_file "defs.cfg" include_file "defs.cfg"
####### DBMS query selection ########
include_file "db_queries_KAMAILIO_DBMS.cfg"
####### Default Configuration ###### ####### Default Configuration ######
include_file "default.cfg" include_file "default.cfg"


Loading…
Cancel
Save