Some of us have been using FreePBX for a very long time and are very used to going to [i]/etc/amportal.conf[/i] to make certain changes. Others rely on the powers of google to quickly find help on how to do things which means they benefit from our collective wisdom, which all points to instructions that say [i]"Go to /etc/amportal.conf and change XYZ to abc."[/i] So why is it when you do that on version 2.9 it does not work and how does all that relate to these new [i]Advanced Settings[/i]? Or if you picked up on Advanced Settings, [i]"why won't it let me change them?"[/i]Haven't gotten to 2.9 yet and wondering what I'm talking about? Here's [url=/news/2011-02-23/2-9-version-upgrade-module-beta-program-status-more][b]FreePBX Version Upgrade Module Information[/b][/url] from last week.
Since I have made at least a dozen or more comments in the forums and tickets on amportal.conf vs. Advanced Settings often related to this confusion, it’s time to try and clarify what is going on. Historically FreePBX had many many Advanced Settings that had to be configured in amportal.conf. For many users this meant going out of their comfort zone requiring command line access and editors like nano or vim or sometimes worse, it would involve blindly following some instructions that turned up on google telling them to run some cryptic sed command that did some magic resulting in their desired behavior. The problem with all of this was two fold. It’s very error prone and it’s hard and potentially dangerous to do for most users.
Some of the more common settings that you may have heard of include:
AMPMGRUSER & AMPMGRPASS - sets the default AMI user/password that FreePBX requires and must also be changed in manager.conf
AMPEXTENSIONS - set to either extensions or deviceanduser to control whether in Extension or Device and User mode
[*]USEDEVSTATE - whether or not to take advantage of DEVICE_STATE() and generate lots of hints for several feature codes to be used with BLF buttons on phones
and many many many more… So, what changed in 2.9? Why did it change? Why is there still an amportal.conf file? And other questions…
Why did it change?
The biggest reason for the change was to make things easier for you, the end user, to be aware of the available settings and help control and police the settings so as to try and catch errors, avoid typos and in general present them inside of a GUI consistent with the rest of your configuration experience. The new Advanced Settings page and framework also forces us to document the settings so that you can get some idea what they do and whether or not you should use or change them.
Why is there still an amportal.conf file?
The amportal.conf file had three main purposes prior to version 2.9:
 It provided the “bootstrap” information that FreePBX used to get started, e.g. AMPDBNAME, AMPDBUSER, AMPDBPASS, AMPDBHOST and AMPDBENGINE (and optionally datasource).
 it provided a place to define many advanced settings that ultimately are made available inside of the FreePBX code base as $amp_conf[‘VARNAME’]
