app_python_admin.xml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 allows executing Python scripts from config file,
  15. exporting functions to access the SIP message from Python.
  16. </para>
  17. </section>
  18. <section>
  19. <title>Dependencies</title>
  20. <section>
  21. <title>&kamailio; Modules</title>
  22. <para>
  23. The following modules must be loaded before this module:
  24. <itemizedlist>
  25. <listitem>
  26. <para>
  27. <emphasis>none</emphasis>.
  28. </para>
  29. </listitem>
  30. </itemizedlist>
  31. </para>
  32. </section>
  33. <section>
  34. <title>External Libraries or Applications</title>
  35. <para>
  36. The following libraries or applications must be installed before running
  37. &kamailio; with this module loaded:
  38. <itemizedlist>
  39. <listitem>
  40. <para>
  41. <emphasis>python-dev</emphasis> - Python devel library.
  42. </para>
  43. </listitem>
  44. </itemizedlist>
  45. </para>
  46. </section>
  47. </section>
  48. <section>
  49. <title>Parameters</title>
  50. <section>
  51. <title><varname>script_name</varname> (string)</title>
  52. <para>
  53. TBD.
  54. </para>
  55. <para>
  56. <emphasis>
  57. Default value is <quote>/usr/local/etc/sip-router/handler.py</quote>.
  58. </emphasis>
  59. </para>
  60. <example>
  61. <title>Set <varname>script_name</varname> parameter</title>
  62. <programlisting format="linespecific">
  63. ...
  64. modparam("app_python", "script_name", "/usr/local/etc/sip-router/myscript.py")
  65. ...
  66. </programlisting>
  67. </example>
  68. </section>
  69. <section>
  70. <title><varname>mod_init_function</varname> (string)</title>
  71. <para>
  72. TBD.
  73. </para>
  74. <para>
  75. <emphasis>
  76. Default value is <quote>mod_init</quote>.
  77. </emphasis>
  78. </para>
  79. <example>
  80. <title>Set <varname>mod_init_function</varname> parameter</title>
  81. <programlisting format="linespecific">
  82. ...
  83. modparam("app_python", "mod_init_function", "my_mod_init")
  84. ...
  85. </programlisting>
  86. </example>
  87. </section>
  88. <section>
  89. <title><varname>child_init_method</varname> (string)</title>
  90. <para>
  91. TBD.
  92. </para>
  93. <para>
  94. <emphasis>
  95. Default value is <quote>child_init</quote>.
  96. </emphasis>
  97. </para>
  98. <example>
  99. <title>Set <varname>child_init_method</varname> parameter</title>
  100. <programlisting format="linespecific">
  101. ...
  102. modparam("app_python", "child_init_method", "my_child_init")
  103. ...
  104. </programlisting>
  105. </example>
  106. </section>
  107. </section>
  108. <section>
  109. <title>Functions</title>
  110. <section>
  111. <title>
  112. <function moreinfo="none">python_exec(method [, mystr])</function>
  113. </title>
  114. <para>
  115. TBD.
  116. </para>
  117. <example>
  118. <title><function>python_exec</function> usage</title>
  119. <programlisting format="linespecific">
  120. ...
  121. python_exec("...");
  122. python_exec("...", "...");
  123. ...
  124. </programlisting>
  125. </example>
  126. </section>
  127. </section>
  128. </chapter>