JR Richardson
2009-Mar-13 22:41 UTC
[asterisk-users] Realtime dialplan application versus REALTIME dialplan function
Hi All, I'm upgrading some PBX's from 1.2 to 1.4 and having a bit of trouble with converting the Realtime application to the REALTIME function. I have the method down and understand simplistically what is going on, at least enough to get my old 1.2 apps to run in 1.4 functions. I do not understand why change from the app to the func? What the benefits? To me, the app seemed so elegant with appending a variable name to each extracted data field within a row. Really convenient and easy, one priority in the dialplan and all data is extracted and easily used further down the line. Initial take on the function is increased priorities in the dialplan to extract the data then cut it up into specified variable, then cut the resulting variable into further bits to get the usable data into another variable so it can be used for the real work. For example here is the 1.2 dialplan: exten => 326,1,Realtime(cfwd|exten|${EXTEN}|cf_) exten => 326,n,GotoIf($["${cf_active}" = "yes" ]?:326|20) exten => 326,n,Goto(cfaccess,${cf_cfnum},1) Here is the 1.4 dialplan to accomplish the same thing: exten => 326,1,Set(row="${REALTIME(cfwd,exten,${EXTEN})}") exten => 326,n,Set(column3=${CUT(row,"|",3)}) exten => 326,n,Set(column4=${CUT(row,"|",4)}) exten => 326,n,Set(cf_cfnum=${CUT(column3,"=",2)}) exten => 326,n,Set(cf_active=${CUT(column4,"=",2)}) exten => 326,n,GotoIf($["${cf_active}" = "no" ]?:326|20) exten => 326,n,Goto(cfaccess,${cf_cfnum},1) So I have in mind that maybe the function is a bit more versatile than the old app, but I don't really see it just yet. Can anyone shed some light on this and expound on the benefits or reasoning behind the switch in the application usage? Thanks. JR -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090313/acd7367a/attachment.htm
Tilghman Lesher
2009-Mar-13 23:34 UTC
[asterisk-users] Realtime dialplan application versus REALTIME dialplan function
On Friday 13 March 2009 17:41:42 JR Richardson wrote:> I'm upgrading some PBX's from 1.2 to 1.4 and having a bit of trouble with > converting the Realtime application to the REALTIME function. I have the > method down and understand simplistically what is going on, at least enough > to get my old 1.2 apps to run in 1.4 functions. I do not understand why > change from the app to the func? What the benefits?The specific reason was one of interface consistency. Dialplan applications "do" specific things with the channel, whereas functions are designed to either retrieve or set information on the channel. Applications may be interactive with the telephone user; functions should never be. You are not the first person to have trouble with this conversion. There are two new functions, REALTIME_FIELD() and REALTIME_HASH(), which will be in 1.6.2, which return some of this functionality. REALTIME_FIELD() permits the retrieval of any single field within a realtime database, while REALTIME_HASH() retrieves an entire record, though it encapsulates it into a container, to avoid possible clashes with existing channel variables. -- Tilghman
Seemingly Similar Threads
- Function to read a string as the variables as opposed to taking the string name as the variable
- Displaying median value over the horizontal(median)line in the boxplot
- make func_realtime work like app_realtime (1.6)
- conditional calculations per row (loop versus apply)
- parsing arguments of a function