Changeset 10969 for freepbx/trunk

Show
Ignore:
Timestamp:
01/15/11 23:54:21 (2 years ago)
Author:
p_lindheimer
Message:

more prep for creating all settings and found a bunch more that were not accounted for re #4740, still have not tested it, will do so tomorrow

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/trunk/libfreepbx.install.php

    r10966 r10969  
    377377 
    378378/********************************************************************************************************************/ 
    379  
    380 // TODO: copy all descriptions into _() gettext at top to be picked up by localization tools 
     379/*                          FREEPBX SETTINGS (AMPORTAL.CONF) DEFINED HERE                                           */ 
     380/********************************************************************************************************************/ 
     381// 
     382// TODO: find a good way to extract the required localization strings for the tools to pickup 
     383// 
     384// freepbx_settings_init() 
     385// this is where we initialize all the freepbx_settings (amportal.conf). This will be run with install_amp and every 
     386// time we run the framework installer, so new settings can be added here that are framework wide. It may make send to 
     387// break this out separtely but for now we'll keep it here since this is already part of the ifrastructure that is 
     388// used by both install_amp and the framework install/upgrade script. 
    381389// 
    382390function freepbx_settings_init() { 
    383391  global $amp_conf; 
     392 
    384393  //TODO will probably change to freepbx_settings.class.php 
     394  // 
    385395  require_once ($amp_conf['AMPWEBROOT'].'/admin/libraries/config.functions.php'); 
    386396 
     
    396406 
    397407  // 
    398   // CATEGORY: Basic Setup 
    399   // 
    400   $set['category'] = 'Basic Setup'; 
     408  // CATEGORY: System Setup 
     409  // 
     410  $set['category'] = 'System Setup'; 
    401411 
    402412  // AMPENGINE 
     
    413423  // AUTHTYPE 
    414424  $set['value'] = 'database'; 
    415   $set['options'] = 'none,database,webserver'; 
    416   $set['description'] = 'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. Valid settings are: none, database.'; 
     425  $set['options'] = 'database,none,webserver'; 
     426  $set['description'] = 'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. When using database you can create users that are restricted to only certain module pages. When set to none, you should make sure you have provided security at the apache level. When set to webserver, FreePBX will expect authentication to happen at the apache level, but will take the user credentials and apply any restrictions as if it were in database mode.'; 
    417427  $set['level'] = 3; 
    418428  $set['type'] = CONF_TYPE_SELECT; 
     
    495505  $set['level'] = 0; 
    496506 
     507 
    497508  // 
    498509  // CATEGORY: Dialplan and Operational 
     
    614625  $freepbx_conf->define_conf_setting('ASTRUNDIR',$set); 
    615626 
    616   // ASTRUNDIR 
    617   $set['value'] = '/var/run/asterisk'; 
    618   $set['description'] = 'This is the default directory for Asterisks run files.'; 
    619   $set['type'] = CONF_TYPE_DIR; 
    620   $freepbx_conf->define_conf_setting('ASTRUNDIR',$set); 
    621  
    622627  // ASTVARLIBDIR 
    623628  $set['value'] = '/var/lib/asterisk'; 
     
    637642  $set['type'] = CONF_TYPE_DIR; 
    638643  $freepbx_conf->define_conf_setting('MOHDIR',$set); 
     644 
    639645 
    640646  // 
     
    705711  // AMPMGRPASS 
    706712  $set['value'] = 'amp111'; 
    707   $set['description'] = 'Password for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.<br>Default = amp111'; 
     713  $set['description'] = 'Password for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.'; 
    708714  $set['type'] = CONF_TYPE_TEXT; 
    709715  $freepbx_conf->define_conf_setting('AMPMGRPASS',$set); 
     
    711717  // AMPMGRUSER 
    712718  $set['value'] = 'admin'; 
    713   $set['description'] = 'Username for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.<br>Default = admin'; 
     719  $set['description'] = 'Username for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.'; 
    714720  $set['type'] = CONF_TYPE_TEXT; 
    715721  $freepbx_conf->define_conf_setting('AMPMGRUSER',$set); 
     
    717723  // ASTMANAGERHOST 
    718724  $set['value'] = 'localhost'; 
    719   $set['description'] = 'Hostname for the Asterisk Manager<br>Default = 5038'; 
     725  $set['description'] = 'Hostname for the Asterisk Manager'; 
    720726  $set['type'] = CONF_TYPE_TEXT; 
    721727  $freepbx_conf->define_conf_setting('ASTMANAGERHOST',$set); 
     
    725731  // ASTMANAGERPORT 
    726732  $set['value'] = '5038'; 
    727   $set['description'] = 'Port for the Asterisk Manager<br>Default = 5038'; 
    728   $set['type'] = CONF_TYPE_TEXT; 
     733  $set['description'] = 'Port for the Asterisk Manager'; 
     734  $set['type'] = CONF_TYPE_UINT; 
    729735  $freepbx_conf->define_conf_setting('ASTMANAGERPORT',$set); 
    730736 
    731  
     737  // ASTMANAGERPROXYPORT 
     738  $set['value'] = ''; 
     739  $set['description'] = 'Optional port for an Asterisk Manager Proxy'; 
     740  $set['type'] = CONF_TYPE_UINT; 
     741  $set['emptyok'] = 1; 
     742  $freepbx_conf->define_conf_setting('ASTMANAGERPROXYPORT',$set); 
     743  $set['emptyok'] = 0; 
     744 
     745 
     746  // 
    732747  // CATEGORY: Developer and Customization 
    733748  // 
    734749  $set['category'] = 'Developer and Customization'; 
    735750  $set['level'] = 2; 
    736  
    737   // POST_RELOAD 
    738   $set['value'] =  
    739   $set['description'] = 'Automatically execute a script after applying changes in the AMP admin. Set POST_RELOAD to the script you wish to execute after applying changes. If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page.'; 
    740   $set['emptyok'] = 0; 
    741   $set['type'] = CONF_TYPE_TEXT; 
    742   $freepbx_conf->define_conf_setting('POST_RELOAD',$set); 
    743   $set['emptyok'] = 1; 
    744751 
    745752  // FPBXDBUGFILE 
     
    761768  $freepbx_conf->define_conf_setting('DEVELRELOAD',$set); 
    762769 
     770  // PRE_RELOAD 
     771  $set['value'] = ''; 
     772  $set['description'] = 'Optional script to run just prior to doing an extension reload to Asterisk through the manager after pressing Apply Configuration Changes in the GUI.'; 
     773  $set['emptyok'] = 1; 
     774  $set['type'] = CONF_TYPE_TEXT; 
     775  $freepbx_conf->define_conf_setting('PRE_RELOAD',$set); 
     776  $set['emptyok'] = 0; 
     777 
     778  // POST_RELOAD 
     779  $set['value'] = ''; 
     780  $set['description'] = 'Automatically execute a script after applying changes in the AMP admin. Set POST_RELOAD to the script you wish to execute after applying changes. If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page.'; 
     781  $set['emptyok'] = 1; 
     782  $set['type'] = CONF_TYPE_TEXT; 
     783  $freepbx_conf->define_conf_setting('POST_RELOAD',$set); 
     784  $set['emptyok'] = 0; 
     785 
    763786  // POST_RELOAD_DEBUG 
    764787  $set['value'] = false; 
     
    766789  $set['type'] = CONF_TYPE_BOOL; 
    767790  $freepbx_conf->define_conf_setting('POST_RELOAD_DEBUG',$set); 
     791 
     792  // AMPLOCALBIN 
     793  $set['value'] = ''; 
     794  $set['description'] = 'If this directory is defined, retrieve_conf will check for a file called <i>retrieve_conf_post_custom</i> and if that file exists, it will be included after other processing thus having full access to the current environment for addtional customization.'; 
     795  $set['type'] = CONF_TYPE_DIR; 
     796  $freepbx_conf->define_conf_setting('AMPLOCALBIN',$set); 
    768797 
    769798  // AMPDISABLELOG 
     
    792821  $freepbx_conf->define_conf_setting('DISABLE_CSS_AUTOGEN',$set); 
    793822 
     823 
    794824  // 
    795825  // CATEGORY: Flash Operator Panel 
     
    888918  $set['emptyok'] = 0; 
    889919 
    890  
    891920  // AMPADMINLOGO 
    892921  $set['value'] = ''; 
     
    10151044  $freepbx_conf->define_conf_setting('BRAND_CSS_CUSTOM',$set); 
    10161045 
     1046 
     1047  // The following settings are used in various modules prior to 2.9. If they are found in amportal.conf then we 
     1048  // retain their values until the individual modules are updated and their install scripts run where a full 
     1049  // configuration (descriptions, defaults, etc.) will be provided and maintained. This provides just enough to 
     1050  // carry the setting through the migration since most upgrades will run framework or install_amp followed by the 
     1051  // module install scripts. 
     1052  // 
     1053  $module_migrate['AMPPLAYKEY'] = CONF_TYPE_TEXT; 
     1054  $module_migrate['AMPBACKUPEMAILFROM'] = CONF_TYPE_TEXT; 
     1055  $module_migrate['AMPBACKUPSUDO'] = CONF_TYPE_BOOL; 
     1056  $module_migrate['USEQUEUESTATE'] = CONF_TYPE_BOOL; 
     1057  $module_migrate['DASHBOARD_INFO_UPDATE_TIME'] = CONF_TYPE_UINT; 
     1058  $module_migrate['DASHBOARD_STATS_UPDATE_TIME'] = CONF_TYPE_UINT; 
     1059  $module_migrate['SSHPORT'] = CONF_TYPE_UINT; 
     1060  $module_migrate['MAXCALLS'] = CONF_TYPE_UINT; 
     1061  $module_migrate['AMPMPG123'] = CONF_TYPE_BOOL; 
     1062  $module_migrate['PARKINGPATCH'] = CONF_TYPE_BOOL; 
     1063 
     1064  $mod_set['value'] = ''; 
     1065  $mod_set['defaultval'] = ''; 
     1066  $mod_set['readonly'] = 0; 
     1067  $mod_set['hidden'] = 1; 
     1068  $mod_set['level'] = 10; 
     1069  $mod_set['module'] = ''; 
     1070  $mod_set['category'] = 'Under Migration'; 
     1071  $mod_set['emptyok'] = 1; 
     1072  $mod_set['description'] = 'This setting is being migrated and will be initialized by its module install script on upgrad.'; 
     1073  foreach ($module_migrate as $setting => $type) { 
     1074    if (isset($amp_conf[$setting])  && !$freepbx_conf->conf_setting_exists($setting)) { 
     1075      $mod_set['value'] = $amp_conf[$setting]; 
     1076      $mod_set['type'] = $type; 
     1077      $freepbx_conf->define_conf_setting($setting,$mod_set); 
     1078    } 
     1079  } 
     1080 
    10171081  $freepbx_conf->commit_conf_settings(); 
    10181082} 
    1019  
    1020 // TODO: temporary, this is all going to be removed, just transitionary work 
    1021 function bogus_for_now() { 
    1022 // TODO: CODE FOR MODULES 
    1023  
    1024 /* 
    1025   TODO: I think I need these 
    1026  
    1027   ASTMANAGERPROXYPORT 
    1028   SSHPORT 
    1029  
    1030   TODO: Check what version we have the patch for? Possibly skip, possibly not. 
    1031  
    1032   PARKINGPATCH 
    1033  
    1034   TODO: Check these, probably skip 
    1035  
    1036   AMPBACKUPEMAILFROM 
    1037   AMPBACKUPSUDO 
    1038   AMPBACKUPADVANCED 
    1039 */ 
    1040  
    1041   // TODO: skipping some of the BACKUP MIGRATION, IF THEY DIDN'T DO IT ALREADY, TOUCH LUCK! 
    1042  
    1043   // USEQUEUESTATE 
    1044   // 
    1045   $set['value'] = false; 
    1046   $set['defaultval'] =& $set['value']; 
    1047   $set['readonly'] = 0; 
    1048   $set['hidden'] = 0; 
    1049   $set['level'] = 3; 
    1050   $set['module'] = 'queues'; 
    1051   $set['category'] = ''; 
    1052   $set['emptyok'] = 0; 
    1053   $set['description'] = 'Setting this flag will generate the required dialplan to integrate with the following Asterisk patch: <b>https://issues.asterisk.org/view.php?id=15168</b>. This setting is obsolete on Asterisk 1.8+ systems where the hint state is now standard and always used. This asterisk patch is only available on Asterisk 1.4, trying to use this setting on Asterisk 1.6 will break some queue behavior and should be avoided'; 
    1054   $set['type'] = CONF_TYPE_BOOL; 
    1055   $freepbx_conf->define_conf_setting('USEQUEUESTATE',$set); 
    1056  
    1057  
    1058   // DASHBOARD_INFO_UPDATE_TIME 
    1059   // 
    1060   $set['value'] = 6; 
    1061   $set['defaultval'] =& $set['value']; 
    1062   $set['readonly'] = 0; 
    1063   $set['hidden'] = 0; 
    1064   $set['level'] = 0; 
    1065   $set['module'] = 'dashboard'; 
    1066   $set['category'] = ''; 
    1067   $set['emptyok'] = 1; 
    1068   $set['description'] = 'Update rate in seconds of all sections of the System Status panel except the Info box.'; 
    1069   $set['type'] = CONF_TYPE_UINT; 
    1070   $freepbx_conf->define_conf_setting('DASHBOARD_INFO_UPDATE_TIME',$set); 
    1071  
    1072   // DASHBOARD_INFO_UPDATE_TIME 
    1073   // 
    1074   $set['value'] = 30; 
    1075   $set['defaultval'] =& $set['value']; 
    1076   $set['readonly'] = 0; 
    1077   $set['hidden'] = 0; 
    1078   $set['level'] = 0; 
    1079   $set['module'] = 'dashboard'; 
    1080   $set['category'] = ''; 
    1081   $set['emptyok'] = 1; 
    1082   $set['description'] = 'Update rate in seconds of the Info section of the System Status panel.'; 
    1083   $set['type'] = CONF_TYPE_UINT; 
    1084   $freepbx_conf->define_conf_setting('DASHBOARD_INFO_UPDATE_TIME',$set); 
    1085  
    1086  
    1087   // AMPMPG123 
    1088   // 
    1089   $set['value'] = true; 
    1090   $set['defaultval'] =& $set['value']; 
    1091   $set['readonly'] = 0; 
    1092   $set['hidden'] = 0; 
    1093   $set['level'] = 0; 
    1094   $set['module'] = 'music'; 
    1095   $set['category'] = ''; 
    1096   $set['emptyok'] = 0; 
    1097   $set['description'] = 'When set to false, the MP3 files can be loaded and WAV files converted to MP3 in the MoH module. The default behavior of true assumes you have mpg123 loaded as well as sox and will convert MP3 files to WAV. This is highly recommended as MP3 files heavily tax the system and can cause instability on a busy phone system'; 
    1098   $set['type'] = CONF_TYPE_BOOL; 
    1099   $freepbx_conf->define_conf_setting('AMPMPG123',$set); 
    1100  
    1101    
    1102   // 
    1103   // NEW TO 2.9: 
    1104   // 
    1105  
    1106  
    1107   // DAYNIGHTTCHOOK 
    1108   // 
    1109   $set['value'] = false; 
    1110   $set['defaultval'] =& $set['value']; 
    1111   $set['readonly'] = 0; 
    1112   $set['hidden'] = 0; 
    1113   $set['level'] = 0; 
    1114   $set['module'] = 'daynight'; 
    1115   $set['category'] = ''; 
    1116   $set['emptyok'] = 0; 
    1117   $set['description'] = 'By default, the Day/Night module will not hook Time Conditions allowing one to associate a daynight manual override with a time condition since time conditions have their own feature code as of version 2.9. If there is already an associaiton configured (on an upgraded system), this will have no affect for the Time Conditions that are effected. Setting this to true reverts the 2.8 and prior behavior by allowing for the use of a daynight toggle to be associated with a time conditon. This can be useful for two scenarios. First, to override a Time Condition without the automatic resetting that occurs with the built in Time Condition overrides. The second use is the ability to associate a single daynight toggle with multiple time conditions thus creating a <b>master switch</b> that can be used to override several possible call flows through different time conditions.'; 
    1118   $set['type'] = CONF_TYPE_BOOL; 
    1119   $freepbx_conf->define_conf_setting('DAYNIGHTTCHOOK',$set); 
    1120  
    1121   // TCINTERVAL 
    1122   // 
    1123   $set['value'] = '60'; 
    1124   $set['defaultval'] =& $set['value']; 
    1125   $set['readonly'] = 0; 
    1126   $set['hidden'] = 0; 
    1127   $set['level'] = 0; 
    1128   $set['module'] = 'timeconditions'; 
    1129   $set['category'] = ''; 
    1130   $set['emptyok'] = 0; 
    1131   $set['description'] = 'The polling interval in seconds used by the Time Conditions manintenace task, launched by an Asterisk call file used to update Time Conditions override states as well as keep custom device state hint values up-to-date when being used with BLF. A shorter interval will assure that BLF keys states are accurate. The interval should be less than the shortest configured span between two time condition states, so that a manual overide during such a period is properly reset when the new period starts.'; 
    1132   $set['type'] = CONF_TYPE_SELECT; 
    1133   $set['options'] = '60, 120, 180, 240, 300, 600, 900'; 
    1134   $freepbx_conf->define_conf_setting('TCINTERVAL',$set); 
    1135  
    1136   // TCMAINT 
    1137   // 
    1138   $set['value'] = true; 
    1139   $set['defaultval'] =& $set['value']; 
    1140   $set['readonly'] = 0; 
    1141   $set['hidden'] = 0; 
    1142   $set['level'] = 0; 
    1143   $set['module'] = 'timeconditions'; 
    1144   $set['category'] = ''; 
    1145   $set['emptyok'] = 0; 
    1146   $set['description'] = 'If set to false, this will override the execution of the Time Conditons maintenace task launched by call files. If all the feature codes for time conditions are disabled, the maintenance task will not be launched anyhow. Setting this to false would be fairly un-common. You may want to set this temporarily if debugging a system to avoid the periodic dialplan running through the CLI that the maintenance task launches and can be distracting.'; 
    1147   $set['type'] = CONF_TYPE_BOOL; 
    1148   $freepbx_conf->define_conf_setting('TCMAINT',$set); 
    1149 } 
    1150  
    1151 /*  
    1152 // TODO: DON'T THINK WE NEED THIS ANYMORE 
    1153 ('AMPWEBADDRESS','',0,'The IP address or host name used to access the CDR<br>Default = not used','text',NULL,NULL,NULL,NULL), 
    1154 */ 
    1155  
  • freepbx/trunk/upgrades/2.9.0alpha1/migrate_ampconf.php

    r10961 r10969  
    11<?php 
    2 //TODO: revisit migration once we have further refined the amportal.conf in a db 
    3 //      architecture. We need a class that allows modules to add their own values 
    4 //      or remove them much like feature codes, also need some concept of sections 
    5 //      which is not necessarily per module. 
     2 
    63if (! function_exists("out")) { 
    74  function out($text) { 
     
    1815global $db, $amp_conf; 
    1916 
    20 outn(_("Preparing to migrate amportal.conf settings..")); 
     17// TODO: add table to newinstall.sql 
     18// 
     19outn(_("Checking for freepbx_settings table..")); 
    2120$sql = 'SELECT count(*) FROM freepbx_settings'; 
    2221$result = $db->query($sql); 
     
    3938  ) ENGINE=MyISAM DEFAULT CHARSET=latin1"; 
    4039 
    41  
    42   // TODO: this needs field names if we keep this, also needs newsql file entry 
    43   // TODO: need to change types on a bunch of these and more likely come up with a different way to do this like use the new 
    44   //       class to insert all this stuff (could get messy but...), look into this! 
    45   $sql[] = "INSERT INTO `freepbx_settings`  
    46     (keyword, value, level, description, type, options, defaultval, readonly, hidden) 
    47     VALUES  
    48     ('AMPADMINLOGO','logo.png',0,'Defines the logo that is to be displayed at the TOP RIGHT of the admin screen. This enables you to customize the look of the administration screen. NOTE: images need to be saved in the ..../admin/images directory of your AMP install. This image should be 55px in height<br>Default = logo.png','text',NULL,NULL,NULL,NULL), 
    49     ('AMPBADNUMBER','1',0,'Generate the bad-number context which traps any bogus number or feature code and plays a message to the effect. If you use the Early Dial feature on some Grandstream phones, you will want to set this to false<br>Default = true','bool',NULL,'1',NULL,NULL), 
    50     ('AMPBIN','/var/lib/asterisk/bin',0,'Location of the FreePBX command line scripts<br>Default = /var/lib/asterisk/bin','dir',NULL,'/var/lib/asterisk/bin',NULL,NULL), 
    51     ('AMPCGIBIN','/var/www/cgi-bin ',0,'The path to Apache cgi-bin dir (leave off trailing slash)<br>Default = var/www/cgi-bin','dir',NULL,'/var/www/cgi-bin',NULL,NULL), 
    52     ('AMPDBENGINE','mysql',0,'Database engine used<br>Mostly used = mysql','select','mysql,sqlite3','mysql',NULL,NULL), 
    53     ('AMPDBHOST','localhost',0,'Hostname where the database asterisk is located<br>Default = localhost','text',NULL,'localhost',NULL,NULL), 
    54     ('AMPDBNAME','asterisk',0,'Name of the FreePBX database<br>Default = asterisk','text',NULL,'asterisk',NULL,NULL), 
    55     ('AMPDBPASS','amp109',0,'Password for accessing the database asterisk. Used in combination with AMPDBUSER<br>Default = amp109','text',NULL,NULL,NULL,NULL), 
    56     ('AMPDBUSER','asteriskuser',0,'Username for accessing the database asterisk<br>Default = asteriskuser','text',NULL,NULL,NULL,NULL), 
    57     ('AMPDISABLELOG','1',0,'Whether or not to invoke the FreePBX log facility<br>Default = true','bool',NULL,'1',NULL,NULL), 
    58     ('AMPENABLEDEVELDEBUG','0',0,'Whether or not to include log messages marked as <b>devel-debug</b> in the log system<br>Default = false','bool',NULL,'0',NULL,NULL), 
    59     ('AMPENGINE','asterisk',0,'The telephony backend engine to use<br>Default = asterisk','select','asterisk','asterisk',NULL,NULL), 
    60     ('AMPEXTENSIONS','extensions',0,'Sets the extension behavior in FreePBX.  If set to <b>extensions</b>, Devices and Users are administered together as a unified Extension, and appear on a single page. If set to <b>deviceanduser</b>, Devices and Users will be administered seperately. Devices (e.g. each individual line on a SIP phone) and Users (e.g. <b>101</b>) will be configured independent of each other, allowing association of one User to many Devices, or allowing Users to login and logout of Devices<br>Default = extensions','select','extensions,deviceanduser','extensions',NULL,NULL), 
    61     ('AMPMGRPASS','amp111',0,'Password for accessing the Asterisk Manager Interface (AMI)<br>Default = amp111','text',NULL,'amp111',NULL,NULL), 
    62     ('AMPMGRUSER','admin',0,'Username for accessing the Asterisk Manager Interface (AMI)<br>Default = admin','text',NULL,'admin',NULL,NULL), 
    63     ('AMPMPG123','1',0,'When set to false, the old MoH behavior is adopted where MP3 files can be loaded and WAV files converted to MP3. The new default behavior assumes you have mpg123 loaded as well as sox and will convert MP3 files to WAV. This is highly recommended as MP3 files heavily tax the system and can cause instability on a busy phone system<br>Default = true','bool',NULL,'1',NULL,NULL), 
    64     ('AMPSBIN','/usr/sbin',0,'Where (root) command line scripts are located<br>Default = /usr/local/sbin','dir',NULL,'/usr/sbin',NULL,NULL), 
    65     ('AMPSYSLOGLEVEL','',0,'Where to log if enabled, SQL, LOG_SQL logs to old MySQL table, others are passed to syslog system to determine where to log. Values are: LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG, LOG_SQL,SQL<br>Default = LOG_ERR','uint',NULL,NULL,NULL,NULL), 
    66     ('AMPVMUMASK','007',0,'Defaults to 077 allowing only the asterisk user to have any permission on VM files. If set to something like 007, it would allow the group to have permissions. This can be used if setting apache to a different user then asterisk, so that the apache user (and thus ARI) can have access to read/write/delete the voicemail files. If changed, some of the voicemail directory structures may have to be manually changed<br>Default = 077','text',NULL,NULL,NULL,NULL), 
    67     ('AMPWEBADDRESS','',0,'The IP address or host name used to access the CDR<br>Default = not used','text',NULL,NULL,NULL,NULL), 
    68     ('AMPWEBROOT','/var/www/html',0,'The path to Apache webroot (leave off trailing slash)<br>Default = /var/www/html','dir',NULL,'/var/www/html',NULL,NULL), 
    69     ('ARI_ADMIN_PASSWORD','ari_password',0,'This is the default admin password to allow an administrator to login to ARI bypassing all security. Change this to a secure password.Default = not set','text',NULL,'ari_password',NULL,NULL), 
    70     ('ARI_ADMIN_USERNAME','',0,'This is the default admin name used to allow an administrator to login to ARI bypassing all security. Change this to whatever you want, dont forget to change the ARI_ADMIN_PASSWORD as well.Default = not set','text',NULL,'admin',NULL,NULL), 
    71     ('ASTAGIDIR','/var/lib/asterisk/agi-bin',0,'This is the default directory for Asterisks agi files<br>Default = /var/lib/asterisk/agi-bin','dir',NULL,'/var/lib/asterisk/agi-bin',NULL,NULL),  
    72     ('ASTETCDIR','/etc/asterisk',0,'This is the default directory for Asterisks configuration files<br>Default = /etc/asterisk','dir',NULL,'/etc/asterisk',NULL,NULL),  
    73     ('ASTLOGDIR','/var/log/asterisk',0,'This is the default directory for Asterisks log files<br>Default = /var/log/asterisk','dir',NULL,'/var/log/asterisk',NULL,NULL),  
    74     ('ASTMODDIR','/usr/lib/asterisk/modules',0,'This is the default directory for Asterisks modules<br>Default = /usr/lib/asterisk/modules','dir',NULL,'/usr/lib/asterisk/modules',NULL,NULL),  
    75     ('ASTSPOOLDIR','/var/spool/asterisk',0,'This is the default directory for Asterisks spool directory<br>Default = /var/spool/asterisk','dir',NULL,'/var/spool/asterisk',NULL,NULL),  
    76     ('ASTRUNDIR','/var/run/asterisk',0,'This is the default directory for Asterisks run files<br>Default = /var/run/asterisk','dir',NULL,'/var/run/asterisk',NULL,NULL),  
    77     ('ASTVARLIBDIR','/var/lib/asterisk',0,'This is the default directory for Asterisks lib files<br>Default = /var/lib/asterisk','dir',NULL,'/var/lib/asterisk',NULL,NULL),  
    78     ('ASTMANAGERPORT','5038',0,'Port for the Asterisk Manager<br>Default = 5038','uint',NULL,'5038',NULL,NULL),  
    79     ('ASTMANAGERHOST','localhost',0,'Hostname for the Asterisk Manager<br>Default = 5038','text',NULL,'5038',NULL,NULL),  
    80     ('AUTHTYPE','database',0,'Authentication type to use for web admin. If type set to <b>database</b>, the primary AMP admin credentials will be the AMPDBUSER/AMPDBPASS above. Valid settings are: none, database<br>Default = database','select','none,database','database',NULL,NULL), 
    81     ('BADDESTABORT','0',0,'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired<br>Default = false','bool',NULL,'0',NULL,NULL), 
    82     ('CDRDBHOST','',0,'Only used if you dont use the default values provided by FreePBX.<br>Hostname of db server if not the same as AMPDBHOST.','text',NULL,NULL,NULL,NULL), 
    83     ('CDRDBNAME','',0,'Only used if you dont use the default values provided by FreePBX.<br>Name of database used for cdr records','text',NULL,NULL,NULL,NULL), 
    84     ('CDRDBPASS','',0,'Only used if you dont use the default values provided by FreePBX.<br>Password for connecting to db if its not the same as AMPDBPASS','text',NULL,NULL,NULL,NULL), 
    85     ('CDRDBPORT','',0,'Only used if you dont use the default values provided by FreePBX.<br>Port number for db host','uint',NULL,NULL,NULL,NULL), 
    86     ('CDRDBTABLENAME','',0,'Only used if you dont use the default values provided by FreePBX. Name of the table in the db where the cdr is stored. cdr is default','text',NULL,NULL,NULL,NULL), 
    87     ('CDRDBTYPE','',0,'Only used if you dont use the default values provided by FreePBX. mysql or postgres mysql is default','text',NULL,NULL,NULL,NULL), 
    88     ('CDRDBUSER','',0,'Only used if you dont use the default values provided by FreePBX. Username to connect to db with if its not the same as AMPDBUSER','text',NULL,NULL,NULL,NULL), 
    89     ('CHECKREFERER','1',0,'When set to the default value of true, all requests into FreePBX that might possibly add/edit/delete settings will be validated to assure the request is coming from the server. This will protect the system from CSRF (cross site request forgery) attacks. It will have the effect of preventing legitimately entering URLs that could modify settings which can be allowed by changing this field to false<br>Default = false','bool',NULL,'1',NULL,NULL), 
    90     ('CUSTOMASERROR','1',0,'If false, then the Destination Registry will not report unknown destinations as errors. This should be left to the default true and custom destinations should be moved into the new custom apps registry<br>Default = true','bool',NULL,'1',NULL,NULL), 
    91     ('CWINUSEBUSY','1',0,'For extensions that have CW enabled, report unanswered CW calls as <b>busy</b> (resulting in busy voicemail greeting). If set to no, unanswered CW calls simply report as <b>no-answer</b><br>Default = true','bool',NULL,'1',NULL,NULL), 
    92     ('DASHBOARD_INFO_UPDATE_TIME','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','uint',NULL,NULL,NULL,NULL), 
    93     ('DASHBOARD_STATS_UPDATE_TIME','',0,'These can be used to change the refresh rate of the System Status Panel. Most of the stats are updated based on the STATS interval but a few items are','uint',NULL,NULL,NULL,NULL), 
    94     ('DAYNIGHTTCHOOK','0',0,'By default, the Day/Night module will not hook Time Conditions allowing one to associate a daynight manual override with a time condition since now time conditions have their own feature code. If there is already an associaiton configured (on an upgraded system), this will have no affect for the Time Conditions that # are effected. Setting this to true reverts the previous behavior by allowing for the continued use of a daynight toggle to be associated with a time conditon. This can be useful for two scenarios. First, to override a Time Condition without the automatic resetting that occurs with the built in Time Condition overrides. The second use is the ability to associate a single daynight toggle with multiple time conditions thus creating a <b>master switch</b> that can be used to override several possible call flows through different time conditions.<br>Default = false','bool',NULL,'1',NULL,NULL),     
    95     ('DEVEL','0',0,'Needs to be documented<br>Default = false','bool',NULL,'0',NULL,NULL), 
    96     ('DEVELRELOAD','0',0,'Needs to be documented<br>Default = false','bool',NULL,'0',NULL,NULL), 
    97     ('DISABLECUSTOMCONTEXTS','0',0,'Normally FreePBX auto-generates a custom context that may be usable for adding custom dialplan to modify the normal behavior of FreePBX. It takes a good understanding of how Asterisk processes these includes to use this and in many of the cases, there is no useful application. All includes will result in a WARNING in the Asterisk log if there is no context found to include though it results in no errors. If you know that you want the includes, you can set this to true. If you comment it out FreePBX will revert to legacy behavior and include the contexts<br>Default = false','bool',NULL,'0',NULL,NULL), 
    98     ('DYNAMICHINTS','0',0,'If true, Core will not statically generate hints, but instead make a call to the AMPBIN php script, and generate_hints.php through an Asterisk #exec call. This requires Asterisk.conf to be configured with <b>execincludes=yes<b> set in the [options] section<br>Default = false','bool',NULL,'0',NULL,NULL), 
    99     ('ENABLECW','1',0,'Enable call waiting by default when an extension is created (Default is yes). Set to <b>no</b> to if you dont want phones to be commissioned with call waiting already enabled. The user would then be required to dial the CW feature code (*70 default) to enable their phone. Most installations should leave this alone. It allows multi-line phones to receive multiple calls on their line appearances<br>Default = yes','bool',NULL,'1',NULL,NULL), 
    100     ('FCBEEPONLY','0',0,'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow<br>Default = false','bool',NULL,'0',NULL,NULL), 
    101     ('FOPDISABLE','0',0,'Set to true to disable FOP in interface and retrieve_conf.  Useful for sqlite3 or if you dont want FOP<br>Default = not set','bool',NULL,'0',NULL,NULL), 
    102     ('FOPPASSWORD','passw0rd',0,'Password for performing transfers and hangups in the Flash Operator Panel (FOP)<br>Default = passw0rd','text',NULL,'passw0rd',NULL,NULL), 
    103     ('FOPRUN','1',0,'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise<br>Default = true','bool',NULL,'1',NULL,NULL), 
    104     ('FOPSORT','extension',0,'How FOP sort extensions. By Last Name [lastname] or by Extension [extension]<br>Default = extension','select','extension,lastname','extension',NULL,NULL), 
    105     ('FOPWEBROOT','/var/www/html/panel',0,'Path to the Flash Operator Panel webroot (leave off trailing slash)<br>Default = /var/www/html/panel','dir',NULL,'/var/www/html/panel',NULL,NULL), 
    106     ('FPBXDBUGFILE','/tmp/freepbx_debug.log',0,'Location and name of the FreePBX debug file. Used by developers<br>Default = /tmp/freepbx_debug.log','text',NULL,'/tmp/freepbx_debug.log',NULL,NULL), 
    107     ('MODULEADMINWGET','0',0,'Module Admin normally tries to get its online information through direct file open type calls to URLs that go back to the freepbx.org server. If it fails, typically because of content filters in firewalls that dont like the way PHP formats the requests, the code will fall back and try a wget to pull the information. This will often solve the problem. However, in such environment there can be a significant timeout before the failed file open calls to the URLs return and there are often 2-3 of these that occur. Setting this value will force FreePBX to avoid the attempt to open the URL and go straight to the wget calls<br>Default = false','bool',NULL,'0',NULL,NULL), 
    108     ('MOHDIR','moh',0,'This is the subdirectory for the MoH files/directories which is located in ASTVARLIBDIR if not specified it will default to mohmp3 for backward compatibility<br>Default = not set','dir',NULL,'moh',NULL,NULL), 
    109     ('POST_RELOAD','',0,'Automatically execute a script after applying changes in the AMP admin. Set POST_RELOAD to the script you wish to execute after applying changes. If POST_RELOAD_DEBUG=true, you will see the output of the script in the web page<br>Default = not set','text',NULL,NULL,NULL,NULL), 
    110     ('POST_RELOAD_DEBUG','0',0,'Display debug output for script used if POST_RELOAD is used<br>Default = not set','bool',NULL,'0',NULL,NULL), 
    111     ('RELOADCONFIRM','1',0,'When set to false, will bypass the confirm on Reload Box<br>Default = true','bool',NULL,'1',NULL,NULL), 
    112     ('SERVERINTITLE','0',0,'Precede browser title with the server name<br>Default = false','bool',NULL,'false',NULL,NULL),  
    113     ('TCINTERVAL','60',0,'The polling interval used by the Time Conditions manintenace task, launched by an Asterisk call file used to update Time Conditions override states as well as keep custom device state hint values up-to-date when being used with BLF. This interval should be shorter than the shortest time condition true (open) or false (closed) interval to assure that an override is reset after the current time period has expired that it was set in.<br>Default value 60 seconds.','uint',NULL,'60',NULL,NULL), 
    114     ('TCMAINT','1',0,'If set to false, this will override the execution of the Time Conditons maintenace task launched by call files. If all the feature codes for time conditions are disabled, the maintenance task will not be launched so this is not needed for that condition. Setting this to false would be fairly un-common. On an extremely active system that has constant calls flowing throught all time conditions of interest that might be overriden one might set this to avoid the additional polling that would otherwise occur since calls traversing the time conditions contexts will also maintain all the necessary state information. You may also set this temporarily if debugging a system to avoid the periodic dialplan running through the CLI that the maintenance task otherwise creates.<br>Default = true','bool',NULL,'1',NULL,NULL),  
    115     ('USECATEGORIES','1',0,'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphebetically with no categories shown (false). Defaults = true','bool',NULL,'1',NULL,NULL), 
    116     ('USEDEVSTATE','1',0,'If this is set, it assumes that you are running Asterisk 1.4 or higher and want to take advantage of the func_devstate.c backport available from Asterisk 1.6. This allows custom hints to be created to support BLF for server side feature codes such as daynight, followme, etc<br>Default = false','bool',NULL,'1',NULL,NULL), 
    117     ('USEGOOGLEDNSFORENUM','0',0,'Setting this flag will generate the required global variable so that enumlookup.agi will use Google DNS 8.8.8.8 when performing an ENUM lookup. Not all DNS deals with NAPTR record, but Google does. There is a drawback to this as Google tracks every lookup. If you are not comfortable with this, do not enable this setting. Please read Google FAQ about this: <b>http://code.google.com/speed/public-dns/faq.html#privacy</b><br>Default = false','bool',NULL,'0',NULL,NULL), 
    118     ('USEQUEUESTATE','0',0,'Setting this flag will generate the required dialplan to integrate with the following Asterisk patch: <b>https://issues.asterisk.org/view.php?id=15168</b>. This feature is planned for a future 1.6 release but given the existence of the patch can be used prior. Once the release version is known, code will be added to automatically enable this format in versions of Asterisk that support it<br>Default = false','bool',NULL,'0',NULL,NULL), 
    119     ('XTNCONFLICTABORT','0',0,'Setting either of these to true will result in retrieve_conf aborting during a reload if an extension conflict is detected or a destination is detected. It is usually better to allow the reload to go through and then correct the problem but these can be set if a more strict behavior is desired<br>Default = false','bool',NULL,'0',NULL,NULL), 
    120     ('ZAP2DAHDICOMPAT','0',0,'If set to true, FreePBX will check if you have chan_dadhi installed. If so, it will automatically use all your ZAP configuration settings (devices and trunks) and silently convert them, under the covers, to DAHDI so no changes are needed. The GUI will continue to refer to these as ZAP but it will use the proper DAHDI channels. This will also keep Zap Channel DIDs working<br>Default = false','bool',NULL,'0',NULL,NULL)"; 
    121      
    122    
    12340  foreach ($sql as $q) { 
    12441    $result = $db->query($q); 
     
    12744    } 
    12845  } 
     46  out(_("created")); 
     47} else { 
     48  out(_("exists")); 
     49} 
    12950   
    130   //migrate legacy options 
    131   foreach ($amp_conf as $key => $val) { 
    132       switch ($val) { 
    133         case 'true': 
    134         case 'yes': 
    135         case '1': 
    136           $val = 'TRUE'; 
    137           break; 
    138         case 'false': 
    139         case 'no': 
    140         case '0': 
    141           $val = 'FALSE'; 
    142           break; 
    143       } 
    144       $settings[] = array('key' => $key, 'value' => $val); 
    145   } 
     51// Make sure we save the settings as they are currenlty parsed 
     52// 
     53$current_amp_conf = $amp_conf; 
    14654 
    147   $query = $db->prepare("UPDATE freepbx_settings set value = ? WHERE `keyword` = ?"); 
    148   $result = $db->executeMultiple($query,$settings); 
    149   if(DB::IsError($result)){ 
    150     die_freepbx($result->getDebugInfo()); 
    151   } 
    152   out(_("migrated")); 
     55// Now let's initialize all the settings, if they happen to already exist for 
     56// some reason, this is ok as the define_conf_settings() method does not save the 
     57// values back once defined, you must explicitly set them. 
     58// 
     59outn(_("Initialize freepbx_conf settings..")); 
     60freepbx_settings_init(); 
     61out(_("ok")); 
     62 
     63// Now we will set the current value of all settings 
     64// 
     65$update_arr = array(); 
     66out(_("Migrate current values into freepbx_conf..")); 
     67foreach ($current_amp_conf as $key => $val) { 
     68  outn(sprintf(_("checking %s .."),$key)); 
     69  if (!$freepbx_conf->conf_setting_exists($key)) { 
     70    out(_("not in freepbx_conf, skipping")); 
     71    continue; 
     72  } 
     73  // Make sure that all "false" values are going to be interpreted as false, the trues will be converted. 
     74  switch (strtolower($val)) { 
     75  case 'false': 
     76  case 'no': 
     77  case 'off': 
     78    $val = false; 
     79    break; 
     80  } 
     81  $update_arr['key'] = $val; 
     82  out(_("preparing for update")); 
     83
     84unset($current_amp_conf); 
     85if (count($update_arr)) { 
     86  outn(_("Updating prepared settings..")); 
     87  $ret = $freepbx_conf->set_conf_values($update_arr, true, true); 
     88  out(sprintf(_("changed %s settings"),$ret)); 
    15389} else { 
    154   out(_("previously migrated")); 
     90  out(_("There were no settings to update")); 
    15591} 
    156 //TODO: set crucial options to readonly 
    157 //build freepbx.conf if it doesnt already exists 
    15892 
    159  
     93// build freepbx.conf if it doesnt already exists 
    16094outn(_("checking for freepbx.conf..")); 
    16195 
     
    186120 
    187121  // don't use file_put_contents re php4 compatibility for framework/core 
     122  // or TODO: do we have install_amp include the compatibility library which we have installed by now? 
     123  // 
    188124  $fh = fopen($filename,'w'); 
    189125  if ($fh === false || (fwrite($fh,$txt) === false)) {