[asterisk-users] RealTime in dialplan - proper way?
Boehm, Matthew
mboehm at theplanet.com
Thu Aug 13 14:21:42 CDT 2009
Hello,
So much keeps changing with the dialplan and Realtime lookups. Just
downloaded the latest stable 1.6.1.2. The app_realtime, which was
perfectly brilliant and did exactly what I needed, is gone; replaced
with func_realtime. The REALTIME function is unacceptable:
; Get the conference number from the user
exten => s,n(readconfno),Read(USER_CONFNO,conf-getconfno,0,3,20)
; See if that conference exists in database
exten => s,n,Set(CONFINFO="${REALTIME(meetme,confno,${USER_CONFNO})}")
; If conference doesn't exist, play error
exten => s,n,GotoIf(${ISNULL(${CONFINFO})} ? 101)
; Retardedly string-manip out the conference settings
exten => s,n,Set(CONF_PINPAIR=${CUT(CONFINFO,"|",2)})
exten => s,n,Set(CONF_PIN=${CUT(CONF_PINPAIR,"=",2)})
exten => s,n,Set(CONF_ADMINPINPAIR=${CUT(CONFINFO,"|",3)})
exten => s,n,Set(CONF_ADMINPIN=${CUT(CONF_ADMINPINPAIR,"=",2)})
exten => s,n,Set(CONF_SETTINGSPAIR=${CUT(CONFINFO,"|",5)})
exten => s,n,Set(CONF_SETTINGS=${CUT(CONF_SETTINGSPAIR,"=",2)})
exten => s,n,NoOp(User PIN: ${CONF_PIN})
exten => s,n,NoOp(Admin PIN: ${CONF_ADMINPIN})
exten => s,n,NoOp(Conf Settings: ${CONF_SETTINGS})
The function returns a single row as one long concatenated string that
must be CUT multiple times using multiple variables. Not only does this
waste resources but there is no guarantee that the columns returned back
will be in the same order all the time.
I found a SVN commit dated Nov 19 2008 that introduces two new
functions, REALTIME_HASH and REALTIME_FIELD. But for some reason, this
patch is NOT located in the 1.6.1.2 that I just downloaded. (Bug #13651)
How is that possible that a 10 month old patch to the trunk is not in
the most recent stable?
So, what is the proper way to do REALTIME lookups within the dial plan
that don't involve so much CUT'ing?
-Matthew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20090813/64748404/attachment.htm
More information about the asterisk-users
mailing list