I suggest this because now it takes about 5s for FreePBX to rewrite configuration files and reload Asterisk server. Is it more convenient to have app-* hard-coded in core/etc/extensions.conf ? Because rarely people will disable feature codes, and it will save time for the retrieve_conf to read those _get_config functions. At least, the core modules (core, framework, voicemail, callwaiting, call forward…) can be hard-code as macro. Then why bother reading functions.inc.* ?
This is a sweet project!
I think your assessment about disabling feature codes is quite inaccurate. As a general rule, everything over time is moving to auto-generation. We won’t go the other way. Reloading is not that common of a thing and there are also a lot of other reasons why it is better to have these auto generated, such as the ability of other modules or custom modules to splice into an change them.
Hi, I saw these piece of code in core/functions.inc.php:
/*
core_get_config($engine){}
*/
$userlist = core_users_list();
if (is_array($userlist)) {
foreach($userlist as $item) {
$exten = core_users_get($item[0]);
$vm = ((($exten['voicemail'] == "novm") || ($exten['voicemail'] == "disabled") || ($exten['voicemail'] == "")) ? "novm" : $exten['extension']);
if (isset($exten['ringtimer']) && $exten['ringtimer'] != 0)
$ext->add('ext-local', $exten['extension'], '', new ext_setvar('__RINGTIMER',$exten['ringtimer']));
$ext->add('ext-local', $exten['extension'], '', new ext_macro('exten-vm',$vm.",".$exten['extension']));
$ext->add('ext-local', $exten['extension'], '', new ext_hangup(''));
if($vm != "novm") {
$ext->add('ext-local', '${VM_PREFIX}'.$exten['extension'], '', new ext_macro('vm',"$vm,DIRECTDIAL"));
$ext->add('ext-local', '${VM_PREFIX}'.$exten['extension'], '', new ext_hangup(''));
$ext->add('ext-local', 'vmb'.$exten['extension'], '', new ext_macro('vm',"$vm,BUSY"));
$ext->add('ext-local', 'vmb'.$exten['extension'], '', new ext_hangup(''));
$ext->add('ext-local', 'vmu'.$exten['extension'], '', new ext_macro('vm',"$vm,NOANSWER"));
$ext->add('ext-local', 'vmu'.$exten['extension'], '', new ext_hangup(''));
$ext->add('ext-local', 'vms'.$exten['extension'], '', new ext_macro('vm',"$vm,NOMESSAGE"));
$ext->add('ext-local', 'vms'.$exten['extension'], '', new ext_hangup(''));
}
and about the function core_users_list():
function core_users_list() {
$results = sql("SELECT extension,name,voicemail FROM users ORDER BY exte
nsion","getAll");
//only allow extensions that are within administrator's allowed range
foreach($results as $result){
if (checkRange($result[0])){
$extens[] = array($result[0],$result[1],$result[2]);
}
}
if (isset($extens)) {
sort($extens);
return $extens;
} else {
return null;
}
}
So, if an administrator, who can only use extension 100 - 200, press the reload bar, then FreePBX won’t write configuration for other extension below 100 and above 200 in ext-local. Is it right? I wonder is it the right choice?