[SR-Users] Kamailio geolocation module

Mititelu Stefan fanx07 at gmail.com
Sat Nov 28 10:40:36 CET 2015


On Mon, Nov 23, 2015 at 10:34 PM, Daniel-Constantin Mierla <
miconda at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20151128/df2b7ff7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: invite_simple.in
Type: application/octet-stream
Size: 596 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20151128/df2b7ff7/attachment.obj>


More information about the sr-users mailing list