I recently successfully used http_async_client for POST. Will try to help you out here -
From: sr-users [mailto:sr-users-bounces@lists.kamailio.org] On Behalf Of Ramachandran,
Agalya (Contractor)
Sent: Tuesday, April 25, 2017 10:17 AM
To: giacomo.vacca(a)gmail.com; sr-users(a)lists.kamailio.org
Subject: [SR-Users] Query with regard to http_client and http_async_client
Hi Giacomo,
I have few questions with regard to rest client in kamailio.
1) I see there are two modules in kamailio for rest client. http_client,
http_async_client.
I hope http_client does the http transfer in synchronous way.
http_async_client does the http transfer in asynchronous manner.
Correct me if am wrong here.
Correct.
2) I want to achieve https transfers in async way, so choosing http_async_client.
Is there a way that kamailio maintains persistent TCP connection pooling for http
transfer.
I see there is a "workers" parameter in http_async_client. By increasing this
number does it result it more http request's handling?
Let the author reply here.
3) Also, I have some questions regarding documentation for module http_async_client in
5.0 version.
In the API exposure, it says "http_async_query(url, route_name)".
But the example if I want to use POST, it says
"http_async_query("http://example.com/test.php",
"{'r_uri':'$rU', 'f_uri':'$fU'}",
"HTTP_REPLY");"
There is a parameter mismatch between the example and the actual function.
If I try to use GET query, kamailio service is starting. But if I try to give the POST
query with payload, kamailio service is not started.
It says, sctp_core_destroy(): SCTP API not initialized.
Also I have noticed that, functions like http_append_header(),http_set_method() are
removed in 5.0 version, whereas we have this API's is 4.x versions.
Is there some issue with the documentation for 5.0 ?
I used it like this and it works -
http_async_query("http://TEXT_BROKER/api/events/CallAnswered",
"{'CallId':'$ci', 'Time' : '$TF'}",
"HTTP_REPLY");
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.
Please let me the know the details for the above queries.
Regards,
Agalya