Just want to clarify something…
When I make a change within FreePBX (add or edit an extension, delete a ring group, make a change to Advanced Settings, or pretty much any other change), and then hit “Submit”, my understanding is that that change then goes into a MySQL database (and that’s the only place it goes), right?
Then when I hit “Apply Config”, FreePBX takes the contents of the MySQL database and writes a new set of .conf files to implement any changes, right?
Is there ever an instance (other than hand-editing the *_custom.conf files) that a change is made directly to a .conf file without having to hit “Apply Config” first?
So if I wanted to take my life in my hands and write some software that makes changes to the PBX configuration, that software could not make changes to the .conf files (except *_custom.conf) but would have to make changes to the database and then execute some command line (“amportal r”, maybe?) that implements the change.
Am I close?
Your top level view is correct (as I understand things), with obviously a ‘dialplan reload’ getting issued after the conf files are rewritten. You can manually run a module reload with the command:
The Voicemail Admin module directly edits the vm.conf file without storing values in MySQL. I have not delved deeply into the code, but I suspect the edits are done on page submit, not on reload. If there is one module doing this, there may well be others.
If your plan is to write software that will directly edit a *.conf file, consider creating a unique file for this purpose that you alone control and #include it in extensions_custom.conf (or any other conf file). That way you don’t have to worry about tip toeing around code not under your control.
Changes are stored in a database and all the various *.conf text files are re-created each time you hit apply. All FreePBX basically does is make it easy to create and re-create the text files. You don’t even need FreePBX running during normal operation. Only when you want to change something.
I think there are a small number of changes that only apply to config files. These tend to be “System Admin” changes like DNS and E-mail settings. You will know these because you don’t have to click “Apply” after you make the change.
So if I have to hit “Apply” on a change, it went into the database, and if not, it went directly into a config file. Got it.
Thanks to all…
Generally yes, but not always. Your words ‘the database’ mean FreePBX’s MySQL database but don’t forget that Asterisk has its own internal database. When you commit a number to the blacklist or the Asterisk phonebook, they get saved to the Asterisk database and as such, no reload is required.