function disable_updates() { global $db; sql("DELETE FROM cronmanager WHERE module = 'module_admin' AND id = 'UPDATES'"); $nt =& notifications::create($db); $text = _("Online Updates are Disabled"); $extext = _("Online updates are disabled in Advanced Settings. When disabled, you will not be notified of bug fixes and Security issues without manually checking for updates online. You are advised to enable the update checking. Updates are never downloaded automatically, they are only checked and reported in the notification panel and log if enabled."); $nt->add_notice('core', 'UPDATES_OFF', $text, $extext, '', true, true); $freepbx_conf =& freepbx_conf::create(); //Make sure we don't set the value again because we dont need to do that //also to prevent against loops if ($freepbx_conf->get_conf_setting('CRONMAN_UPDATES_CHECK')) { $freepbx_conf->set_conf_values(array('CRONMAN_UPDATES_CHECK' => false), true, true); } }
function freepbx_settings_init($commit_to_db = false) { global $amp_conf; if (!class_exists('freepbx_conf')) { include_once $amp_conf['AMPWEBROOT'] . '/admin/libraries/freepbx_conf.class.php'; } $freepbx_conf = \freepbx_conf::create(); $category = 'Advanced Settings Details'; $settings[$category]['AS_DISPLAY_HIDDEN_SETTINGS'] = array('value' => false, 'options' => '', 'name' => 'Display Hidden Settings', '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.', 'readonly' => 1, 'hidden' => 1, 'type' => CONF_TYPE_BOOL); $settings[$category]['AS_DISPLAY_READONLY_SETTINGS'] = array('value' => false, 'options' => '', 'name' => 'Display Readonly Settings', '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.', 'type' => CONF_TYPE_BOOL); $settings[$category]['AS_OVERRIDE_READONLY'] = array('value' => false, 'options' => '', 'name' => 'Override Readonly Settings', '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.', 'type' => CONF_TYPE_BOOL); $settings[$category]['AS_DISPLAY_FRIENDLY_NAME'] = array('value' => true, 'options' => '', 'name' => 'Display Friendly Name', '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..', 'type' => CONF_TYPE_BOOL); $category = 'System Setup'; $settings[$category]['AMPSYSLOGLEVEL'] = array('value' => 'FILE', 'options' => 'FILE, LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG' . (isset($amp_conf['AMPSYSLOGLEVEL']) && (strtoupper($amp_conf['AMPSYSLOGLEVEL']) == 'SQL' || strtoupper($amp_conf['AMPSYSLOGLEVEL']) == 'LOG_SQL') ? ', LOG_SQL, SQL' : ''), 'name' => 'FreePBX Log Routing', '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.", 'sortorder' => -190, 'type' => CONF_TYPE_SELECT); $settings[$category]['AMPDISABLELOG'] = array('value' => false, 'options' => '', 'name' => 'Disable FreePBX Log', 'description' => 'Whether or not to invoke the FreePBX log facility.', 'sortorder' => -180, 'type' => CONF_TYPE_BOOL); $settings[$category]['LOG_OUT_MESSAGES'] = array('value' => true, 'options' => '', 'name' => 'Log Verbose Messages', '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.', 'sortorder' => -170, 'type' => CONF_TYPE_BOOL); $settings[$category]['LOG_NOTIFICATIONS'] = array('value' => true, 'options' => '', 'name' => 'Send Dashboard Notifications to Log', 'description' => 'When enabled all notification updates to the Dashboard notification panel will also be logged into the specified log file when enabled.', 'sortorder' => -160, 'type' => CONF_TYPE_BOOL); $settings[$category]['FPBX_LOG_FILE'] = array('value' => $amp_conf['ASTLOGDIR'] . '/freepbx.log', 'options' => '', 'name' => 'FreePBX Log File', '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.', 'sortorder' => -150, 'type' => CONF_TYPE_TEXT); $settings[$category]['PHP_ERROR_HANDLER_OUTPUT'] = array('value' => 'freepbxlog', 'options' => array('dbug', 'freepbxlog', 'off'), 'name' => 'PHP Error Log Output', '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.", 'sortorder' => -140, 'type' => CONF_TYPE_SELECT); $settings[$category]['PHP_ERROR_LEVEL'] = array('value' => 'ALL_NOSTRICTNOTICE', 'options' => array('ALL', 'ALL_NOSTRICT', 'ALL_NOSTRICTNOTICE', 'ALL_NOSTRICTNOTICEWARNING', 'ALL_NOSTRICTNOTICEWARNINGDEPRECIATED', 'NONE'), 'name' => 'PHP Error Level', 'description' => "Sets which PHP errors are reported", 'sortorder' => -139, 'type' => CONF_TYPE_SELECT); $settings[$category]['PHP_CONSOLE'] = array('value' => false, 'options' => '', 'name' => 'PHP Console', 'description' => "When enabled will turn on PHP Console for error debugging https://github.com/barbushin/php-console", 'sortorder' => -140, 'type' => CONF_TYPE_BOOL); $settings[$category]['PHP_CONSOLE_PASSWORD'] = array('value' => 'batteryhorsestaple', 'options' => '', 'name' => 'PHP Console Password', 'description' => "Used when PHP Console is enabled for error debugging https://github.com/barbushin/php-console", 'sortorder' => -140, 'type' => CONF_TYPE_TEXT); $settings[$category]['AGGRESSIVE_DUPLICATE_CHECK'] = array('value' => false, 'options' => '', 'name' => 'Aggresively Check for Duplicate Extensions', 'description' => "When set to true FreePBX will update its extension map every page load. This is used to check for duplicate extension numbers in the client side javascript validation. Normally the extension map is only created when Apply Configuration Settings is pressed and retrieve_conf is run.", 'sortorder' => -137, 'type' => CONF_TYPE_BOOL); $settings[$category]['AMPEXTENSIONS'] = array('value' => 'extensions', 'options' => 'extensions,deviceanduser', 'name' => 'User & Devices Mode', '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.', 'sortorder' => -135, 'type' => CONF_TYPE_SELECT); $settings[$category]['AUTHTYPE'] = array('value' => 'database', 'options' => 'database,none,webserver,usermanager', 'name' => 'Authorization Type', '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.', 'level' => 3, 'readonly' => 1, 'sortorder' => -130, 'type' => CONF_TYPE_SELECT); $settings[$category]['AMP_ACCESS_DB_CREDS'] = array('value' => false, 'options' => '', 'name' => 'Allow Login With DB Credentials', '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.", 'sortorder' => -126, 'type' => CONF_TYPE_BOOL); $settings[$category]['FORCED_ASTVERSION'] = array('value' => '', 'options' => '', 'name' => 'Force Asterisk Version', '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.', 'emptyok' => 1, 'readonly' => 1, 'sortorder' => -100, 'type' => CONF_TYPE_TEXT, 'level' => 4); $settings[$category]['AMPENGINE'] = array('value' => 'asterisk', 'options' => 'asterisk', 'name' => 'Telephony Engine', 'description' => 'The telephony backend engine being used, asterisk is the only option currently.', 'level' => 3, 'readonly' => 1, 'type' => CONF_TYPE_SELECT); $settings[$category]['AMPVMUMASK'] = array('value' => '007', 'options' => '', 'name' => 'Asterisk VMU Mask', '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 can have access to read/write/delete the voicemail files. If changed, some of the voicemail directory structures may have to be manually changed.', 'type' => CONF_TYPE_TEXT, 'level' => 4); $settings[$category]['AMPWEBADDRESS'] = array('value' => '', 'options' => '', 'name' => 'FreePBX Web Address', '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.', 'emptyok' => 1, 'type' => CONF_TYPE_TEXT, 'level' => 4); $settings[$category]['AMPASTERISKUSER'] = array('value' => 'asterisk', 'options' => '', 'name' => 'System Asterisk User', 'description' => 'The user Asterisk should be running as, used by freepbx_engine. Most systems should not change this.', 'type' => CONF_TYPE_TEXT, 'level' => 4, 'readonly' => 1); $settings[$category]['AMPASTERISKGROUP'] = array('value' => 'asterisk', 'options' => '', 'name' => 'System Asterisk Group', 'description' => 'The user group Asterisk should be running as, used by freepbx_engine. Most systems should not change this.', 'type' => CONF_TYPE_TEXT, 'level' => 4, 'readonly' => 1); $settings[$category]['AMPASTERISKWEBUSER'] = array('value' => 'asterisk', 'options' => '', 'name' => 'System Web User', 'description' => 'The user your httpd should be running as, used by freepbx_engine. Most systems should not change this.', 'type' => CONF_TYPE_TEXT, 'level' => 4, 'readonly' => 1); $settings[$category]['AMPASTERISKWEBGROUP'] = array('value' => 'asterisk', 'options' => '', 'name' => 'System Web Group', 'description' => 'The user group your httpd should be running as, used by freepbx_engine. Most systems should not change this.', 'type' => CONF_TYPE_TEXT, 'level' => 4, 'readonly' => 1); $settings[$category]['AMPDEVUSER'] = array('value' => 'asterisk', 'options' => '', 'name' => 'System Device User', '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.', 'type' => CONF_TYPE_TEXT, 'level' => 4, 'readonly' => 1); $settings[$category]['AMPDEVGROUP'] = array('value' => 'asterisk', 'options' => '', 'name' => 'System Device Group', '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.', 'readonly' => 1, 'type' => CONF_TYPE_TEXT, 'level' => 4); $settings[$category]['BROWSER_STATS'] = array('value' => true, 'options' => '', 'name' => 'Browser Stats', 'description' => 'Setting this to true will allow the development team to use google analytics to anonymously analyze browser information to help make better development decisions.', 'type' => CONF_TYPE_BOOL); $settings[$category]['USE_GOOGLE_CDN_JS'] = array('value' => false, 'options' => '', 'name' => 'Use Google Distribution Network for js Downloads', 'description' => 'Setting this to true will fetch system javascript libraries such as jQuery and jQuery-ui from ajax.googleapis.com. This can be advantageous if accessing remote or multiple different FreePBX systems since the libraries are only cached once in your browser. If external internet connections are problematic, setting this true could result in slow systems. FreePBX will always fallback to the locally available libraries if the CDN is not available.', 'type' => CONF_TYPE_BOOL); $settings[$category]['CRONMAN_UPDATES_CHECK'] = array('value' => true, 'options' => '', 'readonly' => 1, 'name' => 'Update Notifications', 'description' => 'FreePBX allows you to automatically check for updates online. The updates will NOT be automatically installed. It is STRONGYLY advised that you keep this enabled and keep updated of these important notificaions to avoid costly security issues.', 'type' => CONF_TYPE_BOOL); $settings[$category]['SIGNATURECHECK'] = array('value' => true, 'options' => '', 'name' => 'Enable Module Signature Checking', 'description' => 'Checks to make sure modules and their files are validly signed. Will display a notice on any module page that is not correctly verified.', 'type' => CONF_TYPE_BOOL); $settings[$category]['SEND_UNSIGNED_EMAILS_NOTIFICATIONS'] = array('value' => true, 'options' => '', 'name' => 'Send unsigned module email notifications', 'description' => 'Whether or not to send unsigned module email notifications. If disabled unsigned module emails will never be sent', 'type' => CONF_TYPE_BOOL); $settings[$category]['AMPTRACKENABLE'] = array('value' => true, 'options' => '', 'name' => 'Enable Module Tracks', 'description' => 'This enables the setting of module tracks (sub repositories of modules). Whereas a user could select a beta release track of a module or keep it on standard. Disabling this will force all modules into the stable track and disallow users to change the tracks', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['REMOTEUNLOCK'] = array('value' => false, 'options' => '', 'name' => 'Enable Remote Unlocking', 'description' => 'Enabling this option will allow a remote user to automatically authenticate as an admin via use of a one-time key generated by "amportal a genunlockkey"', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['UIDEFAULTLANG'] = array('value' => 'en_US', 'options' => '', 'readonly' => 0, 'hidden' => 0, 'name' => 'Default language', 'description' => 'The default language used in the webUI', 'type' => CONF_TYPE_TEXT); $settings[$category]['FREEPBX_SYSTEM_IDENT'] = array('value' => 'VoIP Server', 'options' => '', 'readonly' => 0, 'hidden' => 0, 'name' => 'System Identity', 'description' => 'This name will be used to help identify this machine in emails or alerts', 'type' => CONF_TYPE_TEXT); $category = 'Dialplan and Operational'; $settings[$category]['AMPBADNUMBER'] = array('value' => true, 'options' => '', 'name' => 'Use bad-number Context', '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.', 'type' => CONF_TYPE_BOOL, 'level' => 2); $settings[$category]['CWINUSEBUSY'] = array('value' => true, 'options' => '', 'name' => 'Occupied Lines CW Busy', '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>.', 'type' => CONF_TYPE_BOOL); $settings[$category]['ZAP2DAHDICOMPAT'] = array('value' => false, 'options' => '', 'name' => 'Convert ZAP Settings to DAHDi', '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.', 'readonly' => 1, 'type' => CONF_TYPE_BOOL); $settings[$category]['DYNAMICHINTS'] = array('value' => false, 'options' => '', 'name' => 'Dynamically Generate Hints', '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.', 'readonly' => 1, 'type' => CONF_TYPE_BOOL); $settings[$category]['ENABLECW'] = array('value' => true, 'options' => '', 'name' => 'CW Enabled by Default', '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.', 'type' => CONF_TYPE_BOOL); $settings[$category]['FCBEEPONLY'] = array('value' => false, 'options' => '', 'name' => 'Feature Codes Beep Only', 'description' => 'When set to true, a beep is played instead of confirmation message when activating/de-activating: CallForward, CallWaiting, DayNight, DoNotDisturb and FindMeFollow.', 'type' => CONF_TYPE_BOOL); $settings[$category]['USEGOOGLEDNSFORENUM'] = array('value' => false, 'options' => '', 'name' => 'Use Google DNS for Enum', '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>.', 'type' => CONF_TYPE_BOOL, 'level' => 2); $settings[$category]['DISABLECUSTOMCONTEXTS'] = array('value' => false, 'options' => '', 'name' => 'Disable -custom Context Includes', '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.', 'type' => CONF_TYPE_BOOL, 'level' => 2); $settings[$category]['NOOPTRACE'] = array('value' => '0', 'options' => '0,1,2,3,4,5,6,7,8,9,10', 'name' => 'NoOp Traces in Dialplan', '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', 'type' => CONF_TYPE_SELECT); $settings[$category]['DIVERSIONHEADER'] = array('value' => false, 'options' => '', 'name' => 'Generate Diversion Headers', '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.', 'type' => CONF_TYPE_BOOL); $opts = array(); for ($i = -1; $i <= 120; $i++) { $opts[] = $i; } $settings[$category]['CFRINGTIMERDEFAULT'] = array('value' => '0', 'options' => $opts, 'name' => 'Call Forward Ringtimer Default', '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.', 'type' => CONF_TYPE_SELECT); unset($opts); $settings[$category]['DEFAULT_INTERNAL_AUTO_ANSWER'] = array('value' => 'disabled', 'options' => array('disabled', 'intercom'), 'name' => 'Internal Auto Answer Default', '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.", 'type' => CONF_TYPE_SELECT); $settings[$category]['FORCE_INTERNAL_AUTO_ANSWER_ALL'] = array('value' => false, 'options' => '', 'name' => 'Force All Internal Auto Answer', '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.", 'type' => CONF_TYPE_BOOL); $opts = array(); for ($i = 0; $i <= 120; $i++) { $opts[] = $i; } $settings[$category]['CONCURRENCYLIMITDEFAULT'] = array('value' => '3', 'options' => $opts, 'name' => 'Extension Concurrency Limit', '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.', 'type' => CONF_TYPE_SELECT); unset($opts); $settings[$category]['BLOCK_OUTBOUND_TRUNK_CNAM'] = array('value' => false, 'options' => '', 'name' => 'Block CNAM on External Trunks', '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.", 'type' => CONF_TYPE_BOOL); $settings[$category]['ASTSTOPTIMEOUT'] = array('value' => '120', 'options' => array(0, 5, 10, 30, 60, 120, 300, 600, 1800, 3600, 7200, 10800), 'name' => 'Waiting Period to Stop Asterisk', '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", 'type' => CONF_TYPE_SELECT); $settings[$category]['ASTSTOPPOLLINT'] = array('value' => '2', 'options' => array(1, 2, 3, 5, 10), 'name' => 'Polling Interval for Stopping Asterisk', '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.", 'type' => CONF_TYPE_SELECT); $settings[$category]['CID_PREPEND_REPLACE'] = array('value' => true, 'options' => '', 'name' => 'Only Use Last CID Prepend', '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 'stacked' in front of one another.", 'type' => CONF_TYPE_BOOL); $settings[$category]['DITECH_VQA_INBOUND'] = array('value' => '7', 'options' => array(0, 1, 2, 3, 4, 5, 6, 7), 'name' => 'Ditech VQA Inbound Setting', 'description' => "If Ditech's VQA, Voice Quality application is installed, this setting will be used for all inbound calls. For more information 'core show application VQA' at the Asterisk CLI will show the different settings.", 'type' => CONF_TYPE_SELECT); $settings[$category]['DITECH_VQA_OUTBOUND'] = array('value' => '7', 'options' => array(0, 1, 2, 3, 4, 5, 6, 7), 'name' => 'Ditech VQA Outbound Setting', 'description' => "If Ditech's VQA, Voice Quality application is installed, this setting will be used for all outbound calls. For more information 'core show application VQA' at the Asterisk CLI will show the different settings.", 'type' => CONF_TYPE_SELECT); $settings[$category]['ASTCONFAPP'] = array('value' => 'app_confbridge', 'options' => array('app_meetme', 'app_confbridge'), 'name' => 'Conference Room App', 'description' => 'The asterisk application to use for conferencing. If only one is compiled into asterisk, FreePBX will auto detect and change this value if set wrong. The app_meetme application is considered "depreciated" and should no longer be used', 'type' => CONF_TYPE_SELECT); $settings[$category]['TRUNK_RING_TIMER'] = array('value' => '300', 'name' => 'Trunk Dial Timeout', 'description' => 'How many seconds to try a call on your trunks before giving up. This should normally be a very long time and is usually only changed if you have some sort of problematic trunks. This is the Asterisk Dial Command timeout parameter.', 'readonly' => 1, 'type' => CONF_TYPE_INT, 'options' => array(0, 86400), 'level' => 2); $settings[$category]['REC_POLICY'] = array('value' => 'caller', 'options' => array('caller', 'callee'), 'name' => 'Call Recording Policy', 'description' => 'Call Recording Policy used to resove the winner in a conflict between two extensions when one wants a call recorded and the other does not, if both their priorities are also the same.', 'type' => CONF_TYPE_SELECT); $settings[$category]['TRANSFER_CONTEXT'] = array('value' => 'from-internal-xfer', 'options' => '', 'readonly' => 1, 'hidden' => 1, 'level' => 9, 'emptyok' => 1, 'name' => 'Asterisk TRANSFER_CONTEXT Variable', 'description' => "This is the Asterisk Channel Variable TRANSFER_CONTEXT. In general it should NOT be changed unless you really know what you are doing. It is used to do create slightly different 'views' when a call is being transfered. An example is hiding the paging groups so a call isn't accidentally transfered into a page.", 'type' => CONF_TYPE_TEXT); $settings[$category]['ASTSIPDRIVER'] = array('value' => 'both', 'options' => array('both', 'chan_sip', 'chan_pjsip'), 'level' => 2, 'name' => 'SIP Channel Driver', 'description' => 'The Asterisk channel driver to use for SIP. The default is both for Asterisk 12 and higher. For Asterisk 11 and lower the default will be chan_sip. If only one is compiled into asterisk, FreePBX will auto detect and change this value if set wrong. The chan_pjsip channel driver is considered "experimental" with known issues and does not work on Asterisk 11 or lower.', 'type' => CONF_TYPE_SELECT); $category = 'Directory Layout'; $settings[$category]['AMPBIN'] = array('value' => '/var/lib/asterisk/bin', 'options' => '', 'name' => 'FreePBX bin Dir', 'description' => 'Location of the FreePBX command line scripts.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['AMPSBIN'] = array('value' => '/usr/sbin', 'options' => '', 'name' => 'FreePBX sbin Dir', 'description' => 'Where (root) command line scripts are located.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['AMPWEBROOT'] = array('value' => '/var/www/html', 'options' => '', 'name' => 'FreePBX Web Root Dir', 'description' => 'The path to Apache webroot (leave off trailing slash).', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTAGIDIR'] = array('value' => '/var/lib/asterisk/agi-bin', 'options' => '', 'name' => 'Asterisk AGI Dir', 'description' => 'This is the default directory for Asterisks agi files.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTETCDIR'] = array('value' => '/etc/asterisk', 'options' => '', 'name' => 'Asterisk etc Dir', 'description' => 'This is the default directory for Asterisks configuration files.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTLOGDIR'] = array('value' => '/var/log/asterisk', 'options' => '', 'name' => 'Asterisk Log Dir', 'description' => 'This is the default directory for Asterisks log files.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTMODDIR'] = array('value' => '/usr/lib/asterisk/modules', 'options' => '', 'name' => 'Asterisk Modules Dir', 'description' => 'This is the default directory for Asterisks modules.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTSPOOLDIR'] = array('value' => '/var/spool/asterisk', 'options' => '', 'name' => 'Asterisk Spool Dir', 'description' => 'This is the default directory for Asterisks spool directory.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTRUNDIR'] = array('value' => '/var/run/asterisk', 'options' => '', 'name' => 'Asterisk Run Dir', 'description' => 'This is the default directory for Asterisks run files.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['ASTVARLIBDIR'] = array('value' => '/var/lib/asterisk', 'options' => '', 'name' => 'Asterisk bin Dir', 'description' => 'This is the default directory for Asterisks lib files.', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['AMPPLAYBACK'] = array('value' => '/var/lib/asterisk/playback', 'options' => '', 'name' => 'Browser Playback Cache Directory', 'description' => 'This is the default directory for HTML5 releated playback files', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['AMPCGIBIN'] = array('value' => '/var/www/cgi-bin', 'options' => '', 'name' => 'CGI Dir', 'description' => 'The path to Apache cgi-bin dir (leave off trailing slash).', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $settings[$category]['MOHDIR'] = array('value' => 'moh', 'options' => array('moh', 'mohmp3'), 'name' => 'MoH Subdirectory', '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.', 'readonly' => 1, 'type' => CONF_TYPE_SELECT, 'level' => 4); $settings[$category]['CERTKEYLOC'] = array('value' => '/etc/asterisk/keys', 'options' => '', 'name' => 'Certificate File Location', 'description' => 'The location for Asterisk Certificates', 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $category = 'GUI Behavior'; $settings[$category]['CHECKREFERER'] = array('value' => true, 'options' => '', 'name' => 'Check Server Referrer', '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.', 'type' => CONF_TYPE_BOOL); $settings[$category]['MODULEADMINWGET'] = array('value' => false, 'options' => '', 'name' => 'Use wget For Module Admin', '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.', 'type' => CONF_TYPE_BOOL); $settings[$category]['SHOWLANGUAGE'] = array('value' => false, 'options' => '', 'name' => 'Show Language setting', 'description' => 'Show Language setting on menu . Defaults = false', 'type' => CONF_TYPE_BOOL); $settings[$category]['SERVERINTITLE'] = array('value' => false, 'options' => '', 'name' => 'Include Server Name in Browser', 'description' => 'Precede browser title with the server name.', 'type' => CONF_TYPE_BOOL); $settings[$category]['RELOADCONFIRM'] = array('value' => true, 'options' => '', 'name' => 'Require Confirm with Apply Changes', 'description' => 'When set to false, will bypass the confirm on Reload Box.', 'type' => CONF_TYPE_BOOL); $settings[$category]['BADDESTABORT'] = array('value' => false, 'options' => '', 'name' => 'Abort Config Gen on Bad Dest', '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.', 'level' => 3, 'type' => CONF_TYPE_BOOL); $settings[$category]['XTNCONFLICTABORT'] = array('value' => false, 'options' => '', 'name' => 'Abort Config Gen on Exten Conflict', '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.', 'level' => 3, 'type' => CONF_TYPE_BOOL); $settings[$category]['CUSTOMASERROR'] = array('value' => true, 'options' => '', 'name' => 'Report Unknown Dest as Error', '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.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['USE_FREEPBX_MENU_CONF'] = array('value' => false, 'options' => '', 'name' => 'Use freepbx_menu.conf Configuration', 'description' => 'When set to true, the system will check for a freepbx_menu.conf file amongst the normal configuraiton files and if found, it will be used to define and remap the menu tabs and contents. See http://wiki.freepbx.org/x/6YDGAg for more details', 'type' => CONF_TYPE_BOOL); $category = 'Asterisk Manager'; $settings[$category]['AMPMGRPASS'] = array('value' => 'amp111', 'options' => '', 'name' => 'Asterisk Manager Password', 'description' => 'Password for accessing the Asterisk Manager Interface (AMI), this will be automatically updated in manager.conf.', 'type' => CONF_TYPE_TEXT, 'level' => 2); $settings[$category]['AMPMGRUSER'] = array('value' => 'admin', 'options' => '', 'name' => 'Asterisk Manager User', 'description' => 'Username for accessing the Asterisk Manager Interface (AMI), this will be automatically updated in manager.conf.', 'type' => CONF_TYPE_TEXT, 'level' => 2); $settings[$category]['ASTMANAGERHOST'] = array('value' => 'localhost', 'options' => '', 'name' => 'Asterisk Manager Host', 'description' => 'Hostname for the Asterisk Manager', 'readonly' => 1, 'type' => CONF_TYPE_TEXT, 'level' => 2); $settings[$category]['ASTMANAGERPORT'] = array('value' => '5038', 'name' => 'Asterisk Manager Port', 'description' => 'Port for the Asterisk Manager', 'readonly' => 1, 'type' => CONF_TYPE_INT, 'options' => array(1024, 65535), 'level' => 2); $settings[$category]['ASTMANAGERPROXYPORT'] = array('value' => '', 'name' => 'Asterisk Manager Proxy Port', 'description' => 'Optional port for an Asterisk Manager Proxy', 'readonly' => 1, 'type' => CONF_TYPE_INT, 'emptyok' => 1, 'options' => array(1024, 65535), 'level' => 2); $settings[$category]['ASTMGRWRITETIMEOUT'] = array('value' => '5000', 'name' => 'Asterisk Manager Write Timeout', 'description' => 'Timeout, im ms, for write timeouts for cases where Asterisk disconnects frequently', 'readonly' => 1, 'type' => CONF_TYPE_INT, 'emptyok' => 1, 'options' => array(100, 100000), 'level' => 2); $category = 'Developer and Customization'; $settings[$category]['FPBXDBUGFILE'] = array('value' => $amp_conf['ASTLOGDIR'] . '/freepbx_dbug', 'options' => '', 'name' => 'Debug File', 'description' => 'Full path and name of FreePBX debug file. Used by the dbug() function by developers.', 'level' => 2, 'type' => CONF_TYPE_TEXT); $settings[$category]['FPBXDBUGDISABLE'] = array('value' => true, 'options' => '', 'name' => 'Disable FreePBX dbug Logging', 'description' => 'Set to true to stop all dbug() calls from writing to the Debug File (FPBXDBUGFILE)', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['FPBXPERFLOGGING'] = array('value' => false, 'options' => '', 'name' => 'Enable Performance Logging', 'description' => 'Set to true to enable Advanced Performance Logging into the dbug file', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['DIE_FREEPBX_VERBOSE'] = array('value' => false, 'options' => '', 'name' => 'Provide Verbose Tracebacks', 'description' => 'Provides a very verbose traceback when die_freepbx() is called including extensive object details if present in the traceback.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['DEVEL'] = array('value' => false, 'options' => '', 'name' => 'Developer Mode', '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.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['USE_PACKAGED_JS'] = array('value' => true, 'options' => '', 'name' => 'Use Packaged Javascript Library ', '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.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['FORCE_JS_CSS_IMG_DOWNLOAD'] = array('value' => false, 'options' => '', 'name' => 'Always Download Web Assets', '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.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['DEVELRELOAD'] = array('value' => false, 'options' => '', 'name' => 'Leave Reload Bar Up', 'description' => "Forces the 'Apply Configuration Changes' reload bar to always be present even when not necessary.", 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['PRE_RELOAD'] = array('value' => '', 'options' => '', 'name' => 'PRE_RELOAD Script', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 2, 'type' => CONF_TYPE_TEXT); $settings[$category]['POST_RELOAD'] = array('value' => '', 'options' => '', 'name' => 'POST_RELOAD Script', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 2, 'type' => CONF_TYPE_TEXT); $settings[$category]['POST_RELOAD_DEBUG'] = array('value' => false, 'options' => '', 'name' => 'POST_RELOAD Debug Mode', 'description' => 'Display debug output for script used if POST_RELOAD is used.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['AMPLOCALBIN'] = array('value' => '', 'options' => '', 'name' => 'AMPLOCALBIN Dir for retrieve_conf', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 2, 'type' => CONF_TYPE_DIR); $settings[$category]['DISABLE_CSS_AUTOGEN'] = array('value' => false, 'options' => '', 'name' => 'Disable Mainstyle CSS Compression', 'description' => 'Stops the automatic generation of a stripped CSS file that replaces the primary sheet, usually mainstyle.css.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['MODULEADMIN_SKIP_CACHE'] = array('value' => false, 'options' => '', 'name' => 'Disable Module Admin Caching', '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.', 'readonly' => 1, 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['DISPLAY_MONITOR_TRUNK_FAILURES_FIELD'] = array('value' => false, 'options' => '', 'name' => 'Display Monitor Trunk Failures Option', 'description' => 'Setting this to true will expose the "Monitor Trunk Failures" field on the Trunks page. This field allows for a custom AGI script to be called upon a trunk failure. This is an advanced field requiring a custom script to be properly written and installed. Existing trunk page entries will not be affected if this is set to false but if the settings are changed on those pages the field will go away.', 'level' => 2, 'type' => CONF_TYPE_BOOL); $settings[$category]['JQMIGRATE'] = array('value' => true, 'options' => '', 'category' => 'Developer and Customization', 'name' => 'Enable jQuery Migrate', 'description' => 'This plugin can be used to detect and restore APIs or features that have been deprecated in jQuery and removed as of version 1.9', 'type' => CONF_TYPE_BOOL); $category = 'Flash Operator Panel'; $settings[$category]['FOPWEBROOT'] = array('value' => '', 'options' => '', 'name' => 'FOP Web Root Dir', 'description' => 'Path to the Flash Operator Panel webroot or other modules providing such functionality (leave off trailing slash).', 'emptyok' => 1, 'readonly' => 1, 'type' => CONF_TYPE_DIR, 'level' => 4); $category = 'Remote CDR Database'; $settings[$category]['CDRDBHOST'] = array('value' => '', 'options' => '', 'name' => 'Remote CDR DB Host', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_TEXT); $settings[$category]['CDRDBNAME'] = array('value' => '', 'options' => '', 'name' => 'Remote CDR DB Name', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_TEXT); $settings[$category]['CDRDBPASS'] = array('value' => '', 'options' => '', 'name' => 'Remote CDR DB Password', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_TEXT); $settings[$category]['CDRDBPORT'] = array('value' => '', 'options' => array(1024, 65536), 'name' => 'Remote CDR DB Port', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_INT); $settings[$category]['CDRDBTABLENAME'] = array('value' => '', 'options' => '', 'name' => 'Remote CDR DB Table', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_TEXT); $settings[$category]['CDRDBTYPE'] = array('value' => '', '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.', 'name' => 'Remote CDR DB Type', 'emptyok' => 1, 'options' => ',mysql,postgres', 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_SELECT); $settings[$category]['CDRDBUSER'] = array('value' => '', 'options' => '', 'name' => 'Remote CDR DB User', '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.', 'emptyok' => 1, 'readonly' => 1, 'level' => 3, 'type' => CONF_TYPE_TEXT); $category = 'Styling and Logos'; $settings[$category]['BRAND_IMAGE_FAVICON'] = array('value' => 'images/favicon.ico', 'options' => '', 'name' => 'Favicon', 'description' => 'Favicon', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 40, 'type' => CONF_TYPE_TEXT, 'level' => 1); $settings[$category]['BRAND_TITLE'] = array('value' => 'FreePBX Administration', 'options' => '', 'name' => 'Page Title', 'description' => 'HTML title of all pages', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 40, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['BRAND_IMAGE_TANGO_LEFT'] = array('value' => 'images/tango.png', 'options' => '', 'name' => 'Image: Left Upper', 'description' => 'Left upper logo.Path is relative to admin.', 'readonly' => 1, 'sortorder' => 40, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['BRAND_IMAGE_FREEPBX_FOOT'] = array('value' => 'images/freepbx_small.png', 'options' => '', 'name' => 'Image: Footer', 'description' => 'Logo in footer.Path is relative to admin.', 'readonly' => 1, 'sortorder' => 50, 'level' => 1, 'type' => CONF_TYPE_TEXT, 'emptyok' => 1); $settings[$category]['BRAND_IMAGE_SPONSOR_FOOT'] = array('value' => 'images/sangoma-horizontal_thumb.png', 'options' => '', 'name' => 'Image: Footer', 'description' => 'Logo in footer.Path is relative to admin.', 'readonly' => 1, 'sortorder' => 50, 'level' => 1, 'type' => CONF_TYPE_TEXT, 'emptyok' => 1); $settings[$category]['BRAND_FREEPBX_ALT_LEFT'] = array('value' => 'FreePBX', 'options' => '', 'name' => 'Alt for Left Logo', 'description' => 'alt attribute to use in place of image and title hover value. Defaults to FreePBX', 'readonly' => 1, 'sortorder' => 70, 'level' => 1, 'type' => CONF_TYPE_TEXT, 'emptyok' => 1); $settings[$category]['BRAND_FREEPBX_ALT_FOOT'] = array('value' => 'FreePBX®', 'options' => '', 'name' => 'Alt for Footer Logo', 'description' => 'alt attribute to use in place of image and title hover value. Defaults to FreePBX', 'readonly' => 1, 'sortorder' => 90, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['BRAND_SPONSOR_ALT_FOOT'] = array('value' => 'www.sangoma.com', 'options' => '', 'name' => 'Alt for Footer Logo', 'description' => 'alt attribute to use in place of image and title hover value. Defaults to FreePBX', 'readonly' => 1, 'sortorder' => 90, 'level' => 1, 'type' => CONF_TYPE_TEXT, 'emptyok' => 1); $settings[$category]['BRAND_IMAGE_FREEPBX_LINK_LEFT'] = array('value' => 'http://www.freepbx.org', 'options' => '', 'name' => 'Link for Left Logo', 'description' => 'link to follow when clicking on logo, defaults to http://www.freepbx.org', 'readonly' => 1, 'sortorder' => 100, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['BRAND_IMAGE_FREEPBX_LINK_FOOT'] = array('value' => 'http://www.freepbx.org', 'options' => '', 'name' => 'Link for Footer Logo', 'description' => 'link to follow when clicking on logo, defaults to http://www.freepbx.org', 'readonly' => 1, 'sortorder' => 120, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['BRAND_IMAGE_SPONSOR_LINK_FOOT'] = array('value' => 'http://www.sangoma.com', 'options' => '', 'name' => 'Link for Sponsor Footer Logo', 'description' => 'link to follow when clicking on sponsor logo', 'readonly' => 1, 'sortorder' => 120, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['BRAND_CSS_ALT_MAINSTYLE'] = array('value' => '', 'options' => '', 'name' => 'Primary CSS Stylesheet', 'description' => 'Set this to replace the default mainstyle.css style sheet with your own, relative to admin.', 'readonly' => 1, 'sortorder' => 160, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['BRAND_CSS_ALT_POPOVER'] = array('value' => '', 'options' => '', 'name' => 'Primary CSS Popover Stylesheet Addtion', 'description' => 'Set this to replace the default popover.css style sheet with your own, relative to admin.', 'readonly' => 1, 'sortorder' => 162, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['BRAND_CSS_CUSTOM'] = array('value' => '', 'options' => '', 'name' => 'Optional Additional CSS Stylesheet', 'description' => 'Optional custom CSS style sheet included after the primary one and any module specific ones are loaded, relative to admin.', 'readonly' => 1, 'sortorder' => 170, 'type' => CONF_TYPE_TEXT, 'level' => 1, 'emptyok' => 1); $settings[$category]['VIEW_FREEPBX_ADMIN'] = array('value' => 'views/freepbx_admin.php', 'options' => '', 'name' => 'View: freepbx_admin.php', 'description' => 'freepbx_admin.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 180, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_FREEPBX'] = array('value' => 'views/freepbx.php', 'options' => '', 'name' => 'View: freepbx.php', 'description' => 'freepbx.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 190, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_FREEPBX_RELOAD'] = array('value' => 'views/freepbx_reload.php', 'options' => '', 'name' => 'View: freepbx_reload.php', 'description' => 'freepbx_reload.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'level' => 1, 'sortorder' => 200, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_FREEPBX_RELOADBAR'] = array('value' => 'views/freepbx_reloadbar.php', 'options' => '', 'name' => 'View: freepbx_reloadbar.php', 'description' => 'freepbx_reloadbar.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'level' => 1, 'sortorder' => 210, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_WELCOME'] = array('value' => 'views/welcome.php', 'options' => '', 'name' => 'View: welcome.php', 'description' => 'welcome.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 220, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_WELCOME_NONMANAGER'] = array('value' => 'views/welcome_nomanager.php', 'options' => '', 'name' => 'View: welcome_nomanager.php', 'description' => 'welcome_nomanager.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'level' => 1, 'sortorder' => 230, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_MENUITEM_DISABLED'] = array('value' => 'views/menuitem_disabled.php', 'options' => '', 'name' => 'View: menuitem_disabled.php', 'description' => 'menuitem_disabled.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 240, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_NOACCESS'] = array('value' => 'views/noaccess.php', 'options' => '', 'name' => 'View: noaccess.php', 'description' => 'noaccess.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 250, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_UNAUTHORIZED'] = array('value' => 'views/unauthorized.php', 'options' => '', 'name' => 'View: unauthorized.php', 'description' => 'unauthorized.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 260, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_BAD_REFFERER'] = array('value' => 'views/bad_refferer.php', 'options' => '', 'name' => 'View: bad_refferer.php', 'description' => 'bad_refferer.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 270, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_LOGGEDOUT'] = array('value' => 'views/loggedout.php', 'options' => '', 'name' => 'View: loggedout.php', 'description' => 'loggedout.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 280, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_PANEL'] = array('value' => 'views/panel.php', 'options' => '', 'name' => 'View: panel.php', 'description' => 'panel.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 290, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_REPORTS'] = array('value' => 'views/reports.php', 'options' => '', 'name' => 'View: reports.php', 'description' => 'reports.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 300, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_MENU'] = array('value' => 'views/menu.php', 'options' => '', 'name' => 'View: menu.php', 'description' => 'menu.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 310, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_BETA_NOTICE'] = array('value' => 'views/beta_notice.php', 'options' => '', 'name' => 'View: beta_notice.php', 'description' => 'beta_notice.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 312, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_OBE'] = array('value' => 'views/obe.php', 'options' => '', 'name' => 'View: obe.php', 'description' => 'obe.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 310, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['JQUERY_CSS'] = array('value' => 'assets/css/jquery-ui.css', 'options' => '', 'name' => 'jQuery UI css', 'description' => 'css file for jquery ui', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 320, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_LOGIN'] = array('value' => 'views/login.php', 'options' => '', 'name' => 'View: login.php', 'description' => 'login.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 330, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_HEADER'] = array('value' => 'views/header.php', 'options' => '', 'name' => 'View: header.php', 'description' => 'header.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 340, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_FOOTER'] = array('value' => 'views/footer.php', 'options' => '', 'name' => 'View: freepbx.php', 'description' => 'footer.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 350, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_FOOTER_CONTENT'] = array('value' => 'views/footer_content.php', 'options' => '', 'name' => 'View: footer_content.php', 'description' => 'footer_content.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 360, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['VIEW_POPOVER_JS'] = array('value' => 'views/popover_js.php', 'options' => '', 'name' => 'View: popover_js.php', 'description' => 'popover_js.php view. This should never be changed except for very advanced layout changes', 'readonly' => 1, 'hidden' => 1, 'sortorder' => 355, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['BRAND_ALT_JS'] = array('value' => '', 'options' => '', 'name' => 'Alternate JS', 'description' => 'Alternate JS file, to supplement legacy.script.js', 'readonly' => 1, 'emptyok' => 1, 'hidden' => 1, 'sortorder' => 360, 'level' => 1, 'type' => CONF_TYPE_TEXT); $settings[$category]['DASHBOARD_FREEPBX_BRAND'] = array('value' => 'FreePBX', 'options' => '', 'name' => 'FreePBX Brand', 'description' => 'The FreePBX Brand Name', 'readonly' => 1, 'emptyok' => 1, 'hidden' => 1, 'sortorder' => 360, 'level' => 1, 'type' => CONF_TYPE_TEXT); $category = 'Device Settings'; $settings[$category]['DEVICE_STRONG_SECRETS'] = array('value' => true, 'options' => '', 'name' => 'Require Strong Secrets', '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.', 'type' => CONF_TYPE_BOOL, 'sortorder' => 12); $settings[$category]['DEVICE_REMOVE_MAILBOX'] = array('value' => false, 'options' => '', 'name' => 'Remove mailbox Setting when no Voicemail', 'description' => 'If set to true, any fixed device associated with a user that has no voicemail configured will have the "mailbox=" setting removed in the generated technology configuration file such as sip_additional.conf. This will not affect the value in the GUI.', 'type' => CONF_TYPE_BOOL, 'sortorder' => 15); $settings[$category]['DEVICE_SIP_CANREINVITE'] = array('value' => 'no', 'options' => array('no', 'yes', 'nonat', 'update'), 'name' => 'SIP canrenivite (directmedia)', 'description' => 'Default setting for SIP canreinvite (same as directmedia). See Asterisk documentation for details.', 'type' => CONF_TYPE_SELECT, 'sortorder' => 20); $settings[$category]['DEVICE_SIP_DTMF'] = array('value' => 'rfc2833', 'options' => array('rfc2833', 'auto', 'shortinfo', 'info', 'inband'), 'name' => 'SIP DTMF Signaling', 'description' => 'The DTMF signaling mode used by this device, usually RFC for most phones. (Note: For PJSIP devices RFC-4733 supercedes the older RFC-2833 and will be used when RFC-2833 is selected for PJSIP devices)', 'type' => CONF_TYPE_SELECT, 'sortorder' => 20); $settings[$category]['DEVICE_SIP_TRUSTRPID'] = array('value' => 'yes', 'options' => array('no', 'yes'), 'name' => 'SIP trustrpid', 'description' => 'Default setting for SIP trustrpid. See Asterisk documentation for details.', 'type' => CONF_TYPE_SELECT, 'sortorder' => 30); $settings[$category]['DEVICE_SIP_SENDRPID'] = array('value' => 'no', 'options' => array('no', 'yes', 'pai'), 'name' => 'SIP sendrpid', 'description' => "Default setting for SIP sendrpid. A value of 'yes' is equivalent to 'rpid' and will send the 'Remote-Party-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.", 'type' => CONF_TYPE_SELECT, 'sortorder' => 40); $settings[$category]['DEVICE_SIP_NAT'] = array('value' => 'no', 'options' => array('no', 'yes', 'never', 'route'), 'name' => 'SIP nat', '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.", 'type' => CONF_TYPE_SELECT, 'sortorder' => 50); $settings[$category]['DEVICE_SIP_ENCRYPTION'] = array('value' => 'no', 'options' => array('no', 'yes'), 'name' => 'SIP encryption', '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.", 'type' => CONF_TYPE_SELECT, 'sortorder' => 60); $settings[$category]['DEVICE_SIP_QUALIFYFREQ'] = array('value' => 60, 'options' => array(15, 86400), 'name' => 'SIP qualifyfreq', '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.", 'type' => CONF_TYPE_INT, 'sortorder' => 70); $settings[$category]['DEVICE_QUALIFY'] = array('value' => 'yes', 'options' => '', 'name' => 'SIP and IAX qualify', '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.", 'type' => CONF_TYPE_TEXT, 'sortorder' => 80); $settings[$category]['DEVICE_DISALLOW'] = array('value' => '', 'options' => '', 'name' => 'SIP and IAX disallow', '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.", 'type' => CONF_TYPE_TEXT, 'emptyok' => 1, 'sortorder' => 90); $settings[$category]['DEVICE_ALLOW'] = array('value' => '', 'options' => '', 'name' => 'SIP and IAX allow', '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.", 'type' => CONF_TYPE_TEXT, 'emptyok' => 1, 'sortorder' => 90); $settings[$category]['DEVICE_CALLGROUP'] = array('value' => '', 'options' => '', 'name' => 'SIP and DAHDi callgroup', '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.", 'type' => CONF_TYPE_TEXT, 'emptyok' => 1, 'sortorder' => 100); $settings[$category]['DEVICE_PICKUPGROUP'] = array('value' => '', 'options' => '', 'name' => 'SIP and DAHDi pickupgroup', '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.", 'type' => CONF_TYPE_TEXT, 'emptyok' => 1, 'sortorder' => 110); $category = 'Internal Use'; $settings[$category]['SIPUSERAGENT'] = array('value' => 'FPBX', 'options' => '', 'name' => 'SIP User Agent', 'description' => 'User Agent prefix', 'readonly' => 1, 'hidden' => 1, 'level' => 10, 'type' => CONF_TYPE_TEXT); $settings[$category]['MODULE_REPO'] = array('value' => 'http://mirror1.freepbx.org,http://mirror2.freepbx.org', 'options' => '', 'name' => 'Repo Server', 'description' => 'repo server', 'readonly' => 1, 'hidden' => 1, 'level' => 10, 'type' => CONF_TYPE_TEXT); $settings[$category]['NOTICE_BROWSER_STATS'] = array('value' => false, 'options' => '', 'name' => 'Browser Stats Notice', 'description' => 'Internal use to track if notice has been given that anonyous browser stats are being collected.', 'readonly' => 1, 'hidden' => 1, 'level' => 10, 'type' => CONF_TYPE_BOOL); $settings[$category]['mainstyle_css_generated'] = array('value' => isset($amp_conf['mainstyle_css_generated']) && $amp_conf['mainstyle_css_generated'] ? $amp_conf['mainstyle_css_generated'] : '', 'description' => 'internal use', 'type' => CONF_TYPE_TEXT, 'name' => 'Compressed Copy of Main CSS', 'readonly' => 1, 'hidden' => 1, 'level' => 10, 'emptyok' => 1); $settings[$category]['SESSION_TIMEOUT'] = array('value' => 2592000, 'options' => array(1, 2147483647), 'name' => 'Session Timeout', 'description' => 'Amount of seconds to allow a session to stay open before logging a user out. For unlimited clear this box and save.', 'level' => 10, 'type' => CONF_TYPE_INT, 'emptyok' => 1); $settings[$category]['CACHE_CLEANUP_DAYS'] = array('value' => 30, 'options' => array(1, 2147483647), 'name' => 'Browser Playback Day Cache', 'description' => 'Amount of days to keep browser playback (HTML5 audio files) cache. Set this to a lower value to conserve disk space.', 'level' => 10, 'type' => CONF_TYPE_INT, 'emptyok' => 0); $settings[$category]['VIEW_ZEND_CONFIG'] = array('value' => 'views/zend_config.php', 'options' => '', 'name' => 'View: zend_config.php', 'description' => 'zend_config.php view. This should never be changed except for very advanced layout changes.', 'readonly' => 1, 'hidden' => 1, 'level' => 10, 'emptyok' => 0, 'sortorder' => 180, 'type' => CONF_TYPE_TEXT); // FREEPBX13 - Add Proxy Support $category = "Proxy Settings"; $settings[$category]['PROXY_ENABLED'] = array('name' => "Use HTTP(S) Proxy", 'description' => "Enable this to send outbound HTTP and HTTPS requests via a proxy. This does not affect Voice or Video traffic.", 'value' => false, 'defaultval' => false, 'emptyok' => 0, 'readonly' => 0, 'sortorder' => 1, 'type' => CONF_TYPE_BOOL); $settings[$category]['PROXY_ADDRESS'] = array('name' => "Proxy Address", 'description' => "Enter the address of the outbound proxy. This will be similar to http://10.1.1.1:3128", 'value' => "", 'defaultval' => "", 'emptyok' => 1, 'readonly' => 0, 'sortorder' => 2, 'type' => CONF_TYPE_TEXT); $settings[$category]['PROXY_USERNAME'] = array('name' => "Proxy Username", 'description' => "If you need to authenticate to the proxy server, you must enter both a username and password. Leaving either (or both) blank disables Proxy Authentication", 'value' => "", 'defaultval' => "", 'emptyok' => 1, 'readonly' => 0, 'sortorder' => 3, 'type' => CONF_TYPE_TEXT); $settings[$category]['PROXY_PASSWORD'] = array('name' => "Proxy Password", 'description' => "If you need to authenticate to the proxy server, you must enter both a username and password. Leaving either (or both) blank disables Proxy Authentication", 'value' => "", 'defaultval' => "", 'emptyok' => 1, 'readonly' => 0, 'sortorder' => 4, 'type' => CONF_TYPE_TEXT); $settings[$category]['DASHBOARD_OVERRIDE'] = array('description' => 'When no params specified, use this module', 'name' => 'DASHBOARD_OVERRIDE', 'value' => '', 'options' => '', 'readonly' => 1, 'hidden' => 1, 'level' => 10, 'emptyok' => 1, 'sortorder' => 180, 'type' => CONF_TYPE_TEXT); // The following settings are used in various modules prior to 2.9. If they are found in amportal.conf then we // retain their values until the individual modules are updated and their install scripts run where a full // configuration (descriptions, defaults, etc.) will be provided and maintained. This provides just enough to // carry the setting through the migration since most upgrades will run framework or install_amp followed by the // module install scripts. // $module_migrate = array('AMPPLAYKEY' => CONF_TYPE_TEXT, 'AMPBACKUPEMAILFROM' => CONF_TYPE_TEXT, 'AMPBACKUPSUDO' => CONF_TYPE_BOOL, 'USEQUEUESTATE' => CONF_TYPE_BOOL, 'DASHBOARD_INFO_UPDATE_TIME' => CONF_TYPE_INT, 'DASHBOARD_STATS_UPDATE_TIME' => CONF_TYPE_INT, 'SSHPORT' => CONF_TYPE_INT, 'MAXCALLS' => CONF_TYPE_INT, 'AMPMPG123' => CONF_TYPE_BOOL); foreach ($module_migrate as $setting => $type) { if (isset($amp_conf[$setting]) && !$freepbx_conf->conf_setting_exists($setting)) { $val = $amp_conf[$setting]; // since this came from a conf file, change any 'false' that will otherwise turn to true if ($type == CONF_TYPE_BOOL) { switch (strtolower($val)) { case 'false': case 'no': case 'off': $val = false; break; } } if (in_array($setting, array('USEQUEUESTATE'))) { $val = true; } $category = 'Under Migration'; $settings[$category][$setting] = array('value' => $val, 'defaultval' => '', 'hidden' => 1, 'level' => 10, 'emptyok' => 1, 'description' => 'This setting is being migrated and will be initialized by its module install script on upgrade.', 'type' => $type); } } $defaults = array('value' => '', 'options' => '', 'module' => '', 'level' => 0, 'readonly' => 0, 'hidden' => 0, 'emptyok' => 0); foreach ($settings as $category => $list) { foreach ($list as $name => $setting) { $setting = array_merge($defaults, $setting); $setting['category'] = $category; if (!isset($setting['defaultval'])) { $setting['defaultval'] = $setting['value']; } $freepbx_conf->define_conf_setting($name, $setting); } } if ($commit_to_db) { $freepbx_conf->commit_conf_settings(); } //Make sure we don't set the value again because we dont need to do that //also to prevent against loops if ($freepbx_conf->get_conf_setting('CRONMAN_UPDATES_CHECK') && file_exists($freepbx_conf->get_conf_setting("AMPWEBROOT") . '/admin/libraries/cronmanager.class.php')) { global $db; if (!class_exists('cronmanager')) { include $amp_conf["AMPWEBROOT"] . '/admin/libraries/cronmanager.class.php'; } $cm =& \cronmanager::create($db); $cm->enable_updates(); } }
public function __construct() { $this->freepbx_conf = freepbx_conf::create(); }
function parse_amportal_conf($conf) { global $db; if (!is_object($db)) { $restrict_mods = true; $bootstrap_settings['skip_astman'] = true; if (!@(include_once getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { include_once '/etc/asterisk/freepbx.conf'; } } $freepbx_conf =& freepbx_conf::create(); freepbx_log(FPBX_LOG_ERROR, 'parse_amportal_conf() is deprecated. Use of bootstrap.php creates $amp_conf'); return $freepbx_conf->parse_amportal_conf($conf); }
private function showi18n($modulename) { //special case core so that we have everything we need for localizations switch ($modulename) { case 'core': $modules = $this->module_getinfo(); break; default: $modules = $this->module_getinfo($modulename); break; } $modulesProcessed = array(); foreach ($modules as $rawname => $mod) { if (!isset($modules[$rawname])) { fatal($rawname . _(' not found')); } if (!in_array($modules[$rawname]['name'], $modulesProcessed['name'])) { $modulesProcessed['name'][] = $modules[$rawname]['name']; if (isset($modules[$rawname]['name'])) { echo "# name:\n_(\"" . $modules[$rawname]['name'] . "\");\n"; } } if (!in_array($modules[$rawname]['category'], $modulesProcessed['category'])) { $modulesProcessed['category'][] = $modules[$rawname]['category']; if (isset($modules[$rawname]['category'])) { echo "# category:\n_(\"" . str_replace("\n", "", $modules[$rawname]['category']) . "\");\n"; } } if (!in_array($modules[$rawname]['description'], $modulesProcessed['description'])) { $moduleProcessed['description'][] = $modules[$rawname]['description']; if (isset($modules[$rawname]['description'])) { echo "# description:\n_(\"" . trim(str_replace("\n", "", $modules[$rawname]['description'])) . "\");\n"; } } if (isset($modules[$rawname]['menuitems'])) { foreach ($modules[$rawname]['menuitems'] as $key => $menuitem) { if (!in_array($menuitem, $modulesProcessed['menuitem'])) { $modulesProcessed['menuitem'][] = $menuitem; echo "# {$key}:\n_(\"{$menuitem}\");\n"; } } } } //get our settings $freepbx_conf = \freepbx_conf::create(); $conf = $freepbx_conf->get_conf_settings(); $settingsProcessed = array(); foreach ($conf as $keyword => $settings) { //we don't need hidden settings as the user never sees them if ($settings['hidden'] != true && ($rawname == 'framework' && $settings['module'] == '') || $settings['module'] == $modulename) { if (!in_array($settings['name'], $settingsProcessed['name'])) { $settingsProcessed['name'][] = $settings['name']; echo "# Setting name - {$keyword}:\n_(\"" . $settings['name'] . "\");\n"; } if (!in_array($settings['category'], $settingsProcessed['category'])) { $settingsProcessed['category'][] = $settings['category']; echo "# Setting category - {$keyword}:\n_(\"" . $settings['category'] . "\");\n"; } if (!in_array($settings['description'], $settingsProcessed['description'])) { $settingsProcessed['description'][] = $settings['description']; echo "# Setting description - {$keyword}:\n_(\"" . $settings['description'] . "\");\n"; } } } }
/** * Update AMI credentials in manager.conf * * @author Philippe Lindheimer * @pram mixed $user false means don't change * @pram mixed $pass password false means don't change * @pram mixed $writetimeout false means don't change * @returns boolean * * allows FreePBX to update the manager credentials primarily used by Advanced Settings and Backup and Restore. */ function fpbx_ami_update($user = false, $pass = false, $writetimeout = false) { global $amp_conf, $astman, $db, $bootstrap_settings; $conf_file = $amp_conf['ASTETCDIR'] . '/manager.conf'; $ret = $ret2 = $ret3 = 0; $output = array(); if (strpos($amp_conf['ASTETCDIR'], "..") === false && !file_exists($conf_file)) { return; } if ($user !== false && $user != '') { $sed_arg = escapeshellarg('s/\\s*\\[general\\].*$/TEMPCONTEXT/;s/\\[.*\\]/\\[' . $amp_conf['AMPMGRUSER'] . '\\]/;s/^TEMPCONTEXT$/\\[general\\]/'); exec("sed -i.bak {$sed_arg} {$conf_file}", $output, $ret); if ($ret) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("Failed changing AMI user to [%s], internal failure details follow:"), $amp_conf['AMPMGRUSER'])); foreach ($output as $line) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("AMI failure details:"), $line)); } } } if ($pass !== false && $pass != '') { unset($output); $sed_arg = escapeshellarg('s/secret\\s*=.*$/secret = ' . $amp_conf['AMPMGRPASS'] . '/'); exec("sed -i.bak {$sed_arg} {$conf_file}", $output2, $ret2); if ($ret2) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("Failed changing AMI password to [%s], internal failure details follow:"), $amp_conf['AMPMGRPASS'])); foreach ($output as $line) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("AMI failure details:"), $line)); } } // We've changed the password, let's update the notification // $nt = notifications::create($db); $freepbx_conf =& freepbx_conf::create(); if ($amp_conf['AMPMGRPASS'] == $freepbx_conf->get_conf_default_setting('AMPMGRPASS')) { if (!$nt->exists('core', 'AMPMGRPASS')) { $nt->add_warning('core', 'AMPMGRPASS', _("Default Asterisk Manager Password Used"), _("You are using the default Asterisk Manager password that is widely known, you should set a secure password")); } } else { $nt->delete('core', 'AMPMGRPASS'); } } //attempt to set writetimeout unset($output); if ($writetimeout) { $sed_arg = escapeshellarg('s/writetimeout\\s*=.*$/writetimeout = ' . $amp_conf['ASTMGRWRITETIMEOUT'] . '/'); exec("sed -i.bak {$sed_arg} {$conf_file}", $output3, $ret3); if ($ret3) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("Failed changing AMI writetimout to [%s], internal failure details follow:"), $amp_conf['ASTMGRWRITETIMEOUT'])); foreach ($output as $line) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("AMI failure details:"), $line)); } } } if ($ret || $ret2 || $ret3) { dbug("aborting early because previous errors"); return false; } if (is_object($astman) && method_exists($astman, "connected") && $astman->connected()) { $ast_ret = $astman->Command('module reload manager'); } else { unset($output); dbug("no astman connection so trying to force through linux command line"); exec(fpbx_which('asterisk') . " -rx 'module reload manager'", $output, $ret2); if ($ret2) { freepbx_log(FPBX_LOG_ERROR, _("Failed to reload AMI, manual reload will be necessary, try: [asterisk -rx 'module reload manager']")); } } if (is_object($astman) && method_exists($astman, "connected") && $astman->connected()) { $astman->disconnect(); } if (!is_object($astman) || !method_exists($astman, "connected")) { //astman isn't initiated so escape return true; } if (!($res = $astman->connect($amp_conf["ASTMANAGERHOST"] . ":" . $amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"], $bootstrap_settings['astman_events']))) { // couldn't connect at all freepbx_log(FPBX_LOG_CRITICAL, "Connection attmempt to AMI failed"); } else { $bmo = FreePBX::create(); $bmo->astman = $astman; } return true; }
protected function execute(InputInterface $input, OutputInterface $output) { global $amp_conf; /* This makes pandas sad. :( */ if (version_compare(PHP_VERSION, '5.3.3', '<')) { //charset=utf8 requires php 5.3.6 (http://php.net/manual/en/mysqlinfo.concepts.charset.php) $output->writeln("<error>FreePBX Requires PHP Version 5.3.3 or Higher, you have: " . PHP_VERSION . "</error>"); return false; } //still needed for module_admin and retrieve_conf $filePath = stream_resolve_include_path('Console/Getopt.php'); if ($filePath === false) { $output->writeln("<error>PEAR must be installed (requires Console/Getopt.php)</error>"); return false; } $this->rootPath = dirname(__DIR__); date_default_timezone_set('America/Los_Angeles'); $style = new OutputFormatterStyle('white', 'black', array('bold')); $output->getFormatter()->setStyle('bold', $style); //STATIC??? define("AMP_CONF", "/etc/amportal.conf"); define("ODBC_INI", "/etc/odbc.ini"); define("ASTERISK_CONF", "/etc/asterisk/asterisk.conf"); define("FREEPBX_CONF", "/etc/freepbx.conf"); define("FILES_DIR", $this->rootPath . "/installlib/files"); define("SQL_DIR", $this->rootPath . "/installlib/SQL"); define("MODULE_DIR", $this->rootPath . "/amp_conf/htdocs/admin/modules"); define("UPGRADE_DIR", $this->rootPath . "/upgrades"); // Fail if !root $euid = posix_getpwuid(posix_geteuid()); if ($euid['name'] != 'root') { $output->writeln("<error>" . $this->getName() . " must be run as root</error>"); exit(1); } foreach ($this->settings as $key => $setting) { $answers[$key] = $input->getOption($key); } if ($input->isInteractive()) { $helper = $this->getHelper('question'); foreach ($this->settings as $key => $setting) { if (isset($setting['default'])) { $question = new Question($setting['description'] . ($setting['default'] ? ' [' . $setting['default'] . ']' : '') . ': ', $answers[$key]); $answers[$key] = $helper->ask($input, $output, $question); } } } $dbroot = $input->getOption('rootdb'); $force = $input->getOption('force'); if ($force) { $output->writeln("<info>Force Install. This will reset everything!</info>"); } if ($dbroot || $answers['dbuser'] == 'root') { $output->writeln("<info>Assuming you are Database Root</info>"); $dbroot = true; } // Make sure SELinux is disabled $output->write("Checking if SELinux is enabled..."); exec("getenforce 2>/dev/null", $tmpout, $ret); if (isset($tmpout[0]) && ($tmpout[0] === "Enabled" || $tmpout[0] === "Enforcing")) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>SELinux is enabled. Please disable SELinux before installing FreePBX.</error>"); exit(1); } $output->writeln("Its not (good)!"); unset($tmpout); require_once 'installlib/installer.class.php'; $installer = new Installer($input, $output); // Copy asterisk.conf if (!file_exists(ASTERISK_CONF)) { $output->write("No " . ASTERISK_CONF . " file detected. Installing..."); $aconf = $installer->asterisk_conf_read(FILES_DIR . "/asterisk.conf"); if (empty($aconf['directories'])) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unable to read " . FILES_DIR . "/asterisk.conf or it was missing a directories section</error>"); exit(1); } $aconf['directories']['astmoddir'] = file_exists('/usr/lib64/asterisk/modules') ? '/usr/lib64/asterisk/modules' : '/usr/lib/asterisk/modules'; $installer->asterisk_conf_write(ASTERISK_CONF, $aconf); $asterisk_conf = $aconf['directories']; $output->writeln("Done!"); } else { $output->write("Reading " . ASTERISK_CONF . "..."); $aconf = $installer->asterisk_conf_read(ASTERISK_CONF); if (empty($aconf['directories'])) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unable to read " . ASTERISK_CONF . " or it was missing a directories section</error>"); exit(1); } $output->writeln("Done"); $asterisk_conf = $aconf['directories']; $asterisk_defaults_conf = array('astetcdir' => '/etc/asterisk', 'astmoddir' => file_exists('/usr/lib64/asterisk/modules') ? '/usr/lib64/asterisk/modules' : '/usr/lib/asterisk/modules', 'astvarlibdir' => '/var/lib/asterisk', 'astagidir' => '/var/lib/asterisk/agi-bin', 'astspooldir' => '/var/spool/asterisk', 'astrundir' => '/var/run/asterisk', 'astlogdir' => '/var/log/asterisk'); foreach ($asterisk_defaults_conf as $key => $value) { if (!isset($asterisk_conf[$key])) { $asterisk_conf[$key] = $value; } } } //Check Asterisk (before file writes) $output->write("Checking if Asterisk is running and we can talk to it as the '" . $answers['user'] . "' user..."); $c = 0; $determined = false; while ($c < 5) { exec("sudo -u " . $answers['user'] . " asterisk -rx 'core show version' 2>&1", $tmpout, $ret); if ($ret != 0) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Error communicating with Asterisk. Ensure that Asterisk is properly installed and running as the " . $answers['user'] . " user</error>"); if (file_exists($asterisk_conf['astrundir'] . "/asterisk.ctl")) { $info = posix_getpwuid(fileowner($asterisk_conf['astrundir'] . "/asterisk.ctl")); $output->writeln("<error>Asterisk appears to be running as " . $info['name'] . "</error>"); } else { $output->writeln("<error>Asterisk does not appear to be running</error>"); } $output->writeln("<error>Try starting Asterisk with the './start_asterisk start' command in this directory</error>"); exit(1); } else { $astver = $tmpout[0]; unset($tmpout); // Parse Asterisk version. if (preg_match('/^Asterisk (?:SVN-|GIT-)?(?:branch-)?(\\d+(\\.\\d+)*)(-?(.*)) built/', $astver, $matches)) { $determined = true; if (version_compare($matches[1], "11") < 0 || version_compare($matches[1], "15", "ge")) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unsupported Version of " . $matches[1] . "</error>"); $output->writeln("<error>Supported Asterisk versions: 11, 12, 13, 14</error>"); exit(1); } break; } } sleep(1); $c++; } if (!$determined) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Could not determine Asterisk version (got: " . $astver . "). Please report this.</error>"); } $output->writeln("Done!"); if (file_exists(FREEPBX_CONF) && !file_exists(AMP_CONF) || !file_exists(FREEPBX_CONF) && file_exists(AMP_CONF)) { if (file_exists(FREEPBX_CONF)) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Half-baked install previously detected. " . FREEPBX_CONF . " should not exist if " . AMP_CONF . " does not exist</error>"); } else { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Half-baked install previously detected. " . AMP_CONF . " should not exist if " . FREEPBX_CONF . " does not exist</error>"); } exit(1); } $output->writeln("Preliminary checks done. Starting FreePBX Installation"); // Copy default amportal.conf $output->write("Checking if this is a new install..."); if (!file_exists(AMP_CONF) || $force) { $output->writeln("Yes (No " . AMP_CONF . " file detected)"); $newinstall = true; require_once 'amp_conf/htdocs/admin/functions.inc.php'; } else { $output->writeln("No (" . AMP_CONF . " file detected)"); $bootstrap_settings['freepbx_auth'] = false; $restrict_mods = true; if (!@(include_once getenv('FREEPBX_CONF') ? getenv('FREEPBX_CONF') : '/etc/freepbx.conf')) { include_once '/etc/asterisk/freepbx.conf'; } } if (isset($answers['dbengine'])) { $amp_conf['AMPDBENGINE'] = $answers['dbengine']; } if (isset($answers['dbname'])) { $amp_conf['AMPDBNAME'] = $answers['dbname']; } if (isset($answers['cdrdbname'])) { $amp_conf['CDRDBNAME'] = $answers['cdrdbname']; } if (isset($answers['webroot'])) { $amp_conf['AMPWEBROOT'] = $answers['webroot']; } if (isset($answers['user'])) { $amp_conf['AMPASTERISKUSER'] = $answers['user']; $amp_conf['AMPASTERISKWEBUSER'] = $answers['user']; $amp_conf['AMPDEVUSER'] = $answers['user']; } if (isset($answers['group'])) { $amp_conf['AMPASTERISKGROUP'] = $answers['group']; $amp_conf['AMPASTERISKWEBGROUP'] = $answers['group']; $amp_conf['AMPDEVGROUP'] = $answers['group']; } if (!isset($amp_conf['AMPMANAGERHOST'])) { $amp_conf['AMPMANAGERHOST'] = 'localhost'; } if ($newinstall || $force) { $amp_conf['AMPMGRUSER'] = '******'; $amp_conf['AMPMGRPASS'] = md5(uniqid()); $amp_conf['AMPDBUSER'] = $answers['dbuser']; $amp_conf['AMPDBPASS'] = $answers['dbpass']; $amp_conf['AMPDBHOST'] = 'localhost'; if ($dbroot) { $output->write("Database Root installation checking credentials and permissions.."); } else { $output->write("Database installation checking credentials and permissions.."); } $dsn = $amp_conf['AMPDBENGINE'] . ":host=" . $amp_conf['AMPDBHOST']; try { $pdodb = new \PDO($dsn, $amp_conf['AMPDBUSER'], $amp_conf['AMPDBPASS']); } catch (\Exception $e) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Invalid Database Permissions. The error was: " . $e->getMessage() . "</error>"); exit(1); } $output->writeln("Connected!"); } if (!file_exists(ODBC_INI)) { $output->write("No " . ODBC_INI . " file detected. Installing..."); if (!copy(FILES_DIR . "/odbc.ini", ODBC_INI)) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unable to copy " . FILES_DIR . "/odbc.ini to " . ODBC_INI . "</error>"); exit(1); } $output->writeln("Done"); } elseif (file_exists(ODBC_INI)) { $conf = file_get_contents(ODBC_INI); $conf = trim($conf); if (empty($conf)) { $output->write("Blank " . ODBC_INI . " file detected. Installing..."); if (!copy(FILES_DIR . "/odbc.ini", ODBC_INI)) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unable to copy " . FILES_DIR . "/odbc.ini to " . ODBC_INI . "</error>"); exit(1); } $output->writeln("Done"); } } if (isset($asterisk_conf['astetcdir'])) { $amp_conf['ASTETCDIR'] = $asterisk_conf['astetcdir']; } if (isset($asterisk_conf['astmoddir'])) { $amp_conf['ASTMODDIR'] = $asterisk_conf['astmoddir']; } if (isset($asterisk_conf['astvarlibdir'])) { $amp_conf['ASTVARLIBDIR'] = $asterisk_conf['astvarlibdir']; } if (isset($asterisk_conf['astagidir'])) { $amp_conf['ASTAGIDIR'] = $asterisk_conf['astagidir']; } if (isset($asterisk_conf['astspooldir'])) { $amp_conf['ASTSPOOLDIR'] = $asterisk_conf['astspooldir']; } if (isset($asterisk_conf['astrundir'])) { $amp_conf['ASTRUNDIR'] = $asterisk_conf['astrundir']; } if (isset($asterisk_conf['astlogdir'])) { $amp_conf['ASTLOGDIR'] = $asterisk_conf['astlogdir']; } // Create database(s). if ($newinstall) { global $db; require_once 'amp_conf/htdocs/admin/libraries/BMO/FreePBX.class.php'; require_once 'amp_conf/htdocs/admin/libraries/DB.class.php'; if ($dbroot) { $amp_conf['AMPDBUSER'] = '******'; $amp_conf['AMPDBPASS'] = md5(uniqid()); } else { $amp_conf['AMPDBUSER'] = $answers['dbuser']; $amp_conf['AMPDBPASS'] = $answers['dbpass']; } if ($dbroot) { if ($force) { $pdodb->query("DROP DATABASE IF EXISTS " . $amp_conf['AMPDBNAME']); } $pdodb->query("CREATE DATABASE IF NOT EXISTS " . $amp_conf['AMPDBNAME'] . " DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci"); $sql = "GRANT ALL PRIVILEGES ON " . $amp_conf['AMPDBNAME'] . ".* TO '" . $amp_conf['AMPDBUSER'] . "'@'localhost' IDENTIFIED BY '" . $amp_conf['AMPDBPASS'] . "'"; $pdodb->query($sql); } else { //check collate } $bmo = new \FreePBX($amp_conf); $dsn = $amp_conf['AMPDBENGINE'] . ":host=" . $amp_conf['AMPDBHOST']; $db = new \DB(new \FreePBX\Database($dsn, $answers['dbuser'], $answers['dbpass'])); $db->query("USE " . $amp_conf['AMPDBNAME']); $sql = "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '" . $amp_conf['AMPDBNAME'] . "';"; if (!$db->getOne($sql)) { $output->writeln("Empty " . $amp_conf['AMPDBNAME'] . " Database going to populate it"); $installer->install_sql_file(SQL_DIR . '/asterisk.sql'); } if ($dbroot) { if ($force) { $db->query("DROP DATABASE IF EXISTS " . $amp_conf['CDRDBNAME']); } $db->query("CREATE DATABASE IF NOT EXISTS " . $amp_conf['CDRDBNAME'] . " DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci"); $sql = "GRANT ALL PRIVILEGES ON " . $amp_conf['CDRDBNAME'] . ".* TO '" . $amp_conf['AMPDBUSER'] . "'@'localhost' IDENTIFIED BY '" . $amp_conf['AMPDBPASS'] . "'"; $db->query($sql); } else { //check collate } $db->query("USE " . $amp_conf['CDRDBNAME']); $sql = "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '" . $amp_conf['CDRDBNAME'] . "';"; if (!$db->getOne($sql)) { $output->writeln("Empty " . $amp_conf['CDRDBNAME'] . " Database going to populate it"); $installer->install_sql_file(SQL_DIR . '/cdr.sql'); } $db->query("USE " . $amp_conf['AMPDBNAME']); } // Get version of FreePBX. $version = $installer->get_version(); $output->writeln("Initializing FreePBX Settings"); $installer_amp_conf = $amp_conf; // freepbx_settings_init(); $installer->freepbx_settings_init(true); // Use the installer defined amp_conf settings $freepbx_conf =& \freepbx_conf::create(); foreach ($installer_amp_conf as $keyword => $value) { if ($freepbx_conf->conf_setting_exists($keyword) && $amp_conf[$keyword] != $value) { $output->writeln("\tChanging " . $keyword . " to match what was given at install time"); $freepbx_conf->set_conf_values(array($keyword => $value), false, true); } } $freepbx_conf->commit_conf_settings(); $output->writeln("Finished initalizing settings"); if (!file_exists($amp_conf['AMPWEBROOT'])) { @mkdir($amp_conf['AMPWEBROOT'], 0777, true); } if (!is_writeable($amp_conf['AMPWEBROOT'])) { throw new \Exception($amp_conf['AMPWEBROOT'] . " is NOT writable!"); } chown($amp_conf['AMPWEBROOT'], $amp_conf['AMPASTERISKWEBUSER']); // Copy amp_conf/ $verb = $answers['dev-links'] ? "Linking" : "Copying"; $output->writeln($verb . " files (this may take a bit)...."); if (is_dir($this->rootPath . "/amp_conf")) { $total_files = $this->getFileCount($this->rootPath . "/amp_conf"); $progress = new ProgressBar($output, $total_files); $progress->setRedrawFrequency(100); $progress->start(); $this->recursive_copy($input, $output, $progress, $this->rootPath . "/amp_conf", "", $newinstall, $answers['dev-links']); $progress->finish(); } $output->writeln(""); $output->writeln("Done"); //Last minute symlinks $sbin = \FreePBX::Config()->get("AMPSBIN"); $bin = \FreePBX::Config()->get("AMPBIN"); //Put new fwconsole into place if (!file_exists($sbin . "/fwconsole")) { $output->write("Symlinking " . $bin . "/fwconsole to " . $sbin . "/fwconsole ..."); if (!symlink($bin . "/fwconsole", $sbin . "/fwconsole")) { $output->writeln("<error>Error</error>"); } $output->writeln("Done"); } elseif (file_exists($sbin . "/fwconsole") && (!is_link($sbin . "/fwconsole") || readlink($sbin . "/fwconsole") != $bin . "/fwconsole")) { unlink($sbin . "/fwconsole"); $output->write("Symlinking " . $bin . "/fwconsole to " . $sbin . "/fwconsole ..."); if (!symlink($bin . "/fwconsole", $sbin . "/fwconsole")) { $output->writeln("<error>Error</error>"); } $output->writeln("Done"); } //put old amportal into place if (!file_exists($sbin . "/amportal")) { if (is_link($sbin . "/amportal")) { unlink($sbin . "/amportal"); } $output->write("Symlinking " . $bin . "/amportal to " . $sbin . "/amportal ..."); if (!symlink($bin . "/amportal", $sbin . "/amportal")) { $output->writeln("<error>Error</error>"); } $output->writeln("Done"); } elseif (file_exists($sbin . "/amportal") && (!is_link($sbin . "/amportal") || readlink($sbin . "/amportal") != $bin . "/amportal")) { unlink($sbin . "/amportal"); $output->write("Symlinking " . $bin . "/amportal to " . $sbin . "/amportal ..."); if (!symlink($bin . "/amportal", $sbin . "/amportal")) { $output->writeln("<error>Error</error>"); } $output->writeln("Done"); } $output->write("Finishing up directory processes..."); $binFiles = array($bin . "/freepbx_engine" => 0755, $bin . "/freepbx_setting" => 0755, $bin . "/fwconsole" => 0755, $bin . "/gen_amp_conf" => 0755, $bin . "/retrieve_conf" => 0755, $sbin . "/amportal" => 0755, $sbin . "/fwconsole" => 0755); foreach ($binFiles as $file => $perms) { if (file_exists($file)) { chmod($file, $perms); } } // Create dirs // /var/www/html/admin/modules/framework/ // /var/www/html/admin/modules/_cache/ // ./amp_conf/htdocs/admin/modules/_cache/ $extraDirs = array($amp_conf['AMPWEBROOT'] . "/admin/modules/_cache" => 0777, $amp_conf['AMPWEBROOT'] . "/admin/modules/framework" => 0777, $amp_conf['ASTSPOOLDIR'] . "/voicemail/device" => 0755, $amp_conf['ASTSPOOLDIR'] . "/fax" => 0766, $amp_conf['ASTSPOOLDIR'] . "/monitor" => 0766); foreach ($extraDirs as $dir => $perms) { if (!file_exists($dir)) { mkdir($dir, $perms, true); } } $copyFrameworkFiles = array("module.xml", "module.sig", "install.php", "LICENSE", "README.md"); foreach ($copyFrameworkFiles as $file) { if (file_exists($this->rootPath . "/" . $file)) { copy($this->rootPath . "/" . $file, $amp_conf['AMPWEBROOT'] . "/admin/modules/framework/" . $file); } } // Copy /etc/asterisk/voicemail.conf.template // ... to /etc/asterisk/voicemail.conf if (!file_exists($amp_conf['ASTETCDIR'] . "/voicemail.conf")) { copy($amp_conf['ASTETCDIR'] . "/voicemail.conf.template", $amp_conf['ASTETCDIR'] . "/voicemail.conf"); } $output->writeln("Done!"); // Create missing #include files. $output->write("Creating missing #include files..."); foreach (glob($amp_conf['ASTETCDIR'] . "/*.conf") as $file) { $data = file_get_contents($file); if (preg_match_all("/#include\\s(.*)/", $data, $matches)) { if (!empty($matches[1])) { foreach ($matches[1] as $include) { if (!file_exists($amp_conf['ASTETCDIR'] . "/" . $include)) { touch($amp_conf['ASTETCDIR'] . "/" . $include); } } } } } $output->writeln("Done"); //File variable replacement $rfiles = array($amp_conf['ASTETCDIR'] . "/manager.conf", $amp_conf['ASTETCDIR'] . "/cdr_adaptive_odbc.conf", ODBC_INI); $output->write("Running variable replacement..."); foreach ($rfiles as $file) { if (!file_exists($file) || !is_writable($file)) { continue; } $conf = file_get_contents($file); $replace = array('AMPMGRUSER' => $amp_conf['AMPMGRUSER'], 'AMPMGRPASS' => $amp_conf['AMPMGRPASS'], 'CDRDBNAME' => $amp_conf['CDRDBNAME'], 'AMPDBUSER' => $amp_conf['AMPDBUSER'], 'AMPDBPASS' => $amp_conf['AMPDBPASS']); $conf = str_replace(array_keys($replace), array_values($replace), $conf); file_put_contents($file, $conf); } $output->writeln("Done"); //setup and get manager working $output->write("Setting up Asterisk Manager Connection..."); exec("sudo -u " . $answers['user'] . " asterisk -rx 'module reload manager'", $o, $r); if ($r !== 0) { $output->writeln("<error>Unable to reload Asterisk Manager</error>"); exit(127); } //TODO: we should check to make sure manager worked at this stage.. $output->writeln("Done"); $output->writeln("Running through upgrades..."); // Upgrade framework (upgrades/ dir) $installer->install_upgrades($version); $output->writeln("Finished upgrades"); $fwxml = simplexml_load_file($this->rootPath . '/module.xml'); //setversion to whatever is in framework.xml forever for here on out. $fwver = (string) $fwxml->version; $output->write("Setting FreePBX version to " . $fwver . "..."); $installer->set_version($fwver); $output->writeln("Done"); $output->write("Writing out " . AMP_CONF . "..."); if (!file_put_contents(AMP_CONF, $freepbx_conf->amportal_generate(true))) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unable to write to file</error>"); exit(1); } $output->writeln("Done"); if ($newinstall) { /* Write freepbx.conf */ $conf = "<?php\n\$amp_conf['AMPDBUSER'] = '******'AMPDBUSER']}';\n\$amp_conf['AMPDBPASS'] = '******'AMPDBPASS']}';\n\$amp_conf['AMPDBHOST'] = '{$amp_conf['AMPDBHOST']}';\n\$amp_conf['AMPDBNAME'] = '{$amp_conf['AMPDBNAME']}';\n\$amp_conf['AMPDBENGINE'] = '{$amp_conf['AMPDBENGINE']}';\n\$amp_conf['datasource'] = ''; //for sqlite3\n\nrequire_once('{$amp_conf['AMPWEBROOT']}/admin/bootstrap.php');\n"; $output->write("Writing out " . FREEPBX_CONF . "..."); if (!file_put_contents(FREEPBX_CONF, $conf)) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Unable to write to file</error>"); exit(1); } $output->writeln("Done"); } //run this here so that we make sure everything is square for asterisk passthru($amp_conf['AMPSBIN'] . "/fwconsole chown"); if (!$answers['dev-links']) { // install_modules() $included_modules = array(); /* read modules list from MODULE_DIR */ if (file_exists(MODULE_DIR)) { $dir = opendir(MODULE_DIR); while ($file = readdir($dir)) { if ($file[0] != "." && $file[0] != "_" && is_dir(MODULE_DIR . "/" . $file)) { $included_modules[] = $file; } } closedir($dir); $output->write("Installing all modules..."); $this->install_modules($included_modules); $output->writeln("Done installing modules"); } } // module_admin install framework $output->writeln("Installing framework..."); $this->install_modules(array('framework')); $output->writeln("Done"); // generate_configs(); $output->writeln("Generating default configurations..."); passthru("sudo -u " . $amp_conf['AMPASTERISKUSER'] . " " . $amp_conf["AMPBIN"] . "/retrieve_conf --skip-registry-checks"); $output->writeln("Finished generating default configurations"); // GPG setup - trustFreePBX(); $output->write("Trusting FreePBX..."); try { \FreePBX::GPG()->trustFreePBX(); } catch (\Exception $e) { $output->writeln("<error>Error!</error>"); $output->writeln("<error>Error while trusting FreePBX: " . $e->getMessage() . "</error>"); exit(1); } $output->writeln("Trusted"); //run this here so that we make sure everything is square for asterisk passthru($amp_conf['AMPSBIN'] . "/fwconsole chown"); $output->writeln("<info>You have successfully installed FreePBX</info>"); }
protected function execute(InputInterface $input, OutputInterface $output, $quiet = false) { $this->output = $output; if (posix_geteuid() != 0) { $output->writeln("<error>" . _("You need to be root to run this command") . "</error>"); exit(1); } $this->quiet = $quiet; $etcdir = \FreePBX::Config()->get('ASTETCDIR'); if (!$this->quiet) { if (!file_exists($etcdir . '/freepbx_chown.conf')) { $output->writeln("<info>" . sprintf(_("Taking too long? Customize the chown command, See %s"), "http://wiki.freepbx.org/display/FOP/FreePBX+Chown+Conf") . "</info>"); } $output->writeln(_("Setting Permissions") . "..."); } $freepbx_conf = \freepbx_conf::create(); $conf = $freepbx_conf->get_conf_settings(); foreach ($conf as $key => $val) { ${$key} = $val['value']; } /* * These are files Framework is responsible for This list can be * reduced by moving responsibility to other modules as a hook * where appropriate. * * Types: * file: Set permissions/ownership on a single item * dir: Set permissions/ownership on a single directory * rdir: Set permissions/ownership on a single directory then recursively on * files within less the execute bit. If the dir is 755, child files will be 644, * child directories will be set the same as the parent. * execdir: Same as rdir but the execute bit is not stripped. */ $sessdir = session_save_path(); $sessdir = !empty($sessdir) ? $sessdir : '/var/lib/php/session'; $args = array(); if ($input) { $args = $input->getArgument('args'); $mname = isset($args[0]) ? $args[0] : ''; $this->moduleName = !empty($this->moduleName) ? $this->moduleName : strtolower($mname); } // Always update hooks before running a Chown \FreePBX::Hooks()->updateBMOHooks(); if (!empty($this->moduleName) && $this->moduleName != 'framework') { $mod = $this->moduleName; $this->modfiles[$mod][] = array('type' => 'rdir', 'path' => $AMPWEBROOT . '/admin/modules/' . $mod, 'perms' => 0755); $hooks = $this->fwcChownFiles(); $current = isset($hooks[ucfirst($mod)]) ? $hooks[ucfirst($mod)] : false; if (is_array($current)) { $this->modfiles[$mod] = array_merge_recursive($this->modfiles[$mod], $current); } } else { $webuser = \FreePBX::Freepbx_conf()->get('AMPASTERISKWEBUSER'); $web = posix_getpwnam($webuser); if (!$web) { throw new \Exception(sprintf(_("I tried to find out about %s, but the system doesn't think that user exists"), $webuser)); } $home = trim($web['dir']); if (is_dir($home)) { $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $home, 'perms' => 0755); // SSH folder needs non-world-readable permissions (otherwise ssh complains, and refuses to work) $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => "{$home}/.ssh", 'perms' => 0700); } $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $sessdir, 'perms' => 0744, 'always' => true); $this->modfiles['framework'][] = array('type' => 'file', 'path' => '/etc/amportal.conf', 'perms' => 0640, 'always' => true); $this->modfiles['framework'][] = array('type' => 'file', 'path' => '/etc/freepbx.conf', 'perms' => 0640, 'always' => true); $this->modfiles['framework'][] = array('type' => 'dir', 'path' => $ASTRUNDIR, 'perms' => 0755, 'always' => true); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => \FreePBX::GPG()->getGpgLocation(), 'perms' => 0755, 'always' => true); //we may wish to declare these manually or through some automated fashion $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTETCDIR, 'perms' => 0750, 'always' => true); $this->modfiles['framework'][] = array('type' => 'file', 'path' => $ASTVARLIBDIR . '/.ssh/id_rsa', 'perms' => 0600); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTLOGDIR, 'perms' => 0755, 'always' => true); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTSPOOLDIR, 'perms' => 0755); //I have added these below individually, $this->modfiles['framework'][] = array('type' => 'file', 'path' => $FPBXDBUGFILE, 'perms' => 0644); $this->modfiles['framework'][] = array('type' => 'file', 'path' => $FPBX_LOG_FILE, 'perms' => 0644); //We may wish to declare files individually rather than touching everything $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTVARLIBDIR . '/' . $MOHDIR, 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTVARLIBDIR . '/sounds', 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'file', 'path' => '/etc/obdc.ini', 'perms' => 0644); //we were doing a recursive on this which I think is not needed. //Changed to just be the directory //^ Needs to be the whole shebang, doesnt work otherwise $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $AMPWEBROOT, 'perms' => 0755); //Anything in bin and agi-bin should be exec'd //Should be after everything except but before hooks //So that we dont get overwritten by ampwebroot $this->modfiles['framework'][] = array('type' => 'execdir', 'path' => $AMPBIN, 'perms' => 0755, 'always' => true); $this->modfiles['framework'][] = array('type' => 'execdir', 'path' => $ASTAGIDIR, 'perms' => 0755, 'always' => true); $this->modfiles['framework'][] = array('type' => 'execdir', 'path' => $ASTVARLIBDIR . "/bin", 'perms' => 0755, 'always' => true); //Merge static files and hook files, then act on them as a single unit $fwcCF = $this->fwcChownFiles(); if (!empty($this->modfiles) && !empty($fwcCF)) { foreach ($fwcCF as $key => $value) { $this->modfiles[$key] = $value; } //$this->modfiles = array_merge_recursive($this->modfiles,$fwcCF); } } //Let's move the custom array to the end so it happens last //FREEPBX-12515 //Store in a temporary variable. If Null we make it an empty array $holdarray = $this->modfiles['byconfig']; //Unset it from the array unset($this->modfiles['byconfig']); //Add it back to the array $this->modfiles['byconfig'] = $holdarray; $ampowner = $AMPASTERISKWEBUSER; /* Address concerns carried over from amportal in FREEPBX-8268. If the apache user is different * than the Asterisk user we provide permissions that allow both. */ $ampgroup = $AMPASTERISKWEBUSER != $AMPASTERISKUSER ? $AMPASTERISKGROUP : $AMPASTERISKWEBGROUP; $fcount = 0; if (!$this->quiet) { $output->write("\t" . _("Collecting Files...")); } $exclusive = $input->hasOption('file') ? $input->getOption('file') : null; $process = array(); foreach ($this->modfiles as $moduleName => $modfilelist) { if (!is_array($modfilelist)) { continue; } foreach ($modfilelist as $file) { switch ($file['type']) { case 'file': case 'dir': if (empty($exclusive) || $exclusive == $file['path']) { $file['files'] = array($file['path']); $fcount++; } else { continue 2; } break; case 'execdir': case 'rdir': $files = $this->recursiveDirList($file['path']); $children = false; if (empty($exclusive) || $exclusive == $file['path']) { $file['files'] = array($file['path']); $fcount++; $children = true; } foreach ($files as $f) { if (empty($exclusive) || $children || $exclusive == $f) { $file['files'][] = $f; $fcount++; } else { continue; } } if (empty($file['files'])) { continue 2; } break; } $process[$file['type']][] = $file; } } $verbose = $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE; if (!$this->quiet) { $output->writeln(_("Done")); if (!$verbose) { $progress = new ProgressBar($output, $fcount); $progress->setRedrawFrequency(100); $progress->start(); } } foreach ($process as $type => $modfilelist) { foreach ($modfilelist as $file) { if (!isset($file['path']) || !isset($file['perms']) || !file_exists($file['path'])) { if (!$this->quiet && !$verbose) { $progress->advance(); } continue; } //Handle custom ownership (optional) $owner = isset($file['owner']) ? $file['owner'] : $ampowner; $group = isset($file['group']) ? $file['group'] : $ampgroup; $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); foreach ($file['files'] as $path) { if ($this->checkBlacklist($path)) { $this->infos[] = sprintf(_('%s skipped by configuration'), $path); continue; } switch ($file['type']) { case 'file': case 'dir': $this->setPermissions(array($path, $owner, $group, $file['perms'])); break; case 'rdir': if (is_dir($path)) { $this->setPermissions(array($path, $owner, $group, $file['perms'])); } else { $fileperms = $this->stripExecute($file['perms']); $this->setPermissions(array($path, $owner, $group, $fileperms)); } break; case 'execdir': $this->setPermissions(array($path, $owner, $group, $file['perms'])); break; } if (!$this->quiet && !$verbose) { $progress->advance(); } } } } if (!$this->quiet && !$verbose) { $progress->finish(); } if (!$this->quiet) { $output->writeln(""); $output->writeln("Finished setting permissions"); $errors = array_unique($this->errors); foreach ($errors as $error) { $output->writeln("<error>" . $error . "</error>"); } $infos = array_unique($this->infos); foreach ($infos as $error) { $output->writeln("<info>" . $error . "</info>"); } } }
/** * Update AMI credentials in manager.conf * * @author Philippe Lindheimer * @pram mixed $user false means don't change * @pram mixed $pass password false means don't change * @pram mixed $writetimeout false means don't change * @returns boolean * * allows FreePBX to update the manager credentials primarily used by Advanced Settings and Backup and Restore. */ function fpbx_ami_update($user = false, $pass = false, $writetimeout = false) { global $amp_conf, $astman; $conf_file = $amp_conf['ASTETCDIR'] . '/manager.conf'; $ret = $ret2 = 0; $output = array(); if ($user !== false && $user != '') { exec('sed -i.bak "s/\\s*\\[general\\].*$/TEMPCONTEXT/;s/\\[.*\\]/\\[' . $amp_conf['AMPMGRUSER'] . '\\]/;s/^TEMPCONTEXT$/\\[general\\]/" ' . $conf_file, $output, $ret); if ($ret) { dbug($output); dbug($ret); freepbx_log(FPBX_LOG_ERROR, sprintf(_("Failed changing AMI user to [%s], internal failure details follow:"), $amp_conf['AMPMGRUSER'])); foreach ($output as $line) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("AMI failure details:"), $line)); } } } if ($pass !== false && $pass != '') { unset($output); exec('sed -i.bak "s/secret\\s*=.*$/secret = ' . $amp_conf['AMPMGRPASS'] . '/" ' . $conf_file, $output, $ret2); if ($ret2) { dbug($output); dbug($ret2); freepbx_log(FPBX_LOG_ERROR, sprintf(_("Failed changing AMI password to [%s], internal failure details follow:"), $amp_conf['AMPMGRPASS'])); foreach ($output as $line) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("AMI failure details:"), $line)); } } // We've changed the password, let's update the notification // $nt = notifications::create($db); $freepbx_conf =& freepbx_conf::create(); if ($amp_conf['AMPMGRPASS'] == $freepbx_conf->get_conf_default_setting('AMPMGRPASS')) { if (!$nt->exists('core', 'AMPMGRPASS')) { $nt->add_warning('core', 'AMPMGRPASS', _("Default Asterisk Manager Password Used"), _("You are using the default Asterisk Manager password that is widely known, you should set a secure password")); } } else { $nt->delete('core', 'AMPMGRPASS'); } } //attempt to set writetimeout unset($output); if ($writetimeout) { exec('sed -i.bak "s/writetimeout\\s*=.*$/writetimeout = ' . $amp_conf['ASTMGRWRITETIMEOUT'] . '/" ' . $conf_file, $output, $ret3); if ($ret3) { dbug($output); dbug($ret3); freepbx_log(FPBX_LOG_ERROR, sprintf(_("Failed changing AMI writetimout to [%s], internal failure details follow:"), $amp_conf['ASTMGRWRITETIMEOUT'])); foreach ($output as $line) { freepbx_log(FPBX_LOG_ERROR, sprintf(_("AMI failure details:"), $line)); } } } if ($ret || $ret2 || $ret3) { dbug("aborting early because previous errors"); return false; } if (!empty($astman)) { $ast_ret = $astman->Command('module reload manager'); } else { unset($output); dbug("no astman connection so trying to force through linux command line"); exec(fpbx_which('asterisk') . " -rx 'module reload manager'", $output, $ret2); if ($ret2) { dbug($output); dbug($ret2); freepbx_log(FPBX_LOG_ERROR, _("Failed to reload AMI, manual reload will be necessary, try: [asterisk -rx 'module reload manager']")); } } return true; }
/** * Start paying attention to this notification type again * * Undoes the effect of method ignore_forever * * @param string $module Raw name of the module requesting * @param string $id ID of the notification */ function undo_ignore_forever($module, $id) { $freepbx_conf =& freepbx_conf::create(); $setting = "NOTIFICATION_IGNORE_{$module}_{$id}"; $freepbx_conf->remove_conf_setting($setting); }
/** * Create admin user & email address * */ function framework_obe_intialize_admin($username, $password, $confirm_password, $email, $confirm_email) { $freepbx_conf =& freepbx_conf::create(); //create admin user framework_add_amp_admin($username, $password); //set ari password if ($freepbx_conf->conf_setting_exists('ARI_ADMIN_USERNAME') && $freepbx_conf->conf_setting_exists('ARI_ADMIN_PASSWORD')) { $freepbx_conf->set_conf_values(array('ARI_ADMIN_USERNAME' => $username, 'ARI_ADMIN_PASSWORD' => $password), true); if ($freepbx_conf->get_last_update_status != $freepbx_conf->get_conf_default_setting('ARI_ADMIN_PASSWORD')) { $nt = notifications::create($db); $nt->delete('ari', 'ARI_ADMIN_PASSWORD'); } $nt->delete('freepbx', 'NEWMODS'); } //set email address $cm =& cronmanager::create($db); $cm->save_email($email); }
/** Replaces variables in a string with the values from ampconf * eg, "%AMPWEBROOT%/admin" => "/var/www/html/admin" */ function _module_ampconf_string_replace($string) { $freepbx_conf =& freepbx_conf::create(); $target = array(); $replace = array(); foreach ($freepbx_conf->conf as $key => $value) { $target[] = '%' . $key . '%'; $replace[] = $value; } return str_replace($target, $replace, $string); }
protected function execute(InputInterface $input, OutputInterface $output, $quiet = false) { if (posix_geteuid() != 0) { $output->writeln("<error>" . _("You need to be root to run this command") . "</error>"); exit(1); } $this->quiet = $quiet; if (!$this->quiet) { $output->writeln(_("Setting Permissions") . "..."); } $freepbx_conf = \freepbx_conf::create(); $conf = $freepbx_conf->get_conf_settings(); foreach ($conf as $key => $val) { ${$key} = $val['value']; } /* * These are files Framework is responsible for This list can be * reduced by moving responsibility to other modules as a hook * where appropriate. * * Types: * file: Set permissions/ownership on a single item * dir: Set permissions/ownership on a single directory * rdir: Set permissions/ownership on a single directory then recursively on * files within less the execute bit. If the dir is 755, child files will be 644, * child directories will be set the same as the parent. * execdir: Same as rdir but the execute bit is not stripped. */ $sessdir = session_save_path(); $sessdir = !empty($session) ? $session : '/var/lib/php/session'; $args = array(); if ($input) { $args = $input->getArgument('args'); $this->moduleName = !empty($this->moduleName) ? $this->moduleName : strtolower($args[0]); } // Always update hooks before running a Chown \FreePBX::Hooks()->updateBMOHooks(); if (!empty($this->moduleName) && $this->moduleName != 'framework') { $mod = $this->moduleName; $this->modfiles[$mod][] = array('type' => 'rdir', 'path' => $AMPWEBROOT . '/admin/modules/' . $mod, 'perms' => 0755); $hooks = $this->fwcChownFiles(); $current = isset($hooks[ucfirst($mod)]) ? $hooks[ucfirst($mod)] : false; if (is_array($current)) { $this->modfiles[$mod] = array_merge_recursive($this->modfiles[$mod], $current); } } else { $webuser = \FreePBX::Freepbx_conf()->get('AMPASTERISKWEBUSER'); $web = posix_getpwnam($webuser); if (!$web) { throw new \Exception(sprintf(_("I tried to find out about %s, but the system doesn't think that user exists"), $webuser)); } $home = trim($web['dir']); if (is_dir($home)) { $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $home, 'perms' => 0755); // SSH folder needs non-world-readable permissions (otherwise ssh complains, and refuses to work) $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => "{$home}/.ssh", 'perms' => 0700); } $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $sessdir, 'perms' => 0744); $this->modfiles['framework'][] = array('type' => 'file', 'path' => '/etc/amportal.conf', 'perms' => 0640); $this->modfiles['framework'][] = array('type' => 'file', 'path' => '/etc/freepbx.conf', 'perms' => 0640); $this->modfiles['framework'][] = array('type' => 'dir', 'path' => $ASTRUNDIR, 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => \FreePBX::GPG()->getGpgLocation(), 'perms' => 0755); //we may wish to declare these manually or through some automated fashion $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTETCDIR, 'perms' => 0750); $this->modfiles['framework'][] = array('type' => 'file', 'path' => $ASTVARLIBDIR . '/.ssh/id_rsa', 'perms' => 0600); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTLOGDIR, 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTSPOOLDIR, 'perms' => 0755); //I have added these below individually, $this->modfiles['framework'][] = array('type' => 'file', 'path' => $FPBXDBUGFILE, 'perms' => 0644); $this->modfiles['framework'][] = array('type' => 'file', 'path' => $FPBX_LOG_FILE, 'perms' => 0644); //We may wish to declare files individually rather than touching everything $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTVARLIBDIR . '/' . $MOHDIR, 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $ASTVARLIBDIR . '/sounds', 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'file', 'path' => '/etc/obdc.ini', 'perms' => 0644); //we were doing a recursive on this which I think is not needed. //Changed to just be the directory //^ Needs to be the whole shebang, doesnt work otherwise $this->modfiles['framework'][] = array('type' => 'rdir', 'path' => $AMPWEBROOT, 'perms' => 0755); //Anything in bin and agi-bin should be exec'd //Should be after everything except but before hooks //So that we dont get overwritten by ampwebroot $this->modfiles['framework'][] = array('type' => 'execdir', 'path' => $AMPBIN, 'perms' => 0755); $this->modfiles['framework'][] = array('type' => 'execdir', 'path' => $ASTAGIDIR, 'perms' => 0755); //Merge static files and hook files, then act on them as a single unit $fwcCF = $this->fwcChownFiles(); if (!empty($this->modfiles) && !empty($fwcCF)) { $this->modfiles = array_merge_recursive($this->modfiles, $fwcCF); } } $ampowner = $AMPASTERISKWEBUSER; /* Address concerns carried over from amportal in FREEPBX-8268. If the apache user is different * than the Asterisk user we provide permissions that allow both. */ $ampgroup = $AMPASTERISKWEBUSER != $AMPASTERISKUSER ? $AMPASTERISKGROUP : $AMPASTERISKWEBGROUP; foreach ($this->modfiles as $moduleName => $modfilelist) { foreach ($modfilelist as $file) { if (!isset($file['path']) || !isset($file['perms']) || !file_exists($file['path'])) { continue; } //Handle custom ownership (optional) $owner = isset($file['owner']) ? $file['owner'] : $ampowner; $group = isset($file['group']) ? $file['group'] : $ampgroup; //Set warning for bad permissions and move on $this->padPermissions($file['path'], $file['perms']); $file['type'] = isset($file['type']) ? $file['type'] : 'file'; switch ($file['type']) { case 'file': case 'dir': $path = \ForceUTF8\Encoding::toLatin1($file['path']); $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); $json = @json_encode(array($path, $owner, $group, $file['perms'])); $err = $this->jsonError(); if (empty($err)) { $this->actions->enqueue($json); } else { $this->errors[] = sprintf(_('An error occurred while adding file %s because %s'), $f, $err); } break; case 'rdir': $fileperms = $this->stripExecute($file['perms']); $files = $this->recursiveDirList($file['path']); $path = \ForceUTF8\Encoding::toLatin1($file['path']); $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); $json = @json_encode(array($path, $owner, $group, $file['perms'])); $err = $this->jsonError(); if (empty($err)) { $this->actions->enqueue($json); } else { $this->errors[] = sprintf(_('An error occurred while adding file %s because %s'), $f, $err); } foreach ($files as $f) { if (is_dir($f)) { $path = \ForceUTF8\Encoding::toLatin1($f); $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); $json = @json_encode(array($path, $owner, $group, $file['perms'])); $err = $this->jsonError(); if (empty($err)) { $this->actions->enqueue($json); } else { $this->errors[] = sprintf(_('An error occurred while adding file %s because %s'), $f, $err); } } else { $path = \ForceUTF8\Encoding::toLatin1($f); $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); $json = @json_encode(array($path, $owner, $group, $fileperms)); $err = $this->jsonError(); if (empty($err)) { $this->actions->enqueue($json); } else { $this->errors[] = sprintf(_('An error occurred while adding file %s because %s'), $f, $err); } } } break; case 'execdir': $files = $this->recursiveDirList($file['path']); $path = \ForceUTF8\Encoding::toLatin1($file['path']); $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); $json = @json_encode(array($path, $owner, $group, $file['perms'])); $err = $this->jsonError(); if (empty($err)) { $this->actions->enqueue($json); } else { $this->errors[] = sprintf(_('An error occurred while adding file %s because %s'), $f, $err); } foreach ($files as $f) { $path = \ForceUTF8\Encoding::toLatin1($f); $owner = \ForceUTF8\Encoding::toLatin1($owner); $group = \ForceUTF8\Encoding::toLatin1($group); $json = @json_encode(array($path, $owner, $group, $file['perms'])); $err = $this->jsonError(); if (empty($err)) { $this->actions->enqueue($json); } else { $this->errors[] = sprintf(_('An error occurred while adding file %s because %s'), $f, $err); } } break; } } } $actioncount = count($this->actions); if (!$this->quiet) { $progress = new ProgressBar($output, $actioncount); $progress->setRedrawFrequency(100); $progress->start(); } foreach ($this->actions as $action) { $action = json_decode($action, true); //Ignore call files, Asterisk may process/delete them before we get to them. if (pathinfo($action[0], PATHINFO_EXTENSION) == 'call') { continue; } $this->singleChown($action[0], $action[1], $action[2]); $this->singlePerms($action[0], $action[3]); if (!$this->quiet) { $progress->advance(); } } if (!$this->quiet) { $progress->finish(); $output->writeln(""); $output->writeln("Finished setting permissions"); foreach ($this->errors as $error) { $output->writeln("<error>" . $error . "</error>"); } foreach ($this->infos as $error) { $output->writeln("<info>" . $error . "</info>"); } } }
function generate_http_additional($ast_version) { $freepbx_conf =& freepbx_conf::create(); $output = "[general]\n"; $output .= "enabled=" . ($freepbx_conf->get_conf_setting('HTTPENABLED') ? 'yes' : 'no') . "\n"; $output .= "enablestatic=" . ($freepbx_conf->get_conf_setting('HTTPENABLESTATIC') ? 'yes' : 'no') . "\n"; $output .= "bindaddr=" . $freepbx_conf->get_conf_setting('HTTPBINDADDRESS') . "\n"; $output .= "bindport=" . $freepbx_conf->get_conf_setting('HTTPBINDPORT') . "\n"; $output .= "prefix=" . $freepbx_conf->get_conf_setting('HTTPPREFIX') . "\n"; return $output; }
<?php //add setting for buffer compression callback global $amp_conf; include_once $amp_conf['AMPWEBROOT'] . '/admin/libraries/freepbx_conf.class.php'; $freepbx_conf =& freepbx_conf::create(); // remove hidden settings to get rid of confusion that it can't be changed // if ($freepbx_conf->conf_setting_exists('AS_DISPLAY_HIDDEN_SETTINGS')) { $freepbx_conf->set_conf_values(array('AS_DISPLAY_HIDDEN_SETTINGS' => false), true); } // Get the rtp ports Asterisk is configured for, make sure we start on even port // $rtp_ports = parse_ini_file($amp_conf['ASTETCDIR'] . "/rtp.conf"); if (!empty($rtp_ports['rtpstart']) && !empty($rtp_ports['rtpend'])) { $parms = array($rtp_ports['rtpstart'], $rtp_ports['rtpend']); $result = $db->query("INSERT INTO `admin` (`variable`, `value`) VALUES ('RTPSTART', ?), ('RTPEND', ?)", $parms); if (DB::IsError($result)) { out(_("ERROR: could not insert previous values for rpt.conf, they may already exist")); } else { out(_("Inserted interim RTPSTART and RTPEND settings")); } } // Saved the interim values, now remove the file as it's supplied by core. If this was a link it will be relinked. // if (file_exists($amp_conf['ASTETCDIR'] . "/rtp.conf")) { out(_("removing rtp.conf it will be symlinked from core")); unlink($amp_conf['ASTETCDIR'] . "/rtp.conf"); } // Remove res_odbc.conf it it's not a symlink and if possible save it as // res_odbc_custom.conf
function url_get_contents($url, $request, $verb = 'get', $params = array()) { $params['sv'] = 2; global $amp_conf; $verb = strtolower($verb); $contents = null; if (!$amp_conf['MODULEADMINWGET']) { $pest = new Pest($url); try { $contents = $pest->{$verb}($url . $request, $params); if (isset($pest->last_headers['x-regenerate-id'])) { $this->_regenerate_unique_id(); } return $contents; } catch (Exception $e) { freepbx_log(FPBX_LOG_ERROR, sprintf(_('Failed to get remote file, error was:'), (string) $e->getMessage())); } } $fn = $url . $request; if (empty($contents)) { $fn2 = str_replace('&', '\\&', $fn); $p = !empty($params) ? "--post-data '" . http_build_query($params) . "'" : ""; exec("wget --tries=1 --timeout=30 {$p} -O - {$fn2} 2>> /dev/null", $data_arr, $retcode); if ($retcode) { // if server isn't available for some reason should return non-zero // so we return and we don't set the flag below freepbx_log(FPBX_LOG_ERROR, sprintf(_('Failed to get remote file, mirror site may be down: %s'), $fn)); // We are here if contents were blank. It's possible that whatever we were getting were suppose to be blank // so we only auto set the WGET var if we received something so as to not false trigger. If there are issues // with content filters that this is designed to get around, we will eventually get a non-empty file which // will trigger this for now and the future. return null; } elseif (!empty($data_arr) && !$amp_conf['MODULEADMINWGET']) { $freepbx_conf =& freepbx_conf::create(); $freepbx_conf->set_conf_values(array('MODULEADMINWGET' => true), true); $nt =& notifications::create($db); $text = sprintf(_("Forced %s to true"), 'MODULEADMINWGET'); $extext = sprintf(_("The system detected a problem trying to access external server data and changed internal setting %s (Use wget For Module Admin) to true, see the tooltip in Advanced Settings for more details."), 'MODULEADMINWGET'); $nt->add_warning('freepbx', 'MODULEADMINWGET', $text, $extext, '', false, true); } $headers = get_headers_assoc($fn2); if (isset($headers['x-regenerate-id'])) { $this->_regenerate_unique_id(); } $contents = implode("\n", $data_arr); return $contents; } }
function generate_http_additional($ast_version) { $freepbx_conf =& freepbx_conf::create(); $output = "[general]\n"; $output .= "enabled=" . ($freepbx_conf->get_conf_setting('HTTPENABLED') ? 'yes' : 'no') . "\n"; $output .= "enablestatic=" . ($freepbx_conf->get_conf_setting('HTTPENABLESTATIC') ? 'yes' : 'no') . "\n"; $output .= "bindaddr=" . $freepbx_conf->get_conf_setting('HTTPBINDADDRESS') . "\n"; $output .= "bindport=" . $freepbx_conf->get_conf_setting('HTTPBINDPORT') . "\n"; $output .= "prefix=" . $freepbx_conf->get_conf_setting('HTTPPREFIX') . "\n"; $output .= "sessionlimit=" . $freepbx_conf->get_conf_setting('HTTPSESSIONLIMIT') . "\n"; $output .= "session_inactivity=" . $freepbx_conf->get_conf_setting('HTTPSESSIONINACTIVITY') . "\n"; $output .= "session_keep_alive=" . $freepbx_conf->get_conf_setting('HTTPSESSIONKEEPALIVE') . "\n"; $tls = $freepbx_conf->get_conf_setting('HTTPTLSENABLE'); if ($tls) { $output .= "tlsenable=yes\n"; // Is this an IPv6 address? If so, it needs brackets around it. $bindaddr = $freepbx_conf->get_conf_setting('HTTPTLSBINDADDRESS'); if (filter_var($bindaddr, \FILTER_VALIDATE_IP, \FILTER_FLAG_IPV6)) { $bindaddr = "[{$bindaddr}]"; } $output .= "tlsbindaddr={$bindaddr}:" . $freepbx_conf->get_conf_setting('HTTPTLSBINDPORT') . "\n"; $output .= "tlscertfile=" . $freepbx_conf->get_conf_setting('HTTPTLSCERTFILE') . "\n"; $output .= "tlsprivatekey=" . $freepbx_conf->get_conf_setting('HTTPTLSPRIVATEKEY') . "\n"; } return $output; }