[sr-dev] git:master: sca: add db schema files and kamctl table create SQL file.

Andrew Mortensen admorten at isc.upenn.edu
Thu Nov 29 04:51:27 CET 2012


Module: sip-router
Branch: master
Commit: 7575c853b1786fc09965238ea68bca4400bd7c5f
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7575c853b1786fc09965238ea68bca4400bd7c5f

Author: Andrew Mortensen <admorten at isc.upenn.edu>
Committer: Andrew Mortensen <admorten at isc.upenn.edu>
Date:   Wed Nov 28 22:50:30 2012 -0500

sca: add db schema files and kamctl table create SQL file.

---

 lib/srdb1/schema/kamailio-sca.xml |   12 ++++
 lib/srdb1/schema/sca.xml          |  126 +++++++++++++++++++++++++++++++++++++
 utils/kamctl/mysql/sca-create.sql |   20 ++++++
 3 files changed, 158 insertions(+), 0 deletions(-)

diff --git a/lib/srdb1/schema/kamailio-sca.xml b/lib/srdb1/schema/kamailio-sca.xml
new file mode 100644
index 0000000..e7b210e
--- /dev/null
+++ b/lib/srdb1/schema/kamailio-sca.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE database PUBLIC "-//kamailio.org//DTD DBSchema V1.1//EN"
+  "http://kamailio.org/pub/kamailio/dbschema/dtd/1.1/dbschema.dtd" [
+
+  <!ENTITY % entities SYSTEM "entities.xml">
+  %entities;
+]>
+
+<database xmlns:xi="http://www.w3.org/2001/XInclude">
+    <name>Shared Call Appearance Values</name>
+    <xi:include href="sca.xml"/>
+</database>
diff --git a/lib/srdb1/schema/sca.xml b/lib/srdb1/schema/sca.xml
new file mode 100644
index 0000000..8dd16e6
--- /dev/null
+++ b/lib/srdb1/schema/sca.xml
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE table PUBLIC "-//kamailio.org//DTD DBSchema V1.1//EN" 
+  "http://kamailio.org/pub/kamailio/dbschema/dtd/1.1/dbschema.dtd" [
+
+<!ENTITY % entities SYSTEM "entities.xml">
+%entities;
+
+]>
+
+<table id="sca_susbcriptions" xmlns:db="http://docbook.org/ns/docbook">
+    <name>sca_subscriptions</name>
+    <version>0</version>
+    <type db="mysql">&MYSQL_TABLE_TYPE;</type>
+    <description>
+        <db:para>This table is used by the sca module to store active subscriptions. At startup time, the sca module loads unexpired subscriptions into its subscription hash table. More information about the sca module can be found at: &KAMAILIO_MOD_DOC;sca.html
+        </db:para>
+    </description>
+
+    <column id="id">
+        <name>id</name>
+        <type>unsigned int</type>
+        <size>&table_id_len;</size>
+        <autoincrement/>
+        <primary/>
+        <type db="dbtext">int,auto</type>
+        <description>Unique ID</description>
+    </column>
+
+    <column id="subscriber">
+        <name>subscriber</name>
+        <type>string</type>
+        <size>255</size>
+        <description>URI of SCA subscriber</description>
+    </column>
+
+    <column id="aor">
+        <name>aor</name>
+        <type>string</type>
+	<size>255</size>
+        <description>SCA Address-of-Record for the group</description>
+    </column>
+
+    <column id="event">
+        <name>event</name>
+        <type>int</type>
+        <default>0</default>
+        <description>SCA event type. 0 - call-info, 1 - line-seize</description>
+    </column>
+
+    <column id="expires">
+        <name>expires</name>
+        <type>int</type>
+        <size>&expires_len;</size>
+	<default>0</default>
+        <description>Epoch time of SCA subscription expiration</description>
+    </column>
+
+    <column id="state">
+        <name>state</name>
+        <type>int</type>
+	<default>0</default>
+        <description>SCA subscription state, 0 - active</description>
+    </column>
+
+    <column id="app_idx">
+        <name>app_idx</name>
+        <type>int</type>
+	<default>0</default>
+        <description>Seized line appearance index</description>
+    </column> 
+
+    <column id="call_id">
+        <name>call_id</name>
+        <type>string</type>
+	<size>&callid_len;</size>
+        <description>Call-ID value for subscription dialog</description>
+    </column>
+
+    <column id="from_tag">
+        <name>from_tag</name>
+        <type>string</type>
+	<size>&domain_len;</size>
+        <description>From-tag for subscription dialog</description>
+    </column>
+
+    <column id="to_tag">
+        <name>to_tag</name>
+        <type>string</type>
+	<size>&domain_len;</size>
+        <description>To-tag for subscription dialog</description>
+    </column>
+
+    <column id="notify_cseq">
+        <name>notify_cseq</name>
+        <type>int</type>
+	<size>&cseq_len;</size>
+        <description>Cseq for NOTIFYs sent to subscriber</description>
+    </column>
+
+    <column id="subscribe_cseq">
+        <name>subscribe_cseq</name>
+        <type>int</type>
+	<size>&cseq_len;</size>
+        <description>Cseq for SUBSCRIBEs sent from subscriber</description>
+    </column>
+
+    <index>
+	<name>sca_subscriptions_idx</name>
+	<colref linkend="subscriber" />
+	<colref linkend="call_id" />
+	<colref linkend="from_tag" />
+	<colref linkend="to_tag" />
+	<unique />
+    </index>
+
+    <index>
+	<name>sca_expires_idx</name>
+	<colref linkend="expires" />
+    </index>
+
+    <index>
+	<name>sca_subscribers_idx</name>
+	<colref linkend="subscriber" />
+	<colref linkend="event" />
+    </index>
+</table>
diff --git a/utils/kamctl/mysql/sca-create.sql b/utils/kamctl/mysql/sca-create.sql
new file mode 100644
index 0000000..ef2e371
--- /dev/null
+++ b/utils/kamctl/mysql/sca-create.sql
@@ -0,0 +1,20 @@
+INSERT INTO version (table_name, table_version) values ('sca_subscriptions','0');
+CREATE TABLE sca_subscriptions (
+    id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,
+    subscriber VARCHAR(255) NOT NULL,
+    aor VARCHAR(255) NOT NULL,
+    event INT DEFAULT 0 NOT NULL,
+    expires INT(11) DEFAULT 0 NOT NULL,
+    state INT DEFAULT 0 NOT NULL,
+    app_idx INT DEFAULT 0 NOT NULL,
+    call_id VARCHAR(255) NOT NULL,
+    from_tag VARCHAR(64) NOT NULL,
+    to_tag VARCHAR(64) NOT NULL,
+    notify_cseq INT(11) NOT NULL,
+    subscribe_cseq INT(11) NOT NULL,
+    CONSTRAINT sca_subscriptions_idx UNIQUE (subscriber, call_id, from_tag, to_tag)
+) ENGINE=MyISAM;
+
+CREATE INDEX sca_expires_idx ON sca_subscriptions (expires);
+CREATE INDEX sca_subscribers_idx ON sca_subscriptions (subscriber, event);
+




More information about the sr-dev mailing list