Add h hostname to option for the gateways.

This commit is contained in:
markjcrane
2015-10-04 01:29:03 -06:00
parent 876516e307
commit 58edf1613d
5 changed files with 52 additions and 0 deletions

View File

@@ -189,6 +189,11 @@
$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'] = "hostname";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(255)";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";

View File

@@ -442,6 +442,15 @@ $text['label-expire_seconds']['de-at'] = "Expire Seconds";
$text['label-expire_seconds']['ar-eg'] = "";
$text['label-expire_seconds']['he'] = "";
$text['label-hostname']['en-us'] = "Hostname";
$text['label-hostname']['pt-pt'] = "Hostname";
$text['label-hostname']['fr-fr'] = "Nom d'hôte";
$text['label-hostname']['pt-br'] = "Hostname";
$text['label-hostname']['pl'] = "Nazwa hosta";
$text['label-hostname']['sv-se'] = "Hostname";
$text['label-hostname']['uk'] = "Назва хоста";
$text['label-hostname']['de-at'] = "Hostname";
$text['label-enabled']['en-us'] = "Enabled";
$text['label-enabled']['es-cl'] = "Activado";
$text['label-enabled']['pt-pt'] = "Habilitado";
@@ -870,6 +879,15 @@ $text['description-expire_seconds']['de-at'] = "Geben Sie an, nach wie vielen Se
$text['description-expire_seconds']['ar-eg'] = "";
$text['description-expire_seconds']['he'] = "";
$text['description-hostname']['en-us'] = "Enter the hostname / switchname.";
$text['description-hostname']['pt-pt'] = "Introduza o hostname";
$text['description-hostname']['fr-fr'] = "Entrer le nom de l'hôte / du switch.";
$text['description-hostname']['pt-br'] = "Insira o hostname";
$text['description-hostname']['pl'] = "Wprowadź nazwę hosta / PBXu.";
$text['description-hostname']['sv-se'] = "Fyll i hostname / switchname.";
$text['description-hostname']['uk'] = "Введіть назву хоста / switchname.";
$text['description-hostname']['de-at'] = "Geben Sie den Hostnamen / Switchnamen an.";
$text['description-enabled']['en-us'] = "Enable or Disable the Gateway";
$text['description-enabled']['es-cl'] = "Activar o Desactivar la Pasarela";
$text['description-enabled']['pt-pt'] = "Habilitar ou Desabilitar o Gateway";

View File

@@ -95,6 +95,7 @@ else {
$extension_in_contact = check_str($_POST["extension_in_contact"]);
$context = check_str($_POST["context"]);
$profile = check_str($_POST["profile"]);
$hostname = check_str($_POST["hostname"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
@@ -198,6 +199,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "extension_in_contact, ";
$sql .= "context, ";
$sql .= "profile, ";
$sql .= "hostname, ";
$sql .= "enabled, ";
$sql .= "description ";
$sql .= ")";
@@ -232,6 +234,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "'$extension_in_contact', ";
$sql .= "'$context', ";
$sql .= "'$profile', ";
if (strlen($hostname) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'$hostname', ";
}
$sql .= "'$enabled', ";
$sql .= "'$description' ";
$sql .= ")";
@@ -278,6 +286,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
else {
$sql .= "domain_uuid = '$domain_uuid', ";
}
if (strlen($hostname) == 0) {
$sql .= "hostname = null, ";
}
else {
$sql .= "hostname = '$hostname', ";
}
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where gateway_uuid = '$gateway_uuid'";
@@ -374,6 +388,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$extension_in_contact = $row["extension_in_contact"];
$context = $row["context"];
$profile = $row["profile"];
$hostname = $row["hostname"];
$enabled = $row["enabled"];
$description = $row["description"];
}
@@ -871,6 +886,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-hostname']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='hostname' maxlength='255' value=\"$hostname\">\n";
echo "<br />\n";
echo $text['description-hostname']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";

View File

@@ -159,6 +159,7 @@ else {
echo "<th>".$text['label-action']."</th>\n";
echo "<th>".$text['label-state']."</th>\n";
}
echo th_order_by('hostname', $text['label-hostname'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>";
@@ -183,6 +184,7 @@ else {
}
echo "</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row["context"]."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row["hostname"]."</td>\n";
if ($fp) {
if ($row["enabled"] == "true") {
$response = switch_gateway_status($row["gateway_uuid"]);

View File

@@ -119,6 +119,7 @@
sql = "select * from v_gateways ";
sql = sql .. "where enabled = 'true' and profile = '"..sip_profile_name.."' ";
end
sql = sql .. "and (g.hostname = '" .. hostname.. "' or g.hostname is null or g.hostname = '') ";
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
end