<?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="lcr_rule" xmlns:db="http://docbook.org/ns/docbook">
    <name>lcr_rule</name>
    <version>2</version>
    <type db="mysql">&MYSQL_TABLE_TYPE;</type>
    <description>
        <db:para>This table is used by the lcr (Least Cost Routing)
	    module to store routing rules.
            More information can be found at: &KAMAILIO_MOD_DOC;lcr.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>
    </column>

    <column id="lcr_id">
        <name>lcr_id</name>
        <type>unsigned short</type>
        <description>LCR instance identifier</description>
    </column>

    <column id="prefix">
        <name>prefix</name>
        <type>string</type>
        <size>16</size>
	<null/>
        <default><null/></default>
        <description>Prefix of Request URI user part</description>
        <natural/>
    </column>

    <column id="from_uri">
        <name>from_uri</name>
        <type>string</type>
        <size>&domain_len;</size>
        <null/>
        <default><null/></default>
        <description>PCRE regular expression that is matched to caller's URI</description>
    </column>

    <column id="request_uri">
        <name>request_uri</name>
        <type>string</type>
        <size>&domain_len;</size>
        <null/>
        <default><null/></default>
        <description>PCRE regular expression that is matched to full request URI</description>
    </column>

    <column id="stopper">
        <name>stopper</name>
        <type>unsigned int</type>
        <default>0</default>
        <description>Tells if rule is "stopper" rule</description>
    </column>

    <column id="enabled">
        <name>enabled</name>
        <type>unsigned int</type>
        <default>1</default>
        <description>Tells if rule is enabled</description>
    </column>

    <index>
        <name>lcr_id_prefix_from_uri_idx</name>
        <colref linkend="lcr_id"/>
        <colref linkend="prefix"/>
        <colref linkend="from_uri"/>
	<unique/>
    </index>

</table>