[*] As a place for additional settings, it is used by other applications in the FreePBX eco system (example, Flash Operator Panel) and probably others that we have no awareness of.
When migrating to version 2.9, we have defined a new and very minimalistic configuration file which is typically located in /etc/freepbx.conf and which provides the bare essentials that are needed to bootstrap FreePBX now. We’ll talk about all the bootstrap changes at some other time but for now, if you are wondering why the above mentioned configuration variable can not be found on the Advanced Settings page, it’s because they are in freepbx.conf.
The remaining settings have been migrated to the internal database and should all be available from the GUI page.
So if they’ve all been migrated, how come there’s still an /etc/amortal.conf file on your system? Well the third bullet point, those third part applications, is the main reason we still have an amportal.conf. It works as follows, once you have fully migrated, we will start auto-generating an amportal.conf file every time you press the Apply Configuration Changes bar and all the other configuration files are generated. This makes sure that those third party applications, AGI scripts, etc. continue to have the file they are used to having with all of the updated configuration settings. We expect those applications to migrate but understand that it will not happen overnight. This is simply our continued attempt to do everything reasonable within our power to help maintain compatibility while at the same time improving and evolving.
We do use amportal.conf in one other place. On initial install, with the use of install_amp that you may be doing or your distro may be doing for you. The install_amp script will use the specified settings when you first install, to get you started and even to make freepbx.conf for you if not present.
What does fully migrated mean and/or Why can’t you edit your settings?
The migration process for systems being upgrade is a bit tricky this time around. The amortal.conf file has never belonged to the asterisk user which is usually the same as the apache user; it has typically belonged to root. As such, we don’t always have the control necessary to make changes to amportal.conf when upgrading through the GUI since the permissions are limited to the web user permissions and thus they can’t usually write to amportal.conf. This presents a dilemma because if we can’t write to amportal.conf then it means we can’t update it with new settings if you go and change those settings. So what do we do and how does it effect you?
The simple answer is, until we can obtain write access to the amportal.conf file, we will not let you change anything on the Advanced Settings page. We’ll also try hard to let you know of the issue including Notifications sent to the panel and log messages. Inside of FreePBX we continue to operate much like we always did. This means we will read amportal.conf and update the internal database with any changes that may have been made to that file so we are always consistent. This means you are running in a crippled mode and thus you are not fully migrated.
To finish off the migration process, we need to get the permissions changed on the /etc/amportal.conf file. For some of you, it may be no big deal, you’ll just go and make the file permission or ownership change in Linux and be on your way. For the most though, this is again outside of your comfort zone. That’s where another command comes in that many may be familiar with, the amportal command. (Which is actually the freepbx_engine command but most people don’t realize that). This is the command that is used to start and stop Asterisk amongst many other things, and it is almost always used (and should be used) by most distros to start Asterisk when you first boot up. As luck has it, this command must be run by root and when you boot your system it is run by root. This means that eventually, and maybe mysteriously, that file permission issue will go away and your migration will be finished and suddenly you will have access to Advanced Settings again.
Of course one challenge here is three fold. FreePBX easily upgrades without requiring either Asterisk or Linux to be rebooted. Linux is rock solid (not like some other operating systems many of us know about) and thus often has up times in months if not years, and Asterisk has come a long way, meaning it often has uptimes in months at least. Furthermore, if you type core restart now from within Asterisk, it will not run amportal. Therefore, if you want to get a jump on things, from the Linux Command line, you can type amportal chown or any other valid amportal comand because each time run, it will check on this permission issue and should rectify the problem for you.
There are settings I want to change but there’s no option to change them?
There are a lot of very volatile settings available and as a further step to try to protect user’s against fatal and costly errors we have made many of the more volatile settings read only which means you need to take extra measures to change them. I’ll cover this by describing the 4 available options at the top of the Advanced Settings page, the Advanced Settings Details category.
Display Friendly Name
We have tried to use less cryptic names for the settings vs. the internal variable names that many of us may have gotten used to over the years. You can still see what these map to along with a lot of other useful information by hovering over the label and having a look at the tool tip. If you prefer to simply have all the cryptic names listed (which can be very useful for a developer) you can set this value to false.
Display Hidden Settings
This will not be of interest to most people. FreePBX has a number of settings that it uses internally and are never meant to be set or changed by the user. If you want to see what these are, you can change this value to true. You will not be given an opportunity to edit these regardless of the other settings. Only a FreePBX module can do this.
Display Readonly Settings
As mentioned, there are many settings that are quite volatile and by default we don’t even show these settings. If you want them displayed you can set this to true. You will not be able to edit them without changing the value of the last option.
Override Readonly Settings
This is the dangerous one. When set to true, it ignores the status of all the read only settings and allows you to change them. You should be VERY careful when doing this because many of these settings could cripple or crash your system requiring some pretty advanced knowledge to get it back working.
Where’s the Submit button, I only have a Refresh Page button?
Unlike most FreePBX pages, there is no Submit button. Each setting is changed by clicking on the little green checkbox to the right of the setting that will appear when you make a change. Each setting must be individually changed if you change more than a single setting. If these are not coming up for you, assuming you are fully migrated then check your bowser. We are currently aware of an IE8 issue which is not fixed at the time of this writing. If there are other issues, seek help in the forums and/or once you are pretty sure it’s a bug, file a report in the tracker and please provide lots of details such as browsers and other so we can reproduce the problem.
So there you have it! In addition to the roughly 100 or settings that existed prior to version 2.9, you can now see the MANY settings available since then (at last check, somewhere close to 200 in all).
Philippe - On behalf of the FreePBX Team!