[OpenSER-Users] 'while' statement in config file

Iñaki Baz Castillo ibc at aliax.net
Tue Sep 11 23:42:02 CEST 2007


El Martes, 11 de Septiembre de 2007, Daniel-Constantin Mierla escribió:

> The block:
>
> $var(i) = 0;
> while($(avp(i:20)[$var(i)]) != null) {
>  .....
> $var(i) = $var(i) +1;
> }
>
> is equivalent with:
>
> $var(i) = 0;
> route(1);
> ....
> route[1] {
> if(($(avp(i:20)[$var(i)]) == null)
>    return;
> ...
> $var(i) = $var(i) +1;
> route(1);
> }
>
> 'while' may look more attractive, but could open the pandora box, people
> asking for more and more, that will turn config language is something
> very complex (not saying that is simple now :-) ).
>
> The drawback with recursive routes is the fixed number of routes that
> can be defined with the standard openser: 40 (number can be increased if
> openser is recompiled), because for each cycle another route has to be
> used.
>
> Waiting for your opinions...


Some days ago I needed to do a SQL query in OpenSer. This query returns 
various rows, and I need to check a column and in case of match then take the 
value of other column in same row.
That was not possible with actual AVP ops, and sincerely I don't want to do 
recursive routing for this (too much complex and strange for something really 
simple).
At the end I used "exec" module and an external script (really a not elegant 
solution).

So in my opinion a simple "while" (or "for") function could be just great.

Regards.


-- 
Iñaki Baz Castillo




More information about the Users mailing list