[SR-Users] Decoding HTTP URLs in event_route[xhttp:request]

Peter Dunkley peter.dunkley at crocodilertc.net
Wed Sep 25 17:15:49 CEST 2013


Hello,

I have added a transformation to the xhttp module that breaks a URL into a
path and a querystring
- {url.path}
- {url.querystring}

I have also added an optional delimiter parameter to the {param.}
transformations.

Regards,

Peter


On 22 September 2013 14:55, Ovidiu Sas <osas at voipembedded.com> wrote:

> You can use {s.select,index,separator} to extract the path and the
> parameters into two different variables.
> Or here you could create a new url transformation to break it in two:
>  - {url.path}
>  - {url.searchpath}
>
> After that, the existing code for param transformation may be reused
> (by making the separator configurable (using '&' instead of ';') and
> we could have a new transformation:
>  - {urlsearchpath.value,name}
> Or maybe we can enhance the existing param transformation to pass as
> an optional argument - the param delimiter:
>  - {param.value,name,[param_delimiter]}.
>  - {param.valueat,index,[param_delimiter]}
>  - {param.name,index,[param_delimiter]}
>  - {param.count,[param_delimiter]}
>
>
> Regards,
> Ovidiu Sas
>
> On Sun, Sep 22, 2013 at 4:50 AM, Peter Dunkley
> <peter.dunkley at crocodilertc.net> wrote:
> > Hello,
> >
> > Does anyone have any ideas about this?
> >
> > If not it's something I want to try and do before the freeze (any
> > suggestions as to how would be appreciated) as it will be a nice
> finishing
> > touch to the WebSocket/outbound/stun/auth_ephemeral stuff I've worked on
> > over the last couple of releases.
> >
> > Thanks,
> >
> > Peter
> >
> >
> > On 19 September 2013 21:36, Peter Dunkley <
> peter.dunkley at crocodilertc.net>
> > wrote:
> >>
> >> Hello,
> >>
> >> I was wondering if there was an easy way to decode HTTP URLs in
> >> event_route[xhttp:request]?
> >>
> >> For example, it would be good to be able to breakdown a URL like:
> >>   /sip?apiKey=abcdefg&username=1234567890:alice at example.com
> >> into "path/on/server" ("/sip" in this case) and a set of parameters.
>  For
> >> the parameters something like the {param.value,name} transformation for
> SIP
> >> header parameters would be ideal (which works perfectly for picking
> values
> >> out of HTTP Cookie: headers).
> >>
> >> I noticed that there is already an {s.urldecode.param} transformation in
> >> the PV module but I couldn't find any documentation for it in the wiki
> and
> >> looking at the code it doesn't appear to do this anyway.
> >>
> >> Regards,
> >>
> >> Peter
> >>
> >>
> >> --
> >> Peter Dunkley
> >> Technical Director
> >> Crocodile RCS Ltd
> >
> >
> >
> >
> > --
> > Peter Dunkley
> > Technical Director
> > Crocodile RCS Ltd
> >
> > _______________________________________________
> > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> > sr-users at lists.sip-router.org
> > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
> >
>
>
>
> --
> VoIP Embedded, Inc.
> http://www.voipembedded.com
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130925/81820a1d/attachment-0001.html>


More information about the sr-users mailing list