Discussion:
[SR-Users] http_query results question
Jonathan Hunter
2014-07-15 17:01:43 UTC
Permalink
Hi Guys,
I have used the http_query function in the past, in conjunction with the json module, on version 3.3 and unbuntu.
I am now using version 4.1 on Centos 6.5, and I am using the http_query, which I'm aware records in the results the first line of the response.
Can you select the result to be recorded depending on the line in the response, for example if a number is returned only in line 4, can this be extracted from a 200 ok response using this function?
Or is this then a need to use JSON module, and if so which repository for centos 6.5 contains it! :)
Sorry for the question!
Thanks
Jon
Juha Heinanen
2014-07-15 17:24:25 UTC
Permalink
Jonathan Hunter writes:

> I am now using version 4.1 on Centos 6.5, and I am using the http_query, which I'm aware records in the results the first line of the response.
> Can you select the result to be recorded depending on the line in the
> response, for example if a number is returned only in line 4, can this
> be extracted from a 200 ok response using this function?

that kind of functionality is not currently supported by http_query.

-- juha
Jonathan Hunter
2014-07-15 20:03:49 UTC
Permalink
Hi Juha,
Thank you for the response.
So I presume there isn't any other option for this functionality at present?
Thanks
Jon

> Date: Tue, 15 Jul 2014 20:24:25 +0300
> To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> From: jh-lyJTu5r7LVPQT0dZR+***@public.gmane.org
> Subject: [SR-Users] http_query results question
>
> Jonathan Hunter writes:
>
> > I am now using version 4.1 on Centos 6.5, and I am using the http_query, which I'm aware records in the results the first line of the response.
> > Can you select the result to be recorded depending on the line in the
> > response, for example if a number is returned only in line 4, can this
> > be extracted from a 200 ok response using this function?
>
> that kind of functionality is not currently supported by http_query.
>
> -- juha
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Daniel-Constantin Mierla
2014-07-15 20:12:40 UTC
Permalink
Hello,

