[SR-Users] Get full body from http POST request

Joel Serrano | VOZELIA joel at vozelia.com
Sun Jun 26 07:25:06 CEST 2016


Hi, 

Nevermind, I found the answer myself:

You have to add the following:

modparam("utils", "http_response_mode", 1)


Now i'm getting:

{#012 "error": {#012  "errors": [#012   {#012    "domain": "global",#012    "reason": "notFound",#012    "message": "User not Found"#012   }#012  ],#012  "code": 404,#012  "message": "User not Found"#012 }#012}


Guess I have to now figure out how to handle thos "#012" chars.



Thanks,
Joel.



----- Original Message -----
> From: "Joel Serrano | VOZELIA" <joel at vozelia.com>
> To: "Kamailio (SER) - Users Mailing List" <sr-users at lists.sip-router.org>
> Sent: Saturday, June 25, 2016 10:18:10 PM
> Subject: [SR-Users] Get full body from http POST request

> Hi,
> 
> I'm using http_query (POST method) to interact with an API.
> 
> This API responds with a JSON.
> 
> Is there a way to get the full body and after parse that JSON?
> 
> Example response:
> 
> {
>  "error": {
>    "code": 404,
>    "message": "Destination not Found"
>  }
> }
> 
> 
> 
> Currently, I'm only being able to get the first line, in the previous example it
> would be: "{"
> 
> According to the doc, that is the expected behavior:
> 
> If HTTP server returns a class 2xx, 3xx or 4xx reply, the first line of the
> reply's body (if any) is stored in “result” parameter, which must be a writable
> pseudo variable.
> 
> 
> I don't have the ability to get the response in 1 single line like: { "error": {
> "code": 404, "message": "Destination not Found" } }
> 
> 
> How can I get the full body instead of only the first line?
> 
> 
> 
> Thanks.
> 
> Best regards,
> Joel.
> 
> 
> 
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list