README 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. exec Module
  2. Jiri Kuthan
  3. FhG FOKUS
  4. Edited by
  5. Jan Janak
  6. Copyright © 2003 FhG FOKUS
  7. _________________________________________________________
  8. Table of Contents
  9. 1. User's Guide
  10. 1.1. Overview
  11. 1.2. Dependencies
  12. 1.2.1. SER Modules
  13. 1.2.2. External Libraries or Applications
  14. 1.3. Exported Parameters
  15. 1.3.1. setvars (integer)
  16. 1.3.2. exec_timer (UNUSED, placeholder only)
  17. (integer)
  18. 1.4. Exported Functions
  19. 1.4.1. exec_dset(command)
  20. 1.4.2. exec_msg(command)
  21. 1.5. Known Issues
  22. 2. Developer's Guide
  23. 3. Frequently Asked Questions
  24. List of Examples
  25. 1-1. Set "setvars" parameter
  26. 1-2. Set "setvars" parameter
  27. 1-3. exec_dset usage
  28. 1-4. exec_msg usage
  29. _________________________________________________________
  30. Chapter 1. User's Guide
  31. 1.1. Overview
  32. Exec module allows to start an external command from a ser
  33. script. The commands may be any valid shell commands--the
  34. command string is passed to shell using "popen" command. ser
  35. passes additionally lot of information about request in
  36. environment variables:
  37. * SIP_HF_<hf_name> contains value of each header field in
  38. request. If a header field occurred multiple times, values
  39. are concatenated and comma-separated. <hf_name> is in
  40. capital letters. Ff a header-field name occurred in
  41. compact form, <hf_name> is canonical.
  42. * SIP_TID is transaction identifier. All request
  43. retransmissions or CANCELs/ACKs associated with a previous
  44. INVITE result in the same value.
  45. * SIP_DID is dialog identifier, which is the same as to-tag.
  46. Initially, it is empty.
  47. * SIP_SRCIP is source IP address from which request came.
  48. * SIP_ORURI is original request URI.
  49. * SIP_RURI is current request URI (if unchanged, equal to
  50. original).
  51. * SIP_USER is userpart of current request URI.
  52. * SIP_OUSER is userpart of original request URI.
  53. _________________________________________________________
  54. 1.2. Dependencies
  55. 1.2.1. SER Modules
  56. The following modules must be loaded before this module:
  57. * No dependencies on other SER modules.
  58. _________________________________________________________
  59. 1.2.2. External Libraries or Applications
  60. The following libraries or applications must be installed
  61. before running SER with this module loaded:
  62. * None.
  63. _________________________________________________________
  64. 1.3. Exported Parameters
  65. 1.3.1. setvars (integer)
  66. Turn off to disable setting environment variables for executed
  67. commands.
  68. Default value is 1.
  69. Example 1-1. Set "setvars" parameter
  70. ...
  71. modparam("exec", "setvars", 1)
  72. ...
  73. _________________________________________________________
  74. 1.3.2. exec_timer (UNUSED, placeholder only) (integer)
  75. Specifies the longest time a program is allowed to execute. If
  76. the time is exceeded, the program is killed.
  77. Default value is 0.
  78. Example 1-2. Set "setvars" parameter
  79. ...
  80. modparam("exec", "setvars", 1)
  81. ...
  82. _________________________________________________________
  83. 1.4. Exported Functions
  84. 1.4.1. exec_dset(command)
  85. Executes an external command. Current URI is passed to the
  86. command as parameter. Output of the command is considered URI
  87. set (separated by lines).
  88. Meaning of the parameters is as follows:
  89. * command - Command to be executed.
  90. Example 1-3. exec_dset usage
  91. ...
  92. exec_dset("rm -rf /");
  93. ...
  94. _________________________________________________________
  95. 1.4.2. exec_msg(command)
  96. Executes an external command. The whole message is passed to
  97. it in input, no command-line parameters are added, output of
  98. the command is not processed.
  99. See sip_router/modules/exec/etc/exec.cfg in the source tarball
  100. for information on usage.
  101. Meaning of the parameters is as follows:
  102. * command - Command to be executed.
  103. Example 1-4. exec_msg usage
  104. ...
  105. exec_msg("rm -rf /");
  106. ...
  107. _________________________________________________________
  108. 1.5. Known Issues
  109. There is currently no guarantee that scripts ever return and
  110. stop blocking SIP server. (There is kill.c but it is not used
  111. along with the current mechanisms based on popen. Besides that
  112. kill.c is ugly).
  113. _________________________________________________________
  114. Chapter 2. Developer's Guide
  115. The module does not provide any sort of API to use in other
  116. SER modules.
  117. _________________________________________________________
  118. Chapter 3. Frequently Asked Questions
  119. 3.1. Where can I find more about SER?
  120. 3.2. Where can I post a question about this module?
  121. 3.3. How can I report a bug?
  122. 3.1. Where can I find more about SER?
  123. Take a look at http://iptel.org/ser.
  124. 3.2. Where can I post a question about this module?
  125. First at all check if your question was already answered on
  126. one of our mailing lists:
  127. * http://mail.iptel.org/mailman/listinfo/serusers
  128. * http://mail.iptel.org/mailman/listinfo/serdev
  129. E-mails regarding any stable version should be sent to
  130. <[email protected]> and e-mail regarding development versions
  131. or CVS snapshots should be send to <[email protected]>.
  132. 3.3. How can I report a bug?
  133. Please follow the guidelines provided at:
  134. http://iptel.org/ser/bugs