Write variable to file

Oh hai gusy !

I have to implement asterisk as IVR system here, and I have made quite a progress, except understanding one thing: how to write a variable from extensions.conf into a file ?

The thing is: I want IVR users to be able to use DTMF to enter their contract number and then store this number into file (or wherever else, database maybe?) to process it afterwards. So far I have figured out how to output any variable to the asterisk console at verbose level at least 3, but no other clues yet. Any tips, please ?

Build an agi script, written in your favorite scripting language, I use php and phpagi classes.
See voip-info.org/wiki-Asterisk+AGI .


Marco Bruni

Have a look at the Asterisk Database (AstDB) or even the MySQL add-on (in asterisk-addons).

Thank you all for quick response ! Gonna try that AGI script thing first.


You could also use the “System()” dialplan application. I have used it to trigger emails and pass variables out of the dialplan to the OS.

You place the system command in the (). In this case I would suggest you simply pass the variable to your app, DB, file, etc. I don’t have a code sample handy but as I recall the quotes are the nasty here.