From 8740bf3d636f063cf4759d7ded231f1d86a94a6b Mon Sep 17 00:00:00 2001 From: Federico Cabiddu Date: Thu, 25 Feb 2016 16:07:29 +0100 Subject: [PATCH] http_async_client: updated README --- modules/http_async_client/README | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/modules/http_async_client/README b/modules/http_async_client/README index fbaf8a68459..e5131063a28 100644 --- a/modules/http_async_client/README +++ b/modules/http_async_client/README @@ -1,4 +1,4 @@ -ASYNC_HTTP Module +HTTP_ASYNC_CLIENT Module Federico Cabiddu @@ -6,7 +6,7 @@ Federico Cabiddu Giacomo Vacca - + Camille Oudot @@ -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" @@ -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. @@ -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 ... @@ -562,6 +569,8 @@ $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"); ... @@ -569,11 +578,11 @@ 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