Skip to content

Commit

Permalink
http_async_client: updated README
Browse files Browse the repository at this point in the history
  • Loading branch information
grumvalski committed Feb 26, 2016
1 parent 8f209d4 commit 8740bf3
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions modules/http_async_client/README
@@ -1,12 +1,12 @@
ASYNC_HTTP Module
HTTP_ASYNC_CLIENT Module

Federico Cabiddu

<federico.cabiddu@gmail.com>

Giacomo Vacca

<Giacomo.vacca@gmail.com>
<giacomo.vacca@gmail.com>

Camille Oudot

Expand Down Expand Up @@ -267,8 +267,11 @@ modparam("http_async_client", "curl_verbose", 1)
free, ...)

Note: if this module is used in conjunction with another module using
libcurl, this parameter will have no effect, and curl will likely use
the system memory allocator by default.
libcurl (http_client, utils, xcap, xcap_client), it must be loaded as
first one for this parameter to have effect, otherwise curl will likely
use the system memory allocator by default. On the other hand if the
module is loaded before any other module using libcurl, all the modules
will use the memory manager specified by this parameter.

Default value "shm"

Expand Down Expand Up @@ -344,13 +347,15 @@ modparam("http_async_client", "tls_ca_path", "/etc/kamailio/ssl/ca/")
of HTTP reply, on error or on timeout. If a transaction exists before
calling http_async_query(), it will be paused and resumed in this
route, while the routing script execution will be stopped. If executed
in a transactionless context, or if http_async_suspend_transaction() is
used to not suspend the transaction, the routing script execution will
continue and the query result will be available in “route_name”.
in a transactionless context, or if http_async_suspend_transaction() or
$http_req(suspend) are used to not suspend the transaction, the routing
script execution will continue and the query result will be available
in “route_name”.

Return value: 0 (stop script execution) on success in transaction
context, 1 (continue script execution) in transaction-less context or
if http_async_suspend_transaction(0) is used, -1 on error.
context, 1 (continue script execution) in transaction-less context (or
if http_async_suspend_transaction(0) or $http_req(suspend) are used),
-1 on error.

This function can be used from ANY_ROUTE.

Expand Down Expand Up @@ -554,6 +559,8 @@ http_async_query("https://example.com/test.php", "HTTP_REPLY");
http_set_tls_client_key())
* tls_ca_path: sets the CA certificate files to use (see
http_set_tls_ca_path())
* suspend: if set to 0 doesn't suspend the current transaction before
performing the query (see http_async_suspend())

Example 1.22. $http_req(key) variable usage
...
Expand All @@ -562,18 +569,20 @@ $http_req(timeout) = 100; # 100 ms
$http_req(method) = "DELETE";
$http_req(hdr) = "X-Sip-Call-Id: " + $ci;
$http_req(hdr) = "X-Foo: bar"; # add a 2nd header
$http_req(suspend) = 0; # don't suspend the transaction, continue ro
uting script's execution
# the following request will use the above parameters
http_async_query("https://example.com/test.php", "HTTP_REPLY");
...

The following read-only pseudo variables can only be used in the
callback routes executed by http_async_query()
* $http_ok: 1 if cURL executed the request successfully, 0 otherwise
(check $ah_err for details)
(check $http_err for details)
* $http_err: cURL error string if an error occured, $null otherwise
* $http_rs: http status
* $http_rr: http reason phrase
* $http_hdr(Name): value of the Name header (the $(ah_hdr(Name)[N])
* $http_hdr(Name): value of the Name header (the $(http_hdr(Name)[N])
syntax can also be used, check the SIP $hdr() PV documentation for
details)
* $http_mb and $http_ml: HTTP response buffer (including headers) and
Expand Down

0 comments on commit 8740bf3

Please sign in to comment.