Add. force_ping option for extension (#1809)

* Add. `force_ping` option for extension

This option force FS send SIP OPTIONS message to
detect if this reged device still available.

* Update language file.
This commit is contained in:
Alexey Melnichuk
2016-08-11 18:46:54 +03:00
committed by FusionPBX
parent 29050e29f3
commit 252f4db916
4 changed files with 81 additions and 1 deletions

View File

@@ -132,6 +132,10 @@
$y++;
$apps[$x]['permissions'][$y]['name'] = "extension_registered";
$y++;
$apps[$x]['permissions'][$y]['name'] = "extension_force_ping";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
//schema details
@@ -413,7 +417,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "force_ping";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y = 1; //table array index

View File

@@ -390,6 +390,19 @@ $text['label-absolute_codec_string']['ro'] = "";
$text['label-absolute_codec_string']['ar-eg'] = "";
$text['label-absolute_codec_string']['he'] = "";
$text['label-force_ping']['en-us'] = "Force ping";
$text['label-force_ping']['es-cl'] = "";
$text['label-force_ping']['pt-pt'] = "";
$text['label-force_ping']['fr-fr'] = "";
$text['label-force_ping']['pt-br'] = "";
$text['label-force_ping']['pl'] = "";
$text['label-force_ping']['uk'] = "";
$text['label-force_ping']['sv-se'] = "";
$text['label-force_ping']['de-at'] = "";
$text['label-force_ping']['ro'] = "";
$text['label-force_ping']['ar-eg'] = "";
$text['label-force_ping']['he'] = "";
$text['label-rewrite_tls_contact_port']['en-us'] = "Rewrite TLS Contact Port";
$text['label-rewrite_tls_contact_port']['es-cl'] = "Reescribir Contacto Puerto TLS";
$text['label-rewrite_tls_contact_port']['pt-pt'] = "Reescreva Contacto Porto TLS";
@@ -1261,6 +1274,19 @@ $text['description-absolute_codec_string']['ro'] = "";
$text['description-absolute_codec_string']['ar-eg'] = "";
$text['description-absolute_codec_string']['he'] = "";
$text['description-force_ping']['en-us'] = "Use OPTIONS to detect if extension is reacheable";
$text['description-force_ping']['es-cl'] = "";
$text['description-force_ping']['pt-pt'] = "";
$text['description-force_ping']['fr-fr'] = "";
$text['description-force_ping']['pt-br'] = "";
$text['description-force_ping']['pl'] = "";
$text['description-force_ping']['uk'] = "";
$text['description-force_ping']['sv-se'] = "";
$text['description-force_ping']['de-at'] = "";
$text['description-force_ping']['ro'] = "";
$text['description-force_ping']['ar-eg'] = "";
$text['description-force_ping']['he'] = "";
$text['description-missed_call']['en-us'] = "Select the notification type, and enter the appropriate destination.";
$text['description-missed_call']['es-cl'] = "Seleccione el tipo de notificación, y entrar en el destino apropiado.";
$text['description-missed_call']['pt-pt'] = "Selecione o tipo de notificação e digite o destino apropriado.";

View File

@@ -136,6 +136,7 @@ else {
$mwi_account = check_str($_POST["mwi_account"]);
$sip_bypass_media = check_str($_POST["sip_bypass_media"]);
$absolute_codec_string = check_str($_POST["absolute_codec_string"]);
$force_ping = check_str($_POST["force_ping"]);
$dial_string = check_str($_POST["dial_string"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
@@ -468,6 +469,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('extension_absolute_codec_string')) {
$sql .= "absolute_codec_string, ";
}
if (permission_exists('extension_force_ping')) {
$sql .= "force_ping, ";
}
if (permission_exists('extension_dial_string')) {
$sql .= "dial_string, ";
}
@@ -538,6 +542,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('extension_absolute_codec_string')) {
$sql .= "'$absolute_codec_string', ";
}
if (permission_exists('extension_force_ping')) {
$sql .= "'$force_ping', ";
}
if (permission_exists('extension_dial_string')) {
$sql .= "'$dial_string', ";
}
@@ -698,6 +705,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('extension_absolute_codec_string')) {
$sql .= "absolute_codec_string = '$absolute_codec_string', ";
}
if (permission_exists('extension_force_ping')) {
$sql .= "force_ping = '$force_ping', ";
}
if (permission_exists('extension_dial_string')) {
$sql .= "dial_string = '$dial_string', ";
}
@@ -864,6 +874,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$mwi_account = $row["mwi_account"];
$sip_bypass_media = $row["sip_bypass_media"];
$absolute_codec_string = $row["absolute_codec_string"];
$force_ping = $row["force_ping"];
$dial_string = $row["dial_string"];
$enabled = $row["enabled"];
$description = $row["description"];
@@ -1943,6 +1954,38 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
}
if (permission_exists('extension_force_ping')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-force_ping']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='force_ping'>\n";
if ($force_ping == "") {
echo " <option value='' selected='selected'></option>\n";
}
else {
echo " <option value=''></option>\n";
}
if ($force_ping == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($force_ping == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-force_ping']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (permission_exists('extension_domain')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";

View File

@@ -253,6 +253,7 @@
nibble_account = row.nibble_account;
sip_bypass_media = row.sip_bypass_media;
absolute_codec_string = row.absolute_codec_string;
force_ping = row.force_ping;
forward_all_enabled = row.forward_all_enabled;
forward_all_destination = row.forward_all_destination;
forward_busy_enabled = row.forward_busy_enabled;
@@ -460,6 +461,9 @@
if (string.len(absolute_codec_string) > 0) then
table.insert(xml, [[ <variable name="absolute_codec_string" value="]] .. absolute_codec_string .. [["/>]]);
end
if (string.len(force_ping) > 0) then
table.insert(xml, [[ <variable name="force_ping" value="]] .. force_ping .. [["/>]]);
end
if (sip_bypass_media == "bypass-media") then
table.insert(xml, [[ <variable name="bypass_media" value="true"/>]]);
end