Well. I found the issue.
I coordinated with service provider. They don't support json which was the
main cause.
However, i suggest to extend example further with
# POST
$http_req(hdr) = "Content-Type: application/x-www-form-urlencoded";
$http_req(body) = "r_uri=$rU&f_uri=$fU";
http_async_query("http://example.com/test.php", "HTTP_REPLY");
I hope this will save others time.
--
regards,
abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445
On 13 July 2017 at 16:49, Abdul Basit <basit.engg(a)gmail.com> wrote:
Hi, Brandon and Federico
Thank you for your reply.
Web server is not in my access and since its https request tcpdump will
not help until i get specific certificates. I replaced the URL here.
Yes. 400 response is from server side.
# POST
$http_req(body) = "r_uri=$rU&f_uri=$fU";
http_async_query("https://example.com/test.php", "HTTP_REPLY");
Its working fine without any header specification.
However, when i try to send in the example format:
# POST
$http_req(hdr) = "Content-Type: application/json";
$http_req(method) = "POST";
$http_req(body) = "{'r_uri':'" + $rU + "',
'f_uri':'" + $fU + "'}";
http_async_query("https://example.com/test.php", "HTTP_REPLY");
It results in
INFO: <script>: route[HTTP_REPLY]: status 400
INFO: <script>: route[HTTP_REPLY]: body Insufficient parameters.
where should i look?
--
regards,
abdul basit | p: +92 32 1416 4196 | o: +92 30 0841 1445
On 13 July 2017 at 13:46, Federico Cabiddu <federico.cabiddu(a)gmail.com>
wrote:
Hi,
this has nothing to do with the module. The reply is coming from your
http server.
In the first request you are sending a json body with "Content-Type:
application/x-www-form-urlencoded" while it should be "Content-Type:
application/json".
In the second request you are sending a totally different body.
You should check your webserver's logs.
Best regards,
Federico Cabiddu
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users(a)lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users