[Asterisk-Users] extra parameter for DB read function
Julian Lyndon-Smith
asterisk at dotr.com
Wed May 31 04:41:31 MST 2006
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(EMAILADDR=Someone at test.com)
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/Someone at test.com)}
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
More information about the asterisk-users
mailing list