[sr-dev] [SR-Users] Decoding HTTP URLs in event_route[xhttp:request]
Ovidiu Sas
osas at voipembedded.com
Sun Sep 22 15:55:17 CEST 2013
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
More information about the sr-dev
mailing list