uri_db_admin.xml 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <?xml version="1.0" encoding='ISO-8859-1'?>
  2. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
  4. <!-- Include general documentation entities -->
  5. <!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
  6. %docentities;
  7. ]>
  8. <!-- Module User's Guide -->
  9. <chapter>
  10. <title>&adminguide;</title>
  11. <section>
  12. <title>Overview</title>
  13. <para>Various checks related to &sip; &uri;.</para>
  14. </section>
  15. <section>
  16. <title>Dependencies</title>
  17. <section>
  18. <title>&kamailio; Modules</title>
  19. <para>
  20. The following modules must be loaded before this module:
  21. <itemizedlist>
  22. <listitem>
  23. <para>
  24. <emphasis>a &kamailio; database module </emphasis>.
  25. </para>
  26. </listitem>
  27. </itemizedlist>
  28. </para>
  29. </section>
  30. <section>
  31. <title>External Libraries or Applications</title>
  32. <para>
  33. The following libraries or applications must be installed before
  34. running &kamailio; with this module loaded:
  35. <itemizedlist>
  36. <listitem>
  37. <para>
  38. <emphasis>None</emphasis>.
  39. </para>
  40. </listitem>
  41. </itemizedlist>
  42. </para>
  43. </section>
  44. </section>
  45. <section>
  46. <title>Parameters</title>
  47. <section id="uri_db.p.db_url">
  48. <title><varname>db_url</varname> (string)</title>
  49. <para>
  50. &url; of the database to be used.
  51. </para>
  52. <para>
  53. If the db_url string is empty, the default database URL
  54. will be used.
  55. </para>
  56. <para>
  57. <emphasis>
  58. Default value is <quote>&defaultrodb;</quote>.
  59. </emphasis>
  60. </para>
  61. <example>
  62. <title>Set <varname>db_url</varname> parameter</title>
  63. <programlisting format="linespecific">
  64. ...
  65. modparam("uri_db", "db_url", "mysql://username:password@localhost/openser")
  66. ...
  67. </programlisting>
  68. </example>
  69. </section>
  70. <section id="uri_db.p.db_table">
  71. <title><varname>db_table</varname> (string)</title>
  72. <para>
  73. The DB table that should be used. Its possible to use the
  74. <quote>subscriber</quote> and <quote>uri</quote> table. If the
  75. <quote>uri</quote> table should be used, an additional parameter
  76. <quote>use-uri-table</quote>) must be set.
  77. </para>
  78. <para>
  79. <emphasis>
  80. Default value is <quote>subscriber</quote>.
  81. </emphasis>
  82. </para>
  83. <example>
  84. <title>Set <varname>uri_table</varname> parameter</title>
  85. <programlisting format="linespecific">
  86. ...
  87. modparam("uri_db", "db_table", "uri")
  88. ...
  89. </programlisting>
  90. </example>
  91. </section>
  92. <section id="uri_db.p.user_column">
  93. <title><varname>user_column</varname> (string)</title>
  94. <para>
  95. Column holding usernames in the table.
  96. </para>
  97. <para>
  98. <emphasis>
  99. Default value is <quote>username</quote>.
  100. </emphasis>
  101. </para>
  102. <example>
  103. <title>Set <varname>user_column</varname> parameter</title>
  104. <programlisting format="linespecific">
  105. ...
  106. modparam("uri_db", "user_column", "username")
  107. ...
  108. </programlisting>
  109. </example>
  110. </section>
  111. <section id="uri_db.p.domain_column">
  112. <title><varname>domain_column</varname> (string)</title>
  113. <para>
  114. Column holding domain in the table.
  115. </para>
  116. <para>
  117. <emphasis>
  118. Default value is <quote>domain</quote>.
  119. </emphasis>
  120. </para>
  121. <example>
  122. <title>Set <varname>domain_column</varname> parameter</title>
  123. <programlisting format="linespecific">
  124. ...
  125. modparam("uri_db", "domain_column", "domain")
  126. ...
  127. </programlisting>
  128. </example>
  129. </section>
  130. <section id="uri_db.p.uriuser_column">
  131. <title><varname>uriuser_column</varname> (string)</title>
  132. <para>
  133. Column holding &uri; username in the table.
  134. </para>
  135. <para>
  136. <emphasis>
  137. Default value is <quote>uri_user</quote>.
  138. </emphasis>
  139. </para>
  140. <example>
  141. <title>Set <varname>uriuser_column</varname> parameter</title>
  142. <programlisting format="linespecific">
  143. ...
  144. modparam("uri_db", "uriuser_column", "uri_user")
  145. ...
  146. </programlisting>
  147. </example>
  148. </section>
  149. <section id="uri_db.p.use_uri_table">
  150. <title><varname>use_uri_table</varname> (integer)</title>
  151. <para>
  152. Specify if the <quote>uri</quote> table should be used for checkings
  153. instead of <quote>subscriber</quote> table. A non-zero value means true.
  154. </para>
  155. <para>
  156. <emphasis>
  157. Default value is <quote>0 (false)</quote>.
  158. </emphasis>
  159. </para>
  160. <example>
  161. <title>Set <varname>use_uri_table</varname> parameter</title>
  162. <programlisting format="linespecific">
  163. ...
  164. modparam("uri_db", "use_uri_table", 1)
  165. ...
  166. </programlisting>
  167. </example>
  168. </section>
  169. <section id="uri_db.p.use_domain">
  170. <title><varname>use_domain</varname> (integer)</title>
  171. <para>
  172. Specify if the domain part of the URI should be used to identify the
  173. users (along with username). This is useful in multi domain setups, a
  174. non-zero value means true.
  175. </para>
  176. <para>This parameter is only evaluated for calls to <quote>does_uri_exist</quote>,
  177. all other functions checks the digest username and realm against the
  178. given username, if the <quote>uri</quote> table is used.
  179. </para>
  180. <para>
  181. <emphasis>
  182. Default value is <quote>0 (false)</quote>.
  183. </emphasis>
  184. </para>
  185. <example>
  186. <title>Set <varname>use_domain</varname> parameter</title>
  187. <programlisting format="linespecific">
  188. ...
  189. modparam("uri_db", "use_domain", 1)
  190. ...
  191. </programlisting>
  192. </example>
  193. </section>
  194. </section>
  195. <section>
  196. <title>Functions</title>
  197. <section id="uri_db.f.check_to">
  198. <title>
  199. <function moreinfo="none">check_to()</function>
  200. </title>
  201. <para>
  202. Check <quote>To</quote> username against &uri; table (if use_uri_table is set) or
  203. digest credentials (no DB backend required).
  204. </para>
  205. <para>
  206. This function can be used from REQUEST_ROUTE.
  207. </para>
  208. <example>
  209. <title><function>check_to</function> usage</title>
  210. <programlisting format="linespecific">
  211. ...
  212. if (check_to()) {
  213. ...
  214. };
  215. ...
  216. </programlisting>
  217. </example>
  218. </section>
  219. <section id="uri_db.f.check_from">
  220. <title>
  221. <function moreinfo="none">check_from()</function>
  222. </title>
  223. <para>
  224. Check <quote>From</quote> username against &uri; table (if use_uri_table is set) or
  225. digest credentials (no DB backend required).
  226. </para>
  227. <para>
  228. This function can be used from REQUEST_ROUTE.
  229. </para>
  230. <example>
  231. <title><function>check_from</function> usage</title>
  232. <programlisting format="linespecific">
  233. ...
  234. if (check_from()) {
  235. ...
  236. };
  237. ...
  238. </programlisting>
  239. </example>
  240. </section>
  241. <section id="uri_db.f.does_uri_exist">
  242. <title>
  243. <function moreinfo="none">does_uri_exist()</function>
  244. </title>
  245. <para>
  246. Check if username in the request &uri; belongs to an existing user.
  247. </para>
  248. <para>
  249. The checking is done against the &uri; table (if use_uri_table is set)
  250. or the subscriber table.
  251. </para>
  252. <para>
  253. This function can be used from REQUEST_ROUTE.
  254. </para>
  255. <example>
  256. <title><function>does_uri_exist</function> usage</title>
  257. <programlisting format="linespecific">
  258. ...
  259. if (does_uri_exist()) {
  260. ...
  261. };
  262. ...
  263. </programlisting>
  264. </example>
  265. </section>
  266. </section>
  267. </chapter>