[asterisk-users] Deprecated Realtime application, what's to be gained ???

Benoit maverick at maverick.eu.org
Fri Jan 2 11:03:03 CST 2009


Benoit a écrit :
> Hi,
>
> After seeing in "pbx/ael/ael-test/ael-test5/extensions.ael" some
> interesting use case of RealTime
> to store extension data (forwardto, dnd, ...) i started to play with it.
>
> To my surprise the two applications RealTime() / RealtimeUpdate() have
> been deprecated in favor
> of the REALTIME() function. While it's not a big deal for the write part
> since it's only a matter a
>  shifting a ')' and adding a '=', the read part is quite harder to use.
>
> while you could simply write
>           RealTime(family|col1|val1|prefix_);
>           NoOp(${prefix_col2});
>           NoOp(${prefix_col3});
>
> No you have to
>
>    Set(row="${REALTIME(family,col1,val1)}");
>    Set(col2_name_pair=${CUT(row,"|",2)});
>    Set(col2_value=${CUT(col2_name_pair,"=",2)});
>    NoOp(${col2_value});
>    Set(col3_name_pair=${CUT(row,"|",3)});
>    Set(col3_value=${CUT(col2_name_pair,"=",3)});
>    NoOp(${col3_value});
>
> 2 more lines per data access, and that's only you you know for sure the
> column orders,
> otherwise it will be more complicated,
>
> I fail to see what's the bonus in here ...
> may someone enlight me ?
>   

In the meantime, i've made the following macro which mimic the
deprecated application:

macro app-realtime(family,fieldmatch,value,prefix) {
        Set(row="${REALTIME(${family},${fieldmatch},${value})}");
        Set(i=1);
   do:
        Set(kv=${CUT(row,\|,${i})});

        if ( ! ${ISNULL(${kv})} ) {
                Set(key=${CUT(kv,=,1)});
                Set(${prefix}${key}=${CUT(kv,=,2)});

                i=${i}+1;
                goto do;
        }
        Set(kv=);
        Set(key=);
        Set(row=);
};


If it could be of any use ..






More information about the asterisk-users mailing list