Sfoglia il codice sorgente

lib/srdb1: extended definitions for location and aliases tables

- new columns ruid and instance to deal with GRUU RFC5627
Daniel-Constantin Mierla 13 anni fa
parent
commit
26b75ccd46

+ 19 - 2
lib/srdb1/schema/aliases.xml

@@ -9,7 +9,7 @@
 
 <table id="aliases" xmlns:db="http://docbook.org/ns/docbook">
     <name>aliases</name>
-    <version>1004</version>
+    <version>5</version>
     <type db="mysql">&MYSQL_TABLE_TYPE;</type>
     <description>
         <db:para>This table for the registrar module is similar to the "location" table, (the aliases index makes lookup of missed calls much faster). Thus, the function lookup("alias") can be used to map aliases to AORs. More information is available at: &KAMAILIO_MOD_DOC;registrar.html. Most people uses the dbaliases table with the alias_db module now.
@@ -26,6 +26,15 @@
         <description>unique ID</description>
     </column>
 
+    <column id="ruid">
+        <name>ruid</name>
+        <type>string</type>
+        <size>64</size>
+        <default/>
+        <description>Record internal unique id</description>
+        <natural/>
+    </column>
+
     <column id="username">
         <name>&USERCOL;</name>
         <type>string</type>
@@ -153,7 +162,15 @@
         <description>Flags that indicate the SIP Methods this contact will accept.</description>
     </column>
 
-    <index>
+	<column id="instance">
+        <name>instance</name>
+        <type>string</type>
+        <size>&hf_len;</size>
+        <default/>
+        <description>The value of SIP instance parameter for GRUU.</description>
+    </column>
+
+	<index>
         <name>alias_idx</name>
         <colref linkend="username"/>
         <colref linkend="domain"/>

+ 20 - 2
lib/srdb1/schema/location.xml

@@ -9,7 +9,7 @@
 
 <table id="location" xmlns:db="http://docbook.org/ns/docbook">
     <name>location</name>
-    <version>1004</version>
+    <version>5</version>
     <type db="mysql">&MYSQL_TABLE_TYPE;</type>
     <description>
         <db:para>Persistent user location information for the usrloc module. More information can be found at: &KAMAILIO_MOD_DOC;usrloc.html
@@ -26,7 +26,16 @@
         <description>unique ID</description>
     </column>
 
-    <column id="username">
+    <column id="ruid">
+        <name>ruid</name>
+        <type>string</type>
+        <size>64</size>
+        <default/>
+        <description>Record internal unique id</description>
+        <natural/>
+    </column>
+
+	<column id="username">
         <name>&USERCOL;</name>
         <type>string</type>
         <size>&user_len;</size>
@@ -153,6 +162,15 @@
         <description>Flags that indicate the SIP Methods this contact will accept.</description>
     </column>
 
+	<column id="instance">
+        <name>instance</name>
+        <type>string</type>
+        <size>&hf_len;</size>
+        <default/>
+        <description>The value of SIP instance parameter for GRUU.</description>
+    </column>
+
+
     <index>
         <name>account_contact_idx</name>
         <colref linkend="username"/>

+ 3 - 3
utils/kamctl/db_berkeley/kamailio/aliases

@@ -1,10 +1,10 @@
 METADATA_COLUMNS
-id(int) username(str) domain(str) contact(str) received(str) path(str) expires(datetime) q(double) callid(str) cseq(int) last_modified(datetime) flags(int) cflags(int) user_agent(str) socket(str) methods(int)
+id(int) ruid(str) username(str) domain(str) contact(str) received(str) path(str) expires(datetime) q(double) callid(str) cseq(int) last_modified(datetime) flags(int) cflags(int) user_agent(str) socket(str) methods(int) instance(str)
 METADATA_KEY
-1 2 
+1 2 3 
 METADATA_READONLY
 0
 METADATA_LOGFLAGS
 0
 METADATA_DEFAULTS
-NIL|''|NULL|''|NULL|NULL|'2020-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'1900-01-01 00:00:01'|0|0|''|NULL|NULL
+NIL|''|''|NULL|''|NULL|NULL|'2020-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'1900-01-01 00:00:01'|0|0|''|NULL|NULL|''

+ 3 - 3
utils/kamctl/db_berkeley/kamailio/domain

@@ -1,10 +1,10 @@
 METADATA_COLUMNS
-id(int) domain(str) last_modified(datetime)
+id(int) domain(str) did(str) last_modified(datetime)
 METADATA_KEY
