Преглед изворни кода

kamctl: regenerate db creation scripts

- lcr and dispatcher had new structure in xml
Daniel-Constantin Mierla пре 15 година
родитељ
комит
b7d7d1b082

+ 2 - 2
utils/kamctl/db_berkeley/kamailio/dispatcher

@@ -1,5 +1,5 @@
 METADATA_COLUMNS
-id(int) setid(int) destination(str) flags(int) priority(int) description(str)
+id(int) setid(int) destination(str) flags(int) priority(int) attrs(str) description(str)
 METADATA_KEY
 1 3 4 
 METADATA_READONLY
@@ -7,4 +7,4 @@ METADATA_READONLY
 METADATA_LOGFLAGS
 0
 METADATA_DEFAULTS
-NIL|0|''|0|0|''
+NIL|0|''|0|0|''|''

+ 1 - 11
utils/kamctl/db_berkeley/kamailio/version

@@ -31,7 +31,7 @@ dialog|4
 dialplan|
 dialplan|1
 dispatcher|
-dispatcher|3
+dispatcher|4
 domain|
 domain|1
 domain_name|
@@ -60,20 +60,12 @@ imc_rooms|
 imc_rooms|1
 METADATA_DEFAULTS
 NIL|NIL|NULL|NULL|NIL|NIL
-lcr_gw|
-lcr_gw|1
-lcr_rule|
-lcr_rule|1
-lcr_rule_target|
-lcr_rule_target|1
 location|
 location|1004
 matrix|
 matrix|1
 missed_calls|
 missed_calls|3
-mtree|
-mtree|1
 pdt|
 pdt|1
 presentity|
@@ -98,8 +90,6 @@ subscriber|
 subscriber|6
 trusted|
 trusted|5
-uacreg|
-uacreg|1
 uri|
 uri|1
 userblacklist|

+ 1 - 1
utils/kamctl/dbtext/kamailio/dispatcher

@@ -1 +1 @@
-id(int,auto) setid(int) destination(string) flags(int) priority(int) description(string) 
+id(int,auto) setid(int) destination(string) flags(int) priority(int) attrs(string) description(string) 

+ 1 - 6
utils/kamctl/dbtext/kamailio/version

@@ -10,7 +10,7 @@ cpl:1
 dbaliases:1
 dialog:4
 dialplan:1
-dispatcher:3
+dispatcher:4
 domain:1
 domain_name:1
 domainpolicy:2
@@ -25,13 +25,9 @@ htable:1
 imc_members:1
 imc_rooms:1
 id(int,auto) lcr_id(int) prefix(string,null) from_uri(string,null) grp_id(int) priority(int) 
-lcr_gw:1
-lcr_rule:1
-lcr_rule_target:1
 location:1004
 matrix:1
 missed_calls:3
-mtree:1
 pdt:1
 presentity:3
 pua:6
@@ -44,7 +40,6 @@ sip_trace:2
 speed_dial:2
 subscriber:6
 trusted:5
-uacreg:1
 uri:1
 userblacklist:1
 usr_preferences:2

+ 2 - 1
utils/kamctl/mysql/dispatcher-create.sql

@@ -1,10 +1,11 @@
-INSERT INTO version (table_name, table_version) values ('dispatcher','3');
+INSERT INTO version (table_name, table_version) values ('dispatcher','4');
 CREATE TABLE dispatcher (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
     setid INT DEFAULT 0 NOT NULL,
     destination VARCHAR(192) DEFAULT '' NOT NULL,
     flags INT DEFAULT 0 NOT NULL,
     priority INT DEFAULT 0 NOT NULL,
+    attrs VARCHAR(128) DEFAULT '' NOT NULL,
     description VARCHAR(64) DEFAULT '' NOT NULL
 ) ENGINE=MyISAM;
 

+ 24 - 14
utils/kamctl/mysql/lcr-create.sql

