sipcapture_admin.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  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>
  14. The sipcapture module stores incoming/outgoing SIP messages in database.
  15. </para>
  16. <para>
  17. Kamailio can capture SIP messages in three modes
  18. <itemizedlist>
  19. <listitem>
  20. <para>
  21. IPIP encapsulation. (ETHHDR+IPHDR+IPHDR+UDPHDR).
  22. </para>
  23. </listitem>
  24. <listitem>
  25. <para>
  26. Monitoring/mirroring port.
  27. </para>
  28. </listitem>
  29. <listitem>
  30. <para>
  31. Homer encapsulation protocol mode (HEP v1, v2, v3).
  32. </para>
  33. </listitem>
  34. </itemizedlist>
  35. </para>
  36. <para>
  37. The capturing can be turned on/off using mi or rpc commands. Example:
  38. </para>
  39. <para>
  40. &ctltool; fifo sip_capture on
  41. </para>
  42. <para>
  43. &ctltool; fifo sip_capture off
  44. </para>
  45. </section>
  46. <section>
  47. <title>Dependencies</title>
  48. <section>
  49. <title>&kamailio; Modules</title>
  50. <para>
  51. The following modules must be loaded before this module:
  52. <itemizedlist>
  53. <listitem>
  54. <para>
  55. <emphasis>database module</emphasis> - mysql, postrgress,
  56. dbtext, unixodbc...
  57. </para>
  58. </listitem>
  59. </itemizedlist>
  60. </para>
  61. </section>
  62. <section>
  63. <title>External Libraries or Applications</title>
  64. <para>
  65. The following libraries or applications must be installed before running
  66. &kamailio; with this module loaded:
  67. <itemizedlist>
  68. <listitem>
  69. <para>
  70. <emphasis>None</emphasis>.
  71. </para>
  72. </listitem>
  73. </itemizedlist>
  74. </para>
  75. </section>
  76. </section>
  77. <section>
  78. <title>Parameters</title>
  79. <section id="sipcapture.p.db_url">
  80. <title><varname>db_url</varname> (str)</title>
  81. <para>
  82. Database URL.
  83. </para>
  84. <para>
  85. <emphasis>
  86. Default value is "".
  87. </emphasis>
  88. </para>
  89. <example>
  90. <title>Set <varname>db_url</varname> parameter</title>
  91. <programlisting format="linespecific">
  92. ...
  93. modparam("sipcapture", "db_url", "mysql://user:passwd@host/dbname")
  94. ...
  95. </programlisting>
  96. </example>
  97. </section>
  98. <section id="sipcapture.p.table_name">
  99. <title><varname>table_name</varname> (str)</title>
  100. <para>
  101. Name of the table's name used to store the SIP messages. Can contain multiple tables, separated by "|".
  102. </para>
  103. <para>
  104. <emphasis>
  105. Default value is "sip_capture".
  106. </emphasis>
  107. </para>
  108. <example>
  109. <title>Set <varname>sip_capture</varname> parameter</title>
  110. <programlisting format="linespecific">
  111. ...
  112. modparam("sipcapture", "table_name", "homer_capture")
  113. ...
  114. modparam("sipcapture", "table_name", "homer_capture1|homer_capture2");
  115. ...
  116. </programlisting>
  117. </example>
  118. </section>
  119. <section id="sipcapture.p.mt_mode">
  120. <title><varname>mt_mode</varname> (str)</title>
  121. <para>
  122. Name of the mode used for storing data in multiple tables. Modes can be "rand" (random), "round_robin" (use a round_robin algorithm) or "hash" (use hashing to determine the table to store). These modes are only triggered if there is more than one table specified in table_name parameter, separated by "|".
  123. </para>
  124. <para>
  125. <emphasis>
  126. Default value is "rand".
  127. </emphasis>
  128. </para>
  129. <example>
  130. <title>Set <varname>mt_mode</varname> parameter</title>
  131. <programlisting format="linespecific">
  132. ...
  133. modparam("sipcapture", "mt_mode", "hash")
  134. ...
  135. </programlisting>
  136. </example>
  137. </section>
  138. <section id="sipcapture.p.hash_source">
  139. <title><varname>hash_source</varname> (str)</title>
  140. <para>
  141. The field of the SIP message used for hashing, when mt_mode is set to "hash". The value can be "call_id", "to_user" or "from_user".
  142. </para>
  143. <para>
  144. <emphasis>
  145. Default value is "call_id".
  146. </emphasis>
  147. </para>
  148. <example>
  149. <title>Set <varname>mt_mode</varname> parameter</title>
  150. <programlisting format="linespecific">
  151. ...
  152. modparam("sipcapture", "hash_source", "to_user")
  153. ...
  154. </programlisting>
  155. </example>
  156. </section>
  157. <section id="sipcapture.p.db_insert_mode">
  158. <title><varname>db_insert_mode</varname> (integer)</title>
  159. <para>
  160. If set to 1, use INSERT DELAYED to store sip message into capture table
  161. when the DB driver has support for it. If no INSERT DELAYED support
  162. is offered by DB driver, then standard INSERT is used.
  163. </para>
  164. <para>
  165. Default value is 0 (no INSERT DELAYED).
  166. </para>
  167. <example>
  168. <title>db_insert_mode example</title>
  169. <programlisting format="linespecific">
  170. modparam("sipcapture", "db_insert_mode", 1)
  171. </programlisting>
  172. </example>
  173. </section>
  174. <section id="sipcapture.p.capture_on">
  175. <title><varname>capture_on</varname> (integer)</title>
  176. <para>
  177. Parameter to enable/disable capture globaly (on(1)/off(0))
  178. </para>
  179. <para>
  180. <emphasis>
  181. Default value is "0".
  182. </emphasis>
  183. </para>
  184. <example>
  185. <title>Set <varname>capture_on</varname> parameter</title>
  186. <programlisting format="linespecific">
  187. ...
  188. modparam("sipcapture", "capture_on", 1)
  189. ...
  190. </programlisting>
  191. </example>
  192. </section>
  193. <section id="sipcapture.p.capture_mode">
  194. <title><varname>capture_mode</varname> (integer)</title>
  195. <para>
  196. This parameter can be used for defining a capture mode which can be used in
  197. the sip_capture calls as a parameter. A capture mode has a name and some parameters.
  198. It must be defined in the format: name=>param1=val1;param2=val2;...
  199. The parameters are db_url, table_name, mt_mode and hash_source (optional).
  200. Multiple capture modes can be defined by using this parameter multiple times.
  201. After this, the capture modes can be used like:
  202. sip_capture ("", "CAPTURE_MODE");
  203. </para>
  204. <example>
  205. <title>capture_mode example</title>
  206. <programlisting format="linespecific">
  207. modparam("sipcapture", "capture_mode", "mode1=>db_url=mysql://user:passwd@host/dbname1;table_name=homer_capture1|homer_capture2;mt_mode=hash;hash_source=call_id;")
  208. modparam("sipcapture", "capture_mode", "mode2=>db_url=mysql://user:passwd@host/dbname2;table_name=homer_capture3|homer_capture4;mt_mode=rand;")
  209. </programlisting>
  210. </example>
  211. </section>
  212. <section id="sipcapture.p.hep_capture_on">
  213. <title><varname>hep_capture_on</varname> (integer)</title>
  214. <para>
  215. Parameter to enable/disable capture of HEP (on(1)/off(0))
  216. </para>
  217. <para>
  218. <emphasis>
  219. Default value is "0".
  220. </emphasis>
  221. </para>
  222. <example>
  223. <title>Set <varname>hep_capture_on</varname> parameter</title>
  224. <programlisting format="linespecific">
  225. ...
  226. modparam("sipcapture", "hep_capture_on", 1)
  227. ...
  228. </programlisting>
  229. </example>
  230. </section>
  231. <section id="sipcapture.p.raw_ipip_capture_on">
  232. <title><varname>raw_ipip_capture_on</varname> (integer)</title>
  233. <para>
  234. Parameter to enable/disable IPIP capturing (on(1)/off(0))
  235. </para>
  236. <para>
  237. <emphasis>
  238. Default value is "0".
  239. </emphasis>
  240. </para>
  241. <example>
  242. <title>Set <varname>raw_ipip_capture_on</varname> parameter</title>
  243. <programlisting format="linespecific">
  244. ...
  245. modparam("sipcapture", "raw_ipip_capture_on", 1)
  246. ...
  247. </programlisting>
  248. </example>
  249. </section>
  250. <section id="sipcapture.p.raw_moni_capture_on">
  251. <title><varname>raw_moni_capture_on</varname> (integer)</title>
  252. <para>
  253. Parameter to enable/disable monitoring/mirroring port capturing (on(1)/off(0))
  254. Only one mode on raw socket can be enabled! Monitoring port capturing currently
  255. supported only on Linux.
  256. </para>
  257. <para>
  258. <emphasis>
  259. Default value is "0".
  260. </emphasis>
  261. </para>
  262. <example>
  263. <title>Set <varname>raw_moni_capture_on</varname> parameter</title>
  264. <programlisting format="linespecific">
  265. ...
  266. modparam("sipcapture", "raw_moni_capture_on", 1)
  267. ...
  268. </programlisting>
  269. </example>
  270. </section>
  271. <section id="sipcapture.p.raw_socket_listen">
  272. <title><varname>raw_socket_listen</varname> (string)</title>
  273. <para>
  274. Parameter indicate an listen IP address of RAW socket for IPIP capturing.
  275. You can also define a port/portrange for IPIP/Mirroring mode, to capture
  276. SIP messages in specific ports:
  277. <para>
  278. "10.0.0.1:5060" - the source/destination port of the SIP message must be equal 5060
  279. </para>
  280. <para>
  281. "10.0.0.1:5060-5090" - the source/destination port of the SIP message must be
  282. equal or be between 5060 and 5090.
  283. </para>
  284. <para>
  285. The port/portrange must be defined if you are planning to
  286. use mirroring capture! In this case, the part with IP address will be
  287. ignored, but to make parser happy, use i.e. 10.0.0.0
  288. </para>
  289. </para>
  290. <para>
  291. <emphasis>
  292. Default value is "".
  293. </emphasis>
  294. </para>
  295. <example>
  296. <title>Set <varname>raw_socket_listen</varname> parameter</title>
  297. <programlisting format="linespecific">
  298. ...
  299. modparam("sipcapture", "raw_socket_listen", "10.0.0.1:5060-5090")
  300. ...
  301. modparam("sipcapture", "raw_socket_listen", "10.0.0.1:5060")
  302. ...
  303. </programlisting>
  304. </example>
  305. </section>
  306. <section id="sipcapture.p.raw_interface">
  307. <title><varname>raw_interface</varname> (string)</title>
  308. <para>
  309. Name of the interface to bind on the raw socket.
  310. </para>
  311. <para>
  312. <emphasis>
  313. Default value is "".
  314. </emphasis>
  315. </para>
  316. <example>
  317. <title>Set <varname>raw_interface</varname> parameter</title>
  318. <programlisting format="linespecific">
  319. ...
  320. modparam("sipcapture", "raw_interface", "eth0")
  321. ...
  322. </programlisting>
  323. </example>
  324. </section>
  325. <section id="sipcapture.p.raw_sock_children">
  326. <title><varname>raw_sock_children</varname> (integer)</title>
  327. <para>
  328. Parameter define how many children that must be created to listen the raw socket.
  329. </para>
  330. <para>
  331. <emphasis>
  332. Default value is "1".
  333. </emphasis>
  334. </para>
  335. <example>
  336. <title>Set <varname>raw_sock_children</varname> parameter</title>
  337. <programlisting format="linespecific">
  338. ...
  339. modparam("sipcapture", "raw_sock_children", 6)
  340. ...
  341. </programlisting>
  342. </example>
  343. </section>
  344. <section id="sipcapture.p.promiscuous_on">
  345. <title><varname>promiscuous_on</varname> (integer)</title>
  346. <para>
  347. Parameter to enable/disable promiscuous mode on the raw socket.
  348. Linux only.
  349. </para>
  350. <para>
  351. <emphasis>
  352. Default value is "0".
  353. </emphasis>
  354. </para>
  355. <example>
  356. <title>Set <varname>promiscous_on</varname> parameter</title>
  357. <programlisting format="linespecific">
  358. ...
  359. modparam("sipcapture", "promiscuous_on", 1)
  360. ...
  361. </programlisting>
  362. </example>
  363. </section>
  364. <section id="sipcapture.p.raw_moni_bpf_on">
  365. <title><varname>raw_moni_bpf_on</varname> (integer)</title>
  366. <para>
  367. Activate Linux Socket Filter (LSF based on BPF) on the mirroring interface.
  368. The structure is defined in linux/filter.h. The default LSF accept a port/portrange
  369. from the raw_socket_listen param. Currently LSF supported only on Linux.
  370. </para>
  371. <para>
  372. <emphasis>
  373. Default value is "0".
  374. </emphasis>
  375. </para>
  376. <example>
  377. <title>Set <varname>raw_moni_bpf_on</varname> parameter</title>
  378. <programlisting format="linespecific">
  379. ...
  380. modparam("sipcapture", "raw_moni_bpf_on", 1)
  381. ...
  382. </programlisting>
  383. </example>
  384. </section>
  385. <section id="sipcapture.p.capture_node">
  386. <title><varname>capture_node</varname> (str)</title>
  387. <para>
  388. Name of the capture node.
  389. </para>
  390. <para>
  391. <emphasis>
  392. Default value is "homer01".
  393. </emphasis>
  394. </para>
  395. <example>
  396. <title>Set <varname>capture_node</varname> parameter</title>
  397. <programlisting format="linespecific">
  398. ...
  399. modparam("sipcapture", "capture_node", "homer03")
  400. ...
  401. </programlisting>
  402. </example>
  403. </section>
  404. <section id="sipcapture.p.insert_retries">
  405. <title><varname>insert_retries</varname> (integer)</title>
  406. <para>
  407. The number of times Kamailio should retry to write to the Homer database in case
  408. the first attempt failed. The retry is also limited timewise by the
  409. insert_retry_timeout parameter. Values allowed range from 0 to 500.
  410. </para>
  411. <para>
  412. <emphasis>
  413. Default value is 0 (no retries).
  414. </emphasis>
  415. </para>
  416. <example>
  417. <title>Set <varname>insert_retries</varname> parameter</title>
  418. <programlisting format="linespecific">
  419. ...
  420. modparam("sipcapture", "insert_retries", 5)
  421. ...
  422. </programlisting>
  423. </example>
  424. </section>
  425. <section id="sipcapture.p.insert_retry_timeout">
  426. <title><varname>insert_retry_timeout</varname> (integer)</title>
  427. <para>
  428. The time limit in seconds Kamailio retries to write to the Homer database in case
  429. the first attempt failed. This parameter is only used together with the insert_retries
  430. parameter. Values allowed range from 0 to 300.
  431. </para>
  432. <para>
  433. <emphasis>
  434. Default value is 60 seconds.
  435. </emphasis>
  436. </para>
  437. <example>
  438. <title>Set <varname>insert_retry_timeout</varname> parameter</title>
  439. <programlisting format="linespecific">
  440. ...
  441. modparam("sipcapture", "insert_retry_timeout", 10)
  442. ...
  443. </programlisting>
  444. </example>
  445. </section>
  446. </section>
  447. <section>
  448. <title>MI Commands</title>
  449. <section id="sipcapture.m.sip_capture">
  450. <title>
  451. <function moreinfo="none">sip_capture</function>
  452. </title>
  453. <para>
  454. </para>
  455. <para>
  456. Name: <emphasis>sip_capture</emphasis>
  457. </para>
  458. <para>Parameters: </para>
  459. <itemizedlist>
  460. <listitem><para>capture_mode : turns on/off SIP message capturing.
  461. Possible values are:</para>
  462. <itemizedlist>
  463. <listitem><para> on </para></listitem>
  464. <listitem><para> off </para></listitem>
  465. </itemizedlist>
  466. <para>The parameter is optional - if missing, the command will
  467. return the status of the SIP message capturing (as string
  468. <quote>on</quote> or <quote>off</quote> ) without changing
  469. anything.</para>
  470. </listitem>
  471. </itemizedlist>
  472. <para>
  473. MI FIFO Command Format:
  474. </para>
  475. <programlisting format="linespecific">
  476. :sip_capture:_reply_fifo_file_
  477. capture_mode
  478. _empty_line_
  479. </programlisting>
  480. </section>
  481. </section><!-- MI commands -->
  482. <section>
  483. <title>RPC Commands</title>
  484. <section id="sipcapture.r.sipcapture.status">
  485. <title>
  486. <function moreinfo="none">sipcapture.status param</function>
  487. </title>
  488. <para>
  489. </para>
  490. <para>
  491. Name: <emphasis>sipcapture.status</emphasis>
  492. </para>
  493. <para>Parameters: </para>
  494. <itemizedlist>
  495. <listitem><para>on or off: turns on/off SIP message capturing.
  496. Possible values are:</para>
  497. <itemizedlist>
  498. <listitem><para>on</para></listitem>
  499. <listitem><para>off</para></listitem>
  500. </itemizedlist>
  501. </listitem>
  502. <listitem><para><quote>check</quote> does not change
  503. sipcapture status, just reports the current status.</para>
  504. </listitem>
  505. </itemizedlist>
  506. </section>
  507. </section><!-- RPC commands -->
  508. <section>
  509. <title>Database setup</title>
  510. <para>
  511. Before running &kamailio; with the sipcapture module, you have to setup the database
  512. tables where the module will store the data. For that, if the table were not
  513. created by the installation script or you choose to install everything by
  514. yourself you can use the sipcapture_create.sql, <acronym>SQL</acronym> script
  515. in the sql folder of sipcapture module as template. You can also find the
  516. complete database documentation on the project webpage, &kamailiodbdocslink;.
  517. </para>
  518. </section>
  519. <section>
  520. <title>Limitations</title>
  521. <itemizedlist>
  522. <listitem>
  523. 1. Only one capturing mode on RAW socket is supported: IPIP or monitoring/mirroring port.
  524. Don't activate both at the same time.
  525. </listitem><listitem>
  526. 2. By default MySQL doesn't support INSERT DELAYED for partitioning table. You can patch MySQL
  527. (http://bugs.mysql.com/bug.php?id=50393)
  528. </listitem><listitem>
  529. 3. Mirroring port capturing works only on Linux.
  530. </listitem>
  531. </itemizedlist>
  532. </section>
  533. </chapter>