[OpenSER-Devel] transformations

Dan Pascu dan at ag-projects.com
Wed Dec 19 11:56:27 UTC 2007


I made a change in the transformation code. Apparently it handled an 
undefined avp/var the same as an avp/var containing an empty string and 
returned error for both of them. The change will allow avps/vars with an 
empty string value and the transformation for them will be a no-op (i.e. 
return an empty string as well, as it would have been expected). 
Now transformations that had issues can be cascaded.

On Tuesday 18 December 2007, Dan Pascu wrote:
> The transformations docs say that they can be cascaded. However in
> practice this doesn't work very well. If a transformation returns no
> result or an empty string, the next transformation will fail. This
> means in practice that one has to execute them one by one and test in
> between if the previous has returned something and non-empty.
>
> Consider this example:
>
> $var(x) = "sip:1.2.3.4:5060;p1=;p2=7";
> $avp(s:y) = $(var(x){uri.param,p1}{s.unescape.user});
> $avp(s:z) = $(var(x){uri.param,p3}{s.unescape.user});
>
> Both will fail as after the first transformation the result is an empty
> string. While I'm at this, I also find it unintuitive that asking for
> an unexisting param in an uri will yield an avp containing an empty
> string. I would rather expect an undefined avp, otherwise how to
> distinguish between the case where the param doesn't exist from the
> case where it contains an empty string (p1 vs p3)?
>
> This issue is similar with the one that gives an error if the avp/hdr
> on the right side of a statement is undefined or the one that doesn't
> allow undefined avps in boolean tests.



-- 
Dan



More information about the Devel mailing list