On Wed, 2006-05-31 at 14:30 +0100, Julian Lyndon-Smith wrote:
> There are often times that I want to read a DB value from the dialplan, 
> and if this family/key pair does not exist, set it to some default value.
> 
> for example:
> 
> 1234,1 => Set(EMAILADDR=${DB(x/y)}
> 1234,2 => GotoIf($["${EMAILADDR}" = ""]?3:4)
> 1234,3 => Set([EMAIL PROTECTED])
> 1234,4 => NoOp(${EMAILADDR})
> 1234,5 => Hangup()

I hate to burst your bubble, but what's wrong with using the DB_EXISTS
dialplan function?  

exten => 1234,1,Set(EMAILADDR=
${IF($[${DB_EXISTS(x/y)}]?${DB_RESULT}:[EMAIL PROTECTED])})

Obviously it's a little harder to read (especially when all placed on
one line), but it's already quite easy to use without adding more code
to Asterisk.

-Jared

_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

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

Reply via email to