Benoit
2009-Jan-02 15:37 UTC
[asterisk-users] Deprecated Realtime application, what's to be gained ???
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 ?
Benoit
2009-Jan-02 17:03 UTC
[asterisk-users] Deprecated Realtime application, what's to be gained ???
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 ..
Tilghman Lesher
2009-Jan-02 18:33 UTC
[asterisk-users] Deprecated Realtime application, what's to be gained ???
On Friday 02 January 2009 09:37:51 Benoit wrote:> 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 ?http://svn.digium.com/view/asterisk?view=rev&revision=157870 -- Tilghman