Open Source Training Seminar FreePBX Paid Support

Ticket #1356 (new Feature Requests)

Opened 2 years ago

Last modified 2 years ago

Method to write complete files with retrieve_conf

Reported by: gregmac Assigned to:
Priority: major Milestone: 4.0
Component: Asterisk Configuration Version:
Keywords: Cc:
Confirmation: SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

Right now, modules (eg, parking) just write directly to files they need.. to allow for proper seperation of web interface and configuration writing, we should really have retrive_conf writing all files.

This can be done by creating a table (eg, files) that has 'filename', 'active' and 'data' fields. modules that need to write files can just put stuff into the database, and then retrieve_conf can read it and write the actual files out. It should do path substitution (eg, "%ASTETC%/file.conf" becomes /etc/asterisk/file.conf).

Prior to writing configs, UPDATE files SET active = 0 should be run, and retrieve_conf should delete any files with active == 0 (and only then remove them from the table - this way we have a reliable method to delete previously-created files).

There should be an API for this (eg, the table should not be accessed by modules directly), so modules can do freepbx_file_set_contents($filename, $data) (UPDATES or INSERTS a row, with active=1) or freepbx_file_remove($filename) (set active=0,data=).

Change History

11/15/06 14:57:37 changed by p_lindheimer

while you are at it - you should actually be doing the same thing with updating astdb variables because otherwise the perceived separation of configuration changes and THE RED BAR isn't really there. In other words, extensions writes to astdb variables, followme and many others. So as soon as someone clicks submit, the pbx is in a partial inconsisten state until they apply. So what you really need is a transaction log that can be applied by retrieve_conf or similar, for anything that would change the state of the machines and generate a reload. This includes adding, deleting and changing astdb variables, file changes, etc. Voicemail would have to be looked at carefully - this one is a bit volatile and needs some thought.

11/16/06 18:10:34 changed by gregmac

Thinking about this further, I think this implementation is a bit off.. modules should really be writing their data into tables that are data-specific. The _get_config scripts can then take that data, and they should be responsible for populating a global $files array (similar to the $ext idea) with data, eg, $files%ASTETC%/file.conf? = $data;

philippel: yeah, I think you're right, but created #1368 to deal with that issue.

01/08/07 11:46:49 changed by

  • milestone deleted.

Milestone 2.3 deleted

01/08/07 12:06:32 changed by vgster

  • milestone set to 2.3.
Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads