root/freepbx/branches/2.9/libfreepbx.install.php

Revision 11822, 86.8 kB (checked in by p_lindheimer, 2 years ago)

add advanced setting to determine if prepends should be stacked or not re #4977

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 //This file is part of FreePBX.
3 //
4 //    FreePBX is free software: you can redistribute it and/or modify
5 //    it under the terms of the GNU General Public License as published by
6 //    the Free Software Foundation, either version 2 of the License, or
7 //    (at your option) any later version.
8 //
9 //    FreePBX is distributed in the hope that it will be useful,
10 //    but WITHOUT ANY WARRANTY; without even the implied warranty of
11 //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 //    GNU General Public License for more details.
13 //
14 //    You should have received a copy of the GNU General Public License
15 //    along with FreePBX.  If not, see <http://www.gnu.org/licenses/>.
16 //
17 //    Copyright 2007, Philippe Lindheimer
18 //
19
20 /********************************************************************************************************************/
21 /* freepbxlib.install.php
22  *
23  * These are used by install_amp and the framework install script to run updates
24  *
25  * These variables are required to be defined outside of this library. The purpose
26  * of this is to allow the library to be used by both install_amp as well as the
27  * framework which would potentially be accessing these from different locations.
28  *
29  * Examples:
30  *
31  * UPGRADE_DIR     dirname(__FILE__)."/upgrades"
32  * MODULE_DIR      dirname(__FILE__)."/amp_conf/htdocs/admin/modules/"
33  *
34  * or (in framework for instance)
35  *
36  * MODULE_DIR      dirname(__FILE__)."/htdocs/admin/modules/"
37  *
38  * $debug = false;
39  * $dryrun = false;
40  */
41
42 function upgrade_all($version) {
43
44   // **** Read upgrades/ directory
45
46   outn("Checking for upgrades..");
47
48   // read versions list from upgrades/
49   $versions = array();
50   $dir = opendir(UPGRADE_DIR);
51   while ($file = readdir($dir)) {
52     if (($file[0] != ".") && is_dir(UPGRADE_DIR."/".$file)) {
53       $versions[] = $file;
54     }
55   }
56   closedir($dir);
57
58   // callback to use php's version_compare() to sort
59   usort($versions, "version_compare_freepbx");
60
61
62   // find versions that are higher than the current version
63   $starting_version = false;
64   foreach ($versions as $check_version) {
65     if (version_compare_freepbx($check_version, $version) > 0) { // if check_version < version
66       $starting_version = $check_version;
67       break;
68     }
69   }
70
71   // run all upgrades from the list of higher versions
72   if ($starting_version) {
73     $pos = array_search($starting_version, $versions);
74     $upgrades = array_slice($versions, $pos); // grab the list of versions, starting at $starting_version
75     out(count($upgrades)." found");
76     run_upgrade($upgrades);
77
78     /* Set the base version of key modules, currently core and framework, to the
79      * Version packaged with this tarball, if any. The expectation is that the
80      * packaging scripts will make these module version numbers the same as the
81      * release plus a '.0' which can be incremented for bug fixes delivered through
82      * the online system between main releases.
83      *
84      * added if function_exists because if this is being run from framework there is no
85      * need to reset the base version.
86      */
87     if (function_exists('set_base_version')) {
88       set_base_version();
89     }
90
91   } else {
92     out("No upgrades found");
93   }
94
95 }
96
97 //----------------------------------
98 // dependencies for upgrade_all
99
100
101 /** Invoke upgrades
102  * @param $versions array The version upgrade scripts to run
103  */
104 function run_upgrade($versions) {
105   global $dryrun;
106  
107   foreach ($versions as $version) {
108     out("Upgrading to ".$version."..");
109     install_upgrade($version);
110     if (!$dryrun) {
111       setversion($version);
112     }
113     out("Upgrading to ".$version."..OK");
114   }
115 }
116
117 //get the version number
118 function install_getversion() {
119   global $db;
120   $sql = "SELECT value FROM admin WHERE variable = 'version'";
121   $results = $db->getAll($sql);
122   if(DB::IsError($results)) {
123     return false;
124   }
125   return $results[0][0];
126 }
127
128 //set the version number
129 function setversion($version) {
130   global $db;
131   $sql = "UPDATE admin SET value = '".$version."' WHERE variable = 'version'";
132   debug($sql);
133   $result = $db->query($sql);
134   if(DB::IsError($result)) {     
135     die($result->getMessage());
136   }
137 }
138
139 /** Install a particular version
140  */
141 function install_upgrade($version) {
142   global $db;
143   global $dryrun;
144   global $amp_conf;
145  
146   $db_engine = $amp_conf["AMPDBENGINE"];
147  
148   if (is_dir(UPGRADE_DIR."/".$version)) {
149     // sql scripts first
150     $dir = opendir(UPGRADE_DIR."/".$version);
151     while ($file = readdir($dir)) {
152       if (($file[0] != ".") && is_file(UPGRADE_DIR."/".$version."/".$file)) {
153         if ( (strtolower(substr($file,-4)) == ".sqlite") && ($db_engine == "sqlite") ) {
154           install_sqlupdate( $version, $file );
155         }
156         elseif ((strtolower(substr($file,-4)) == ".sql") &&
157             ( ($db_engine  == "mysql")  ||  ($db_engine  == "pgsql") || ($db_engine == "sqlite3") ) ) {
158           install_sqlupdate( $version, $file );
159         }
160       }
161     }
162
163                 // now non sql scripts
164                 $dir = opendir(UPGRADE_DIR."/".$version);
165                 while ($file = readdir($dir)) {
166                         if (($file[0] != ".") && is_file(UPGRADE_DIR."/".$version."/".$file)) {
167                                 if ((strtolower(substr($file,-4)) == ".sql") || (strtolower(substr($file,-7)) == ".sqlite")) {
168                                         // sql scripts were dealt with first
169                                 } else if (strtolower(substr($file,-4)) == ".php") {
170                                         out("-> Running PHP script ".UPGRADE_DIR."/".$version."/".$file);
171                                         if (!$dryrun) {
172                                                 run_included(UPGRADE_DIR."/".$version."/".$file);
173                                         }
174
175                                 } else if (is_executable(UPGRADE_DIR."/".$version."/".$file)) {
176                                         out("-> Executing ".UPGRADE_DIR."/".$version."/".$file);
177                                         if (!$dryrun) {
178                                                 exec(UPGRADE_DIR."/".$version."/".$file);
179                                         }
180                                 } else {
181                                         error("-> Don't know what to do with ".UPGRADE_DIR."/".$version."/".$file);
182                                 }
183                         }
184                 }
185
186   }
187 }
188
189
190 function checkDiff($file1, $file2) {
191   // diff, ignore whitespace and be quiet
192   exec("diff -wq ".escapeshellarg($file2)." ".escapeshellarg($file1), $output, $retVal);
193   return ($retVal != 0);
194 }
195
196 function amp_mkdir($directory, $mode = "0755", $recursive = false) {
197   debug("mkdir ".$directory.", ".$mode);
198   $ntmp = sscanf($mode,"%o",$modenum); //assumes all inputs are octal
199   if (version_compare(phpversion(), '5.0') < 0) {
200     // php <5 can't recursively create directories
201     if ($recursive) {
202       $output = false;
203       $return_value = false;
204       exec("mkdir -m ".$mode." -p ".$directory,  $output, $return_value);
205       return ($return_value == 0);
206     } else {
207       return mkdir($directory, $modenum);
208     }
209   } else {
210     return mkdir($directory, $modenum, $recursive);
211   }
212 }
213
214 /** Recursively copy a directory
215  */
216 function recursive_copy($dirsourceparent, $dirdest, &$md5sums, $dirsource = "") {
217   global $dryrun;
218   global $check_md5s;
219   global $amp_conf;
220   global $asterisk_conf;
221   global $install_moh;
222   global $make_links;
223
224   $moh_subdir = isset($amp_conf['MOHDIR']) ? trim(trim($amp_conf['MOHDIR']),'/') : 'mohmp3';
225
226   // total # files, # actually copied
227   $num_files = $num_copied = 0;
228  
229   if ($dirsource && ($dirsource[0] != "/")) $dirsource = "/".$dirsource;
230  
231   if (is_dir($dirsourceparent.$dirsource)) $dir_handle = opendir($dirsourceparent.$dirsource);
232  
233   /*
234   echo "dirsourceparent: "; var_dump($dirsourceparent);
235   echo "dirsource: "; var_dump($dirsource);
236   echo "dirdest: "; var_dump($dirdest);
237   */
238  
239   while (isset($dir_handle) && ($file = readdir($dir_handle))) {
240     if (($file!=".") && ($file!="..") && ($file != "CVS") && ($file != ".svn")) {
241       $source = $dirsourceparent.$dirsource."/".$file;
242       $destination =  $dirdest.$dirsource."/".$file;
243      
244       if ($dirsource == "" && $file == "moh" && !$install_moh) {
245         // skip to the next dir
246         continue;
247       }
248
249      
250       // configurable in amportal.conf
251       if (strpos($destination,"htdocs_panel")) {
252         $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination);
253       } else {
254         $destination=str_replace("/htdocs",trim($amp_conf["AMPWEBROOT"]),$destination);
255       }
256       $destination=str_replace("/htdocs_panel",trim($amp_conf["FOPWEBROOT"]),$destination);
257 //      $destination=str_replace("/cgi-bin",trim($amp_conf["AMPCGIBIN"]),$destination);
258       if(strpos($dirsource, 'modules') === false) $destination=str_replace("/bin",trim($amp_conf["AMPBIN"]),$destination);
259       $destination=str_replace("/sbin",trim($amp_conf["AMPSBIN"]),$destination);
260      
261       // the following are configurable in asterisk.conf
262       $destination=str_replace("/astetc",trim($asterisk_conf["astetcdir"]),$destination);
263       $destination=str_replace("/moh",trim($asterisk_conf["astvarlibdir"])."/$moh_subdir",$destination);
264       $destination=str_replace("/astvarlib",trim($asterisk_conf["astvarlibdir"]),$destination);
265       if(strpos($dirsource, 'modules') === false) $destination=str_replace("/agi-bin",trim($asterisk_conf["astagidir"]),$destination);
266       if(strpos($dirsource, 'modules') === false) $destination=str_replace("/sounds",trim($asterisk_conf["astvarlibdir"])."/sounds",$destination);
267
268       // if this is a directory, ensure destination exists
269       if (is_dir($source)) {
270         if (!file_exists($destination)) {
271           if ((!$dryrun) && ($destination != "")) {
272             amp_mkdir($destination, "0750", true);
273           }
274         }
275       }
276      
277       //var_dump($md5sums);
278       if (!is_dir($source)) {
279         $md5_source = preg_replace("|^/?amp_conf/|", "/", $source);
280
281         if ($check_md5s && file_exists($destination) && isset($md5sums[$md5_source]) && (md5_file($destination) != $md5sums[$md5_source])) {
282           // double check using diff utility (and ignoring whitespace)
283           // This is a somewhat edge case (eg, the file doesn't match
284           // it's md5 sum from the previous version, but no substantial
285           // changes exist compared to the current version), but it
286           // prevents a useless prompt to the user.
287           if (checkDiff($source, $destination)) {
288             $overwrite = ask_overwrite($source, $destination);
289           } else {
290             debug("NOTE: MD5 for ".$destination." was different, but `diff` did not detect any (non-whitespace) changes: overwriting");
291             $overwrite = true;
292           }
293         } else {
294           $overwrite = true;
295         }
296        
297         // These are modified by apply_conf.sh, there may be others that fit in this category also. This keeps these from
298         // being symlinked and then developers inadvertently checking in the changes when they should not have.
299         //
300         $never_symlink = array("cdr_mysql.conf", "manager.conf", "vm_email.inc");
301
302         $num_files++;
303         if ($overwrite) {
304           debug(($make_links ? "link" : "copy")." ".$source." -> ".$destination);
305           if (!$dryrun) {
306             if ($make_links && !in_array(basename($source),$never_symlink)) {
307               // symlink, unlike copy, doesn't overwrite - have to delete first
308               if (is_link($destination) || file_exists($destination)) {
309                 unlink($destination);
310               }
311               symlink($_ENV["PWD"]."/".$source, $destination);
312             } else {
313               copy($source, $destination);
314             }
315             $num_copied++;
316           }
317         } else {
318           debug("not overwriting ".$destination);
319         }
320       } else {
321         //echo "recursive_copy($dirsourceparent, $dirdest, $md5sums, $dirsource/$file)";
322         list($tmp_num_files, $tmp_num_copied) = recursive_copy($dirsourceparent, $dirdest, $md5sums, $dirsource."/".$file);
323         $num_files += $tmp_num_files;
324         $num_copied += $tmp_num_copied;
325       }
326     }
327   }
328  
329   if (isset($dir_handle)) closedir($dir_handle);
330  
331   return array($num_files, $num_copied);
332 }
333
334 function read_md5_file($filename) {
335   $md5 = array();
336   if (file_exists($filename)) {
337     foreach (file($filename) as $line) {
338       if (preg_match("/^([a-f0-9]{32})\s+(.*)$/", $line, $matches)) {
339         $md5[ "/".$matches[2] ] = $matches[1];
340       }
341     }
342   }
343   return $md5;
344 }
345
346 /** Include a .php file
347  * This is a function just to keep a separate context
348  */
349 function run_included($file) {
350   global $db;
351   global $amp_conf;
352  
353   include($file);
354 }
355
356 function install_sqlupdate( $version, $file )
357 {
358   global $db;
359   global $dryrun;
360
361   out("-> Running SQL script ".UPGRADE_DIR."/".$version."/".$file);
362   // run sql script
363   $fd = fopen(UPGRADE_DIR."/".$version."/".$file, "r");
364   $data = "";
365   while (!feof($fd)) {
366     $data .= fread($fd, 1024);
367   }
368   fclose($fd);
369
370   preg_match_all("/((SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|ALTER).*);\s*\n/Us", $data, $matches);
371  
372   foreach ($matches[1] as $sql) {
373     debug($sql);
374     if (!$dryrun) {
375       $result = $db->query($sql);
376       if(DB::IsError($result)) {     
377         fatal($result->getDebugInfo()."\" while running ".$file."\n");
378       }
379     }
380   }
381 }
382
383 /********************************************************************************************************************/
384 /*                          FREEPBX SETTINGS (AMPORTAL.CONF) DEFINED HERE                                           */
385 /********************************************************************************************************************/
386 //
387 // TODO: find a good way to extract the required localization strings for the tools to pickup
388 //
389 // freepbx_settings_init()
390 // this is where we initialize all the freepbx_settings (amportal.conf). This will be run with install_amp and every
391 // time we run the framework installer, so new settings can be added here that are framework wide. It may make send to
392 // break this out separately but for now we'll keep it here since this is already part of the infrastructure that is
393 // used by both install_amp and the framework install/upgrade script.
394 //
395 function freepbx_settings_init($commit_to_db = false) {
396   global $amp_conf;
397
398   include_once ($amp_conf['AMPWEBROOT'].'/admin/libraries/freepbx_conf.class.php');
399
400   $freepbx_conf =& freepbx_conf::create();
401
402   $set['value'] = '';
403   $set['defaultval'] =& $set['value'];
404   $set['readonly'] = 0;
405   $set['hidden'] = 0;
406   $set['level'] = 0;
407   $set['module'] = '';
408   $set['emptyok'] = 0;
409
410
411   //
412   // CATEGORY: Advanced Settings Display
413   //
414   $set['category'] = 'Advanced Settings Details';
415
416   /* This was too confusing, will remove for now and re-evaluate if needed
417   // AS_DISPLAY_DETAIL_LEVEL
418   $set['value'] = '0';
419   $set['options'] = '0,1,2,3,4,5,6,7,8,9,10';
420   $set['name'] = 'Display Detail Level';
421   $set['description'] = 'This will filter which settings that are displayed on this Advanced Settings page. The higher the level, the more obscure settings will be shown. Settings at higher levels are unlikely to be of interest to most users and could be more volatile to breaking your system if set wrong.';
422   $set['emptyok'] = 0;
423   $set['level'] = 0;
424   $set['readonly'] = 0;
425   $set['type'] = CONF_TYPE_SELECT;
426   $freepbx_conf->define_conf_setting('AS_DISPLAY_DETAIL_LEVEL',$set);
427   $set['readonly'] = 0;
428   $set['level'] = 0;
429   */
430
431   // AS_DISPLAY_HIDDEN_SETTINGS
432   $set['value'] = false;
433   $set['options'] = '';
434   $set['name'] = 'Display Hidden Settings';
435   $set['description'] = 'This will display settings that are normally hidden by the system. These settings are often internally used settings that are not of interest to most users.';
436   $set['emptyok'] = 0;
437   $set['level'] = 0;
438   $set['readonly'] = 0;
439   $set['type'] = CONF_TYPE_BOOL;
440   $freepbx_conf->define_conf_setting('AS_DISPLAY_HIDDEN_SETTINGS',$set);
441   $set['readonly'] = 0;
442   $set['level'] = 0;
443
444   // AS_DISPLAY_READONLY_SETTINGS
445   $set['value'] = false;
446   $set['options'] = '';
447   $set['name'] = 'Display Readonly Settings';
448   $set['description'] = 'This will display settings that are readonly. These settings are often internally used settings that are not of interest to most users. Since they are readonly they can only be viewed.';
449   $set['emptyok'] = 0;
450   $set['level'] = 0;
451   $set['readonly'] = 0;
452   $set['type'] = CONF_TYPE_BOOL;
453   $freepbx_conf->define_conf_setting('AS_DISPLAY_READONLY_SETTINGS',$set);
454   $set['readonly'] = 0;
455   $set['level'] = 0;
456
457   // AS_OVERRIDE_READONLY
458   $set['value'] = false;
459   $set['options'] = '';
460   $set['name'] = 'Override Readonly Settings';
461   $set['description'] = 'Setting this to true will allow you to override un-hidden readonly setting to change them. Settings that are readonly may be extremely volatile and have a high chance of breaking your system if you change them. Take extreme caution when electing to make such changes.';
462   $set['emptyok'] = 0;
463   $set['level'] = 0;
464   $set['readonly'] = 0;
465   $set['type'] = CONF_TYPE_BOOL;
466   $freepbx_conf->define_conf_setting('AS_OVERRIDE_READONLY',$set);
467   $set['readonly'] = 0;
468   $set['level'] = 0;
469
470   // AS_DISPLAY_FRIENDLY_NAME
471   $set['value'] = true;
472   $set['options'] = '';
473   $set['name'] = 'Display Friendly Name';
474   $set['description'] = 'Normally the friendly names will be displayed on this page and the internal freepbx_conf configuration names are shown in the tooltip. If you prefer to view the configuration variables, and the friendly name in the tooltip, set this to false..';
475   $set['emptyok'] = 0;
476   $set['level'] = 0;
477   $set['readonly'] = 0;
478   $set['type'] = CONF_TYPE_BOOL;
479   $freepbx_conf->define_conf_setting('AS_DISPLAY_FRIENDLY_NAME',$set);
480   $set['readonly'] = 0;
481   $set['level'] = 0;
482
483   //
484   // CATEGORY: System Setup
485   //
486   $set['category'] = 'System Setup';
487
488   // AMPSYSLOGLEVEL
489   $set['value'] = 'FILE';
490   $set['options'] = 'FILE, LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG';
491   // LOG_SQL, SQL are discontinued, they are removed during migration if the slipped in and in core if it were to persist because amportal.conf was not
492   // writeable for a while.
493   //
494   if (isset($amp_conf['AMPSYSLOGLEVEL']) && (strtoupper($amp_conf['AMPSYSLOGLEVEL']) == 'SQL' || strtoupper($amp_conf['AMPSYSLOGLEVEL']) == 'LOG_SQL')) {
495     $set['options'] .= ', LOG_SQL, SQL';
496   }
497   $set['name'] = 'FreePBX Log Routing';
498   $set['description'] = "Determine where to send log information if the log is enabled ('Disable FreePBX Log' (AMPDISABLELOG) false. There are two places to route the log messages. 'FILE' will send all log messages to the defined 'FreePBX Log File' (FPBX_LOG_FILE). All the other settings will route the log messages to your System Logging subsystem (syslog) using the specified log level. Syslog can be configured to route different levels to different locations. See 'syslog' documentation (man syslog) on your system for more details.";
499   $set['emptyok'] = 0;
500   $set['readonly'] = 0;
501   $set['sortorder'] = -190;
502   $set['type'] = CONF_TYPE_SELECT;
503   $freepbx_conf->define_conf_setting('AMPSYSLOGLEVEL',$set);
504
505   // AMPDISABLELOG
506   $set['value'] = false;
507   $set['options'] = '';
508   $set['name'] = 'Disable FreePBX Log';
509   $set['description'] = 'Whether or not to invoke the FreePBX log facility.';
510   $set['emptyok'] = 0;
511   $set['readonly'] = 0;
512   $set['sortorder'] = -180;
513   $set['type'] = CONF_TYPE_BOOL;
514   $freepbx_conf->define_conf_setting('AMPDISABLELOG',$set);
515
516   // LOG_OUT_MESSAGES
517   $set['value'] = true;
518   $set['options'] = '';
519   $set['name'] = 'Log Verbose Messages';
520   $set['description'] = 'FreePBX has many verbose and useful messages displayed to users during module installation, system installations, loading configurations and other places. In order to accumulate these messages in the log files as well as the on screen display, set this to true.';
521   $set['emptyok'] = 0;
522   $set['readonly'] = 0;
523   $set['sortorder'] = -170;
524   $set['type'] = CONF_TYPE_BOOL;
525   $freepbx_conf->define_conf_setting('LOG_OUT_MESSAGES',$set);
526
527   // LOG_NOTIFICATIONS
528   $set['value'] = true;
529   $set['options'] = '';
530   $set['name'] = 'Send Dashboard Notifications to Log';
531   $set['description'] = 'When enabled all notification updates to the Dashboard notification panel will also be logged into the specified log file when enabled.';
532   $set['emptyok'] = 0;
533   $set['readonly'] = 0;
534   $set['sortorder'] = -160;
535   $set['type'] = CONF_TYPE_BOOL;
536   $freepbx_conf->define_conf_setting('LOG_NOTIFICATIONS',$set);
537
538   // FPBX_LOG_FILE
539   $set['value'] = '/tmp/freepbx.log';
540   $set['options'] = '';
541   $set['name'] = 'FreePBX Log File';
542   $set['description'] = 'Full path and name of the FreePBX Log File used in conjunction with the Syslog Level (AMPSYSLOGLEVEL) being set to FILE, not used otherwise. Initial installs may have some early logging sent to /tmp/freepbx_pre_install.log when it is first bootstrapping the installer.';
543   $set['emptyok'] = 0;
544   $set['readonly'] = 0;
545   $set['sortorder'] = -150;
546   $set['type'] = CONF_TYPE_TEXT;
547   $freepbx_conf->define_conf_setting('FPBX_LOG_FILE',$set);
548
549   // PHP_ERROR_HANDLER_OUTPUT
550   $set['value'] = 'dbug';
551   $set['options'] = array('dbug','freepbxlog','off');
552   $set['name'] = 'PHP Error Log Output';
553   $set['description'] = "Where to send PHP errors, warnings and notices by the FreePBX PHP error handler. Set to 'dbug', they will go to the Debug File regardless of whether dbug Loggin is disabled or not. Set to 'freepbxlog' will send them to the FreePBX Log. Set to 'off' and they will be ignored.";
554   $set['emptyok'] = 0;
555   $set['readonly'] = 0;
556   $set['sortorder'] = -140;
557   $set['type'] = CONF_TYPE_SELECT;
558   $freepbx_conf->define_conf_setting('PHP_ERROR_HANDLER_OUTPUT',$set);
559
560   // AMPEXTENSIONS
561   $set['value'] = 'extensions';
562   $set['options'] = 'extensions,deviceanduser';
563   $set['name'] = 'User & Devices Mode';
564   $set['description'] = '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 separately. 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.';
565   $set['emptyok'] = 0;
566   $set['readonly'] = 0;
567   $set['sortorder'] = -135;
568   $set['type'] = CONF_TYPE_SELECT;
569   $freepbx_conf->define_conf_setting('AMPEXTENSIONS',$set);
570
571   // AUTHTYPE
572   $set['value'] = 'database';
573   $set['options'] = 'database,none,webserver';
574   $set['name'] = 'Authorization Type';
575   $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.';
576   $set['emptyok'] = 0;
577   $set['level'] = 3;
578   $set['readonly'] = 1;
579   $set['sortorder'] = -130;
580   $set['type'] = CONF_TYPE_SELECT;
581   $freepbx_conf->define_conf_setting('AUTHTYPE',$set);
582   $set['level'] = 0;
583
584   // AMP_ACCESS_DB_CREDS
585   $set['value'] = false;
586   $set['options'] = '';
587   $set['name'] = 'Allow Login With DB Credentials';
588   $set['description'] = "When Set to True, admin access to the FreePBX GUI will be allowed using the FreePBX configured AMPDBUSER and AMPDBPASS credentials. This only applies when Authorization Type is 'database' mode.";
589   $set['emptyok'] = 0;
590   $set['readonly'] = 0;
591   $set['sortorder'] = -126;
592   $set['type'] = CONF_TYPE_BOOL;
593   $freepbx_conf->define_conf_setting('AMP_ACCESS_DB_CREDS',$set);
594
595   // ARI_ADMIN_USERNAME
596   $set['value'] = '';
597   $set['options'] = '';
598   $set['name'] = 'User Portal Admin Username';
599   $set['description'] = 'This is the default admin name used to allow an administrator to login to ARI bypassing all security. Change this to whatever you want, do not forget to change the User Portal Admin Password as well. Default = not set';
600   $set['emptyok'] = 1;
601   $set['readonly'] = 0;
602   $set['sortorder'] = -120;
603   $set['type'] = CONF_TYPE_TEXT;
604   $freepbx_conf->define_conf_setting('ARI_ADMIN_USERNAME',$set);
605
606   // ARI_ADMIN_PASSWORD
607   $set['value'] = 'ari_password';
608   $set['options'] = '';
609   $set['name'] = 'User Portal Admin Password';
610   $set['description'] = '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';
611   $set['emptyok'] = 0;
612   $set['readonly'] = 0;
613   $set['sortorder'] = -110;
614   $set['type'] = CONF_TYPE_TEXT;
615   $freepbx_conf->define_conf_setting('ARI_ADMIN_PASSWORD',$set);
616
617   // FORCED_ASTVERSION
618   $set['value'] = '';
619   $set['options'] = '';
620   $set['name'] = 'Force Asterisk Version';
621   $set['description'] = 'Normally FreePBX gets the current Asterisk version directly from Asterisk. This is required to generate proper dialplan for a given version. When using some custom Asterisk builds, the version may not be properly parsed and improper dialplan generated. Setting this to an equivalent Asterisk version will override what is read from Asterisk. This SHOULD be left blank unless you know what you are doing.';
622   $set['emptyok'] = 1;
623   $set['readonly'] = 1;
624   $set['sortorder'] = -100;
625   $set['type'] = CONF_TYPE_TEXT;
626   $set['level'] = 4;
627   $freepbx_conf->define_conf_setting('FORCED_ASTVERSION',$set);
628   $set['level'] = 0;
629
630   // AMPENGINE
631   $set['value'] = 'asterisk';
632   $set['options'] = 'asterisk';
633   $set['name'] = 'Telephony Engine';
634   $set['description'] = 'The telephony backend engine being used, asterisk is the only option currently.';
635   $set['emptyok'] = 0;
636   $set['level'] = 3;
637   $set['readonly'] = 1;
638   $set['type'] = CONF_TYPE_SELECT;
639   $freepbx_conf->define_conf_setting('AMPENGINE',$set);
640   $set['level'] = 0;
641
642   // AMPVMUMASK
643   $set['value'] = '007';
644   $set['options'] = '';
645   $set['name'] = 'Asterisk VMU Mask';
646   $set['description'] = '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.';
647   $set['emptyok'] = 0;
648   $set['readonly'] = 0;
649   $set['type'] = CONF_TYPE_TEXT;
650   $set['level'] = 4;
651   $freepbx_conf->define_conf_setting('AMPVMUMASK',$set);
652   $set['level'] = 0;
653
654   // AMPWEBADDRESS
655   $set['value'] = '';
656   $set['options'] = '';
657   $set['name'] = 'FreePBX Web Address';
658   $set['description'] = 'This is the address of your Web Server. It is mostly obsolete and derived when not supplied and will be phased out, but there are still some areas expecting a variable to be set and if you are using it this will migrate your value.';
659   $set['emptyok'] = 1;
660   $set['readonly'] = 0;
661   $set['type'] = CONF_TYPE_TEXT;
662   $set['level'] = 4;
663   $freepbx_conf->define_conf_setting('AMPWEBADDRESS',$set);
664   $set['level'] = 0;
665
666   // AMPASTERISKUSER
667   $set['value'] = 'asterisk';
668   $set['options'] = '';
669   $set['name'] = 'System Asterisk User';
670   $set['description'] = 'The user Asterisk should be running as, used by freepbx_engine. Most systems should not change this.';
671   $set['emptyok'] = 0;
672   $set['type'] = CONF_TYPE_TEXT;
673   $set['level'] = 4;
674   $set['readonly'] = 1;
675   $freepbx_conf->define_conf_setting('AMPASTERISKUSER',$set);
676   $set['level'] = 0;
677
678   // AMPASTERISKGROUP
679   $set['value'] = 'asterisk';
680   $set['options'] = '';
681   $set['name'] = 'System Asterisk Group';
682   $set['description'] = 'The user group Asterisk should be running as, used by freepbx_engine. Most systems should not change this.';
683   $set['emptyok'] = 0;
684   $set['type'] = CONF_TYPE_TEXT;
685   $set['level'] = 4;
686   $set['readonly'] = 1;
687   $freepbx_conf->define_conf_setting('AMPASTERISKGROUP',$set);
688   $set['level'] = 0;
689
690   // AMPASTERISKWEBUSER
691   $set['value'] = 'asterisk';
692   $set['options'] = '';
693   $set['name'] = 'System Web User';
694   $set['description'] = 'The user your httpd should be running as, used by freepbx_engine. Most systems should not change this.';
695   $set['emptyok'] = 0;
696   $set['type'] = CONF_TYPE_TEXT;
697   $set['level'] = 4;
698   $set['readonly'] = 1;
699   $freepbx_conf->define_conf_setting('AMPASTERISKWEBUSER',$set);
700   $set['level'] = 0;
701
702   // AMPASTERISKWEBGROUP
703   $set['value'] = 'asterisk';
704   $set['options'] = '';
705   $set['name'] = 'System Web Group';
706   $set['description'] = 'The user group your httpd should be running as, used by freepbx_engine. Most systems should not change this.';
707   $set['emptyok'] = 0;
708   $set['type'] = CONF_TYPE_TEXT;
709   $set['level'] = 4;
710   $set['readonly'] = 1;
711   $freepbx_conf->define_conf_setting('AMPASTERISKWEBGROUP',$set);
712   $set['level'] = 0;
713
714   // AMPDEVUSER
715   $set['value'] = 'asterisk';
716   $set['options'] = '';
717   $set['name'] = 'System Device User';
718   $set['description'] = 'The user that various device directories should be set to, used by freepbx_engine. Examples include /dev/zap, /dev/dahdi, /dev/misdn, /dev/mISDN and /dev/dsp. Most systems should not change this.';
719   $set['emptyok'] = 0;
720   $set['type'] = CONF_TYPE_TEXT;
721   $set['level'] = 4;
722   $set['readonly'] = 1;
723   $freepbx_conf->define_conf_setting('AMPDEVUSER',$set);
724   $set['level'] = 0;
725
726   // AMPDEVGROUP
727   $set['value'] = 'asterisk';
728   $set['options'] = '';
729   $set['name'] = 'System Device Group';
730   $set['description'] = 'The user group that various device directories should be set to, used by freepbx_engine. Examples include /dev/zap, /dev/dahdi, /dev/misdn, /dev/mISDN and /dev/dsp. Most systems should not change this.';
731   $set['emptyok'] = 0;
732   $set['readonly'] = 1;
733   $set['type'] = CONF_TYPE_TEXT;
734   $set['level'] = 4;
735   $freepbx_conf->define_conf_setting('AMPDEVGROUP',$set);
736   $set['level'] = 0;
737
738   //
739   // CATEGORY: Dialplan and Operational
740   //
741   $set['category'] = 'Dialplan and Operational';
742
743   // AMPBADNUMBER
744   $set['value'] = true;
745   $set['options'] = '';
746   $set['name'] = 'Use bad-number Context';
747   $set['description'] = '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.';
748   $set['emptyok'] = 0;
749   $set['readonly'] = 0;
750   $set['type'] = CONF_TYPE_BOOL;
751   $set['level'] = 2;
752   $freepbx_conf->define_conf_setting('AMPBADNUMBER',$set);
753   $set['level'] = 0;
754
755   // CWINUSEBUSY
756   $set['value'] = true;
757   $set['options'] = '';
758   $set['name'] = 'Occupied Lines CW Busy';
759   $set['description'] = '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>.';
760   $set['emptyok'] = 0;
761   $set['readonly'] = 0;
762   $set['type'] = CONF_TYPE_BOOL;
763   $freepbx_conf->define_conf_setting('CWINUSEBUSY',$set);
764
765   // ZAP2DAHDICOMPAT
766   $set['value'] = false;
767   $set['options'] = '';
768   $set['name'] = 'Convert ZAP Settings to DAHDi';
769   $set['description'] = 'If set to true, FreePBX will check if you have chan_dahdi 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.';
770   $set['emptyok'] = 0;
771   $set['readonly'] = 1;
772   $set['type'] = CONF_TYPE_BOOL;
773   $freepbx_conf->define_conf_setting('ZAP2DAHDICOMPAT',$set);
774
775   // DYNAMICHINTS
776   $set['value'] = false;
777   $set['options'] = '';
778   $set['name'] = 'Dynamically Generate Hints';
779   $set['description'] = '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.';
780   $set['emptyok'] = 0;
781   $set['readonly'] = 1;
782   $set['type'] = CONF_TYPE_BOOL;
783   $freepbx_conf->define_conf_setting('DYNAMICHINTS',$set);
784
785   // ENABLECW
786   $set['value'] = true;
787   $set['options'] = '';
788   $set['name'] = 'CW Enabled by Default';
789   $set['description'] = 'Enable call waiting by default when an extension is created (Default is yes). Set to <b>no</b> to if you do not 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.';
790   $set['emptyok'] = 0;
791   $set['readonly'] = 0;
792   $set['type'] = CONF_TYPE_BOOL;
793   $freepbx_conf->define_conf_setting('ENABLECW',$set);
794
795   // FCBEEPONLY
796   $set['value'] = false;
797   $set['options'] = '';
798   $set['name'] = 'Feature Codes Beep Only';
799   $set['description'] = 'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow.';
800   $set['emptyok'] = 0;
801   $set['readonly'] = 0;
802   $set['type'] = CONF_TYPE_BOOL;
803   $freepbx_conf->define_conf_setting('FCBEEPONLY',$set);
804
805   // USEDEVSTATE
806   $set['value'] = false;
807   $set['options'] = '';
808   $set['name'] = 'Enable Custom Device States';
809   $set['description'] = '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';
810   $set['emptyok'] = 0;
811   $set['readonly'] = 0;
812   $set['type'] = CONF_TYPE_BOOL;
813   $freepbx_conf->define_conf_setting('USEDEVSTATE',$set);
814
815   // USEGOOGLEDNSFORENUM
816   $set['value'] = false;
817   $set['options'] = '';
818   $set['name'] = 'Use Google DNS for Enum';
819   $set['description'] = '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>.';
820   $set['emptyok'] = 0;
821   $set['type'] = CONF_TYPE_BOOL;
822   $set['level'] = 2;
823   $set['readonly'] = 0;
824   $freepbx_conf->define_conf_setting('USEGOOGLEDNSFORENUM',$set);
825   $set['level'] = 0;
826
827   // DISABLECUSTOMCONTEXTS
828   $set['value'] = false;
829   $set['options'] = '';
830   $set['name'] = 'Disable -custom Context Includes';
831   $set['description'] = '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.';
832   $set['emptyok'] = 0;
833   $set['readonly'] = 0;
834   $set['type'] = CONF_TYPE_BOOL;
835   $set['level'] = 2;
836   $freepbx_conf->define_conf_setting('DISABLECUSTOMCONTEXTS',$set);
837   $set['level'] = 0;
838
839
840   // NOOPTRACE
841   $set['value'] = '0';
842   $set['options'] = '0,1,2,3,4,5,6,7,8,9,10';
843   $set['name'] = 'NoOp Traces in Dialplan';
844   $set['description'] = 'Some modules will generate lots of NoOp() commands proceeded by a [TRACE](trace_level) that can be used during development or while trying to trace call flows. These NoOp() commands serve no other purpose so if you do not want to see excessive NoOp()s in your dialplan you can set this to 0. The higher the number the more detailed level of trace NoOp()s will be generated';
845   $set['emptyok'] = 0;
846   $set['readonly'] = 0;
847   $set['type'] = CONF_TYPE_SELECT;
848   $freepbx_conf->define_conf_setting('NOOPTRACE',$set);
849
850   // DIVERSIONHEADER
851   $set['value'] = false;
852   $set['options'] = '';
853   $set['name'] = 'Generate Diversion Headers';
854   $set['description'] = 'If this value is set to true, then calls going out your outbound routes that originate from outside your PBX and were subsequently forwarded through a call forward, ring group, follow-me or other means, will have a SIP diversion header added to the call with the original incoming DID assuming there is a DID available. This is useful with some carriers that may require this under certain circumstances.';
855   $set['emptyok'] = 0;
856   $set['readonly'] = 0;
857   $set['type'] = CONF_TYPE_BOOL;
858   $freepbx_conf->define_conf_setting('DIVERSIONHEADER',$set);
859
860   // CFRINGTIMERDEFAULT
861   $opts = array();
862   for ($i=-1;$i<=120;$i++) {
863       $opts[]=$i;
864   }
865   $set['value'] = '0';
866   $set['options'] = $opts;
867   $set['name'] = 'Call Forward Ringtimer Default';
868   $set['description'] = 'This is the default time in seconds to try and connect a call that has been call forwarded by the server side CF, CFU and CFB options. (If your phones use client side CF such as SIP redirects, this will not have any affect) If set to the default of 0, it will use the standard ring timer. If set to -1 it will ring the forwarded number with no limit which is consistent with the behavior of some existing PBX systems. If set to any other value, it will ring for that duration before diverting the call to the users voicemail if they have one. This can be overridden for each extension.';
869   $set['emptyok'] = 0;
870   $set['readonly'] = 0;
871   $set['type'] = CONF_TYPE_SELECT;
872   $freepbx_conf->define_conf_setting('CFRINGTIMERDEFAULT',$set);
873   unset($opts); 
874  
875   // DEFAULT_INTERNAL_AUTO_ANSWER
876   $set['value'] = 'disabled';
877   $set['options'] = array('disabled','intercom');
878   $set['name'] = 'Internal Auto Answer Default';
879   $set['description'] = "Default setting for new extensions. When set to Intercom, calls to new extensions/users from other internal users act as if they were intercom calls meaning they will be auto-answered if the endpoint supports this feature and the system is configured to operate in this mode. All the normal white list and black list settings will be honored if they are set. External calls will still ring as normal, as will certain other circumstances such as blind transfers and when a Follow Me is configured and enabled. If Disabled, the phone rings as a normal phone.";
880   $set['emptyok'] = 0;
881   $set['readonly'] = 0;
882   $set['type'] = CONF_TYPE_SELECT;
883   $freepbx_conf->define_conf_setting('DEFAULT_INTERNAL_AUTO_ANSWER',$set);
884
885   // FORCE_INTERNAL_AUTO_ANSWER_ALL
886   $set['value'] = false;
887   $set['options'] = '';
888   $set['name'] = 'Force All Internal Auto Answer';
889   $set['description'] = "Force all extensions to operate in the Internal Auto Answer mode regardless of their individual settings. See 'Internal Auto Answer Default' for more information.";
890   $set['emptyok'] = 0;
891   $set['readonly'] = 0;
892   $set['type'] = CONF_TYPE_BOOL;
893   $freepbx_conf->define_conf_setting('FORCE_INTERNAL_AUTO_ANSWER_ALL',$set);
894
895   // CONCURRENCYLIMITDEFAULT
896   $opts = array();
897   for ($i=0;$i<=120;$i++) {
898       $opts[]=$i;
899   }
900   $set['value'] = '0';
901   $set['options'] = $opts;
902   $set['name'] = 'Extension Concurrency Limit';
903   $set['description'] = 'Default maximum number of outbound simultaneous calls that an extension can make. This is also very useful as a Security Protection against a system that has been compromised. It will limit the number of simultaneous calls that can be made on the compromised extension. This default is used when an extension is created. A default of 0 means no limit.';
904   $set['emptyok'] = 0;
905   $set['readonly'] = 0;
906   $set['type'] = CONF_TYPE_SELECT;
907   $freepbx_conf->define_conf_setting('CONCURRENCYLIMITDEFAULT',$set);
908   unset($opts); 
909
910   // BLOCK_OUTBOUND_TRUNK_CNAM
911   $set['value'] = false;
912   $set['options'] = '';
913   $set['name'] = 'Block CNAM on External Trunks';
914   $set['description'] = 'Some carriers will reject a call if a CallerID Name (CNAM) is presented. This occurs in several areas when configuring CID on the PBX using the format of "CNAM" <CNUM>. To remove the CNAM part of CID on all external trunks, set this value to true. This WILL NOT remove CNAM when a trunk is called from an Intra-Company route. This can be done on each individual trunk in addition to globally if there are trunks where it is desirable to keep CNAM information, though most carriers ignore CNAM.';
915   $set['emptyok'] = 0;
916   $set['readonly'] = 0;
917   $set['type'] = CONF_TYPE_BOOL;
918   $freepbx_conf->define_conf_setting('BLOCK_OUTBOUND_TRUNK_CNAM',$set);
919
920   // ASTSTOPTIMEOUT
921   $opts = array();
922   $set['value'] = '120';
923   $set['options'] = array(0,5,10,30,60,120,300,600,1800,3600,7200,10800);
924   $set['name'] = 'Waiting Period to Stop Asterisk';
925   $set['description'] = "When Asterisk is stopped or restarted with the 'amportal stop/restart' commands, it does a graceful stop waiting for active channels to hangup. This sets the maximum time in seconds to wait prior to force stopping Asterisk";
926   $set['emptyok'] = 0;
927   $set['readonly'] = 0;
928   $set['type'] = CONF_TYPE_SELECT;
929   $freepbx_conf->define_conf_setting('ASTSTOPTIMEOUT',$set);
930
931   // ASTSTOPPOLLINT
932   $opts = array();
933   $set['value'] = '2';
934   $set['options'] = array(1,2,3,5,10);
935   $set['name'] = 'Polling Interval for Stopping Asterisk';
936   $set['description'] = "When Asterisk is stopped or restarted with the 'amportal stop/restart' commands, it does a graceful stop waiting for active channels to hangup. This sets the polling interval to check if Asterisk is shutdown and update the countdown timer.";
937   $set['emptyok'] = 0;
938   $set['readonly'] = 0;
939   $set['type'] = CONF_TYPE_SELECT;
940   $freepbx_conf->define_conf_setting('ASTSTOPPOLLINT',$set);
941
942   // CID_PREPEND_REPLACE
943   $set['value'] = true;
944   $set['options'] = '';
945   $set['name'] = 'Only Use Last CID Prepend';
946   $set['description'] = "Some modules allow the CNAM to be prepended. If a previous prepend was done, the default behavior is to remove the previous prepend and only use the most recent one. Setting this to false will turn that off allowing all prepends to be 'starcked' in front of one another.";
947   $set['emptyok'] = 0;
948   $set['readonly'] = 0;
949   $set['type'] = CONF_TYPE_BOOL;
950   $freepbx_conf->define_conf_setting('CID_PREPEND_REPLACE',$set);
951
952
953   //
954   // CATEGORY: Directory Layout
955   //
956   $set['category'] = 'Directory Layout';
957
958   // AMPBIN
959   $set['value'] = '/var/lib/asterisk/bin';
960   $set['options'] = '';
961   $set['name'] = 'FreePBX bin Dir';
962   $set['description'] = 'Location of the FreePBX command line scripts.';
963   $set['emptyok'] = 0;
964   $set['readonly'] = 1;
965   $set['type'] = CONF_TYPE_DIR;
966   $set['level'] = 4;
967   $freepbx_conf->define_conf_setting('AMPBIN',$set);
968
969   // AMPSBIN
970   $set['value'] = '/usr/sbin';
971   $set['options'] = '';
972   $set['name'] = 'FreePBX sbin Dir';
973   $set['description'] = 'Where (root) command line scripts are located.';
974   $set['emptyok'] = 0;
975   $set['readonly'] = 1;
976   $set['type'] = CONF_TYPE_DIR;
977   $set['level'] = 4;
978   $freepbx_conf->define_conf_setting('AMPSBIN',$set);
979    
980   // AMPWEBROOT
981   $set['value'] = '/var/www/html';
982   $set['options'] = '';
983   $set['name'] = 'FreePBX Web Root Dir';
984   $set['description'] = 'The path to Apache webroot (leave off trailing slash).';
985   $set['emptyok'] = 0;
986   $set['readonly'] = 1;
987   $set['type'] = CONF_TYPE_DIR;
988   $set['level'] = 4;
989   $freepbx_conf->define_conf_setting('AMPWEBROOT',$set);
990
991   // ASTAGIDIR
992   $set['value'] = '/var/lib/asterisk/agi-bin';
993   $set['options'] = '';
994   $set['name'] = 'Asterisk AGI Dir';
995   $set['description'] = 'This is the default directory for Asterisks agi files.';
996   $set['emptyok'] = 0;
997   $set['readonly'] = 1;
998   $set['type'] = CONF_TYPE_DIR;
999   $set['level'] = 4;
1000   $freepbx_conf->define_conf_setting('ASTAGIDIR',$set);
1001
1002   // ASTETCDIR
1003   $set['value'] = '/etc/asterisk';
1004   $set['options'] = '';
1005   $set['name'] = 'Asterisk etc Dir';
1006   $set['description'] = 'This is the default directory for Asterisks configuration files.';
1007   $set['emptyok'] = 0;
1008   $set['readonly'] = 1;
1009   $set['type'] = CONF_TYPE_DIR;
1010   $set['level'] = 4;
1011   $freepbx_conf->define_conf_setting('ASTETCDIR',$set);
1012
1013   // ASTLOGDIR
1014   $set['value'] = '/var/log/asterisk';
1015   $set['options'] = '';
1016   $set['name'] = 'Asterisk Log Dir';
1017   $set['description'] = 'This is the default directory for Asterisks log files.';
1018   $set['emptyok'] = 0;
1019   $set['readonly'] = 1;
1020   $set['type'] = CONF_TYPE_DIR;
1021   $set['level'] = 4;
1022   $freepbx_conf->define_conf_setting('ASTLOGDIR',$set);
1023
1024   // ASTMODDIR
1025   $set['value'] = '/usr/lib/asterisk/modules';
1026   $set['options'] = '';
1027   $set['name'] = 'Asterisk Modules Dir';
1028   $set['description'] = 'This is the default directory for Asterisks modules.';
1029   $set['emptyok'] = 0;
1030   $set['readonly'] = 1;
1031   $set['type'] = CONF_TYPE_DIR;
1032   $set['level'] = 4;
1033   $freepbx_conf->define_conf_setting('ASTMODDIR',$set);
1034
1035   // ASTSPOOLDIR
1036   $set['value'] = '/var/spool/asterisk';
1037   $set['options'] = '';
1038   $set['name'] = 'Asterisk Spool Dir';
1039   $set['description'] = 'This is the default directory for Asterisks spool directory.';
1040   $set['emptyok'] = 0;
1041   $set['readonly'] = 1;
1042   $set['type'] = CONF_TYPE_DIR;
1043   $set['level'] = 4;
1044   $freepbx_conf->define_conf_setting('ASTSPOOLDIR',$set);
1045
1046   // ASTRUNDIR
1047   $set['value'] = '/var/run/asterisk';
1048   $set['options'] = '';
1049   $set['name'] = 'Asterisk Run Dir';
1050   $set['description'] = 'This is the default directory for Asterisks run files.';
1051   $set['emptyok'] = 0;
1052   $set['readonly'] = 1;
1053   $set['type'] = CONF_TYPE_DIR;
1054   $set['level'] = 4;
1055   $freepbx_conf->define_conf_setting('ASTRUNDIR',$set);
1056
1057   // ASTVARLIBDIR
1058   $set['value'] = '/var/lib/asterisk';
1059   $set['options'] = '';
1060   $set['name'] = 'Asterisk bin Dir';
1061   $set['description'] = 'This is the default directory for Asterisks lib files.';
1062   $set['emptyok'] = 0;
1063   $set['readonly'] = 1;
1064   $set['type'] = CONF_TYPE_DIR;
1065   $set['level'] = 4;
1066   $freepbx_conf->define_conf_setting('ASTVARLIBDIR',$set);
1067
1068   // AMPCGIBIN
1069   $set['value'] = '/var/www/cgi-bin ';
1070   $set['options'] = '';
1071   $set['name'] = 'CGI Dir';
1072   $set['description'] = 'The path to Apache cgi-bin dir (leave off trailing slash).';
1073   $set['emptyok'] = 0;
1074   $set['readonly'] = 1;
1075   $set['type'] = CONF_TYPE_DIR;
1076   $set['level'] = 4;
1077   $freepbx_conf->define_conf_setting('AMPCGIBIN',$set);
1078
1079   // MOHDIR
1080   $set['value'] = 'moh';
1081   $set['options'] = array('moh','mohmp3');
1082   $set['name'] = 'MoH Subdirectory';
1083   $set['description'] = 'This is the subdirectory for the MoH files/directories which is located in ASTVARLIBDIR. Older installation may be using mohmp3 which was the old Asterisk default and should be set to that value if the music files are located there relative to the ASTVARLIBDIR.';
1084   $set['emptyok'] = 0;
1085   $set['readonly'] = 1;
1086   $set['type'] = CONF_TYPE_SELECT;
1087   $set['level'] = 4;
1088   $freepbx_conf->define_conf_setting('MOHDIR',$set);
1089   $set['level'] = 0;
1090
1091
1092   //
1093   // CATEGORY: GUI Behavior
1094   //
1095   $set['category'] = 'GUI Behavior';
1096
1097   // CHECKREFERER
1098   $set['value'] = true;
1099   $set['options'] = '';
1100   $set['name'] = 'Check Server Referrer';
1101   $set['description'] = '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.';
1102   $set['emptyok'] = 0;
1103   $set['readonly'] = 0;
1104   $set['type'] = CONF_TYPE_BOOL;
1105   $freepbx_conf->define_conf_setting('CHECKREFERER',$set);
1106
1107   // MODULEADMINWGET
1108   $set['value'] = false;
1109   $set['options'] = '';
1110   $set['name'] = 'Use wget For Module Admin';
1111   $set['description'] = '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 do not 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.';
1112   $set['emptyok'] = 0;
1113   $set['readonly'] = 0;
1114   $set['type'] = CONF_TYPE_BOOL;
1115   $freepbx_conf->define_conf_setting('MODULEADMINWGET',$set);
1116
1117   // USECATEGORIES
1118   $set['value'] = true;
1119   $set['options'] = '';
1120   $set['name'] = 'Show Categories in Nav Menu';
1121   $set['description'] = 'Controls if the menu items in the admin interface are sorted by category (true) or sorted alphabetically with no categories shown (false). Defaults = true';
1122   $set['emptyok'] = 0;
1123   $set['readonly'] = 0;
1124   $set['type'] = CONF_TYPE_BOOL;
1125   $freepbx_conf->define_conf_setting('USECATEGORIES',$set);
1126
1127   // SERVERINTITLE
1128   $set['value'] = false;
1129   $set['options'] = '';
1130   $set['name'] = 'Include Server Name in Browser';
1131   $set['description'] = 'Precede browser title with the server name.';
1132   $set['emptyok'] = 0;
1133   $set['readonly'] = 0;
1134   $set['type'] = CONF_TYPE_BOOL;
1135   $freepbx_conf->define_conf_setting('SERVERINTITLE',$set);
1136
1137   // RELOADCONFIRM
1138   $set['value'] = true;
1139   $set['options'] = '';
1140   $set['name'] = 'Require Confirm with Apply Changes';
1141   $set['description'] = 'When set to false, will bypass the confirm on Reload Box.';
1142   $set['emptyok'] = 0;
1143   $set['readonly'] = 0;
1144   $set['type'] = CONF_TYPE_BOOL;
1145   $freepbx_conf->define_conf_setting('RELOADCONFIRM',$set);
1146
1147   // BADDESTABORT
1148   $set['value'] = false;
1149   $set['options'] = '';
1150   $set['name'] = 'Abort Config Gen on Bad Dest';
1151   $set['description'] = '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.';
1152   $set['emptyok'] = 0;
1153   $set['level'] = 3;
1154   $set['readonly'] = 0;
1155   $set['type'] = CONF_TYPE_BOOL;
1156   $freepbx_conf->define_conf_setting('BADDESTABORT',$set);
1157   $set['level'] = 0;
1158
1159   // XTNCONFLICTABORT
1160   $set['value'] = false;
1161   $set['options'] = '';
1162   $set['name'] = 'Abort Config Gen on Exten Conflict';
1163   $set['description'] = '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.';
1164   $set['emptyok'] = 0;
1165   $set['level'] = 3;
1166   $set['readonly'] = 0;
1167   $set['type'] = CONF_TYPE_BOOL;
1168   $freepbx_conf->define_conf_setting('XTNCONFLICTABORT',$set);
1169   $set['level'] = 0;
1170
1171   // CUSTOMASERROR
1172   $set['value'] = true;
1173   $set['options'] = '';
1174   $set['name'] = 'Report Unknown Dest as Error';
1175   $set['description'] = '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.';
1176   $set['emptyok'] = 0;
1177   $set['level'] = 2;
1178   $set['readonly'] = 0;
1179   $set['type'] = CONF_TYPE_BOOL;
1180   $freepbx_conf->define_conf_setting('CUSTOMASERROR',$set);
1181   $set['level'] = 0;
1182
1183 // ALWAYS_SHOW_DEVICE_DETAILS
1184   $set['value'] = false;
1185   $set['options'] = '';
1186   $set['name'] = 'Show all Device Setting on Add';
1187   $set['description'] = 'When adding a new extension/device, setting this to true will show most available device settings that are displayed when you edit the same extension/device. Otherwise, just a few basic settings are displayed.';
1188   $set['emptyok'] = 0;
1189   $set['level'] = 0;
1190   $set['readonly'] = 0;
1191   $set['type'] = CONF_TYPE_BOOL;
1192   $freepbx_conf->define_conf_setting('ALWAYS_SHOW_DEVICE_DETAILS',$set);
1193   $set['level'] = 0;
1194
1195   //
1196   // CATEGORY: Asterisk Manager
1197   //
1198   $set['category'] = 'Asterisk Manager';
1199
1200   // AMPMGRPASS
1201   $set['value'] = 'amp111';
1202   $set['options'] = '';
1203   $set['name'] = 'Asterisk Manager Password';
1204   $set['description'] = 'Password for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.';
1205   $set['emptyok'] = 0;
1206   $set['type'] = CONF_TYPE_TEXT;
1207   $set['level'] = 2;
1208   $set['readonly'] = 1;
1209   $freepbx_conf->define_conf_setting('AMPMGRPASS',$set);
1210   $set['level'] = 0;
1211
1212   // AMPMGRUSER
1213   $set['value'] = 'admin';
1214   $set['options'] = '';
1215   $set['name'] = 'Asterisk Manager User';
1216   $set['description'] = 'Username for accessing the Asterisk Manager Interface (AMI), you must change this in manager.conf if changed here.';
1217   $set['emptyok'] = 0;
1218   $set['readonly'] = 1;
1219   $set['type'] = CONF_TYPE_TEXT;
1220   $set['level'] = 2;
1221   $freepbx_conf->define_conf_setting('AMPMGRUSER',$set);
1222   $set['level'] = 0;
1223
1224   // ASTMANAGERHOST
1225   $set['value'] = 'localhost';
1226   $set['options'] = '';
1227   $set['name'] = 'Asterisk Manager Host';
1228   $set['description'] = 'Hostname for the Asterisk Manager';
1229   $set['emptyok'] = 0;
1230   $set['readonly'] = 1;
1231   $set['type'] = CONF_TYPE_TEXT;
1232   $set['level'] = 2;
1233   $freepbx_conf->define_conf_setting('ASTMANAGERHOST',$set);
1234   $set['level'] = 0;
1235
1236   // ASTMANAGERPORT
1237   $set['value'] = '5038';
1238   $set['name'] = 'Asterisk Manager Port';
1239   $set['description'] = 'Port for the Asterisk Manager';
1240   $set['emptyok'] = 0;
1241   $set['readonly'] = 1;
1242   $set['type'] = CONF_TYPE_INT;
1243   $set['options'] = array(1024,65535);
1244   $set['level'] = 2;
1245   $freepbx_conf->define_conf_setting('ASTMANAGERPORT',$set);
1246   $set['level'] = 0;
1247
1248   // ASTMANAGERPROXYPORT
1249   $set['value'] = '';
1250   $set['name'] = 'Asterisk Manager Proxy Port';
1251   $set['description'] = 'Optional port for an Asterisk Manager Proxy';
1252   $set['readonly'] = 1;
1253   $set['type'] = CONF_TYPE_INT;
1254   $set['emptyok'] = 1;
1255   $set['options'] = array(1024,65535);
1256   $set['level'] = 2;
1257   $freepbx_conf->define_conf_setting('ASTMANAGERPROXYPORT',$set);
1258   $set['level'] = 0;
1259
1260
1261   //
1262   // CATEGORY: Developer and Customization
1263   //
1264   $set['category'] = 'Developer and Customization';
1265   $set['level'] = 2;
1266
1267   // FPBXDBUGFILE
1268   $set['value'] = '/tmp/freepbx_debug.log';
1269   $set['options'] = '';
1270   $set['name'] = 'Debug File';
1271   $set['description'] = 'Full path and name of FreePBX debug file. Used by the dbug() function by developers.';
1272   $set['emptyok'] = 0;
1273   $set['readonly'] = 0;
1274   $set['type'] = CONF_TYPE_TEXT;
1275   $freepbx_conf->define_conf_setting('FPBXDBUGFILE',$set);
1276
1277   // FPBXDBUGDISABLE
1278   $set['value'] = true;
1279   $set['options'] = '';
1280   $set['name'] = 'Disable FreePBX dbug Logging';
1281   $set['description'] = 'Set to true to stop all dbug() calls from writing to the Debug File (FPBXDBUGFILE)';
1282   $set['emptyok'] = 0;
1283   $set['readonly'] = 0;
1284   $set['type'] = CONF_TYPE_BOOL;
1285   $freepbx_conf->define_conf_setting('FPBXDBUGDISABLE',$set);
1286
1287   // DIE_FREEPBX_VERBOSE
1288   $set['value'] = false;
1289   $set['options'] = '';
1290   $set['name'] = 'Provide Verbose Tracebacks';
1291   $set['description'] = 'Provides a very verbose traceback when die_freepbx() is called including extensive object details if present in the traceback.';
1292   $set['emptyok'] = 0;
1293   $set['readonly'] = 0;
1294   $set['type'] = CONF_TYPE_BOOL;
1295   $freepbx_conf->define_conf_setting('DIE_FREEPBX_VERBOSE',$set);
1296
1297
1298
1299   // DEVEL
1300   $set['value'] = false;
1301   $set['options'] = '';
1302   $set['name'] = 'Developer Mode';
1303   $set['description'] = 'This enables several debug features geared towards developers, including some page load timing information, some debug information in Module Admin, use of original CSS files and other future capabilities will be enabled.';
1304   $set['emptyok'] = 0;
1305   $set['readonly'] = 0;
1306   $set['type'] = CONF_TYPE_BOOL;
1307   $freepbx_conf->define_conf_setting('DEVEL',$set);
1308
1309   // USE_PACKAGED_JS
1310   $set['value'] = true;
1311   $set['options'] = '';
1312   $set['name'] = 'Use Packaged Javascript Library ';
1313   $set['description'] = 'FreePBX packages several javascript libraries and components into a compressed file called libfreepbx.javascript.js. By default this will be loaded instead of the individual uncompressed libraries. Setting this to false will force FreePBX to load all the libraries as individual uncompressed files. This is useful during development and debugging.';
1314   $set['emptyok'] = 0;
1315   $set['readonly'] = 0;
1316   $set['type'] = CONF_TYPE_BOOL;
1317   $freepbx_conf->define_conf_setting('USE_PACKAGED_JS',$set);
1318
1319   // FORCE_JS_CSS_IMG_DOWNLOAD
1320   $set['value'] = false;
1321   $set['options'] = '';
1322   $set['name'] = 'Always Download Web Assets';
1323   $set['description'] = 'FreePBX appends versioning tags on the CSS and javascript files and some of the main logo images. The versioning will help force browsers to load new versions of the files when module versions are upgraded. Setting this value to true will try to force these to be loaded to the browser every page load by appending an additional timestamp in the version information. This is useful during development and debugging where changes are being made to javascript and CSS files.';
1324   $set['emptyok'] = 0;
1325   $set['readonly'] = 0;
1326   $set['type'] = CONF_TYPE_BOOL;
1327   $freepbx_conf->define_conf_setting('FORCE_JS_CSS_IMG_DOWNLOAD',$set);
1328
1329   // DEVELRELOAD
1330   $set['value'] = false;
1331   $set['options'] = '';
1332   $set['name'] = 'Leave Reload Bar Up';
1333   $set['description'] = 'Forces the "Apply Configuration Changes" reload bar to always be present even when not necessary.';
1334   $set['emptyok'] = 0;
1335   $set['readonly'] = 0;
1336   $set['type'] = CONF_TYPE_BOOL;
1337   $freepbx_conf->define_conf_setting('DEVELRELOAD',$set);
1338
1339   // PRE_RELOAD
1340   $set['value'] = '';
1341   $set['options'] = '';
1342   $set['name'] = 'PRE_RELOAD Script';
1343   $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.';
1344   $set['emptyok'] = 1;
1345   $set['readonly'] = 1;
1346   $set['type'] = CONF_TYPE_TEXT;
1347   $freepbx_conf->define_conf_setting('PRE_RELOAD',$set);
1348
1349   // POST_RELOAD
1350   $set['value'] = '';
1351   $set['options'] = '';
1352   $set['name'] = 'POST_RELOAD Script';
1353   $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.';
1354   $set['emptyok'] = 1;
1355   $set['readonly'] = 1;
1356   $set['type'] = CONF_TYPE_TEXT;
1357   $freepbx_conf->define_conf_setting('POST_RELOAD',$set);
1358
1359   // POST_RELOAD_DEBUG
1360   $set['value'] = false;
1361   $set['options'] = '';
1362   $set['name'] = 'POST_RELOAD Debug Mode';
1363   $set['description'] = 'Display debug output for script used if POST_RELOAD is used.';
1364   $set['emptyok'] = 0;
1365   $set['readonly'] = 0;
1366   $set['type'] = CONF_TYPE_BOOL;
1367   $freepbx_conf->define_conf_setting('POST_RELOAD_DEBUG',$set);
1368
1369   // AMPLOCALBIN
1370   $set['value'] = '';
1371   $set['options'] = '';
1372   $set['name'] = 'AMPLOCALBIN Dir for retrieve_conf';
1373   $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 additional customization.';
1374   $set['emptyok'] = 1;
1375   $set['readonly'] = 1;
1376   $set['type'] = CONF_TYPE_DIR;
1377   $freepbx_conf->define_conf_setting('AMPLOCALBIN',$set);
1378  
1379   // DISABLE_CSS_AUTOGEN
1380   $set['value'] = false;
1381   $set['options'] = '';
1382   $set['name'] = 'Disable Mainstyle CSS Compression';
1383   $set['description'] = 'Stops the automatic generation of a stripped CSS file that replaces the primary sheet, usually mainstyle.css.';
1384   $set['emptyok'] = 0;
1385   $set['readonly'] = 0;
1386   $set['type'] = CONF_TYPE_BOOL;
1387   $freepbx_conf->define_conf_setting('DISABLE_CSS_AUTOGEN',$set);
1388
1389   // MODULEADMIN_SKIP_CACHE
1390   $set['value'] = false;
1391   $set['options'] = '';
1392   $set['name'] = 'Disable Module Admin Caching';
1393   $set['description'] = 'Module Admin caches a copy of the online XML document that describes what is available on the server. Subsequent online update checks will use the cached information if it is less than 5 minutes old. To bypass the cache and force it to go to the server each time, set this to True. This should normally be false but can be helpful during testing.';
1394   $set['emptyok'] = 0;
1395   $set['readonly'] = 1;
1396   $set['type'] = CONF_TYPE_BOOL;
1397   $freepbx_conf->define_conf_setting('MODULEADMIN_SKIP_CACHE',$set);
1398
1399
1400   //
1401   // CATEGORY: Flash Operator Panel
1402   //
1403   $set['category'] = 'Flash Operator Panel';
1404   $set['level'] = 0;
1405
1406   // FOPSORT
1407   $set['value'] = 'extension';
1408   $set['options'] = 'extension,lastname';
1409   $set['name'] = 'FOP Sort Mode';
1410   $set['description'] = 'How FOP sort extensions. By Last Name [lastname] or by Extension [extension].';
1411   $set['emptyok'] = 0;
1412   $set['readonly'] = 0;
1413   $set['type'] = CONF_TYPE_SELECT;
1414   $freepbx_conf->define_conf_setting('FOPSORT',$set);
1415
1416   // FOPWEBROOT
1417   $set['value'] = '/var/www/html/panel';
1418   $set['options'] = '';
1419   $set['name'] = 'FOP Web Root Dir';
1420   $set['description'] = 'Path to the Flash Operator Panel webroot (leave off trailing slash).';
1421   $set['emptyok'] = 0;
1422   $set['readonly'] = 1;
1423   $set['type'] = CONF_TYPE_DIR;
1424   $set['level'] = 4;
1425   $freepbx_conf->define_conf_setting('FOPWEBROOT',$set);
1426   $set['level'] = 0;
1427
1428   // FOPPASSWORD
1429   $set['value'] = 'passw0rd';
1430   $set['options'] = '';
1431   $set['name'] = 'FOP Password';
1432   $set['description'] = 'Password for performing transfers and hangups in the Flash Operator Panel (FOP).';
1433   $set['emptyok'] = 0;
1434   $set['readonly'] = 0;
1435   $set['type'] = CONF_TYPE_TEXT;
1436   $freepbx_conf->define_conf_setting('FOPPASSWORD',$set);
1437
1438   // FOPDISABLE
1439   $set['value'] = false;
1440   $set['options'] = '';
1441   $set['name'] = 'Disable FOP';
1442   $set['description'] = 'Set to true to disable FOP in interface and retrieve_conf.  Useful for sqlite3 or if you do not want FOP.';
1443   $set['emptyok'] = 0;
1444   $set['readonly'] = 0;
1445   $set['type'] = CONF_TYPE_BOOL;
1446   $freepbx_conf->define_conf_setting('FOPDISABLE',$set);
1447
1448   // FOPRUN
1449   $set['value'] = true;
1450   $set['options'] = '';
1451   $set['name'] = 'Start FOP with amportal';
1452   $set['description'] = 'Set to true if you want FOP started by freepbx_engine (amportal_start), false otherwise.';
1453   $set['emptyok'] = 0;
1454   $set['readonly'] = 0;
1455   $set['type'] = CONF_TYPE_BOOL;
1456   $freepbx_conf->define_conf_setting('FOPRUN',$set);
1457
1458
1459   //
1460   // CATEGORY: Remote CDR Database
1461   //
1462   $set['category'] = 'Remote CDR Database';
1463   $set['level'] = 3;
1464
1465   // CDRDBHOST
1466   $set['value'] = '';
1467   $set['options'] = '';
1468   $set['name'] = 'Remote CDR DB Host';
1469   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX.<br>Hostname of db server if not the same as AMPDBHOST.';
1470   $set['emptyok'] = 1;
1471   $set['readonly'] = 1;
1472   $set['type'] = CONF_TYPE_TEXT;
1473   $freepbx_conf->define_conf_setting('CDRDBHOST',$set);
1474
1475   // CDRDBNAME
1476   $set['value'] = '';
1477   $set['options'] = '';
1478   $set['name'] = 'Remote CDR DB Name';
1479   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX.<br>Name of database used for cdr records.';
1480   $set['emptyok'] = 1;
1481   $set['readonly'] = 1;
1482   $set['type'] = CONF_TYPE_TEXT;
1483   $freepbx_conf->define_conf_setting('CDRDBNAME',$set);
1484
1485   // CDRDBPASS
1486   $set['value'] = '';
1487   $set['options'] = '';
1488   $set['name'] = 'Remote CDR DB Password';
1489   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX.<br>Password for connecting to db if its not the same as AMPDBPASS.';
1490   $set['emptyok'] = 1;
1491   $set['readonly'] = 1;
1492   $set['type'] = CONF_TYPE_TEXT;
1493   $freepbx_conf->define_conf_setting('CDRDBPASS',$set);
1494
1495   // CDRDBPORT
1496   $set['value'] = '';
1497   $set['options'] = array(1024,65536);
1498   $set['name'] = 'Remote CDR DB Password';
1499   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX.<br>Port number for db host.';
1500   $set['emptyok'] = 1;
1501   $set['readonly'] = 1;
1502   $set['type'] = CONF_TYPE_INT;
1503   $freepbx_conf->define_conf_setting('CDRDBPORT',$set);
1504
1505   // CDRDBTABLENAME
1506   $set['value'] = '';
1507   $set['options'] = '';
1508   $set['name'] = 'Remote CDR DB Table';
1509   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX. Name of the table in the db where the cdr is stored. cdr is default.';
1510   $set['emptyok'] = 1;
1511   $set['readonly'] = 1;
1512   $set['type'] = CONF_TYPE_TEXT;
1513   $freepbx_conf->define_conf_setting('CDRDBTABLENAME',$set);
1514
1515   // CDRDBTYPE
1516   $set['value'] = '';
1517   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX. Defaults to your configured AMDBENGINE.';
1518   $set['name'] = 'Remote CDR DB Type';
1519   $set['emptyok'] = 1;
1520   $set['options'] = ',mysql,postgres';
1521   $set['readonly'] = 1;
1522   $set['type'] = CONF_TYPE_SELECT;
1523   $freepbx_conf->define_conf_setting('CDRDBTYPE',$set);
1524
1525   // CDRDBUSER
1526   $set['value'] = '';
1527   $set['options'] = '';
1528   $set['name'] = 'Remote CDR DB User';
1529   $set['description'] = 'DO NOT set this unless you know what you are doing. Only used if you do not use the default values provided by FreePBX. Username to connect to db with if it is not the same as AMPDBUSER.';
1530   $set['emptyok'] = 1;
1531   $set['readonly'] = 1;
1532   $set['type'] = CONF_TYPE_TEXT;
1533   $freepbx_conf->define_conf_setting('CDRDBUSER',$set);
1534
1535
1536   //
1537   // CATEGORY: Styling and Logos
1538   //
1539   $set['category'] = 'Styling and Logos';
1540   $set['level'] = 1;
1541
1542   // AMPADMINLOGO
1543   $set['value'] = '';
1544   $set['options'] = '';
1545   $set['name'] = 'Legacy Right Logo';
1546   $set['description'] = 'Legacy setting, use BRAND_IMAGE_FREEPBX_RIGHT in the future. If set, this will override BRAND_IMAGE_FREEPBX_RIGHT. The setting is the name of the image file and is always assumed to be present in the admin/images directory. Overrides the standard 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.';
1547   $set['readonly'] = 1;
1548   $set['sortorder'] = 0;
1549   $set['type'] = CONF_TYPE_TEXT;
1550   $set['emptyok'] = 1;
1551   $freepbx_conf->define_conf_setting('AMPADMINLOGO',$set);
1552
1553   // BRAND_IMAGE_HIDE_NAV_BACKGROUND
1554   $set['value'] = false;
1555   $set['options'] = '';
1556   $set['name'] = 'Hide Nav Background';
1557   $set['description'] = 'Hide the configured left navigation bar background.';
1558   $set['readonly'] = 0;
1559   $set['sortorder'] = 10;
1560   $set['type'] = CONF_TYPE_BOOL;
1561   $set['emptyok'] = 0;
1562   $freepbx_conf->define_conf_setting('BRAND_IMAGE_HIDE_NAV_BACKGROUND',$set);
1563
1564   // BRAND_IMAGE_SHADOW_SIDE_BACKGROUND
1565   $set['value'] = 'images/shadow-side-background.png';
1566   $set['options'] = '';
1567   $set['name'] = 'Image: shadow-side-background.png';
1568   $set['description'] = 'Styling image.';
1569   $set['emptyok'] = 1;
1570   $set['readonly'] = 1;
1571   $set['sortorder'] = 20;
1572   $set['type'] = CONF_TYPE_TEXT;
1573   $freepbx_conf->define_conf_setting('BRAND_IMAGE_SHADOW_SIDE_BACKGROUND',$set);
1574
1575   // BRAND_IMAGE_FREEPBX_RIGHT
1576   $set['value'] = 'images/logo.png';
1577   $set['options'] = '';
1578   $set['name'] = 'Image: Right Upper';
1579   $set['description'] = 'Right upper logo. Use this setting instead of AMPADMINLOGO. Path is relative to admin.';
1580   $set['readonly'] = 1;
1581   $set['sortorder'] = 30;
1582   $set['type'] = CONF_TYPE_TEXT;
1583   $set['emptyok'] = 0;
1584   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_RIGHT',$set);
1585
1586   // BRAND_IMAGE_FREEPBX_LEFT
1587   $set['value'] = 'images/freepbx_large.png';
1588   $set['options'] = '';
1589   $set['name'] = 'Image: Left Upper';
1590   $set['description'] = 'Left upper logo.  Path is relative to admin.';
1591   $set['readonly'] = 1;
1592   $set['sortorder'] = 40;
1593   $set['type'] = CONF_TYPE_TEXT;
1594   $set['emptyok'] = 0;
1595   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LEFT',$set);
1596
1597   // BRAND_IMAGE_FREEPBX_FOOT
1598   $set['value'] = 'images/freepbx_small.png';
1599   $set['options'] = '';
1600   $set['name'] = 'Image: Footer';
1601   $set['description'] = 'Logo in footer.  Path is relative to admin.';
1602   $set['readonly'] = 1;
1603   $set['sortorder'] = 50;
1604   $set['type'] = CONF_TYPE_TEXT;
1605   $set['emptyok'] = 1;
1606   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_FOOT',$set);
1607
1608   // BRAND_IMAGE_RELOAD_LOADING
1609   $set['value'] = 'images/loading.gif';
1610   $set['options'] = '';
1611   $set['name'] = 'Image: Reload Screen';
1612   $set['description'] = 'Image used during a reload, default is animated GIF eating the * (asterisk).  Path is relative to admin.';
1613   $set['readonly'] = 1;
1614   $set['sortorder'] = 60;
1615   $set['type'] = CONF_TYPE_TEXT;
1616   $set['emptyok'] = 1;
1617   $freepbx_conf->define_conf_setting('BRAND_IMAGE_RELOAD_LOADING',$set);
1618
1619   // BRAND_FREEPBX_ALT_LEFT
1620   $set['value'] = '';
1621   $set['options'] = '';
1622   $set['name'] = 'Alt for Left Logo';
1623   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
1624   $set['readonly'] = 1;
1625   $set['sortorder'] = 70;
1626   $set['type'] = CONF_TYPE_TEXT;
1627   $set['emptyok'] = 1;
1628   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_LEFT',$set);
1629
1630   // BRAND_FREEPBX_ALT_RIGHT
1631   $set['value'] = '';
1632   $set['options'] = '';
1633   $set['name'] = 'Alt for Right Logo';
1634   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
1635   $set['readonly'] = 1;
1636   $set['sortorder'] = 80;
1637   $set['type'] = CONF_TYPE_TEXT;
1638   $set['emptyok'] = 1;
1639   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_RIGHT',$set);
1640
1641   // BRAND_FREEPBX_ALT_FOOT
1642   $set['value'] = '';
1643   $set['options'] = '';
1644   $set['name'] = 'Alt for Footer Logo';
1645   $set['description'] = 'alt attribute to use in place of image and title hover value. Defaults to FreePBX';
1646   $set['readonly'] = 1;
1647   $set['sortorder'] = 90;
1648   $set['type'] = CONF_TYPE_TEXT;
1649   $set['emptyok'] = 1;
1650   $freepbx_conf->define_conf_setting('BRAND_FREEPBX_ALT_FOOT',$set);
1651
1652   // BRAND_IMAGE_FREEPBX_LINK_LEFT
1653   $set['value'] = '';
1654   $set['options'] = '';
1655   $set['name'] = 'Link for Left Logo';
1656   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1657   $set['readonly'] = 1;
1658   $set['sortorder'] = 100;
1659   $set['type'] = CONF_TYPE_TEXT;
1660   $set['emptyok'] = 1;
1661   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_LEFT',$set);
1662
1663   // BRAND_IMAGE_FREEPBX_LINK_RIGHT
1664   $set['value'] = '';
1665   $set['options'] = '';
1666   $set['name'] = 'Link for Right Logo';
1667   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1668   $set['readonly'] = 1;
1669   $set['sortorder'] = 110;
1670   $set['type'] = CONF_TYPE_TEXT;
1671   $set['emptyok'] = 1;
1672   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_RIGHT',$set);
1673
1674   // BRAND_IMAGE_FREEPBX_LINK_FOOT
1675   $set['value'] = '';
1676   $set['options'] = '';
1677   $set['name'] = 'Link for Footer Logo';
1678   $set['description'] = 'link to follow when clicking on logo, defaults to http://www.freepbx.org';
1679   $set['readonly'] = 1;
1680   $set['sortorder'] = 120;
1681   $set['type'] = CONF_TYPE_TEXT;
1682   $set['emptyok'] = 1;
1683   $freepbx_conf->define_conf_setting('BRAND_IMAGE_FREEPBX_LINK_FOOT',$set);
1684
1685   // BRAND_HIDE_LOGO_RIGHT
1686   $set['value'] = false;
1687   $set['options'] = '';
1688   $set['name'] = 'Hide Right Logo';
1689   $set['description'] = 'Setting to true will hide the upper right logo.';
1690   $set['readonly'] = 0;
1691   $set['sortorder'] = 130;
1692   $set['type'] = CONF_TYPE_BOOL;
1693   $set['emptyok'] = 0;
1694   $freepbx_conf->define_conf_setting('BRAND_HIDE_LOGO_RIGHT',$set);
1695
1696   // BRAND_HIDE_HEADER_VERSION
1697   $set['value'] = false;
1698   $set['options'] = '';
1699   $set['name'] = 'Hide Left FreePBX Version';
1700   $set['description'] = 'Setting to true will hide the FreePBX version information below the left upper header.';
1701   $set['readonly'] = 0;
1702   $set['sortorder'] = 140;
1703   $set['type'] = CONF_TYPE_BOOL;
1704   $set['emptyok'] = 0;
1705   $freepbx_conf->define_conf_setting('BRAND_HIDE_HEADER_VERSION',$set);
1706
1707   // BRAND_HIDE_HEADER_MENUS
1708   $set['value'] = false;
1709   $set['options'] = '';
1710   $set['name'] = 'Hide Header Menus';
1711   $set['description'] = 'Setting to true will hide the complete horizontal menu bar in the header.';
1712   $set['readonly'] = 0;
1713   $set['sortorder'] = 150;
1714   $set['type'] = CONF_TYPE_BOOL;
1715   $set['emptyok'] = 0;
1716   $freepbx_conf->define_conf_setting('BRAND_HIDE_HEADER_MENUS',$set);
1717
1718   // BRAND_CSS_ALT_MAINSTYLE
1719   $set['value'] = '';
1720   $set['options'] = '';
1721   $set['name'] = 'Primary CSS Stylesheet';
1722   $set['description'] = 'Set this to replace the default mainstyle.css style sheet with your own, relative to admin.';
1723   $set['readonly'] = 1;
1724   $set['sortorder'] = 160;
1725   $set['type'] = CONF_TYPE_TEXT;
1726   $set['emptyok'] = 1;
1727   $freepbx_conf->define_conf_setting('BRAND_CSS_ALT_MAINSTYLE',$set);
1728
1729   // BRAND_CSS_CUSTOM
1730   $set['value'] = '';
1731   $set['options'] = '';
1732   $set['name'] = 'Optional Additional CSS Stylesheet';
1733   $set['description'] = 'Optional custom CSS style sheet included after the primary one and any module specific ones are loaded, relative to admin.';
1734   $set['readonly'] = 1;
1735   $set['sortorder'] = 170;
1736   $set['type'] = CONF_TYPE_TEXT;
1737   $set['emptyok'] = 1;
1738   $freepbx_conf->define_conf_setting('BRAND_CSS_CUSTOM',$set);
1739
1740   // VIEW_FREEPBX_ADMIN
1741   $set['value'] = 'views/freepbx_admin.php';
1742   $set['options'] = '';
1743   $set['name'] = 'View: freepbx_admin.php';
1744   $set['description'] = 'freepbx_admin.php view. This should never be changed except for very advanced layout changes.';
1745   $set['readonly'] = 1;
1746   $set['emptyok'] = 0;
1747   $set['hidden'] = 1;
1748   $set['sortorder'] = 180;
1749   $set['type'] = CONF_TYPE_TEXT;
1750   $freepbx_conf->define_conf_setting('VIEW_FREEPBX_ADMIN',$set);
1751
1752   // VIEW_FREEPBX
1753   $set['value'] = 'views/freepbx.php';
1754   $set['options'] = '';
1755   $set['name'] = 'View: freepbx.php';
1756   $set['description'] = 'freepbx.php view. This should never be changed except for very advanced layout changes.';
1757   $set['readonly'] = 1;
1758   $set['emptyok'] = 0;
1759   $set['hidden'] = 1;
1760   $set['sortorder'] = 190;
1761   $set['type'] = CONF_TYPE_TEXT;
1762   $freepbx_conf->define_conf_setting('VIEW_FREEPBX',$set);
1763
1764   // VIEW_FREEPBX_RELOAD
1765   $set['value'] = 'views/freepbx_reload.php';
1766   $set['options'] = '';
1767   $set['name'] = 'View: freepbx_reload.php';
1768   $set['description'] = 'freepbx_reload.php view. This should never be changed except for very advanced layout changes.';
1769   $set['readonly'] = 1;
1770   $set['emptyok'] = 0;
1771   $set['hidden'] = 1;
1772   $set['sortorder'] = 200;
1773   $set['type'] = CONF_TYPE_TEXT;
1774   $freepbx_conf->define_conf_setting('VIEW_FREEPBX_RELOAD',$set);
1775
1776   // VIEW_FREEPBX_RELOADBAR
1777   $set['value'] = 'views/freepbx_reloadbar.php';
1778   $set['options'] = '';
1779   $set['name'] = 'View: freepbx_reloadbar.php';
1780   $set['description'] = 'freepbx_reloadbar.php view. This should never be changed except for very advanced layout changes.';
1781   $set['readonly'] = 1;
1782   $set['emptyok'] = 0;
1783   $set['hidden'] = 1;
1784   $set['sortorder'] = 210;
1785   $set['type'] = CONF_TYPE_TEXT;
1786   $freepbx_conf->define_conf_setting('VIEW_FREEPBX_RELOADBAR',$set);
1787
1788   // VIEW_WELCOME
1789   $set['value'] = 'views/welcome.php';
1790   $set['options'] = '';
1791   $set['name'] = 'View: welcome.php';
1792   $set['description'] = 'welcome.php view. This should never be changed except for very advanced layout changes.';
1793   $set['readonly'] = 1;
1794   $set['emptyok'] = 0;
1795   $set['hidden'] = 1;
1796   $set['sortorder'] = 220;
1797   $set['type'] = CONF_TYPE_TEXT;
1798   $freepbx_conf->define_conf_setting('VIEW_WELCOME',$set);
1799
1800   // VIEW_WELCOME_NONMANAGER
1801   $set['value'] = 'views/welcome_nomanager.php';
1802   $set['options'] = '';
1803   $set['name'] = 'View: welcome_nomanager.php';
1804   $set['description'] = 'welcome_nomanager.php view. This should never be changed except for very advanced layout changes.';
1805   $set['readonly'] = 1;
1806   $set['emptyok'] = 0;
1807   $set['hidden'] = 1;
1808   $set['sortorder'] = 230;
1809   $set['type'] = CONF_TYPE_TEXT;
1810   $freepbx_conf->define_conf_setting('VIEW_WELCOME_NONMANAGER',$set);
1811
1812   // VIEW_MENUITEM_DISABLED
1813   $set['value'] = 'views/menuitem_disabled.php';
1814   $set['options'] = '';
1815   $set['name'] = 'View: menuitem_disabled.php';
1816   $set['description'] = 'menuitem_disabled.php view. This should never be changed except for very advanced layout changes.';
1817   $set['readonly'] = 1;
1818   $set['emptyok'] = 0;
1819   $set['hidden'] = 1;
1820   $set['sortorder'] = 240;
1821   $set['type'] = CONF_TYPE_TEXT;
1822   $freepbx_conf->define_conf_setting('VIEW_MENUITEM_DISABLED',$set);
1823
1824   // VIEW_NOACCESS
1825   $set['value'] = 'views/noaccess.php';
1826   $set['options'] = '';
1827   $set['name'] = 'View: noaccess.php';
1828   $set['description'] = 'noaccess.php view. This should never be changed except for very advanced layout changes.';
1829   $set['readonly'] = 1;
1830   $set['emptyok'] = 0;
1831   $set['hidden'] = 1;
1832   $set['sortorder'] = 250;
1833   $set['type'] = CONF_TYPE_TEXT;
1834   $freepbx_conf->define_conf_setting('VIEW_NOACCESS',$set);
1835
1836   // VIEW_UNAUTHORIZED
1837   $set['value'] = 'views/unauthorized.php';
1838   $set['options'] = '';
1839   $set['name'] = 'View: unauthorized.php';
1840   $set['description'] = 'unauthorized.php view. This should never be changed except for very advanced layout changes.';
1841   $set['readonly'] = 1;
1842   $set['emptyok'] = 0;
1843   $set['hidden'] = 1;
1844   $set['sortorder'] = 260;
1845   $set['type'] = CONF_TYPE_TEXT;
1846   $freepbx_conf->define_conf_setting('VIEW_UNAUTHORIZED',$set);
1847
1848   // VIEW_BAD_REFFERER
1849   $set['value'] = 'views/bad_refferer.php';
1850   $set['options'] = '';
1851   $set['name'] = 'View: bad_refferer.php';
1852   $set['description'] = 'bad_refferer.php view. This should never be changed except for very advanced layout changes.';
1853   $set['readonly'] = 1;
1854   $set['emptyok'] = 0;
1855   $set['hidden'] = 1;
1856   $set['sortorder'] = 270;
1857   $set['type'] = CONF_TYPE_TEXT;
1858   $freepbx_conf->define_conf_setting('VIEW_BAD_REFFERER',$set);
1859
1860   // VIEW_LOGGEDOUT
1861   $set['value'] = 'views/loggedout.php';
1862   $set['options'] = '';
1863   $set['name'] = 'View: loggedout.php';
1864   $set['description'] = 'loggedout.php view. This should never be changed except for very advanced layout changes.';
1865   $set['readonly'] = 1;
1866   $set['emptyok'] = 0;
1867   $set['hidden'] = 1;
1868   $set['sortorder'] = 280;
1869   $set['type'] = CONF_TYPE_TEXT;
1870   $freepbx_conf->define_conf_setting('VIEW_LOGGEDOUT',$set);
1871
1872   // VIEW_PANEL
1873   $set['value'] = 'views/panel.php';
1874   $set['options'] = '';
1875   $set['name'] = 'View: panel.php';
1876   $set['description'] = 'panel.php view. This should never be changed except for very advanced layout changes.';
1877   $set['readonly'] = 1;
1878   $set['emptyok'] = 0;
1879   $set['hidden'] = 1;
1880   $set['sortorder'] = 290;
1881   $set['type'] = CONF_TYPE_TEXT;
1882   $freepbx_conf->define_conf_setting('VIEW_PANEL',$set);
1883
1884   // VIEW_REPORTS
1885   $set['value'] = 'views/reports.php';
1886   $set['options'] = '';
1887   $set['name'] = 'View: reports.php';
1888   $set['description'] = 'reports.php view. This should never be changed except for very advanced layout changes.';
1889   $set['readonly'] = 1;
1890   $set['emptyok'] = 0;
1891   $set['hidden'] = 1;
1892   $set['sortorder'] = 300;
1893   $set['type'] = CONF_TYPE_TEXT;
1894   $freepbx_conf->define_conf_setting('VIEW_REPORTS',$set);
1895
1896
1897   //
1898   // CATEGORY: Device Setting Defaults
1899   //
1900   $set['category'] = 'Device Settings';
1901   $set['level'] = 0;
1902
1903   // ALWAYS_SHOW_DEVICE_DETAILS
1904   $set['value'] = false;
1905   $set['options'] = '';
1906   $set['name'] = 'Show all Device Setting on Add';
1907   $set['description'] = 'When adding a new extension/device, setting this to true will show most available device settings that are displayed when you edit the same extension/device. Otherwise, just a few basic settings are displayed.';
1908   $set['readonly'] = 0;
1909   $set['type'] = CONF_TYPE_BOOL;
1910   $set['emptyok'] = 0;
1911   $set['sortorder'] = 10;
1912   $freepbx_conf->define_conf_setting('ALWAYS_SHOW_DEVICE_DETAILS',$set);
1913
1914   // DEVICE_STRONG_SECRETS
1915   $set['value'] = true;
1916   $set['options'] = '';
1917   $set['name'] = 'Require Strong Secrets';
1918   $set['description'] = 'Requires a strong secret on SIP and IAX devices requiring at least two numeric and non-numeric characters and 6 or more characters. This can be disabled if using devices that can not meet these needs, or you prefer to put other constraints including more rigid constraints that this rule actually considers weak when it may not be.';
1919   $set['readonly'] = 0;
1920   $set['type'] = CONF_TYPE_BOOL;
1921   $set['emptyok'] = 0;
1922   $set['sortorder'] = 12;
1923   $freepbx_conf->define_conf_setting('DEVICE_STRONG_SECRETS',$set);
1924
1925   // DEVICE_SIP_CANREINVITE
1926   $set['value'] = 'no';
1927   $set['options'] = array('no', 'yes', 'nonat', 'update');
1928   $set['name'] = 'SIP canrenivite (directmedia)';
1929   $set['description'] = 'Default setting for SIP canreinvite (same as directmedia). See Asterisk documentation for details.';
1930   $set['readonly'] = 0;
1931   $set['type'] = CONF_TYPE_SELECT;
1932   $set['emptyok'] = 0;
1933   $set['sortorder'] = 20;
1934   $freepbx_conf->define_conf_setting('DEVICE_SIP_CANREINVITE',$set);
1935
1936   // DEVICE_SIP_TRUSTRPID
1937   $set['value'] = 'yes';
1938   $set['options'] = array('no', 'yes');
1939   $set['name'] = 'SIP trustrpid';
1940   $set['description'] = 'Default setting for SIP trustrpid. See Asterisk documentation for details.';
1941   $set['readonly'] = 0;
1942   $set['type'] = CONF_TYPE_SELECT;
1943   $set['emptyok'] = 0;
1944   $set['sortorder'] = 30;
1945   $freepbx_conf->define_conf_setting('DEVICE_SIP_TRUSTRPID',$set);
1946
1947   // DEVICE_SIP_SENDRPID
1948   $set['value'] = 'no';
1949   $set['options'] = array('no', 'yes', 'pai');
1950   $set['name'] = 'SIP sendrpid';
1951   $set['description'] = "Default setting for SIP sendrpid. A value of 'yes' is equivalent to 'rpid' and will send the 'Remote-Pary-ID' header. A value of 'pai' is only valid starting with Asterisk 1.8 and will send the 'P-Asserted-Identity' header. See Asterisk documentation for details.";
1952   $set['readonly'] = 0;
1953   $set['type'] = CONF_TYPE_SELECT;
1954   $set['emptyok'] = 0;
1955   $set['sortorder'] = 40;
1956   $freepbx_conf->define_conf_setting('DEVICE_SIP_SENDRPID',$set);
1957
1958   // DEVICE_SIP_NAT
1959   $set['value'] = 'no';
1960   $set['options'] = array('no', 'yes', 'never', 'route');
1961   $set['name'] = 'SIP nat';
1962   $set['description'] = "Default setting for SIP nat. A 'yes' will attempt to handle nat, also works for local (uses the network ports and address instead of the reported ports), 'no' follows the protocol, 'never' tries to block it, no RFC3581, 'route' ignores the rport information. See Asterisk documentation for details.";
1963   $set['readonly'] = 0;
1964   $set['type'] = CONF_TYPE_SELECT;
1965   $set['emptyok'] = 0;
1966   $set['sortorder'] = 50;
1967   $freepbx_conf->define_conf_setting('DEVICE_SIP_NAT',$set);
1968
1969   // DEVICE_SIP_ENCRYPTION
1970   $set['value'] = 'no';
1971   $set['options'] = array('no', 'yes');
1972   $set['name'] = 'SIP encryption';
1973   $set['description'] = "Default setting for SIP encryption. Whether to offer SRTP encrypted media (and only SRTP encrypted media) on outgoing calls to a peer. Calls will fail with HANGUPCAUSE=58 if the peer does not support SRTP. See Asterisk documentation for details.";
1974   $set['readonly'] = 0;
1975   $set['type'] = CONF_TYPE_SELECT;
1976   $set['emptyok'] = 0;
1977   $set['sortorder'] = 60;
1978   $freepbx_conf->define_conf_setting('DEVICE_SIP_ENCRYPTION',$set);
1979
1980   // DEVICE_SIP_QUALIFYFREQ
1981   $set['value'] = 60;
1982   $set['options'] = array(15, 86400);
1983   $set['name'] = 'SIP qualifyfreq';
1984   $set['description'] = "Default setting for SIP qualifyfreq. Only valid for Asterisk 1.6 and above. Frequency that 'qualify' OPTIONS messages will be sent to the device. Can help to keep NAT holes open but not dependable for remote client firewalls. See Asterisk documentation for details.";
1985   $set['readonly'] = 0;
1986   $set['type'] = CONF_TYPE_INT;
1987   $set['emptyok'] = 0;
1988   $set['sortorder'] = 70;
1989   $freepbx_conf->define_conf_setting('DEVICE_SIP_QUALIFYFREQ',$set);
1990
1991   // DEVICE_QUALIFY
1992   $set['value'] = 'yes';
1993   $set['options'] = '';
1994   $set['name'] = 'SIP and IAX qualify';
1995   $set['description'] = "Default setting for SIP and IAX qualify. Whether to send periodic OPTIONS messages (for SIP) or otherwise monitor the channel, and at what point to consider the channel unavailable. A value of 'yes' is equivalent to 2000, time in msec. Can help to keep NAT holes open with SIP but not dependable for remote client firewalls. See Asterisk documentation for details.";
1996   $set['readonly'] = 0;
1997   $set['type'] = CONF_TYPE_TEXT;
1998   $set['emptyok'] = 0;
1999   $set['sortorder'] = 80;
2000   $freepbx_conf->define_conf_setting('DEVICE_QUALIFY',$set);
2001
2002   // DEVICE_DISALLOW
2003   $set['value'] = '';
2004   $set['options'] = '';
2005   $set['name'] = 'SIP and IAX disallow';
2006   $set['description'] = "Default setting for SIP and IAX disallow (for codecs). Codecs to disallow, can help to reset from the general settings by setting a value of 'all' and then specifically including allowed codecs with the 'allow' directive. Values van be separated with '&' e.g. 'g729&g722'. See Asterisk documentation for details.";
2007   $set['readonly'] = 0;
2008   $set['type'] = CONF_TYPE_TEXT;
2009   $set['emptyok'] = 1;
2010   $set['sortorder'] = 90;
2011   $freepbx_conf->define_conf_setting('DEVICE_DISALLOW',$set);
2012
2013   // DEVICE_ALLOW
2014   $set['value'] = '';
2015   $set['options'] = '';
2016   $set['name'] = 'SIP and IAX allow';
2017   $set['description'] = "Default setting for SIP and IAX allow (for codecs). Codecs to allow in addition to those set in general settings unless explicitly 'disallowed' for the device. Values van be separated with '&' e.g. 'ulaw&g729&g729' where the preference order is preserved. See Asterisk documentation for details.";
2018   $set['readonly'] = 0;
2019   $set['type'] = CONF_TYPE_TEXT;
2020   $set['emptyok'] = 1;
2021   $set['sortorder'] = 90;
2022   $freepbx_conf->define_conf_setting('DEVICE_ALLOW',$set);
2023
2024   // DEVICE_CALLGROUP
2025   $set['value'] = '';
2026   $set['options'] = '';
2027   $set['name'] = 'SIP & DAHDI callgroup';
2028   $set['description'] = "Default setting for SIP, DAHDI (and Zap) callgroup. Callgroup(s) that the device is part of, can be one or more callgroups, e.g. '1,3-5' would be in groups 1,3,4,5. See Asterisk documentation for details.";
2029   $set['readonly'] = 0;
2030   $set['type'] = CONF_TYPE_TEXT;
2031   $set['emptyok'] = 1;
2032   $set['sortorder'] = 100;
2033   $freepbx_conf->define_conf_setting('DEVICE_CALLGROUP',$set);
2034
2035   // DEVICE_PICKUPGROUP
2036   $set['value'] = '';
2037   $set['options'] = '';
2038   $set['name'] = 'SIP & DAHDI pickupgroup';
2039   $set['description'] = "Default setting for SIP, DAHDI (and Zap) pickupgroup. Pickupgroups(s) that the device can pickup calls from, can be one or more groups, e.g. '1,3-5' would be in groups 1,3,4,5. Device does not have to be in a group to be able to pickup calls from that group. See Asterisk documentation for details.";
2040   $set['readonly'] = 0;
2041   $set['type'] = CONF_TYPE_TEXT;
2042   $set['emptyok'] = 1;
2043   $set['sortorder'] = 110;
2044   $freepbx_conf->define_conf_setting('DEVICE_PICKUPGROUP',$set);
2045
2046   // The following settings are used in various modules prior to 2.9. If they are found in amportal.conf then we
2047   // retain their values until the individual modules are updated and their install scripts run where a full
2048   // configuration (descriptions, defaults, etc.) will be provided and maintained. This provides just enough to
2049   // carry the setting through the migration since most upgrades will run framework or install_amp followed by the
2050   // module install scripts.
2051   //
2052   $module_migrate['AMPPLAYKEY'] = CONF_TYPE_TEXT;
2053   $module_migrate['AMPBACKUPEMAILFROM'] = CONF_TYPE_TEXT;
2054   $module_migrate['AMPBACKUPSUDO'] = CONF_TYPE_BOOL;
2055   $module_migrate['USEQUEUESTATE'] = CONF_TYPE_BOOL;
2056   $module_migrate['DASHBOARD_INFO_UPDATE_TIME'] = CONF_TYPE_INT;
2057   $module_migrate['DASHBOARD_STATS_UPDATE_TIME'] = CONF_TYPE_INT;
2058   $module_migrate['SSHPORT'] = CONF_TYPE_INT;
2059   $module_migrate['MAXCALLS'] = CONF_TYPE_INT;
2060   $module_migrate['AMPMPG123'] = CONF_TYPE_BOOL;
2061   $module_migrate['PARKINGPATCH'] = CONF_TYPE_BOOL;
2062
2063   $mod_set['value'] = '';
2064   $mod_set['defaultval'] = '';
2065   $mod_set['readonly'] = 0;
2066   $mod_set['hidden'] = 1;
2067   $mod_set['level'] = 10;
2068   $mod_set['module'] = '';
2069   $mod_set['category'] = 'Under Migration';
2070   $mod_set['emptyok'] = 1;
2071   $mod_set['description'] = 'This setting is being migrated and will be initialized by its module install script on upgrade.';
2072   foreach ($module_migrate as $setting => $type) {
2073     if (isset($amp_conf[$setting])  && !$freepbx_conf->conf_setting_exists($setting)) {
2074       $val = $amp_conf[$setting];
2075
2076       // since this came from a conf file, change any 'false' that will otherwise turn to true
2077       //
2078       if ($type == CONF_TYPE_BOOL) switch (strtolower($val)) {
2079       case 'false':
2080       case 'no':
2081       case 'off':
2082         $val = false;
2083       break;
2084       }
2085       $mod_set['value'] = $val;
2086       $mod_set['type'] = $type;
2087       $freepbx_conf->define_conf_setting($setting,$mod_set);
2088     }
2089   }
2090
2091   if ($commit_to_db) {
2092     $freepbx_conf->commit_conf_settings();
2093   }
2094 }
Note: See TracBrowser for help on using the browser.