Browse code

modules: readme files regenerated - xhttp ... [skip ci]

Kamailio Dev authored on 18/04/2017 12:16:42
Showing 1 changed files
... ...
@@ -1,182 +1,2 @@
1
-xHTTP Module
2 1
 
3
-Daniel-Constantin Mierla
4 2
 
5
-   <miconda@gmail.com>
6
-
7
-Edited by
8
-
9
-Daniel-Constantin Mierla
10
-
11
-   <miconda@gmail.com>
12
-
13
-Edited by
14
-
15
-Alex Balashov
16
-
17
-   <abalashov@evaristesys.com>
18
-
19
-   Copyright © 2010 asipto.com
20
-     __________________________________________________________________
21
-
22
-   Table of Contents
23
-
24
-   1. Admin Guide
25
-
26
-        1. Overview
27
-        2. Note on Latency
28
-        3. Dependencies
29
-
30
-              3.1. Kamailio Modules
31
-              3.2. Kamailio Core Settings
32
-              3.3. External Libraries or Applications
33
-
34
-        4. Parameters
35
-
36
-              4.1. url_skip (str)
37
-              4.2. url_match (str)
38
-
39
-        5. Functions
40
-
41
-              5.1. xhttp_reply(code, reason, ctype, body)
42
-
43
-   List of Examples
44
-
45
-   1.1. Set url_skip parameter
46
-   1.2. Set url_match parameter
47
-   1.3. xhttp_reply usage
48
-
49
-Chapter 1. Admin Guide
50
-
51
-   Table of Contents
52
-
53
-   1. Overview
54
-   2. Note on Latency
55
-   3. Dependencies
56
-
57
-        3.1. Kamailio Modules
58
-        3.2. Kamailio Core Settings
59
-        3.3. External Libraries or Applications
60
-
61
-   4. Parameters
62
-
63
-        4.1. url_skip (str)
64
-        4.2. url_match (str)
65
-
66
-   5. Functions
67
-
68
-        5.1. xhttp_reply(code, reason, ctype, body)
69
-
70
-1. Overview
71
-
72
-   This module provides basic HTTP/1.0 server functionality inside
73
-   Kamailio. SIP and HTTP are very similar protocols, so, practically, the
74
-   SIP parser can easily handle HTTP requests just by adding a fake Via
75
-   header.
76
-
77
-   The <module>xmlrpc</module> module uses the same concept. The xHTTP
78
-   module offers a generic way of handling the HTTP protocol, by calling
79
-   event_route[xhttp:request] in your config. You can check the HTTP URL
80
-   via the config variable $hu. Note that use of $ru will raise errors
81
-   since the structure of an HTTP URL is not compatible with that of a SIP
82
-   URI.
83
-
84
-2. Note on Latency
85
-
86
-   Because HTTP requests in xhttp are handled by the same, finite number
87
-   of SIP worker processes that operate on SIP messages, the same general
88
-   principles regarding script execution speed and throughput should be
89
-   observed by the writer in event_route[xhttp:request] as in any other
90
-   part of the route script.
91
-
92
-   For example, if you initiate a database query in the HTTP request route
93
-   that takes a long time to return rows, the SIP worker process in which
94
-   the request is handled will be blocked for that time and unable to
95
-   process other SIP messages. In most typical installations, there are
96
-   only a few of these worker processes running.
97
-
98
-   Therefore, it is highly inadvisable to execute particularly slow things
99
-   in the event_route[xhttp:request], because the request is not handled
100
-   in an asynchronous manner or otherwise peripherally to general SIP
101
-   processing. SIP worker threads will block, pending the outcome of the
102
-   event route just like any other config script route.
103
-
104
-   This is no more or less true for xhttp than it is for any other block
105
-   of script in any other scenario, and does not warrant any extraordinary
106
-   concern. It nevertheless bears mention here because some processes with
107
-   embedded HTTP servers have the request processing take place "outside"
108
-   of the main synchronous event sequence, whether by creating separate
109
-   threads or by some other asynchronous handling. That is not the case
110
-   with xhttp.
111
-
112
-3. Dependencies
113
-
114
-   3.1. Kamailio Modules
115
-   3.2. Kamailio Core Settings
116
-   3.3. External Libraries or Applications
117
-
118
-3.1. Kamailio Modules
119
-
120
-   The following modules must be loaded before this module:
121
-     * sl - stateless reply.
122
-
123
-3.2. Kamailio Core Settings
124
-
125
-   SIP requires a Content-Length header for TCP transport. But most HTTP
126
-   clients do not set the content length for normal GET requests.
127
-   Therefore, the core must be configured to allow incoming requests
128
-   without content length header:
129
-     * tcp_accept_no_cl=yes
130
-
131
-3.3. External Libraries or Applications
132
-
133
-   The following libraries or applications must be installed before
134
-   running Kamailio with this module loaded:
135
-     * None
136
-
137
-4. Parameters
138
-
139
-   4.1. url_skip (str)
140
-   4.2. url_match (str)
141
-
142
-4.1. url_skip (str)
143
-
144
-   Regular expression to match the HTTP URL. If there is a match, the
145
-   event route is not executed.
146
-
147
-   Default value is null (don't skip).
148
-
149
-   Example 1.1. Set url_skip parameter
150
-...
151
-modparam("xhttp", "url_skip", "^/RPC2")
152
-...
153
-
154
-4.2. url_match (str)
155
-
156
-   Regular expression to match the HTTP URL. If there is no match, the
157
-   event route is not executed. This check is done after url_skip, so if
158
-   both url_skip and url_match would match then the event route is not
159
-   executed (url_skip has higher priority).
160
-
161
-   Default value is null (match everything).
162
-
163
-   Example 1.2. Set url_match parameter
164
-...
165
-modparam("xhttp", "url_match", "^/sip/")
166
-...
167
-
168
-5. Functions
169
-
170
-   5.1. xhttp_reply(code, reason, ctype, body)
171
-
172
-5.1.  xhttp_reply(code, reason, ctype, body)
173
-
174
-   Send back a reply with content-type and body.
175
-
176
-   Example 1.3. xhttp_reply usage
177
-...
178
-event_route[xhttp:request] {
179
-    xhttp_reply("200", "OK", "text/html",
180
-        "<html><body>OK - [$si:$sp]</body></html>");
181
-}
182
-...