the patch for utils module might be trivial for such extension, however,
my way to deal with http client needs was to use an embedded lua script.
It was always fast and I had all the options I needed for setting the
body of the request and handling the response. Lua has http lib with
support for https as well. This can be an option for the moment. Perhaps
other embedded interpreters can be used if you are more familiar with
any of the alternatives (e.g., perl, python, C# ...).

Cheers,
Daniel

On 15/07/14 22:03, Jonathan Hunter wrote:
> Hi Juha,
>
> Thank you for the response.
>
> So I presume there isn't any other option for this functionality at
> present?
>
> Thanks
>
> Jon
>
> > Date: Tue, 15 Jul 2014 20:24:25 +0300
> > To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> > From: jh-lyJTu5r7LVPQT0dZR+***@public.gmane.org
> > Subject: [SR-Users] http_query results question
> >
> > Jonathan Hunter writes:
> >
> > > I am now using version 4.1 on Centos 6.5, and I am using the
> http_query, which I'm aware records in the results the first line of
> the response.
> > > Can you select the result to be recorded depending on the line in the
> > > response, for example if a number is returned only in line 4, can this
> > > be extracted from a 200 ok response using this function?
> >
> > that kind of functionality is not currently supported by http_query.
> >
> > -- juha
> >
> > _______________________________________________
> > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> > sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.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-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

--
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Jonathan Hunter
2014-08-08 10:31:44 UTC
Permalink
Hi All,
I am using the xhttp module to receive and respond to HTTP requests to my kamailio instance, and I am trying to extract the body of the HTTP post sent into kamailio, so that I can store it in variables.
Is this possible?
I can send 200ok responses with content, this is working well, I just need to try and get details from the received POST, can this be done?
Thanks
Jon
Jonathan Hunter
2014-08-08 10:56:42 UTC
Permalink
Hi Guys,
I am able to do this using $rb , is this the best method for this if I want to capture the details and manipulate or store accordingly into variables?
Thanks
Jon

From: hunterj91-***@public.gmane.org
To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
Date: Fri, 8 Aug 2014 10:31:44 +0000
Subject: [SR-Users] xhttp Module Version 4.1





Hi All,
I am using the xhttp module to receive and respond to HTTP requests to my kamailio instance, and I am trying to extract the body of the HTTP post sent into kamailio, so that I can store it in variables.
Is this possible?
I can send 200ok responses with content, this is working well, I just need to try and get details from the received POST, can this be done?
Thanks
Jon
Daniel-Constantin Mierla
2014-08-08 11:33:20 UTC
Permalink
Hello,

yes, $rb is the way to get the body. If you have big bodies and you use
it in other expressions, you may need to increase the value for
pv_buffer_size global parameter.

Cheers,
Daniel

On 08/08/14 12:56, Jonathan Hunter wrote:
> Hi Guys,
>
> I am able to do this using *$rb* , is this the best method for this if
> I want to capture the details and manipulate or store accordingly into
> variables?
>
> Thanks
>
> Jon
>
> ------------------------------------------------------------------------
> From: hunterj91-***@public.gmane.org
> To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> Date: Fri, 8 Aug 2014 10:31:44 +0000
> Subject: [SR-Users] xhttp Module Version 4.1
>
>
> Hi All,
>
> I am using the xhttp module to receive and respond to HTTP requests to
> my kamailio instance, and I am trying to extract the body of the HTTP
> post sent into kamailio, so that I can store it in variables.
>
> Is this possible?
>
> I can send 200ok responses with content, this is working well, I just
> need to try and get details from the received POST, can this be done?
>
> Thanks
>
> Jon
>
>
> _______________________________________________ SIP Express Router
> (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.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-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA
Jonathan Hunter
2014-08-08 11:41:54 UTC
Permalink
Hello Daniel,
Thanks for that.
Is the best way to manipulate the contents of $rb to use transformations to extract particular information?
I just want to search or extract what I get in $rb and use it for subsequent routing.
Jon

Date: Fri, 8 Aug 2014 13:33:20 +0200
From: miconda-***@public.gmane.org
To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
Subject: Re: [SR-Users] xhttp Module Version 4.1






Hello,



yes, $rb is the way to get the body. If you have big bodies and you
use it in other expressions, you may need to increase the value for
pv_buffer_size global parameter.



Cheers,

Daniel



On 08/08/14 12:56, Jonathan Hunter
wrote:




Hi Guys,



I am able to do this using $rb , is this the best
method for this if I want to capture the details and
manipulate or store accordingly into variables?



Thanks



Jon




From: hunterj91-***@public.gmane.org

To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org

Date: Fri, 8 Aug 2014 10:31:44 +0000

Subject: [SR-Users] xhttp Module Version 4.1






Hi All,



I am using the xhttp module to receive and respond to
HTTP requests to my kamailio instance, and I am trying
to extract the body of the HTTP post sent into kamailio,
so that I can store it in variables.



Is this possible?



I can send 200ok responses with content, this is
working well, I just need to try and get details from
the received POST, can this be done?



Thanks



Jon














_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
mailing list
sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.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-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA
Daniel-Constantin Mierla
2014-08-11 09:03:47 UTC
Permalink
Hello,

yes, transformations are the way to parse/extract values from a
variable. If it is something more complex, then using an embedded
language such as Lua, Perl, Python ... can be a more convenient alternative.

Cheers,
Daniel

On 08/08/14 13:41, Jonathan Hunter wrote:
> Hello Daniel,
>
> Thanks for that.
>
> Is the best way to manipulate the contents of $rb to use
> transformations to extract particular information?
>
> I just want to search or extract what I get in $rb and use it for
> subsequent routing.
>
> Jon
>
> ------------------------------------------------------------------------
> Date: Fri, 8 Aug 2014 13:33:20 +0200
> From: miconda-***@public.gmane.org
> To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> Subject: Re: [SR-Users] xhttp Module Version 4.1
>
> Hello,
>
> yes, $rb is the way to get the body. If you have big bodies and you
> use it in other expressions, you may need to increase the value for
> pv_buffer_size global parameter.
>
> Cheers,
> Daniel
>
> On 08/08/14 12:56, Jonathan Hunter wrote:
>
> Hi Guys,
>
> I am able to do this using *$rb* , is this the best method for
> this if I want to capture the details and manipulate or store
> accordingly into variables?
>
> Thanks
>
> Jon
>
> ------------------------------------------------------------------------
> From: hunterj91-***@public.gmane.org <mailto:hunterj91-***@public.gmane.org>
> To: sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> <mailto:sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org>
> Date: Fri, 8 Aug 2014 10:31:44 +0000
> Subject: [SR-Users] xhttp Module Version 4.1
>
>
> Hi All,
>
> I am using the xhttp module to receive and respond to HTTP
> requests to my kamailio instance, and I am trying to extract the
> body of the HTTP post sent into kamailio, so that I can store it
> in variables.
>
> Is this possible?
>
> I can send 200ok responses with content, this is working well, I
> just need to try and get details from the received POST, can this
> be done?
>
> Thanks
>
> Jon
>
>
> _______________________________________________ SIP Express Router
> (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> <mailto:sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.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-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org <mailto:sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org>
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierla
> http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> -http://www.linkedin.com/in/miconda
> Next Kamailio Advanced Trainings 2014 -http://www.asipto.com
> Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA
>
> _______________________________________________ SIP Express Router
> (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users-cR8azDVoa3IcDhw6gZKtMWD2FQJk+8+***@public.gmane.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

--
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Next Kamailio Advanced Trainings 2014 - http://www.asipto.com
Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA
Loading...