[SR-Users] issue sending http_async_client POST request

Abdul Basit basit.engg at gmail.com
Thu Jul 13 10:34:08 CEST 2017


Hi folks,

I am using

I was trying to send http POST request to my web server example.com
following example Example 1.12. http_async_query() usage
<https://www.kamailio.org/docs/modules/5.0.x/modules/http_async_client.html#http_async_client.f.http_async_query>

https://www.kamailio.org/docs/modules/5.0.x/modules/http_async_client.html

according to that we should send parameters in body like

# POST
$http_req(body) = "{'r_uri':'" + $rU + "', 'f_uri':'" + $fU + "'}";
http_async_query("http://example.com/test.php", "HTTP_REPLY");

But its not working out of the box as described with error message from
server:

INFO: <script>: route[HTTP_REPLY]: status 400
INFO: <script>: route[HTTP_REPLY]: body Insufficient parameters.

I even tried adding additional parameters
  $http_req(hdr) = "Content-Type: application/x-www-form-urlencoded";
  $http_req(method) = "POST";

But again it didn't work.

I tried the alternative way which worked fine.

# POST
$http_req(body) = "r_uri=$rU&f_uri=$fU";
http_async_query("http://example.com/test.php", "HTTP_REPLY");

Is there any issue with documentation or i am missing something for POST
request?

--
regards,

abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20170713/d4695460/attachment.html>


More information about the sr-users mailing list