[asterisk-users] Realtime dialplan application versus REALTIME dialplan function

2009-03-13 Thread JR Richardson
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

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Realtime dialplan application versus REALTIME dialplan function

2009-03-13 Thread Tilghman Lesher
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

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users