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 have modified the db function to take an extra parameter to set if the key does not exist. So, the dialplan would now look like:

1234,1 => Set(EMAILADDR=${DB(x/y/[EMAIL PROTECTED])}
1234,2 => NoOp(${EMAILADDR})
1234,3 => Hangup()

It's just a shortcut to acheive the same goal, but with 2 less lines in the dialplan.

Now, I am *not* a C programmer, so I may have made some horrendous mistake or potential segfault, so is there someone who would look at the changes before I make a fool of myself and post it to the -dev list or mantis ?

Much appreciated :)

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

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

Reply via email to