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