DB()

DB(family/key)

Reads/sets a value in the Asterisk DB (AstDB). When reading, either a value is returned, or an empty string if the key does not exist. The output can be found in the variable DB_RESULT.

; Set open/source in the AstDB and then query it:
exten => 123,1,Set(DB(open/source)=${yes})
exten => 123,n,Set(var=${DB(open/source)})
exten => 123,n,GotoIf($[[${DB(open/source)} = 1]?opensource:closedsource
)
[Note]

Internal help for this application in Asterisk 1.4: 

  -= Info about function 'DB' =- 

[Syntax]
DB(<family>/<key>)

[Synopsis]
Read from or write to the Asterisk database

[Description]
This function will read from or write a value to the Asterisk database. 
 On a
read, this function returns the corresponding value from the database, o
r blank
if it does not exist.  Reading a database value will also set the variab
le
DB_RESULT.  If you wish to find out if an entry exists, use the DB_EXIST
S
function.

diff output to internal help in Asterisk 1.2: 

- none - 

See also. the section called “DB_EXISTS(), the section called “DB_DELETE(), the section called “DBdeltree()