1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
|
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
%docentities;
]>
<!-- Module User's Guide -->
<chapter>
<title>&adminguide;</title>
<section>
<title>Overview</title>
<para>
This module allows to use the unixodbc package with &kamailio;. It have been
tested with mysql and the odbc connector, but it should work also with
other database. The auth_db module works.
</para>
<para>
For more information, see the <ulink url="http://www.unixodbc.org/">
http://www.unixodbc.org/</ulink> project web page.
</para>
<para>
To see what DB engines can be used via unixodbc, look at
<ulink url="http://www.unixodbc.org/drivers.html">
http://www.unixodbc.org/drivers.html</ulink>.
</para>
</section>
<section>
<title>Dependencies</title>
<section>
<title>&kamailio; Modules</title>
<para>
The following modules must be loaded before this module:
<itemizedlist>
<listitem>
<para>
<emphasis>No dependencies on other &kamailio; modules</emphasis>.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section>
<title>External Libraries or Applications</title>
<para>
The following libraries or applications must be installed before running
&kamailio; with this module loaded:
<itemizedlist>
<listitem>
<para>
<emphasis>None</emphasis>.
</para>
</listitem>
</itemizedlist>
</para>
</section>
</section>
<section>
<title>Parameters</title>
<section>
<title><varname>ping_interval</varname> (int)</title>
<para>
Sets the ping time interval.
</para>
<para>
<emphasis>
Default value is <quote>300</quote> seconds.
</emphasis>
</para>
<example>
<title>Set the <quote>ping_interval</quote> parameter</title>
<programlisting format="linespecific">
...
modparam("db_unixodbc", "ping_interval", 600)
...
</programlisting>
</example>
</section>
<section>
<title><varname>auto_reconnect</varname> (int)</title>
<para>
Turns on or off the auto_reconnect mode.
</para>
<para>
<emphasis>
Default value is <quote>1</quote>, this means it is enabled.
</emphasis>
</para>
<example>
<title>Set the <quote>auto_reconnect</quote> parameter</title>
<programlisting format="linespecific">
...
modparam("db_unixodbc", "auto_reconnect", 0)
...
</programlisting>
</example>
</section>
<section>
<title><varname>use_escape_common</varname> (int)</title>
<para>
Escape values in query using internal escape_common() function.
It escapes single quote ''', double quote '"', backslash '\',
and NULL characters.
</para>
<para>
You should enable this parameter if you know that the ODBC driver
considers the above characters as special (for marking begin and end
of a value, escape other characters ...). It prevents against SQL
injection.
</para>
<para>
<emphasis>
Default value is <quote>0</quote> (0 = disabled; 1 = enabled).
</emphasis>
</para>
<example>
<title>Set the <quote>use_escape_common</quote> parameter</title>
<programlisting format="linespecific">
...
modparam("db_unixodbc", "use_escape_common", 1)
...
</programlisting>
</example>
</section>
</section>
<section>
<title>Functions</title>
<para>
NONE
</para>
</section>
<section>
<title>Installation and Running</title>
<section>
<title>Installing</title>
<para>
Prerequirement: you should first install unixodbc (or another program that
implements the odbc standard, such iodbc), your database, and the right
connector. Set the DSN in the odbc.ini file and the connector drivers in
the odbcinst.ini file.
</para>
</section>
<section>
<title>Configuring and Running</title>
<para>
In the openser.conf file, add the line:
</para>
<programlisting format="linespecific">
....
loadmodule "/usr/local/lib/kamailio/modules/db_unixodbc.so"
....
</programlisting>
<para>
You should also uncomment this:
</para>
<programlisting format="linespecific">
....
loadmodule "/usr/local/lib/kamailio/modules/auth.so"
loadmodule "/usr/local/lib/kamailio/modules/auth_db.so"
modparam("usrloc", "db_mode", 2)
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
....
</programlisting>
<para>
and setting the DSN specified in the odbc.ini, inserting this with the
url adding this line:
</para>
<programlisting format="linespecific">
....
modparam("usrloc|auth_db", "db_url",
"unixodbc://openser:openserrw@localhost/my_dsn")
....
</programlisting>
<para>
replacing my_dsn with the correct value.
</para>
<para>
HINT: if unixodbc don't want to connect to mysql server, try restarting
mysql server with:
</para>
<programlisting format="linespecific">
shell>safe_mysqld --user=mysql --socket=/var/lib/mysql/mysql.sock
</programlisting>
<para>
The connector search the socket in /var/lib/mysql/mysql.sock and not
in /tmp/mysql.sock
</para>
</section>
</section>
</chapter>
|