kex_admin.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  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. This module collects extensions from &kamailio; core.
  15. </para>
  16. <para>
  17. &kamailio; Core CookBook is available at:
  18. <ulink url="http://kamailio.org/dokuwiki/">
  19. http://kamailio.org/dokuwiki/</ulink>
  20. </para>
  21. </section>
  22. <section>
  23. <title>Dependencies</title>
  24. <section>
  25. <title>&kamailio; Modules</title>
  26. <para>
  27. The following modules must be loaded before this module:
  28. <itemizedlist>
  29. <listitem>
  30. <para>
  31. <emphasis>No dependencies on other &kamailio; modules</emphasis>.
  32. </para>
  33. </listitem>
  34. </itemizedlist>
  35. </para>
  36. </section>
  37. <section>
  38. <title>External Libraries or Applications</title>
  39. <para>
  40. The following libraries or applications must be installed before running
  41. &kamailio; with this module loaded:
  42. <itemizedlist>
  43. <listitem>
  44. <para>
  45. <emphasis>None</emphasis>.
  46. </para>
  47. </listitem>
  48. </itemizedlist>
  49. </para>
  50. </section>
  51. </section>
  52. <section>
  53. <title>Functions</title>
  54. <section id="kex.f.setsflag">
  55. <title><function moreinfo="none">setsflag(flag)</function></title>
  56. <para>
  57. Set the script flag.
  58. </para>
  59. <para>Meaning of the parameters is as follows:</para>
  60. <itemizedlist>
  61. <listitem>
  62. <para>
  63. <emphasis>flag</emphasis> - the index of the script flag to
  64. be set. Can be integer or pseudo-variable with integer value.
  65. </para>
  66. </listitem>
  67. </itemizedlist>
  68. <para>
  69. This function can be used from ANY_ROUTE.
  70. </para>
  71. <example>
  72. <title><function>setsflag</function> usage</title>
  73. <programlisting format="linespecific">
  74. ...
  75. setsflag("1");
  76. ...
  77. $var(flag) = 11;
  78. setsflag("$var(flag)");
  79. ...
  80. </programlisting>
  81. </example>
  82. </section>
  83. <section id="kex.f.issflagset">
  84. <title><function moreinfo="none">issflagset(flag)</function></title>
  85. <para>
  86. Return true of the script flag is set.
  87. </para>
  88. <para>Meaning of the parameters is as follows:</para>
  89. <itemizedlist>
  90. <listitem>
  91. <para>
  92. <emphasis>flag</emphasis> - the index of the script flag to
  93. be tested. Can be integer or pseudo-variable with integer value.
  94. </para>
  95. </listitem>
  96. </itemizedlist>
  97. <para>
  98. This function can be used from ANY_ROUTE.
  99. </para>
  100. <example>
  101. <title><function>issflagset</function> usage</title>
  102. <programlisting format="linespecific">
  103. ...
  104. if(issflagset("1"))
  105. {
  106. ...
  107. }
  108. ...
  109. </programlisting>
  110. </example>
  111. </section>
  112. <section id="kex.f.resetsflag">
  113. <title><function moreinfo="none">resetsflag(flag)</function></title>
  114. <para>
  115. Reset the script flag.
  116. </para>
  117. <para>Meaning of the parameters is as follows:</para>
  118. <itemizedlist>
  119. <listitem>
  120. <para>
  121. <emphasis>flag</emphasis> - the index of the script flag to
  122. be reset. Can be integer or pseudo-variable with integer value.
  123. </para>
  124. </listitem>
  125. </itemizedlist>
  126. <para>
  127. This function can be used from ANY_ROUTE.
  128. </para>
  129. <example>
  130. <title><function>resetsflag</function> usage</title>
  131. <programlisting format="linespecific">
  132. ...
  133. resetsflag("1");
  134. ...
  135. </programlisting>
  136. </example>
  137. </section>
  138. <section id="kex.f.setbflag">
  139. <title><function moreinfo="none">setbflag(flag [, branch])</function></title>
  140. <para>
  141. Set the branch flag.
  142. </para>
  143. <para>Meaning of the parameters is as follows:</para>
  144. <itemizedlist>
  145. <listitem>
  146. <para>
  147. <emphasis>flag</emphasis> - the index of the branch flag to
  148. be set. Can be integer or pseudo-variable with integer value.
  149. </para>
  150. </listitem>
  151. <listitem>
  152. <para>
  153. <emphasis>branch</emphasis> - the index of the branch whose
  154. flag to be set. Can be integer or pseudo-variable with integer
  155. value. If omitted, then branch 0 is used (R-URI).
  156. </para>
  157. </listitem>
  158. </itemizedlist>
  159. <para>
  160. This function can be used from ANY_ROUTE.
  161. </para>
  162. <example>
  163. <title><function>setbflag</function> usage</title>
  164. <programlisting format="linespecific">
  165. ...
  166. setbflag("1");
  167. ...
  168. $var(flag) = 11;
  169. setbflag("$var(flag)", "1");
  170. ...
  171. </programlisting>
  172. </example>
  173. </section>
  174. <section id="kex.f.isbflagset">
  175. <title><function moreinfo="none">isbflagset(flag [, branch])</function></title>
  176. <para>
  177. Return true of the branch flag is set.
  178. </para>
  179. <para>Meaning of the parameters is as follows:</para>
  180. <itemizedlist>
  181. <listitem>
  182. <para>
  183. <emphasis>flag</emphasis> - the index of the branch flag to
  184. be tested. Can be integer or pseudo-variable with integer value.
  185. </para>
  186. </listitem>
  187. <listitem>
  188. <para>
  189. <emphasis>branch</emphasis> - the index of the branch whose
  190. flag to be set. Can be integer or pseudo-variable with integer
  191. value. If omitted, then branch 0 is used (R-URI).
  192. </para>
  193. </listitem>
  194. </itemizedlist>
  195. <para>
  196. This function can be used from ANY_ROUTE.
  197. </para>
  198. <example>
  199. <title><function>isbflagset</function> usage</title>
  200. <programlisting format="linespecific">
  201. ...
  202. if(isbflagset("1"))
  203. {
  204. ...
  205. }
  206. ...
  207. </programlisting>
  208. </example>
  209. </section>
  210. <section id="kex.f.resetbflag">
  211. <title><function moreinfo="none">resetbflag(flag [, branch])</function></title>
  212. <para>
  213. Reset the branch flag.
  214. </para>
  215. <para>Meaning of the parameters is as follows:</para>
  216. <itemizedlist>
  217. <listitem>
  218. <para>
  219. <emphasis>flag</emphasis> - the index of the branch flag to
  220. be reset. Can be integer or pseudo-variable with integer value.
  221. </para>
  222. </listitem>
  223. <listitem>
  224. <para>
  225. <emphasis>branch</emphasis> - the index of the branch whose
  226. flag to be set. Can be integer or pseudo-variable with integer
  227. value. If omitted, then branch 0 is used (R-URI).
  228. </para>
  229. </listitem>
  230. </itemizedlist>
  231. <para>
  232. This function can be used from ANY_ROUTE.
  233. </para>
  234. <example>
  235. <title><function>resetbflag</function> usage</title>
  236. <programlisting format="linespecific">
  237. ...
  238. resetbflag("1");
  239. ...
  240. </programlisting>
  241. </example>
  242. </section>
  243. <section id="kex.f.setdsturi">
  244. <title><function moreinfo="none">setdsturi(uri)</function></title>
  245. <para>
  246. Set the destination address URI (outbound proxy address).
  247. </para>
  248. <para>Meaning of the parameters is as follows:</para>
  249. <itemizedlist>
  250. <listitem>
  251. <para>
  252. <emphasis>uri</emphasis> - Valid SIP URI representing the
  253. address where to send the request. It must be a static string,
  254. no variables are evaluated at runtime. If you need to set
  255. outbound proxy address via a variable, use assginment to
  256. <emphasis>$du</emphasis>.
  257. </para>
  258. </listitem>
  259. </itemizedlist>
  260. <para>
  261. This function can be used from ANY_ROUTE.
  262. </para>
  263. <example>
  264. <title><function>setdsturi</function> usage</title>
  265. <programlisting format="linespecific">
  266. ...
  267. setdsturi("sip:10.0.0.10");
  268. ...
  269. </programlisting>
  270. </example>
  271. </section>
  272. <section id="kex.f.resetdsturi">
  273. <title><function moreinfo="none">resetdsturi()</function></title>
  274. <para>
  275. Reset the destination address URI (outbound proxy address).
  276. </para>
  277. <para>
  278. This function can be used from ANY_ROUTE.
  279. </para>
  280. <example>
  281. <title><function>resetdsturi</function> usage</title>
  282. <programlisting format="linespecific">
  283. ...
  284. resetdsturi();
  285. ...
  286. </programlisting>
  287. </example>
  288. </section>
  289. <section id="kex.f.isdsturiset">
  290. <title><function moreinfo="none">isdsturiset()</function></title>
  291. <para>
  292. Check if the destination address URI (outbound proxy address)
  293. is set.
  294. </para>
  295. <para>
  296. This function can be used from ANY_ROUTE.
  297. </para>
  298. <example>
  299. <title><function>isdsturiset</function> usage</title>
  300. <programlisting format="linespecific">
  301. ...
  302. if(isdsturiset())
  303. {
  304. ...
  305. }
  306. ...
  307. </programlisting>
  308. </example>
  309. </section>
  310. <section id="kex.f.pv_printf">
  311. <title><function moreinfo="none">pv_printf(var, str)</function></title>
  312. <para>
  313. Evalues the str and sets the resulting value to variable var. For
  314. backward compatibility reasons, the same function can be executed via
  315. 'avp_printf(var, str)'.
  316. </para>
  317. <para>Meaning of the parameters is as follows:</para>
  318. <itemizedlist>
  319. <listitem>
  320. <para>
  321. <emphasis>var</emphasis> - name of a writable variable
  322. </para>
  323. </listitem>
  324. <listitem>
  325. <para>
  326. <emphasis>str</emphasis> - string that may contain variables
  327. which will be evaluated at runtime.
  328. </para>
  329. </listitem>
  330. </itemizedlist>
  331. <para>
  332. This function can be used from ANY_ROUTE.
  333. </para>
  334. <example>
  335. <title><function>pv_printf</function> usage</title>
  336. <programlisting format="linespecific">
  337. ...
  338. pv_printf("$ru", "sip:$rU@$fd");
  339. pv_printf("$avp(x)", "From: $fU - To: $tU");
  340. ...
  341. </programlisting>
  342. </example>
  343. </section>
  344. <section id="kex.f.is_myself">
  345. <title><function moreinfo="none">is_myself(uri)</function></title>
  346. <para>
  347. Check if the parameter matches the 'myself' condition (i.e., is
  348. a local IP or domain).
  349. </para>
  350. <para>Meaning of the parameters is as follows:</para>
  351. <itemizedlist>
  352. <listitem>
  353. <para>
  354. <emphasis>uri</emphasis> - Valid SIP URI or IP address to
  355. check against the list of local IP addresses or domains.
  356. The parameter value can contain pseudo-variables.
  357. </para>
  358. </listitem>
  359. </itemizedlist>
  360. <para>
  361. This function can be used from ANY_ROUTE.
  362. </para>
  363. <example>
  364. <title><function>is_myself</function> usage</title>
  365. <programlisting format="linespecific">
  366. ...
  367. if(is_myself("$fu")) {
  368. ...
  369. }
  370. ...
  371. </programlisting>
  372. </example>
  373. </section>
  374. <section id="kex.f.setdebug">
  375. <title><function moreinfo="none">setdebug(level)</function></title>
  376. <para>
  377. Set the debug log level per process.
  378. </para>
  379. <para>Meaning of the parameters is as follows:</para>
  380. <itemizedlist>
  381. <listitem>
  382. <para>
  383. <emphasis>level</emphasis> - the debug log level to
  384. be set. Can be integer or pseudo-variable with integer value.
  385. </para>
  386. </listitem>
  387. </itemizedlist>
  388. <para>
  389. This function can be used from ANY_ROUTE.
  390. </para>
  391. <example>
  392. <title><function>setdebug</function> usage</title>
  393. <programlisting format="linespecific">
  394. ...
  395. setdebug("1");
  396. ...
  397. $var(level) = 2;
  398. setdebug("$var(level)");
  399. ...
  400. </programlisting>
  401. </example>
  402. </section>
  403. <section id="kex.f.resetdebug">
  404. <title><function moreinfo="none">resetdebug()</function></title>
  405. <para>
  406. Reset the local debug log level back to the value of core parameter
  407. 'debug'.
  408. </para>
  409. <para>
  410. This function can be used from ANY_ROUTE.
  411. </para>
  412. <example>
  413. <title><function>resetdebug</function> usage</title>
  414. <programlisting format="linespecific">
  415. ...
  416. resetdebug();
  417. ...
  418. </programlisting>
  419. </example>
  420. </section>
  421. <section id="kex.f.km_append_branch">
  422. <title><function moreinfo="none">km_append_branch([uri])</function></title>
  423. <para>
  424. This function was replaced by append_branch() from corex module, starting with
  425. version 4.0.0.
  426. </para>
  427. </section>
  428. </section>
  429. <section>
  430. <title>MI Commands</title>
  431. <section id="kex.m.arg">
  432. <title>
  433. <function moreinfo="none">arg</function>
  434. </title>
  435. <para>
  436. Print command line arguments.
  437. </para>
  438. <para>
  439. Name: <emphasis>arg</emphasis>
  440. </para>
  441. <para>Parameters: <emphasis>none</emphasis>.</para>
  442. <para>
  443. MI FIFO Command Format:
  444. </para>
  445. <programlisting format="linespecific">
  446. :arg:_reply_fifo_file_
  447. _empty_line_
  448. </programlisting>
  449. </section>
  450. <section id="kex.m.kill">
  451. <title>
  452. <function moreinfo="none">kill</function>
  453. </title>
  454. <para>
  455. Kill the application.
  456. </para>
  457. <para>
  458. Name: <emphasis>kill</emphasis>
  459. </para>
  460. <para>Parameters: <emphasis>none</emphasis>.</para>
  461. <para>
  462. MI FIFO Command Format:
  463. </para>
  464. <programlisting format="linespecific">
  465. :kill:_reply_fifo_file_
  466. _empty_line_
  467. </programlisting>
  468. </section>
  469. <section id="kex.m.pwd">
  470. <title>
  471. <function moreinfo="none">pwd</function>
  472. </title>
  473. <para>
  474. Print working directory.
  475. </para>
  476. <para>
  477. Name: <emphasis>pwd</emphasis>
  478. </para>
  479. <para>Parameters: <emphasis>none</emphasis>.</para>
  480. <para>
  481. MI FIFO Command Format:
  482. </para>
  483. <programlisting format="linespecific">
  484. :pwd:_reply_fifo_file_
  485. _empty_line_
  486. </programlisting>
  487. </section>
  488. <section id="kex.m.uptime">
  489. <title>
  490. <function moreinfo="none">uptime</function>
  491. </title>
  492. <para>
  493. Print uptime.
  494. </para>
  495. <para>
  496. Name: <emphasis>uptime</emphasis>
  497. </para>
  498. <para>Parameters: <emphasis>none</emphasis>.</para>
  499. <para>
  500. MI FIFO Command Format:
  501. </para>
  502. <programlisting format="linespecific">
  503. :uptime:_reply_fifo_file_
  504. _empty_line_
  505. </programlisting>
  506. </section>
  507. <section id="kex.m.version">
  508. <title>
  509. <function moreinfo="none">version</function>
  510. </title>
  511. <para>
  512. Print version information.
  513. </para>
  514. <para>
  515. Name: <emphasis>version</emphasis>
  516. </para>
  517. <para>Parameters: <emphasis>none</emphasis>.</para>
  518. <para>
  519. MI FIFO Command Format:
  520. </para>
  521. <programlisting format="linespecific">
  522. :version:_reply_fifo_file_
  523. _empty_line_
  524. </programlisting>
  525. </section>
  526. <section id="kex.m.which">
  527. <title>
  528. <function moreinfo="none">which</function>
  529. </title>
  530. <para>
  531. Print list of available MI commands.
  532. </para>
  533. <para>
  534. Name: <emphasis>which</emphasis>
  535. </para>
  536. <para>Parameters: <emphasis>none</emphasis>.</para>
  537. <para>
  538. MI FIFO Command Format:
  539. </para>
  540. <programlisting format="linespecific">
  541. :which:_reply_fifo_file_
  542. _empty_line_
  543. </programlisting>
  544. </section>
  545. <section id="kex.m.get_statistics">
  546. <title>
  547. <function moreinfo="none">get_statistics</function>
  548. </title>
  549. <para>
  550. Print the list of available internal statistics.
  551. </para>
  552. <para>
  553. Name: <emphasis>get_statistics</emphasis>
  554. </para>
  555. <para>Parameters: <emphasis>statsid</emphasis> - which statistics to
  556. be printed. If set to 'all' then all statistics are printed; if
  557. set to 'statsgroup:' then all statistics in the group are printed;
  558. if set to 'statsname' then the statistics identified by the name
  559. is printed.</para>
  560. <para>
  561. MI FIFO Command Format:
  562. </para>
  563. <programlisting format="linespecific">
  564. :get_statistics:_reply_fifo_file_
  565. _statsid_
  566. _empty_line_
  567. </programlisting>
  568. </section>
  569. <section id="kex.m.reset_statistics">
  570. <title>
  571. <function moreinfo="none">reset_statistics</function>
  572. </title>
  573. <para>
  574. Reset internal statistics.
  575. </para>
  576. <para>
  577. Name: <emphasis>reset_statistics</emphasis>
  578. </para>
  579. <para>Parameters: <emphasis>statsid</emphasis> - which statistics to
  580. be reset, give as name.</para>
  581. <para>
  582. MI FIFO Command Format:
  583. </para>
  584. <programlisting format="linespecific">
  585. :reset_statistics:_reply_fifo_file_
  586. _statsid_
  587. _empty_line_
  588. </programlisting>
  589. </section>
  590. <section id="kex.m.clear_statistics">
  591. <title>
  592. <function moreinfo="none">clear_statistics</function>
  593. </title>
  594. <para>
  595. Return statistics and reset their value in one command.
  596. </para>
  597. <para>
  598. Name: <emphasis>get_statistics</emphasis>
  599. </para>
  600. <para>Parameters: <emphasis>statsid</emphasis> - same as for
  601. get_statistics.</para>
  602. <para>
  603. MI FIFO Command Format:
  604. </para>
  605. <programlisting format="linespecific">
  606. :clear_statistics:_reply_fifo_file_
  607. _statsid_
  608. _empty_line_
  609. </programlisting>
  610. </section>
  611. </section>
  612. <section>
  613. <title>RPC Commands</title>
  614. <section id="kex.r.pkg.stats">
  615. <title>
  616. <function moreinfo="none">pkg.stats</function>
  617. </title>
  618. <para>
  619. Print private memory (pkg) usage statistics per process. It
  620. can take optinally a filter to print statistics only for a
  621. specific process or set of processes. If no filter is given,
  622. it prints statistics for all processes.
  623. </para>
  624. <para>The filter can be:</para>
  625. <itemizedlist>
  626. <listitem>
  627. <para>
  628. <emphasis>pid value</emphasis> - print statistics for
  629. specific process pid.
  630. </para>
  631. </listitem>
  632. <listitem>
  633. <para>
  634. <emphasis>rank value</emphasis> - print statistics for
  635. specific process rank.
  636. </para>
  637. </listitem>
  638. <listitem>
  639. <para>
  640. <emphasis>index value</emphasis> - print statistics for
  641. specific index in process table.
  642. </para>
  643. </listitem>
  644. </itemizedlist>
  645. <para>
  646. Examples:
  647. </para>
  648. <programlisting format="linespecific">
  649. &sercmd; pkg.stats
  650. &sercmd; pkg.stats pid 1234
  651. &sercmd; pkg.stats rank 1
  652. &sercmd; pkg.stats index 10
  653. </programlisting>
  654. </section>
  655. <section id="kex.r.stats.get_statistics">
  656. <title>
  657. <function moreinfo="none">stats.get_statistics</function>
  658. </title>
  659. <para>Print the list of available internal statistics.</para>
  660. <para>Parameters: <emphasis>statsid</emphasis> - which statistics to
  661. be printed. If set to 'all' then all statistics are printed; if
  662. set to 'statsgroup:' then all statistics in the group are printed;
  663. if set to 'statsname' then the statistics identified by the name
  664. is printed.</para>
  665. <para>Examples:</para>
  666. <programlisting format="linespecific">
  667. &sercmd; stats.get_statistics all
  668. &sercmd; stats.get_statistics core:
  669. &sercmd; stats.get_statistics unsupported_methods
  670. &sercmd; stats.get_statistics shmem: fwd_requests fwd_replies
  671. </programlisting>
  672. </section>
  673. <section id="kex.r.stats.reset_statistics">
  674. <title>
  675. <function moreinfo="none">stats.reset_statistics</function>
  676. </title>
  677. <para>Reset internal statistics.</para>
  678. <para>
  679. Parameters: <emphasis>statsid</emphasis> - same as for get_statistics.
  680. </para>
  681. <para>Examples:</para>
  682. <programlisting format="linespecific">
  683. &sercmd; stats.reset_statistics all
  684. &sercmd; stats.reset_statistics core:
  685. &sercmd; stats.reset_statistics unsupported_methods
  686. &sercmd; stats.reset_statistics shmem: fwd_requests fwd_replies
  687. </programlisting>
  688. </section>
  689. <section id="kex.r.stats.clear_statistics">
  690. <title>
  691. <function moreinfo="none">stats.clear_statistics</function>
  692. </title>
  693. <para>Return statistics and reset their value in one command.</para>
  694. <para>
  695. Parameters: <emphasis>statsid</emphasis> - same as for get_statistics.
  696. </para>
  697. <para>Examples:</para>
  698. <programlisting format="linespecific">
  699. &sercmd; stats.reset_statistics all
  700. &sercmd; stats.reset_statistics core:
  701. &sercmd; stats.reset_statistics unsupported_methods
  702. &sercmd; stats.reset_statistics shmem: fwd_requests fwd_replies
  703. </programlisting>
  704. </section>
  705. </section>
  706. </chapter>