[Asterisk-Dev] Loss of functionality with depreciation of DBGet/Put?

Leif Madsen - Certified Asterisk Consultant asterisk.leif.madsen at gmail.com
Tue May 17 12:23:15 MST 2005


On 5/16/05, Kevin P. Fleming <kpfleming at digium.com> wrote:
> exten => 100,1,Set(temp=${DB(CFIM/200)})
> exten => 100,n,GotoIF(${temp} = "" ? novalue)
> exten => 100,n,...
> exten => 100,n(novalue),...

I've been trying to figure out the best way of replacing the DBget()
n+101 functionality in the IRC channel - thanks to MikeJ, jsmith and
drumkilla for the help. I don't like the idea of having to set a
temporary variable, so here's a possibly better way of handling the
n+101 syntax (works like the ${DIALSTATUS} channel variable for the
Dial() application).

exten => 100,1,Set(DB(foo/bar)=blah)
exten => 100,n,GotoIf(${EXISTS(${DB(foo/bar)})}?:novalue)
exten => 100,n,...
exten => 100,n(novalue),...

Also of interest is that you don't actually need the GotoIf()
application at all, replace with:

exten => 100,n,Goto(${IF(${EXISTS(${DB(foo/bar)})})}?:novalue)

Nope, you won't get any argument from me that the syntax is ugly and
error prone - however the use of functions is very powerful and a
great addition - but I hate the syntax :)

-- 
Leif Madsen
http://www.leifmadsen.com



More information about the asterisk-dev mailing list