<!-- Module User's Guide -->

<chapter>
    <chapterinfo>
	<revhistory>
	    <revision>
		<revnumber>$Revision: 1.2.2.1 $</revnumber>
		<date>$Date: 2005/02/01 11:01:29 $</date>
	    </revision>
	</revhistory>
    </chapterinfo>
    <title>User's Guide</title>
    
    <section>
	<title>Overview</title>
	<para>
	    This module provides on-server speed dial facilities. An user can store
		records consisting of pairs short numbers (2 digits) and SIP addresses
		into a table of SER. Then it can dial the two digits whenever he wants
		to call the SIP address associated with those digits.
	</para>
    </section>
    <section>
	<title>Dependencies</title>
	<section>
	    <title>&ser; Modules</title>
	    <para>
		The following modules must be loaded before this module:
	    	<itemizedlist>
		    <listitem>
			<para>
			    <emphasis>database module (mysql, dbtext, ...)</emphasis>.
			</para>
		    </listitem>
		    <listitem>
			<para>
			    <emphasis>sl - stateless module</emphasis>.
			</para>
		    </listitem>
	    	</itemizedlist>
	    </para>
	</section>
	<section>
	    <title>External Libraries or Applications</title>
	    <para>
		The following libraries or applications must be installed before running
		&ser; with this module loaded:
	    	<itemizedlist>
		    <listitem>
			<para>
			    <emphasis>None</emphasis>.
			</para>
		    </listitem>
	    	</itemizedlist>
	    </para>
	</section>
    </section>
    <section>
	<title>Exported Parameters</title>
	<section>
	    <title><varname>db_url</varname> (string)</title>
	    <para>
		The URL of database where the table containing speed dial records.
	    </para>
	    <para>
		<emphasis>
		    Default value is DEFAULT_RODB_URL.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>db_url</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "db_url", "mysql://ser:xxx@localhost/ser")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>user_column</varname> (string)</title>
	    <para>
		The name of column storing the user name of the owner of the speed dial
		record.
	    </para>
	    <para>
		<emphasis>
		    Default value is <quote>username</quote>.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>user_column</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "user_column", "userid")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>domain_column</varname> (string)</title>
	    <para>
		The name of column storing the domain of the owner of the speed dial
		record.
	    </para>
	    <para>
		<emphasis>
		    Default value is  <quote>domain</quote>.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>domain_column</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "domain_column", "userdomain")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>sd_user_column</varname> (string)</title>
	    <para>
		The name of the column storing the user part of the short dial address.
	    </para>
	    <para>
		<emphasis>
		    Default value is  <quote>sd_username</quote>.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>sd_user_column</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "sd_user_column", "short_user")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>sd_domain_column</varname> (string)</title>
	    <para>
		The name of the column storing the domain of the short dial address.
	    </para>
	    <para>
		<emphasis>
		    Default value is  <quote>sd_domain</quote>.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>sd_domain_column</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "sd_domain_column", "short_domain")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>new_uri_column</varname> (string)</title>
	    <para>
		The name of the column containing the URI that will be use to replace
		the short dial URI.
	    </para>
	    <para>
		<emphasis>
		    Default value is <quote>new_uri</quote>.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>new_uri_column</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "new_uri_column", "real_uri")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>domain_prefix</varname> (string)</title>
	    <para>
		If the domain of the owner (From URI) starts with the value of this parameter, then
		it is stripped before performing the lookup of the short number.
	    </para>
	    <para>
		<emphasis>
		    Default value is NULL.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>domain_prefix</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "domain_prefix", "tel.")
...
</programlisting>
	    </example>
	</section>
	<section>
	    <title><varname>use_domain</varname> (int)</title>
	    <para>
		The parameter specifies wheter or not to use the domain when searching a
		speed dial record (0 - no domain, 1 - use domain from From URI,
		2 - use both domains, from From URI and from request URI).
	    </para>
	    <para>
		<emphasis>
		    Default value is 0.
		</emphasis>
	    </para>
	    <example>
		<title>Set <varname>use_domain</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("speeddial", "use_domain", 1)
...
</programlisting>
	    </example>
	</section>
    </section>
    <section>
	<title>Exported Functions</title>
	<section>
	    <title>
		<function moreinfo="none">sd_lookup(table)</function>
	    </title>
	    <para>
		Print a formated message using LOG function.
	    </para>
	    <para>Meaning of the parameters is as follows:</para>
	    <itemizedlist>
		<listitem>
		    <para><emphasis>table</emphasis> - The name of the table storing the
			speed dial records.
		    </para>
		</listitem>
	    </itemizedlist>
	    <example>
		<title><function>sd_lookup</function> usage</title>
		<programlisting format="linespecific">
...
if(uri=~"sip:[0-9]{2}@.*")
    sd_lookup("speeddial");
...
</programlisting>
	    </example>
	</section>
    </section>
	<section>
	<title>Installation & Running</title>
	<section>
	    <title>Database setup</title>
	    <para>
		Before using speeddial module, you have to create the database table where
		the short dial addresses are stored. If the table was not created at the
		installation time, you can use the following <acronym>SQL</acronym> script
		(tested with MySQL) as template. Database, the table name, and column names
		can be set with module parameters so they can be changed.
	    </para>
	    <example>
		<title>speeddial sql script</title>
		<programlisting format="linespecific">
...
&speeddialsql;
...
</programlisting>
		</example>
    	</section>
	
    	<section>
	    <title>&ser; config file</title>
	    <para>
		Next picture displays a sample usage of speeddial.
	    </para>
	    <example>
		<title>&ser; config script - sample speeddial usage</title>
		<programlisting format="linespecific">
...
&speeddialcfg;
...
		</programlisting>
	    </example>
	</section>
    </section>
</chapter>

<!-- Keep this element at the end of the file
Local Variables:
sgml-parent-document: ("speeddial.sgml" "Book" "chapter")
End:
-->
