Hey Colin,
Perfect will try it out.
Thanks very much.
Jon
Get Outlook for iOS
On Mon, Aug 22, 2016 at 2:57 PM +0100, "Colin Morelli"
<colin.morelli(a)gmail.com> wrote:
Hey Jonathan,
You can also use the Jansson module to create the JSON request. For
example, in one of my configs, I have a route that looks basically like:
$var(params) = $null;
jansson_set("string", "request.uri", "$ru",
"$var(params)");
jansson_set("string", "request.method", "$rm",
"$var(params)");
jansson_set("string", "request.domain", "$rd",
"$var(params)");
/// other fields set here
http_set_timeout(5000);
http_set_method("POST");
http_append_header("Content-Type: application/json");
http_async_query("https://mydomain.com/api/v1/blah", "$var(params)",
"API_ROUTE_REPLY");
Then a API_ROUTE_REPLY block that processes the response like:
if $http_ok {
if $http_rs == 200 {
$var(action) = $null;
jansson_get_field("$http_rb", "authentication.action",
"$var(action)");
// other stuff
}
}
Hopefully that's helpful.
Best,
Colin
On Mon, Aug 22, 2016 at 9:52 AM Jonathan Hunter <hunterj91(a)hotmail.com>
wrote:
Hi Guys,
I need to send a JSON document over HTTP to a server, and then process the
response, both in the kamailio configuration file.
I assume I need to use Jansson module to extract contents of response?
What is the best method for generating the initial request containing JSON
?
Many thanks
Jon
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users(a)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(a)lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users