<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<section id="usrloc.parameters" xmlns:xi="http://www.w3.org/2001/XInclude">
    <sectioninfo>
    </sectioninfo>

    <title>Parameters</title>

    <section id="usrloc.user_column">
	<title><varname>user_column</varname> (string)</title>
	<para>
	    Name of column containing usernames.
	</para>
	<para>
	    Default value is "username".
	</para>
	<example>
	    <title>Set <varname>user_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "user_column", "username")
...
	    </programlisting>
	</example>
    </section>

    <section id="contact_column">
	<title><varname>contact_column</varname> (string)</title>
	<para>
	    Name of column containing contacts.
	</para>
	<para>
	    Default value is "contact".
	</para>
	<example>
	    <title>Set <varname>contact_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "contact_column", "contact")
...
	    </programlisting>
	</example>
    </section>

    <section id="expires_column">
	<title><varname>expires_column</varname> (string)</title>
	<para>
	    Name of column containing expires value.
	</para>
	<para>
	    Default value is "expires".
	</para>
	<example>
	    <title>Set <varname>expires_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "expires_column", "expires")
...
	    </programlisting>
	</example>
    </section>

    <section id="q_column">
	<title><varname>q_column</varname> (string)</title>
	<para>
	    Name of column containing q values.
	</para>
	<para>
	    Default value is "q".
	</para>
	<example>
	    <title>Set <varname>q_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "q_column", "q")
...
	    </programlisting>
	</example>
    </section>

    <section id="callid_column">
	<title><varname>callid_column</varname> (string)</title>
	<para>
	    Name of column containing callid values.
	</para>
	<para>
	    Default value is "callid".
	</para>
	<example>
	    <title>Set <varname>callid_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "callid_column", "callid")
...
	    </programlisting>
	</example>
    </section>

    <section id="cseq_column">
	<title><varname>cseq_column</varname> (string)</title>
	<para>
	    Name of column containing cseq numbers.
	</para>
	<para>
	    Default value is "cseq".
	</para>
	<example>
	    <title>Set <varname>cseq_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "cseq_column", "cseq")
...
	    </programlisting>
	</example>
    </section>

    <section id="method_column">
	<title><varname>method_column</varname> (string)</title>
	<para>
	    Name of column containing supported methods.
	</para>
	<para>
	    Default value is "method".
	</para>
	<example>
	    <title>Set <varname>method_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "method_column", "method")
...
	    </programlisting>
	</example>
    </section>

    <section id="user_agent_column">
	<title><varname>user_agent_column</varname> (string)</title>
	<para>
	    Name of column containing user-agent values.
	</para>
	<para>
	    Default value is "user_agent".
	</para>
	<example>
	    <title>Set <varname>user_agent_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "user_agent_column", "user_agent")
...
	    </programlisting>
	</example>
    </section>

    <section id="received_column">
	<title><varname>received_column</varname> (string)</title>
	<para>
	    Name of column containing the source IP, port, and protocol from
	    the REGISTER message.
	</para>
	<para>
	    Default value is "received".
	</para>
	<example>
	    <title>Set <varname>received_column</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "received_column", "received")
...
	    </programlisting>
	</example>
    </section>

    <section id="usrloc.db_url">
	<title><varname>db_url</varname> (string)</title>
	<para>
	    URL of the database that should be used.
	</para>
	<para>
	    Default value is "mysql://ser:heslo@localhost/ser".
	</para>
	<example>
	    <title>Set <varname>db_url</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "db_url", "mysql://username:password@localhost/ser")
...
	    </programlisting>
	</example>
    </section>

    <section id="timer_interval">
	<title><varname>timer_interval</varname> (integer)</title>
	<para>
	    Number of seconds between two timer runs. The module uses timer to
	    delete expired contacts, synchronize with database and other tasks,
	    that need to be run periodically.
	</para>
	<para>
	    Default value is 60.
	</para>
	<example>
	    <title>Set <varname>timer_interval</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "timer_interval", 120)
...
	    </programlisting>
	</example>
    </section>

    <section id="usrloc.db_mode">
	<title><varname>db_mode</varname> (integer)</title>
	<para>
	    The usrloc module can utilize database for persistent contact
	    storage. If you use database, your contacts will survive machine
	    restarts or SW crashes. The disadvantage is that accessing database
	    can be very time consuming. Therefore, usrloc module implements
	    four database accessing modes:
	</para>
	<itemizedlist>
	    <listitem>
		<para>
		    0 - This disables database completely. Only memory will be
		    used. Contacts will not survive restart. Use this value if
		    you need a really fast usrloc and contact persistence is
		    not necessary or is provided by other means.
		</para>
	    </listitem>
	    <listitem>
		<para>
		    1 - Write-Through scheme. All changes to usrloc are
		    immediately reflected in database too. This is very slow,
		    but very reliable. Use this scheme if speed is not your
		    priority but need to make sure that no registered contacts
		    will be lost during crash or reboot.
		</para>
	    </listitem>
	    <listitem>
		<para>
		    2 - Write-Back scheme. This is a combination of previous
		    two schemes. All changes are made to memory and database
		    synchronization is done in the timer. The timer deletes all
		    expired contacts and flushes all modified or new contacts
		    to database.  Use this scheme if you encounter high-load
		    peaks and want them to process as fast as possible. The
		    mode will not help at all if the load is high all the time.
		    Also, latency of this mode is much lower than latency of
		    mode 1, but slightly higher than latency of mode 0.
		</para>
	    </listitem>
	    <listitem>
		<para>
		    3 - Read-Only scheme. Disables commits to database. Upon start
		    contacts are read from the database but changes are not written.
		    Contacts will thus not survive a restart unless taken care of
		    otherwise.  Use this if you need the benefits of mode 0 with a
		    databases backed preloading feature.  Attention: There is a
		    slight window where updated contacts might not make it into
		    memory while reading and parsing contacts from the database
		    before going into full production mode.
		</para>
	    </listitem>
	</itemizedlist>
	<warning>
	    <para>
		In case of crash or restart contacts that are in memory only
		and haven't been flushed yet will get lost. If you want
		minimize the risk, use shorter timer interval.
	    </para>
	</warning>
	<para>
	    Default value is 0.
	</para>
	<example>
	    <title>Set <varname>db_mode</varname> parameter</title>
	    <programlisting>
...
modparam("usrloc", "db_mode", 2)
...
	    </programlisting>
	</example>
    </section>

</section>
