Hi all, as a wrap up to this thread, since there were some private exchanges, this summarises what can be correctly used (tested with version 4.4):
$var(target_url) = "http://test.com"; $http_req(method) = "PUT"; http_append_header("Content-Type: application/json"); $var(payload) = '{ "key1" : "value1", "key2" : "' + $fU + '" }'; http_async_query("$var(target_url)", "$var(payload)", "HTTP_REPLY"); which would result in something like: PUT / HTTP/1.1. Host: test.com. Accept: */*. Content-Type: application/json. Content-Length: 38. . { "key1" : "value1", "key2" : "sipp" } $var(payload) can be constructed by concatenating the needed strings, including pseudovariables, and timestamps can be computed with $TV() and again concatenated in the payload as needed. The payload string has to be escaped as expected by the web service. Cheers, Giacomo On 1 December 2016 at 10:14, Giacomo Vacca <giacomo.va...@gmail.com> wrote: > Hi Agalya, > can you please provide an example of the data format you'd like to use and > the related http_async parameters and request? > And possibly also an example of expected final content of the HTTP > request? > We'll try to better understand what you want achieve. > > Cheers, > Giacomo > > On 30 November 2016 at 20:00, Ramachandran, Agalya (Contractor) < > agalya_ramachand...@comcast.com> wrote: > >> Hi team, >> >> >> >> We are trying to use kamailio for our project purpose, which will be used >> as a proxy server. >> >> Am trying to use “http_async_client” module to send my rest queries >> asynchronously. >> >> >> >> I have few queries regarding the usage of http_async_query() and using >> PUT method. >> >> *http_append_header("Authorization: Bearer $var(auth)");* >> >> *http_append_header("Content-Type: application/json");* >> >> *http_set_method("PUT");* >> >> *http_async_query("http://sdk-evm-wcdc-c-001.rtc.sys.comcast.net/events/createxmpprooteventfortn >> <http://sdk-evm-wcdc-c-001.rtc.sys.comcast.net/events/createxmpprooteventfortn>", >> "{'from_tn':'$fU','to_tn':'$tU','callid':'ci'}", "HTTP_REPLY");* >> >> >> >> Here am passing from, to, callid in post data field. >> >> Passing as ‘key’:’value’ is mandatory or I can pass only value- ? >> >> >> >> In the file, async_http.c – in async_send_query(), if I modify the post >> data to the format I need, I see the value is truncated up to three fields >> only. >> >> How can I achieve that my payload format whatever I form in >> async_send_query(),doesn’t get truncated and will be passed to the server-? >> >> Can you please explain how this works-? >> >> >> >> Also, I observed that kamailio is restricting the content-length of HTTP >> request to 256. >> >> Is this something modifiable-? If so please guide me how this can be >> achieved. >> >> >> >> Regards, >> Agalya >> >> >> >> _______________________________________________ >> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list >> sr-users@lists.sip-router.org >> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users >> >> >
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users