<div dir="ltr">I have updated the http_async_client documentation for master and 5.0.<div><br></div><div>Please note that in respect to 4.4 http_async_query() now only takes 2 parameters: the payload is passed with $http_req(body).</div><div><br></div><div>Giacomo</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 25 April 2017 at 22:09, Giacomo Vacca <span dir="ltr"><<a href="mailto:giacomo.vacca@gmail.com" target="_blank">giacomo.vacca@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div>reusing the same connection to the same url is delegated to liburl, so you can have that when using http_async_client.</div><div>More workers will increase the capacity at the price of resources (shared memory).</div><div>I wrote a wrap up about building the request payload here: <a href="https://lists.kamailio.org/pipermail/sr-users/2016-December/095454.html" target="_blank">https://lists.kamailio.<wbr>org/pipermail/sr-users/2016-<wbr>December/095454.html</a> - please double check escaping.</div><div>The function methods have been reviewed in version 5 and removed, replaced by pseudovariable settings which is more common practice in kamailio. </div><div>Instead of http_append_header() use </div><div>$http_req(hdr) = "X-theheader: the value";</div><div><br></div><div>Instead of http_set_method() use</div><div>$http_req(method) = "POST";<div><br></div><div>The latest documentation requires a little review for some mentions of the old functions. Will try to fix as soon as possible.</div><div><br></div><div>Best Regards,</div><div>Giacomo</div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 25 April 2017 at 19:02, Pranathi Venkatayogi <span dir="ltr"><<a href="mailto:pvenkatayogi@cyracom.com" target="_blank">pvenkatayogi@cyracom.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="m_-6437315626799778042m_7916116336273400451WordSection1">
<p class="MsoNormal">I recently successfully used http_async_client for POST. Will try to help you out here -
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> sr-users [mailto:<a href="mailto:sr-users-bounces@lists.kamailio.org" target="_blank">sr-users-bounces@lists<wbr>.kamailio.org</a>]
<b>On Behalf Of </b>Ramachandran, Agalya (Contractor)<br>
<b>Sent:</b> Tuesday, April 25, 2017 10:17 AM<br>
<b>To:</b> <a href="mailto:giacomo.vacca@gmail.com" target="_blank">giacomo.vacca@gmail.com</a>; <a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<b>Subject:</b> [SR-Users] Query with regard to http_client and http_async_client<u></u><u></u></p>
</div>
</div><span>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hi Giacomo,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I have few questions with regard to rest client in kamailio.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><u></u><span>1)<span style="font:7.0pt "Times New Roman"">    
</span></span><u></u>I see there are two modules in kamailio for rest client. http_client, http_async_client.<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">I hope http_client does the http transfer in synchronous  way.<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">http_async_client does the http transfer in asynchronous manner.
<u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">Correct me if am wrong here. <u></u><u></u></p>
</span><p class="MsoNormal" style="text-indent:.5in"><span style="background:yellow">Correct.</span><u></u><u></u></p><span>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><u></u><span>2)<span style="font:7.0pt "Times New Roman"">    
</span></span><u></u>I want to achieve https transfers in async way, so choosing http_async_client.<u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">Is there a way that kamailio <b>maintains persistent TCP connection  pooling for http transfer</b>.<u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">I see there is a <span style="color:red">“workers”</span> parameter in http_async_client. By increasing this number does it result it more http request’s handling?
<u></u><u></u></p>
</span><p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><span style="background:yellow">Let the author reply here.</span><u></u><u></u></p><span>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><u></u><span>3)<span style="font:7.0pt "Times New Roman"">    
</span></span><u></u>Also, I have some questions regarding documentation for module http_async_client in 5.0 version.<u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">In the API exposure, it says <b><span style="color:red">“http_async_query(url, route_name)”</span></b><span style="color:red">.
</span><u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">But the example if I want to use <b><span style="color:red">POST</span></b>, it says
<b><span style="color:red">“http_async_query("<a href="http://example.com/test.php" target="_blank">http://exam<wbr>ple.com/test.php</a>", "{'r_uri':'$rU', 'f_uri':'$fU'}", "HTTP_REPLY");”</span></b><u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">There is a parameter mismatch between the example and the actual function.
<u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><u></u> <u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">If I try to use <b>GET</b> query, kamailio service is starting. But if I try to give the
<b>POST</b> query with payload, kamailio service is not started. <u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><span style="color:red">It says, sctp_core_destroy(): SCTP API not initialized.<u></u><u></u></span></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><u></u> <u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">Also I have noticed that, functions like http_append_header(),http_set_<wbr>method() are removed in 5.0 version, whereas we have this API’s is 4.x versions.
<u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph">Is there some issue with the documentation for 5.0  ?<u></u><u></u></p>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph"><u></u> <u></u></p>
</span><p class="MsoNormal">I used it like this and it works - http_async_query("<a href="http://TEXT_BROKER/api/events/CallAnswered" target="_blank">http://TEXT_<wbr>BROKER/api/events/CallAnswered</a><wbr>", <br>
                              <wbr>                              <wbr>                              "{'CallId':'$<wbr>ci', 'Time' : '$TF'}", <br>
                              <wbr>                              <wbr>                               "HTTP_REPLY");
<u></u><u></u></p>
<p class="MsoNormal"><span style="background:yellow">Issue may be with quotes. Make sure you don’t have “ in the second parameter content. If you send Kamailio log it will be easier to debug.<u></u><u></u></span></p><span>
<p class="m_-6437315626799778042m_7916116336273400451MsoListParagraph" style="margin-left:0in"><u></u> <u></u></p>
<p class="MsoNormal">Please let me the know the details for the above queries. <u></u>
<u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Regards,<br>
Agalya<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
</span></div>
</div>

</blockquote></div><br></div>
</div></div></blockquote></div><br></div>