[asterisk-dev] how to get json body from client->ser

Vipul Rastogi vipul.rastogi at temasys.com.sg
Tue Feb 3 22:05:04 CST 2015


I am trying to retrieve json body from http response (below code) but
ast_http_get_json method expects ast_variable which is probably list of
headers. so question is how to I get this from client (or client->ser).
Suggestions most welcome !

res_http_websocket.c -> websocket_client_handshake_get_response()

struct ast_variable temp;
struct ast_json *body = ast_http_get_json(client->ser, &temp);
ast_log(LOG_ERROR, "After get json");
struct ast_json *field = ast_json_object_get(body, "sid");
ast_log(LOG_ERROR, "After get sid");
if (field) {
ast_log(LOG_ERROR, "received sid=%s",ast_json_string_get(field));
}


thanks,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20150204/14abdc7d/attachment.html>


More information about the asterisk-dev mailing list