@@ -1,32 +1,42 @@
-INSERT INTO version (table_name, table_version) values ('gw','10');
-CREATE TABLE gw (
+INSERT INTO version (table_name, table_version) values ('lcr_gw','1');
+CREATE TABLE lcr_gw (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
     lcr_id SMALLINT UNSIGNED NOT NULL,
-    gw_name VARCHAR(128) NOT NULL,
-    grp_id INT UNSIGNED NOT NULL,
-    ip_addr VARCHAR(15) NOT NULL,
+    gw_name VARCHAR(128),
+    ip_addr VARCHAR(15),
     hostname VARCHAR(64),
     port SMALLINT UNSIGNED,
+    params VARCHAR(64),
     uri_scheme TINYINT UNSIGNED,
     transport TINYINT UNSIGNED,
     strip TINYINT UNSIGNED,
     tag VARCHAR(16) DEFAULT NULL,
-    weight INT UNSIGNED,
     flags INT UNSIGNED DEFAULT 0 NOT NULL,
     defunct INT UNSIGNED DEFAULT NULL,
-    CONSTRAINT lcr_id_grp_id_gw_name_idx UNIQUE (lcr_id, grp_id, gw_name),
-    CONSTRAINT lcr_id_grp_id_ip_addr_idx UNIQUE (lcr_id, grp_id, ip_addr)
+    CONSTRAINT lcr_id_ip_addr_port_hostname_idx UNIQUE (lcr_id, ip_addr, port, hostname)
 ) ENGINE=MyISAM;
 
-INSERT INTO version (table_name, table_version) values ('lcr','3');
-CREATE TABLE lcr (
+INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1');
+CREATE TABLE lcr_rule_target (
+    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+    lcr_id SMALLINT UNSIGNED NOT NULL,
+    rule_id INT UNSIGNED NOT NULL,
+    gw_id INT UNSIGNED NOT NULL,
+    priority TINYINT UNSIGNED NOT NULL,
+    weight INT UNSIGNED DEFAULT 1 NOT NULL,
+    CONSTRAINT rule_id_gw_id_idx UNIQUE (rule_id, gw_id)
+) ENGINE=MyISAM;
+
+CREATE INDEX lcr_id_idx ON lcr_rule_target (lcr_id);
+
+INSERT INTO version (table_name, table_version) values ('lcr_rule','1');
+CREATE TABLE lcr_rule (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
     lcr_id SMALLINT UNSIGNED NOT NULL,
     prefix VARCHAR(16) DEFAULT NULL,
     from_uri VARCHAR(64) DEFAULT NULL,
-    grp_id INT UNSIGNED NOT NULL,
-    priority TINYINT UNSIGNED NOT NULL
+    stopper INT UNSIGNED DEFAULT 0 NOT NULL,
+    enabled INT UNSIGNED DEFAULT 1 NOT NULL,
+    CONSTRAINT lcr_id_prefix_from_uri_idx UNIQUE (lcr_id, prefix, from_uri)
 ) ENGINE=MyISAM;
 
-CREATE INDEX lcr_id_idx ON lcr (lcr_id);
-

+ 2 - 1
utils/kamctl/oracle/dispatcher-create.sql

@@ -1,10 +1,11 @@
-INSERT INTO version (table_name, table_version) values ('dispatcher','3');
+INSERT INTO version (table_name, table_version) values ('dispatcher','4');
 CREATE TABLE dispatcher (
     id NUMBER(10) PRIMARY KEY,
     setid NUMBER(10) DEFAULT 0 NOT NULL,
     destination VARCHAR2(192) DEFAULT '',
     flags NUMBER(10) DEFAULT 0 NOT NULL,
     priority NUMBER(10) DEFAULT 0 NOT NULL,
+    attrs VARCHAR2(128) DEFAULT '',
     description VARCHAR2(64) DEFAULT ''
 );
 

+ 38 - 20
utils/kamctl/oracle/lcr-create.sql

@@ -1,48 +1,66 @@
-INSERT INTO version (table_name, table_version) values ('gw','10');
-CREATE TABLE gw (
+INSERT INTO version (table_name, table_version) values ('lcr_gw','1');
+CREATE TABLE lcr_gw (
     id NUMBER(10) PRIMARY KEY,
     lcr_id NUMBER(5),
     gw_name VARCHAR2(128),
-    grp_id NUMBER(10),
     ip_addr VARCHAR2(15),
     hostname VARCHAR2(64),
     port NUMBER(5),
+    params VARCHAR2(64),
     uri_scheme NUMBER(5),
     transport NUMBER(5),
     strip NUMBER(5),
     tag VARCHAR2(16) DEFAULT NULL,
-    weight NUMBER(10),
     flags NUMBER(10) DEFAULT 0 NOT NULL,
     defunct NUMBER(10) DEFAULT NULL,
-    CONSTRAINT gw_lcr_id_grp_id_gw_name_idx  UNIQUE (lcr_id, grp_id, gw_name),
-    CONSTRAINT gw_lcr_id_grp_id_ip_addr_idx  UNIQUE (lcr_id, grp_id, ip_addr)
+    CONSTRAINT ORA_lcr_id_ip_addr_port_hostname_idx  UNIQUE (lcr_id, ip_addr, port, hostname)
 );
 
-CREATE OR REPLACE TRIGGER gw_tr
-before insert on gw FOR EACH ROW
+CREATE OR REPLACE TRIGGER lcr_gw_tr
+before insert on lcr_gw FOR EACH ROW
 BEGIN
   auto_id(:NEW.id);
-END gw_tr;
+END lcr_gw_tr;
 /
-BEGIN map2users('gw'); END;
+BEGIN map2users('lcr_gw'); END;
 /
-INSERT INTO version (table_name, table_version) values ('lcr','3');
-CREATE TABLE lcr (
+INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1');
+CREATE TABLE lcr_rule_target (
+    id NUMBER(10) PRIMARY KEY,
+    lcr_id NUMBER(5),
+    rule_id NUMBER(10),
+    gw_id NUMBER(10),
+    priority NUMBER(5),
+    weight NUMBER(10) DEFAULT 1 NOT NULL,
+    CONSTRAINT ORA_rule_id_gw_id_idx  UNIQUE (rule_id, gw_id)
+);
+
+CREATE OR REPLACE TRIGGER lcr_rule_target_tr
+before insert on lcr_rule_target FOR EACH ROW
+BEGIN
+  auto_id(:NEW.id);
+END lcr_rule_target_tr;
+/
+BEGIN map2users('lcr_rule_target'); END;
+/
+CREATE INDEX lcr_rule_target_lcr_id_idx  ON lcr_rule_target (lcr_id);
+
+INSERT INTO version (table_name, table_version) values ('lcr_rule','1');
+CREATE TABLE lcr_rule (
     id NUMBER(10) PRIMARY KEY,
     lcr_id NUMBER(5),
     prefix VARCHAR2(16) DEFAULT NULL,
     from_uri VARCHAR2(64) DEFAULT NULL,
-    grp_id NUMBER(10),
-    priority NUMBER(5)
+    stopper NUMBER(10) DEFAULT 0 NOT NULL,
+    enabled NUMBER(10) DEFAULT 1 NOT NULL,
+    CONSTRAINT ORA_lcr_id_prefix_from_uri_idx  UNIQUE (lcr_id, prefix, from_uri)
 );
 
-CREATE OR REPLACE TRIGGER lcr_tr
-before insert on lcr FOR EACH ROW
+CREATE OR REPLACE TRIGGER lcr_rule_tr
+before insert on lcr_rule FOR EACH ROW
 BEGIN
   auto_id(:NEW.id);
-END lcr_tr;
+END lcr_rule_tr;
 /
-BEGIN map2users('lcr'); END;
+BEGIN map2users('lcr_rule'); END;
 /
-CREATE INDEX lcr_lcr_id_idx  ON lcr (lcr_id);
-

+ 2 - 1
utils/kamctl/postgres/dispatcher-create.sql

@@ -1,10 +1,11 @@
-INSERT INTO version (table_name, table_version) values ('dispatcher','3');
+INSERT INTO version (table_name, table_version) values ('dispatcher','4');
 CREATE TABLE dispatcher (
     id SERIAL PRIMARY KEY NOT NULL,
     setid INTEGER DEFAULT 0 NOT NULL,
     destination VARCHAR(192) DEFAULT '' NOT NULL,
     flags INTEGER DEFAULT 0 NOT NULL,
     priority INTEGER DEFAULT 0 NOT NULL,
+    attrs VARCHAR(128) DEFAULT '' NOT NULL,
     description VARCHAR(64) DEFAULT '' NOT NULL
 );
 

+ 24 - 14
utils/kamctl/postgres/lcr-create.sql

@@ -1,32 +1,42 @@
-INSERT INTO version (table_name, table_version) values ('gw','10');
-CREATE TABLE gw (
+INSERT INTO version (table_name, table_version) values ('lcr_gw','1');
+CREATE TABLE lcr_gw (
     id SERIAL PRIMARY KEY NOT NULL,
     lcr_id SMALLINT NOT NULL,
-    gw_name VARCHAR(128) NOT NULL,
-    grp_id INTEGER NOT NULL,
-    ip_addr VARCHAR(15) NOT NULL,
+    gw_name VARCHAR(128),
+    ip_addr VARCHAR(15),
     hostname VARCHAR(64),
     port SMALLINT,
+    params VARCHAR(64),
     uri_scheme SMALLINT,
     transport SMALLINT,
     strip SMALLINT,
     tag VARCHAR(16) DEFAULT NULL,
-    weight INTEGER,
     flags INTEGER DEFAULT 0 NOT NULL,
     defunct INTEGER DEFAULT NULL,
-    CONSTRAINT gw_lcr_id_grp_id_gw_name_idx UNIQUE (lcr_id, grp_id, gw_name),
-    CONSTRAINT gw_lcr_id_grp_id_ip_addr_idx UNIQUE (lcr_id, grp_id, ip_addr)
+    CONSTRAINT lcr_gw_lcr_id_ip_addr_port_hostname_idx UNIQUE (lcr_id, ip_addr, port, hostname)
 );
 
-INSERT INTO version (table_name, table_version) values ('lcr','3');
-CREATE TABLE lcr (
+INSERT INTO version (table_name, table_version) values ('lcr_rule_target','1');
+CREATE TABLE lcr_rule_target (
+    id SERIAL PRIMARY KEY NOT NULL,
+    lcr_id SMALLINT NOT NULL,
+    rule_id INTEGER NOT NULL,
+    gw_id INTEGER NOT NULL,
+    priority SMALLINT NOT NULL,
+    weight INTEGER DEFAULT 1 NOT NULL,
+    CONSTRAINT lcr_rule_target_rule_id_gw_id_idx UNIQUE (rule_id, gw_id)
+);
+
+CREATE INDEX lcr_rule_target_lcr_id_idx ON lcr_rule_target (lcr_id);
+
+INSERT INTO version (table_name, table_version) values ('lcr_rule','1');
+CREATE TABLE lcr_rule (
     id SERIAL PRIMARY KEY NOT NULL,
     lcr_id SMALLINT NOT NULL,
     prefix VARCHAR(16) DEFAULT NULL,
     from_uri VARCHAR(64) DEFAULT NULL,
-    grp_id INTEGER NOT NULL,
-    priority SMALLINT NOT NULL
+    stopper INTEGER DEFAULT 0 NOT NULL,
+    enabled INTEGER DEFAULT 1 NOT NULL,
+    CONSTRAINT lcr_rule_lcr_id_prefix_from_uri_idx UNIQUE (lcr_id, prefix, from_uri)
 );
 
-CREATE INDEX lcr_lcr_id_idx ON lcr (lcr_id);
-