Add contact-params (#6545)

Adding contact params for control over this setting.
This commit is contained in:
FusionPBX 2023-02-06 22:24:16 -07:00 committed by GitHub
parent 46854d4025
commit 09c41b88ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 73 additions and 4 deletions

View File

@ -185,6 +185,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'] = "contact_params";
$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'] = "retry_seconds";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";

View File

@ -357,6 +357,27 @@ $text['label-register_transport']['ru-ru'] = "Регистрация Транс
$text['label-register_transport']['sv-se'] = "Register Transport";
$text['label-register_transport']['uk-ua'] = "Транспорт для реєстрації";
$text['label-contact_params']['en-us'] = "Contact Params";
$text['label-contact_params']['en-gb'] = "Contact Params";
$text['label-contact_params']['ar-eg'] = "";
$text['label-contact_params']['de-at'] = ""; //copied from de-de
$text['label-contact_params']['de-ch'] = ""; //copied from de-de
$text['label-contact_params']['de-de'] = "";
$text['label-contact_params']['es-cl'] = "";
$text['label-contact_params']['es-mx'] = ""; //copied from es-cl
$text['label-contact_params']['fr-ca'] = ""; //copied from fr-fr
$text['label-contact_params']['fr-fr'] = "";
$text['label-contact_params']['he-il'] = "";
$text['label-contact_params']['it-it'] = "";
$text['label-contact_params']['nl-nl'] = "";
$text['label-contact_params']['pl-pl'] = "";
$text['label-contact_params']['pt-br'] = "";
$text['label-contact_params']['pt-pt'] = "";
$text['label-contact_params']['ro-ro'] = "";
$text['label-contact_params']['ru-ru'] = "";
$text['label-contact_params']['sv-se'] = "";
$text['label-contact_params']['uk-ua'] = "";
$text['label-register_proxy']['en-us'] = "Register Proxy";
$text['label-register_proxy']['en-gb'] = "Register Proxy";
$text['label-register_proxy']['ar-eg'] = "";
@ -1071,6 +1092,27 @@ $text['description-register_transport']['ru-ru'] = "Выберите предп
$text['description-register_transport']['sv-se'] = "Välj om registrera transport eller ej.";
$text['description-register_transport']['uk-ua'] = "Choose whether to register-transport.";
$text['description-contact_params']['en-us'] = "Enter the contact params here.";
$text['description-contact_params']['en-gb'] = "Enter the contact params here.";
$text['description-contact_params']['ar-eg'] = "";
$text['description-contact_params']['de-at'] = "";
$text['description-contact_params']['de-ch'] = "";
$text['description-contact_params']['de-de'] = "";
$text['description-contact_params']['es-cl'] = "";
$text['description-contact_params']['es-mx'] = "";
$text['description-contact_params']['fr-ca'] = "";
$text['description-contact_params']['fr-fr'] = "";
$text['description-contact_params']['he-il'] = "";
$text['description-contact_params']['it-it'] = "";
$text['description-contact_params']['nl-nl'] = "";
$text['description-contact_params']['pl-pl'] = "";
$text['description-contact_params']['pt-br'] = "";
$text['description-contact_params']['pt-pt'] = "";
$text['description-contact_params']['ro-ro'] = "";
$text['description-contact_params']['ru-ru'] = "";
$text['description-contact_params']['sv-se'] = "";
$text['description-contact_params']['uk-ua'] = "";
$text['description-register_proxy']['en-us'] = "Enter the hostname or IP address of the register proxy. host[:port]";
$text['description-register_proxy']['en-gb'] = "Enter the hostname or IP address of the register proxy. host[:port]";
$text['description-register_proxy']['ar-eg'] = "أدخل اسم المضيف أو عنوان إب الخاص بروكسي السجل. (وهذا يمكن أن تتخذ شكل المضيف: ميناء)";

View File

@ -71,6 +71,7 @@
$expire_seconds = $row["expire_seconds"];
$register = $row["register"];
$register_transport = $row["register_transport"];
$contact_params = $row["contact_params"];
$retry_seconds = $row["retry_seconds"];
$extension = $row["extension"];
$codec_prefs = $row["codec_prefs"];
@ -116,6 +117,7 @@
$array['gateways'][0]['expire_seconds'] = $expire_seconds;
$array['gateways'][0]['register'] = $register;
$array['gateways'][0]['register_transport'] = $register_transport;
$array['gateways'][0]['contact_params'] = $contact_params;
$array['gateways'][0]['retry_seconds'] = $retry_seconds;
$array['gateways'][0]['extension'] = $extension;
$array['gateways'][0]['codec_prefs'] = $codec_prefs;

View File

@ -94,6 +94,7 @@
$expire_seconds = $_POST["expire_seconds"];
$register = $_POST["register"];
$register_transport = $_POST["register_transport"];
$contact_params = $_POST["contact_params"];
$retry_seconds = $_POST["retry_seconds"];
$extension = $_POST["extension"];
$ping = $_POST["ping"];
@ -181,6 +182,7 @@
$array['gateways'][$x]["expire_seconds"] = $expire_seconds;
$array['gateways'][$x]["register"] = $register;
$array['gateways'][$x]["register_transport"] = $register_transport;
$array['gateways'][$x]["contact_params"] = $contact_params;
$array['gateways'][$x]["retry_seconds"] = $retry_seconds;
$array['gateways'][$x]["extension"] = $extension;
$array['gateways'][$x]["ping"] = $ping;
@ -285,6 +287,7 @@
$expire_seconds = $row["expire_seconds"];
$register = $row["register"];
$register_transport = $row["register_transport"];
$contact_params = $row["contact_params"];
$retry_seconds = $row["retry_seconds"];
$extension = $row["extension"];
$ping = $row["ping"];
@ -588,6 +591,17 @@
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-contact_params']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='contact_params' maxlength='255' value=\"".escape($contact_params)."\">\n";
echo "<br />\n";
echo $text['description-contact_params']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-register_proxy']."\n";

View File

@ -172,12 +172,16 @@
table.insert(xml, [[ <param name="register-transport" value="tcp"/>]]);
elseif (field.register_transport == "tls") then
table.insert(xml, [[ <param name="register-transport" value="tls"/>]]);
table.insert(xml, [[ <param name="contact-params" value="transport=tls"/>]]);
else
table.insert(xml, [[ <param name="register-transport" value="udp"/>]]);
end
end
if (field.contact_params) then
table.insert(xml, [[ <param name="contact-params" value="]] .. field.contact_params .. [["/>]]);
end
if (string.len(field.retry_seconds) > 0) then
table.insert(xml, [[ <param name="retry-seconds" value="]] .. field.retry_seconds .. [["/>]]);
end

View File

@ -308,13 +308,16 @@ function save_gateway_xml() {
break;
case "tls":
$xml .= " <param name=\"register-transport\" value=\"tls\"/>\n";
$xml .= " <param name=\"contact-params\" value=\"transport=tls\"/>\n";
break;
default:
$xml .= " <param name=\"register-transport\" value=\"" . $row['register_transport'] . "\"/>\n";
}
}
if (strlen($row['contact_params']) > 0) {
$xml .= " <param name=\"contact-params\" value=\"" . $row['contact_params'] . "\"/>\n";
}
if (strlen($row['retry_seconds']) > 0) {
$xml .= " <param name=\"retry-seconds\" value=\"" . $row['retry_seconds'] . "\"/>\n";
}