Asterisk Internal Database
Asterisk comes with a database that is used internally and made available for Asterisk programmers and administrators to use as they see fit.
Asterisk versions up to 1.8 used the Berkeley DB, and in version 10 the project
What is the Purpose of the internal database in Asterisk
The database really has two purposes:
- Asterisk uses it to store information that needs to persist between reloads/restarts. Various modules use it for this purpose automatically.
- Users can use it to store arbitrary data. This is done using a variety of dialplan applications and functions such as:
- Application: DBdeltree
Usages: Read from or write to the Asterisk database.
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, or blank if it does not exist. Reading a database value will also set the variable DB_RESULT. If you wish to find out if an entry exists, use the DB_EXISTS function.
Usages: Return a value from the database and delete it.
This function will retrieve a value from the Asterisk database and then remove that key from the database.
DB_RESULT will be set to the key’s value if it exists.
Database commands on the CLI
*AsteirskCLI> core show help database
database del -- Removes database key/value database deltree -- Removes database keytree/values database get -- Gets database value database put -- Adds/updates database value database query -- Run a user-specified query on the astdb database show -- Shows database contents database showkey -- Shows database contents