[Asterisk-Dev] Adding set and backref functionality to the function
syntax.
Jerris, Michael MI
mjerris at ofllc.com
Tue May 17 23:56:16 MST 2005
> Jerris, Michael MI
>
> Drumkilla is working on correcting this issue. This
> conversation brings up another part of functions which is
> less optimal than the application way of doing things. We
> now need to do the lookup twice, one time to check if it is
> null (once that issue is fixed) and a second time to get the
> acutal value. Can anyone come up with a good syntax and
> functionality within the fuctions structure that would allow
> for performing the fuction only once, but allowing multiple
> branches of action based upon the result of a function check.
> Perhapse allowing a set somehow within the function parsing.
> Something roughly (although obviously the syntax is totally
> pseudo here) like this:
>
> Dial(If(Isnull(x=DB(Key\${Exten})?SIP\100:${x})|15|t)
>
Gotta love quoting yourself. In discussions this evening with drumkilla
(Russell) and Corydon (Tilghman) we came up with the following to toss
around for syntax both to setvar within a function block, and the
ability to backref a var from the same line in the dialplan, essentially
a variable that lives only in that line. Please provide comments on the
format. Parsing should be fairly low hit within the code that searches
for the function name.
${x=DB(foo/${EXTEN})} would set the variable x to the return of the DB
function, and the entire expression would evaluate just like
${DB(foo/${EXTEN})}
${\x=DB(foo/${EXTEN})}would set the backref var \x to the return of the
DB function, and the entire expression would evaluate just like
${DB(foo/${EXTEN})}. \x would live only in the parsing of that line in
the dialplan.
Examples:
${IF(${ISNULL(${x=DB(foo/${EXTEN})})}?other:${x})} for setvar
${IF(${ISNULL(${\x=DB(foo/${EXTEN})})}?other:${\x})} for backref
Mike
More information about the asterisk-dev
mailing list