-1 
+
 METADATA_READONLY
 0
 METADATA_LOGFLAGS
 0
 METADATA_DEFAULTS
-NIL|''|'1900-01-01 00:00:01'
+NIL|NIL|NULL|'1900-01-01 00:00:01'

+ 10 - 0
utils/kamctl/db_berkeley/kamailio/domain_attrs

@@ -0,0 +1,10 @@
+METADATA_COLUMNS
+id(int) did(str) name(str) type(int) value(str) last_modified(datetime)
+METADATA_KEY
+
+METADATA_READONLY
+0
+METADATA_LOGFLAGS
+0
+METADATA_DEFAULTS
+NIL|NIL|NIL|NIL|NIL|'1900-01-01 00:00:01'

+ 3 - 3
utils/kamctl/db_berkeley/kamailio/location

@@ -1,10 +1,10 @@
 METADATA_COLUMNS
-id(int) username(str) domain(str) contact(str) received(str) path(str) expires(datetime) q(double) callid(str) cseq(int) last_modified(datetime) flags(int) cflags(int) user_agent(str) socket(str) methods(int)
+id(int) ruid(str) username(str) domain(str) contact(str) received(str) path(str) expires(datetime) q(double) callid(str) cseq(int) last_modified(datetime) flags(int) cflags(int) user_agent(str) socket(str) methods(int) instance(str)
 METADATA_KEY
-1 2 
+1 2 3 
 METADATA_READONLY
 0
 METADATA_LOGFLAGS
 0
 METADATA_DEFAULTS
-NIL|''|NULL|''|NULL|NULL|'2020-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'1900-01-01 00:00:01'|0|0|''|NULL|NULL
+NIL|''|''|NULL|''|NULL|NULL|'2020-05-28 21:32:15'|1.0|'Default-Call-ID'|1|'1900-01-01 00:00:01'|0|0|''|NULL|NULL|''

+ 5 - 3
utils/kamctl/db_berkeley/kamailio/version

@@ -15,7 +15,7 @@ active_watchers|9
 address|
 address|5
 aliases|
-aliases|1004
+aliases|5
 carrier_name|
 carrier_name|1
 carrierfailureroute|
@@ -35,7 +35,9 @@ dialplan|1
 dispatcher|
 dispatcher|4
 domain|
-domain|1
+domain|2
+domain_attrs|
+domain_attrs|1
 domain_name|
 domain_name|1
 domainpolicy|
@@ -65,7 +67,7 @@ lcr_rule|1
 lcr_rule_target|
 lcr_rule_target|1
 location|
-location|1004
+location|5
 matrix|
 matrix|1
 missed_calls|

+ 14 - 2
utils/kamctl/db_sqlite/domain-create.sql

@@ -1,8 +1,20 @@
-INSERT INTO version (table_name, table_version) values ('domain','1');
+INSERT INTO version (table_name, table_version) values ('domain','2');
 CREATE TABLE domain (
     id INTEGER PRIMARY KEY NOT NULL,
-    domain VARCHAR(64) DEFAULT '' NOT NULL,
+    domain VARCHAR(64) NOT NULL,
+    did VARCHAR(64) DEFAULT NULL,
     last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
     CONSTRAINT domain_domain_idx UNIQUE (domain)
 );
 
+INSERT INTO version (table_name, table_version) values ('domain_attrs','1');
+CREATE TABLE domain_attrs (
+    id INTEGER PRIMARY KEY NOT NULL,
+    did VARCHAR(64) NOT NULL,
+    name VARCHAR(32) NOT NULL,
+    type INTEGER NOT NULL,
+    value VARCHAR(255) NOT NULL,
+    last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
+    CONSTRAINT domain_attrs_domain_attrs_idx UNIQUE (did, name, value)
+);
+

