Merge pull request #5930 from greenbea/default_accountcodes

Add ability to set default accountcodes
This commit is contained in:
FusionPBX
2021-05-05 21:25:45 -06:00
committed by GitHub
2 changed files with 21 additions and 0 deletions

View File

@@ -397,6 +397,11 @@
if (permission_exists('extension_accountcode')) {
$array["extensions"][$i]["accountcode"] = $accountcode;
}
else {
if ($action == "add") {
$array["extensions"][$i]["accountcode"] = get_accountcode();
}
}
if (permission_exists("effective_caller_id_name")) {
$array["extensions"][$i]["effective_caller_id_name"] = $effective_caller_id_name;
}
@@ -878,6 +883,7 @@
//set the defaults
if (strlen($user_context) == 0) { $user_context = $_SESSION['domain_name']; }
if (strlen($max_registrations) == 0) { $max_registrations = $_SESSION['extension']['max_registrations']['numeric']; }
if (strlen($accountcode) == 0) { $accountcode = get_accountcode(); }
if (strlen($limit_max) == 0) { $limit_max = '5'; }
if (strlen($limit_destination) == 0) { $limit_destination = 'error/user_busy'; }
if (strlen($call_timeout) == 0) { $call_timeout = '30'; }

View File

@@ -2192,4 +2192,19 @@ function number_pad($number,$n) {
}
}
//get accountode
if (!function_exists('get_accountcode')) {
function get_accountcode() {
if (strlen($accountcode = $_SESSION['domain']['accountcode']['text']) > 0) {
if ($accountcode == "none") {
return;
}
}
else {
$accountcode = $_SESSION['domain_name'];
}
return $accountcode;
}
}
?>