ASTDB Question - How To

I have nine numbers:


I want to store a variable for use, by number. I was thinking AstDB would be the right tool for the job, but wants quite sure how to do it.

The variable will come from a .txt file in in the /etc/asterisk folder.
For example:
the variable for 111.111.1111 would come from the /etc/asterisk/1111111111.txt file.

The .txt file would only contain the variable, the entire content of the file is the variable.
For example, 1111111111.txt would contain:
This whole sentence is the variable.


  • What’s a good way to structure this from a family key perspective? I am having a hard time conceptualizing this (my first time using AstDB).

  • Given the command, what’s the DB update command I should use to set the data?

Thanks in advance for any ideas you may have.

The Asterisk Database doesn’t really interface with external files.

Why do you need the text files, Why not set the key/value pair directly?

The DB function is easy to use.

exten => 100,1,Set(DB(1111111111/data)=This whole sentence is the variable)

exten => 101,1,NoOP(The Value of 1111111111/data is ${DB(1111111111/data)})

1 Like

I need a way for the end user to get the data into the keypair (or rather the dial plan, as a variable) without me. I was thinking of a webpage that would write the file (user fills out a field on the website, that field is linked to the .txt file), but would be open to other ideas if you had any.

The variable is a text string of less than 160 characters, that the end user would like to change periodically.

If you are going to have a web page modify your data you might as well use a sql database instead and func_odbc.