+ 4 - 2
utils/kamctl/db_sqlite/registrar-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('aliases','1004');
+INSERT INTO version (table_name, table_version) values ('aliases','5');
 CREATE TABLE aliases (
     id INTEGER PRIMARY KEY NOT NULL,
+    ruid VARCHAR(64) DEFAULT '' NOT NULL,
     username VARCHAR(64) DEFAULT '' NOT NULL,
     domain VARCHAR(64) DEFAULT NULL,
     contact VARCHAR(255) DEFAULT '' NOT NULL,
@@ -15,7 +16,8 @@ CREATE TABLE aliases (
     cflags INTEGER DEFAULT 0 NOT NULL,
     user_agent VARCHAR(255) DEFAULT '' NOT NULL,
     socket VARCHAR(64) DEFAULT NULL,
-    methods INTEGER DEFAULT NULL
+    methods INTEGER DEFAULT NULL,
+    instance VARCHAR(255) DEFAULT '' NOT NULL
 );
 
 CREATE INDEX aliases_alias_idx ON aliases (username, domain, contact);

+ 4 - 2
utils/kamctl/db_sqlite/usrloc-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('location','1004');
+INSERT INTO version (table_name, table_version) values ('location','5');
 CREATE TABLE location (
     id INTEGER PRIMARY KEY NOT NULL,
+    ruid VARCHAR(64) DEFAULT '' NOT NULL,
     username VARCHAR(64) DEFAULT '' NOT NULL,
     domain VARCHAR(64) DEFAULT NULL,
     contact VARCHAR(255) DEFAULT '' NOT NULL,
@@ -15,7 +16,8 @@ CREATE TABLE location (
     cflags INTEGER DEFAULT 0 NOT NULL,
     user_agent VARCHAR(255) DEFAULT '' NOT NULL,
     socket VARCHAR(64) DEFAULT NULL,
-    methods INTEGER DEFAULT NULL
+    methods INTEGER DEFAULT NULL,
+    instance VARCHAR(255) DEFAULT '' NOT NULL
 );
 
 CREATE INDEX location_account_contact_idx ON location (username, domain, contact);

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

@@ -1 +1 @@
-id(int,auto) username(string) domain(string,null) contact(string) received(string,null) path(string,null) expires(int) q(double) callid(string) cseq(int) last_modified(int) flags(int) cflags(int) user_agent(string) socket(string,null) methods(int,null) 
+id(int,auto) ruid(string) username(string) domain(string,null) contact(string) received(string,null) path(string,null) expires(int) q(double) callid(string) cseq(int) last_modified(int) flags(int) cflags(int) user_agent(string) socket(string,null) methods(int,null) instance(string) 

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

@@ -1 +1 @@
-id(int,auto) domain(string) last_modified(int) 
+id(int,auto) domain(string) did(string,null) last_modified(int) 

+ 1 - 0
utils/kamctl/dbtext/kamailio/domain_attrs

@@ -0,0 +1 @@
+id(int,auto) did(string) name(string) type(int) value(string) last_modified(int) 

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

@@ -1 +1 @@
-id(int,auto) username(string) domain(string,null) contact(string) received(string,null) path(string,null) expires(int) q(double) callid(string) cseq(int) last_modified(int) flags(int) cflags(int) user_agent(string) socket(string,null) methods(int,null) 
+id(int,auto) ruid(string) username(string) domain(string,null) contact(string) received(string,null) path(string,null) expires(int) q(double) callid(string) cseq(int) last_modified(int) flags(int) cflags(int) user_agent(string) socket(string,null) methods(int,null) instance(string) 

+ 4 - 3
utils/kamctl/dbtext/kamailio/version

@@ -2,7 +2,7 @@ table_name(string) table_version(int)
 acc:4
 active_watchers:9
 address:5
-aliases:1004
+aliases:5
 carrier_name:1
 carrierfailureroute:2
 carrierroute:3
@@ -12,7 +12,8 @@ dialog:7
 dialog_vars:1
 dialplan:1
 dispatcher:4
-domain:1
+domain:2
+domain_attrs:1
 domain_name:1
 domainpolicy:2
 dr_gateways:3
@@ -27,7 +28,7 @@ imc_rooms:1
 lcr_gw:2
 lcr_rule:1
 lcr_rule_target:1
-location:1004
+location:5
 matrix:1
 missed_calls:3
 mtree:1

+ 14 - 2
utils/kamctl/mysql/domain-create.sql

@@ -1,8 +1,20 @@
-INSERT INTO version (table_name, table_version) values ('domain','1');
+INSERT INTO version (table_name, table_version) values ('domain','2');
 CREATE TABLE domain (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
-    domain VARCHAR(64) DEFAULT '' NOT NULL,
+    domain VARCHAR(64) NOT NULL,
+    did VARCHAR(64) DEFAULT NULL,
     last_modified DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL,
     CONSTRAINT domain_idx UNIQUE (domain)
 ) ENGINE=MyISAM;
 
+INSERT INTO version (table_name, table_version) values ('domain_attrs','1');
+CREATE TABLE domain_attrs (
+    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+    did VARCHAR(64) NOT NULL,
+    name VARCHAR(32) NOT NULL,
+    type INT UNSIGNED NOT NULL,
+    value VARCHAR(255) NOT NULL,
+    last_modified DATETIME DEFAULT '1900-01-01 00:00:01' NOT NULL,
+    CONSTRAINT domain_attrs_idx UNIQUE (did, name, value)
+) ENGINE=MyISAM;
+

+ 4 - 2
utils/kamctl/mysql/registrar-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('aliases','1004');
+INSERT INTO version (table_name, table_version) values ('aliases','5');
 CREATE TABLE aliases (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+    ruid VARCHAR(64) DEFAULT '' NOT NULL,
     username VARCHAR(64) DEFAULT '' NOT NULL,
     domain VARCHAR(64) DEFAULT NULL,
     contact VARCHAR(255) DEFAULT '' NOT NULL,
@@ -15,7 +16,8 @@ CREATE TABLE aliases (
     cflags INT(11) DEFAULT 0 NOT NULL,
     user_agent VARCHAR(255) DEFAULT '' NOT NULL,
     socket VARCHAR(64) DEFAULT NULL,
-    methods INT(11) DEFAULT NULL
+    methods INT(11) DEFAULT NULL,
+    instance VARCHAR(255) DEFAULT '' NOT NULL
 ) ENGINE=MyISAM;
 
 CREATE INDEX alias_idx ON aliases (username, domain, contact);

+ 4 - 2
utils/kamctl/mysql/usrloc-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('location','1004');
+INSERT INTO version (table_name, table_version) values ('location','5');
 CREATE TABLE location (
     id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+    ruid VARCHAR(64) DEFAULT '' NOT NULL,
     username VARCHAR(64) DEFAULT '' NOT NULL,
     domain VARCHAR(64) DEFAULT NULL,
     contact VARCHAR(255) DEFAULT '' NOT NULL,
@@ -15,7 +16,8 @@ CREATE TABLE location (
     cflags INT(11) DEFAULT 0 NOT NULL,
     user_agent VARCHAR(255) DEFAULT '' NOT NULL,
     socket VARCHAR(64) DEFAULT NULL,
-    methods INT(11) DEFAULT NULL
+    methods INT(11) DEFAULT NULL,
+    instance VARCHAR(255) DEFAULT '' NOT NULL
 ) ENGINE=MyISAM;
 
 CREATE INDEX account_contact_idx ON location (username, domain, contact);

+ 22 - 2
utils/kamctl/oracle/domain-create.sql

@@ -1,7 +1,8 @@
-INSERT INTO version (table_name, table_version) values ('domain','1');
+INSERT INTO version (table_name, table_version) values ('domain','2');
 CREATE TABLE domain (
     id NUMBER(10) PRIMARY KEY,
-    domain VARCHAR2(64) DEFAULT '',
+    domain VARCHAR2(64),
+    did VARCHAR2(64) DEFAULT NULL,
     last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
     CONSTRAINT domain_domain_idx  UNIQUE (domain)
 );
@@ -14,3 +15,22 @@ END domain_tr;
 /
 BEGIN map2users('domain'); END;
 /
+INSERT INTO version (table_name, table_version) values ('domain_attrs','1');
+CREATE TABLE domain_attrs (
+    id NUMBER(10) PRIMARY KEY,
+    did VARCHAR2(64),
+    name VARCHAR2(32),
+    type NUMBER(10),
+    value VARCHAR2(255),
+    last_modified DATE DEFAULT to_date('1900-01-01 00:00:01','yyyy-mm-dd hh24:mi:ss'),
+    CONSTRAINT domain_attrs_domain_attrs_idx  UNIQUE (did, name, value)
+);
+
+CREATE OR REPLACE TRIGGER domain_attrs_tr
+before insert on domain_attrs FOR EACH ROW
+BEGIN
+  auto_id(:NEW.id);
+END domain_attrs_tr;
+/
+BEGIN map2users('domain_attrs'); END;
+/

+ 4 - 2
utils/kamctl/oracle/registrar-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('aliases','1004');
+INSERT INTO version (table_name, table_version) values ('aliases','5');
 CREATE TABLE aliases (
     id NUMBER(10) PRIMARY KEY,
+    ruid VARCHAR2(64) DEFAULT '',
     username VARCHAR2(64) DEFAULT '',
     domain VARCHAR2(64) DEFAULT NULL,
     contact VARCHAR2(255) DEFAULT '',
@@ -15,7 +16,8 @@ CREATE TABLE aliases (
     cflags NUMBER(10) DEFAULT 0 NOT NULL,
     user_agent VARCHAR2(255) DEFAULT '',
     socket VARCHAR2(64) DEFAULT NULL,
-    methods NUMBER(10) DEFAULT NULL
+    methods NUMBER(10) DEFAULT NULL,
+    instance VARCHAR2(255) DEFAULT ''
 );
 
 CREATE OR REPLACE TRIGGER aliases_tr

+ 4 - 2
utils/kamctl/oracle/usrloc-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('location','1004');
+INSERT INTO version (table_name, table_version) values ('location','5');
 CREATE TABLE location (
     id NUMBER(10) PRIMARY KEY,
+    ruid VARCHAR2(64) DEFAULT '',
     username VARCHAR2(64) DEFAULT '',
     domain VARCHAR2(64) DEFAULT NULL,
     contact VARCHAR2(255) DEFAULT '',
@@ -15,7 +16,8 @@ CREATE TABLE location (
     cflags NUMBER(10) DEFAULT 0 NOT NULL,
     user_agent VARCHAR2(255) DEFAULT '',
     socket VARCHAR2(64) DEFAULT NULL,
-    methods NUMBER(10) DEFAULT NULL
+    methods NUMBER(10) DEFAULT NULL,
+    instance VARCHAR2(255) DEFAULT ''
 );
 
 CREATE OR REPLACE TRIGGER location_tr

+ 14 - 2
utils/kamctl/postgres/domain-create.sql

@@ -1,8 +1,20 @@
-INSERT INTO version (table_name, table_version) values ('domain','1');
+INSERT INTO version (table_name, table_version) values ('domain','2');
 CREATE TABLE domain (
     id SERIAL PRIMARY KEY NOT NULL,
-    domain VARCHAR(64) DEFAULT '' NOT NULL,
+    domain VARCHAR(64) NOT NULL,
+    did VARCHAR(64) DEFAULT NULL,
     last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
     CONSTRAINT domain_domain_idx UNIQUE (domain)
 );
 
+INSERT INTO version (table_name, table_version) values ('domain_attrs','1');
+CREATE TABLE domain_attrs (
+    id SERIAL PRIMARY KEY NOT NULL,
+    did VARCHAR(64) NOT NULL,
+    name VARCHAR(32) NOT NULL,
+    type INTEGER NOT NULL,
+    value VARCHAR(255) NOT NULL,
+    last_modified TIMESTAMP WITHOUT TIME ZONE DEFAULT '1900-01-01 00:00:01' NOT NULL,
+    CONSTRAINT domain_attrs_domain_attrs_idx UNIQUE (did, name, value)
+);
+

+ 4 - 2
utils/kamctl/postgres/registrar-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('aliases','1004');
+INSERT INTO version (table_name, table_version) values ('aliases','5');
 CREATE TABLE aliases (
     id SERIAL PRIMARY KEY NOT NULL,
+    ruid VARCHAR(64) DEFAULT '' NOT NULL,
     username VARCHAR(64) DEFAULT '' NOT NULL,
     domain VARCHAR(64) DEFAULT NULL,
     contact VARCHAR(255) DEFAULT '' NOT NULL,
@@ -15,7 +16,8 @@ CREATE TABLE aliases (
     cflags INTEGER DEFAULT 0 NOT NULL,
     user_agent VARCHAR(255) DEFAULT '' NOT NULL,
     socket VARCHAR(64) DEFAULT NULL,
-    methods INTEGER DEFAULT NULL
+    methods INTEGER DEFAULT NULL,
+    instance VARCHAR(255) DEFAULT '' NOT NULL
 );
 
 CREATE INDEX aliases_alias_idx ON aliases (username, domain, contact);

+ 4 - 2
utils/kamctl/postgres/usrloc-create.sql

@@ -1,6 +1,7 @@
-INSERT INTO version (table_name, table_version) values ('location','1004');
+INSERT INTO version (table_name, table_version) values ('location','5');
 CREATE TABLE location (
     id SERIAL PRIMARY KEY NOT NULL,
+    ruid VARCHAR(64) DEFAULT '' NOT NULL,
     username VARCHAR(64) DEFAULT '' NOT NULL,
     domain VARCHAR(64) DEFAULT NULL,
     contact VARCHAR(255) DEFAULT '' NOT NULL,
@@ -15,7 +16,8 @@ CREATE TABLE location (
     cflags INTEGER DEFAULT 0 NOT NULL,
     user_agent VARCHAR(255) DEFAULT '' NOT NULL,
     socket VARCHAR(64) DEFAULT NULL,
-    methods INTEGER DEFAULT NULL
+    methods INTEGER DEFAULT NULL,
+    instance VARCHAR(255) DEFAULT '' NOT NULL
 );
 
 CREATE INDEX location_account_contact_idx ON location (username, domain, contact);