Add max registrations per extension setting

This commit is contained in:
agree 2021-04-11 00:28:06 -04:00
parent 3ce50ef8d2
commit 5967dfbfaf
4 changed files with 71 additions and 0 deletions

View File

@ -212,6 +212,9 @@
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "user";
$y++;
$apps[$x]['permissions'][$y]['name'] = "extension_max_registrations";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "extension_limit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
@ -435,6 +438,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "max_registrations";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "limit_max";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";

View File

@ -1100,6 +1100,27 @@ $text['label-line']['ru-ru'] = "Линия";
$text['label-line']['sv-se'] = "Linje";
$text['label-line']['uk-ua'] = "";
$text['label-max_registrations']['en-us'] = "Max Registrations";
$text['label-max_registrations']['en-gb'] = "Max Registrations";
$text['label-max_registrations']['ar-eg'] = "Max Registrations";
$text['label-max_registrations']['de-at'] = "Max Registrations";
$text['label-max_registrations']['de-ch'] = "Max Registrations";
$text['label-max_registrations']['de-de'] = "Max Registrations";
$text['label-max_registrations']['es-cl'] = "Max Registrations";
$text['label-max_registrations']['es-mx'] = "Max Registrations";
$text['label-max_registrations']['fr-ca'] = "Max Registrations";
$text['label-max_registrations']['fr-fr'] = "Max Registrations";
$text['label-max_registrations']['he-il'] = "Max Registrations";
$text['label-max_registrations']['it-it'] = "Max Registrations";
$text['label-max_registrations']['nl-nl'] = "Max Registrations";
$text['label-max_registrations']['pl-pl'] = "Max Registrations";
$text['label-max_registrations']['pt-br'] = "Max Registrations";
$text['label-max_registrations']['pt-pt'] = "Max Registrations";
$text['label-max_registrations']['ro-ro'] = "Max Registrations";
$text['label-max_registrations']['ru-ru'] = "Max Registrations";
$text['label-max_registrations']['sv-se'] = "Max Registrations";
$text['label-max_registrations']['uk-ua'] = "Max Registrations";
$text['label-limit_max']['en-us'] = "Limit Max";
$text['label-limit_max']['en-gb'] = "Limit Max";
$text['label-limit_max']['ar-eg'] = "";
@ -2410,6 +2431,27 @@ $text['description-missed_call']['ru-ru'] = "Выберите тип уведо
$text['description-missed_call']['sv-se'] = "Välj typ anmälan, och ange lämplig destination.";
$text['description-missed_call']['uk-ua'] = "Виберіть тип повідомлення, і ввести відповідний пункт призначення.";
$text['description-max_registrations']['en-us'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['en-gb'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['ar-eg'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['de-at'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['de-ch'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['de-de'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['es-cl'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['es-mx'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['fr-ca'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['fr-fr'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['he-il'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['it-it'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['nl-nl'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['pl-pl'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['pt-br'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['pt-pt'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['ro-ro'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['ru-ru'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['sv-se'] = "Enter the maximum registration allowed for this user";
$text['description-max_registrations']['uk-ua'] = "Enter the maximum registration allowed for this user";
$text['description-limit_max']['en-us'] = "Enter the max number of outgoing calls for this user.";
$text['description-limit_max']['en-gb'] = "Enter the max number of outgoing calls for this user.";
$text['description-limit_max']['ar-eg'] = "";

View File

@ -102,6 +102,7 @@
$directory_last_name = $_POST["directory_last_name"];
$directory_visible = $_POST["directory_visible"];
$directory_exten_visible = $_POST["directory_exten_visible"];
$max_registrations = $_POST["max_registrations"];
$limit_max = $_POST["limit_max"];
$limit_destination = $_POST["limit_destination"];
//$device_uuid = $_POST["device_uuid"];
@ -420,6 +421,10 @@
$array["extensions"][$i]["directory_visible"] = $directory_visible;
$array["extensions"][$i]["directory_exten_visible"] = $directory_exten_visible;
}
if (!permission_exists("extension_max_registrations") && $action == "add") {
$max_registrations = $_SESSION['extension']['max_registrations']['numeric'];
}
$array["extensions"][$i]["max_registrations"] = $max_registrations;
if (permission_exists("extension_limit")) {
$array["extensions"][$i]["limit_max"] = $limit_max;
$array["extensions"][$i]["limit_destination"] = $limit_destination;
@ -717,6 +722,7 @@
$directory_last_name = $row["directory_last_name"];
$directory_visible = $row["directory_visible"];
$directory_exten_visible = $row["directory_exten_visible"];
$max_registrations = $row["max_registrations"];
$limit_max = $row["limit_max"];
$limit_destination = $row["limit_destination"];
$user_context = $row["user_context"];
@ -867,6 +873,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($limit_max) == 0) { $limit_max = '5'; }
if (strlen($limit_destination) == 0) { $limit_destination = 'error/user_busy'; }
if (strlen($call_timeout) == 0) { $call_timeout = '30'; }
@ -1563,6 +1570,19 @@
echo "</tr>\n";
}
if (permission_exists("extension_max_registrations")) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-max_registrations']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='max_registrations' maxlength='255' value=\"".escape($max_registrations)."\">\n";
echo "<br />\n";
echo $text['description-max_registrations']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (permission_exists("extension_limit")) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";

View File

@ -337,6 +337,7 @@
directory_exten_visible = row.directory_exten_visible;
limit_max = row.limit_max;
call_timeout = row.call_timeout;
max_registrations = row.max_registrations;
limit_destination = row.limit_destination;
sip_force_contact = row.sip_force_contact;
sip_force_expires = row.sip_force_expires;
@ -530,6 +531,7 @@
table.insert(xml, [[ <param name="verto-dialplan" value="XML"/>]]);
table.insert(xml, [[ <param name="jsonrpc-allowed-methods" value="verto"/>]]);
table.insert(xml, [[ <param name="jsonrpc-allowed-event-channels" value="demo,conference,presence"/>]]);
table.insert(xml, [[ <param name="max-registrations-per-extension" value="]] .. max_registrations .. [["/>]]);
for key,row in pairs(extension_settings) do
if (row.extension_setting_type == 'param') then
table.insert(xml, [[ <param name="]]..row.extension_setting_name..[[" value="]]..row.extension_setting_value..[["/>]]);