Hi everyone,
Is there such a thing like "geolocation" module in Kamailio? (or something related to it i.e. [1] [2]).
Thanks, Stefan Mititelu
[1] https://tools.ietf.org/html/rfc6442 [2] https://tools.ietf.org/html/rfc3693#page-6
Hello,
On 22/11/15 22:06, Mititelu Stefan wrote:
Hi everyone,
Is there such a thing like "geolocation" module in Kamailio? (or something related to it i.e. [1] [2]).
Thanks, Stefan Mititelu
[1] https://tools.ietf.org/html/rfc6442 [2] https://tools.ietf.org/html/rfc3693#page-6
if it is just about carrying the geo location data through the proxy, then Kamailio can do that.
If you need to do some kind of processing based on geolocation data, then describe a bit more about what you want to achieve, kamailio has a lot of configuration file tools that may help (e.g., xml parser with xpath support -- xmlops module).
Cheers, Daniel
Hi,
On Mon, Nov 23, 2015 at 10:38 AM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
If you need to do some kind of processing based on geolocation data, then describe a bit more about what you want to achieve, kamailio has a lot of configuration file tools that may help (e.g., xml parser with xpath support -- xmlops module).
Yes, I am thinking of the capability to extract that geolocation data from the xml (when the "Geolocation-Routing: yes").
Consider the example from the section 5.1 from [1]. Suppose I want to extract "gml:pos32.86726 -97.16054</gml:pos>" data and do some processing with it: - save the initial value of this call - compute the value difference relative to the initial value (as geolocation data is received for further messages) - trigger something when a certain difference is reached (e.g. log a message)
Can I approach this somehow with current Kamailio?
Thanks, Stefan
Hello,
you should be able to extract the value of gml:pos node using the re.subst transformation over $rb variables:
https://www.kamailio.org/wiki/cookbooks/devel/transformations#resubst_expres...
I noticed we have functions only to append, set and remove a part of multipart body. I plan to add the function to get a content of a multipart body, that will make it work then with xmlops module for this particular case.
Cheers, Daniel
On 23/11/15 14:52, Mititelu Stefan wrote:
Hi,
On Mon, Nov 23, 2015 at 10:38 AM, Daniel-Constantin Mierla <miconda@gmail.com mailto:miconda@gmail.com> wrote:
If you need to do some kind of processing based on geolocation data, then describe a bit more about what you want to achieve, kamailio has a lot of configuration file tools that may help (e.g., xml parser with xpath support -- xmlops module).
Yes, I am thinking of the capability to extract that geolocation data from the xml (when the "Geolocation-Routing: yes").
Consider the example from the section 5.1 from [1]. Suppose I want to extract "gml:pos32.86726 -97.16054</gml:pos>" data and do some processing with it:
- save the initial value of this call
- compute the value difference relative to the initial value (as
geolocation data is received for further messages)
- trigger something when a certain difference is reached (e.g. log a
message)
Can I approach this somehow with current Kamailio?
Thanks, Stefan
On Mon, Nov 23, 2015 at 10:34 PM, Daniel-Constantin Mierla < miconda@gmail.com> wrote:
I plan to add the function to get a content of a multipart body, that will make it work then with xmlops module for this particular case.
Thank you Daniel, the "get" function from textops worked for me with a small index change for the end buff when mode == 1, for get_body_part_helper() function (I'll do a pull request for the changes).
I've tried with the attached message file using sipsak and the following config additions:
... modparam("xmlops", "xml_ns", "pos=pos-namespace") ... if (is_present_hf("Geolocation") && is_present_hf("Geolocation-Routing") && $hdr(Geolocation-Routing)=~"yes" && has_body("multipart/mixed")) { get_body_part("application/pidf+xml", "$var(geobody)"); xlog("geobody is $var(geobody)\n");
$xml(posxml=>doc)=$var(geobody); $var(posX)=$xml(posxml=>xpath:/pos:position/pos:x/text()); $var(posY)=$xml(posxml=>xpath:/pos:position/pos:y/text());
$var(posX)=$(var(posX){s.trim}{s.int}); $var(posY)=$(var(posY){s.trim}{s.int});
xlog("LOCATION X IS: $var(posX)\n"); xlog("LOCATION Y IS: $var(posY)\n"); } ...
Regards, Stefan