mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-09 10:08:23 +00:00
Add support for the new sip profiles enabled field.
This commit is contained in:
@@ -365,6 +365,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
unset ($prep_statement);
|
unset ($prep_statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get the sip profiles
|
||||||
|
$sql = "select sip_profile_name from v_sip_profiles ";
|
||||||
|
$sql .= "order by sip_profile_name asc ";
|
||||||
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
|
$prep_statement->execute();
|
||||||
|
$sip_profiles = $prep_statement->fetchAll();
|
||||||
|
unset ($prep_statement, $sql);
|
||||||
|
|
||||||
//set defaults
|
//set defaults
|
||||||
if (strlen($enabled) == 0) { $enabled = "true"; }
|
if (strlen($enabled) == 0) { $enabled = "true"; }
|
||||||
if (strlen($register) == 0) { $register = "true"; }
|
if (strlen($register) == 0) { $register = "true"; }
|
||||||
@@ -831,8 +839,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-profile']."\n";
|
echo " ".$text['label-profile']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
if (strlen($profile) == 0) { $profile = "external"; }
|
echo " <select class='formfld' name='profile' required='required'>\n";
|
||||||
echo " <input class='formfld' type='text' name='profile' maxlength='255' value=\"$profile\" required='required' >\n";
|
foreach ($sip_profiles as $row) {
|
||||||
|
$sip_profile_name = $row["sip_profile_name"];
|
||||||
|
if ($profile == $sip_profile_name) {
|
||||||
|
echo " <option value='$sip_profile_name' selected='selected'>".$sip_profile_name."</option>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo " <option value='$sip_profile_name'>".$sip_profile_name."</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
echo " </select>\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-profile']."\n";
|
echo $text['description-profile']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
|
|||||||
@@ -77,6 +77,7 @@
|
|||||||
$json = json_encode($xml);
|
$json = json_encode($xml);
|
||||||
$sip_profile = json_decode($json, true);
|
$sip_profile = json_decode($json, true);
|
||||||
$sip_profile_name = $sip_profile['@attributes']['name'];
|
$sip_profile_name = $sip_profile['@attributes']['name'];
|
||||||
|
$sip_profile_enabled = $sip_profile['@attributes']['enabled'];
|
||||||
//echo "sip profile name: ".$sip_profile_name."\n";
|
//echo "sip profile name: ".$sip_profile_name."\n";
|
||||||
|
|
||||||
if ($sip_profile_name != "{v_sip_profile_name}") {
|
if ($sip_profile_name != "{v_sip_profile_name}") {
|
||||||
@@ -101,53 +102,56 @@
|
|||||||
$sip_profile_description .= '';
|
$sip_profile_description .= '';
|
||||||
}
|
}
|
||||||
|
|
||||||
//add the sip profile
|
//add the sip profile if it is not false
|
||||||
$sip_profile_uuid = uuid();
|
if ($sip_profile_enabled != "false") {
|
||||||
$sql = "insert into v_sip_profiles";
|
//insert the sip profile name, description
|
||||||
$sql .= "(";
|
$sip_profile_uuid = uuid();
|
||||||
$sql .= "sip_profile_uuid, ";
|
$sql = "insert into v_sip_profiles";
|
||||||
$sql .= "sip_profile_name, ";
|
$sql .= "(";
|
||||||
$sql .= "sip_profile_description ";
|
$sql .= "sip_profile_uuid, ";
|
||||||
$sql .= ") ";
|
$sql .= "sip_profile_name, ";
|
||||||
$sql .= "values ";
|
$sql .= "sip_profile_description ";
|
||||||
$sql .= "( ";
|
$sql .= ") ";
|
||||||
$sql .= "'".check_str($sip_profile_uuid)."', ";
|
$sql .= "values ";
|
||||||
$sql .= "'".check_str($sip_profile_name)."', ";
|
$sql .= "( ";
|
||||||
$sql .= "'".check_str($sip_profile_description)."' ";
|
$sql .= "'".check_str($sip_profile_uuid)."', ";
|
||||||
$sql .= ")";
|
$sql .= "'".check_str($sip_profile_name)."', ";
|
||||||
//echo $sql."\n\n";
|
$sql .= "'".check_str($sip_profile_description)."' ";
|
||||||
$db->exec(check_sql($sql));
|
$sql .= ")";
|
||||||
unset($sql);
|
//echo $sql."\n\n";
|
||||||
|
$db->exec(check_sql($sql));
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
//add the sip profile settings
|
//add the sip profile settings
|
||||||
foreach ($sip_profile['settings']['param'] as $row) {
|
foreach ($sip_profile['settings']['param'] as $row) {
|
||||||
//get the name and value pair
|
//get the name and value pair
|
||||||
$sip_profile_setting_name = $row['@attributes']['name'];
|
$sip_profile_setting_name = $row['@attributes']['name'];
|
||||||
$sip_profile_setting_value = $row['@attributes']['value'];
|
$sip_profile_setting_value = $row['@attributes']['value'];
|
||||||
$sip_profile_setting_enabled = $row['@attributes']['enabled'];
|
$sip_profile_setting_enabled = $row['@attributes']['enabled'];
|
||||||
if ($sip_profile_setting_enabled != "false") { $sip_profile_setting_enabled = "true"; }
|
if ($sip_profile_setting_enabled != "false") { $sip_profile_setting_enabled = "true"; }
|
||||||
//echo "name: $name value: $value\n";
|
//echo "name: $name value: $value\n";
|
||||||
//add the profile settings into the database
|
//add the profile settings into the database
|
||||||
$sip_profile_setting_uuid = uuid();
|
$sip_profile_setting_uuid = uuid();
|
||||||
$sql = "insert into v_sip_profile_settings ";
|
$sql = "insert into v_sip_profile_settings ";
|
||||||
$sql .= "(";
|
$sql .= "(";
|
||||||
$sql .= "sip_profile_setting_uuid, ";
|
$sql .= "sip_profile_setting_uuid, ";
|
||||||
$sql .= "sip_profile_uuid, ";
|
$sql .= "sip_profile_uuid, ";
|
||||||
$sql .= "sip_profile_setting_name, ";
|
$sql .= "sip_profile_setting_name, ";
|
||||||
$sql .= "sip_profile_setting_value, ";
|
$sql .= "sip_profile_setting_value, ";
|
||||||
$sql .= "sip_profile_setting_enabled ";
|
$sql .= "sip_profile_setting_enabled ";
|
||||||
$sql .= ") ";
|
$sql .= ") ";
|
||||||
$sql .= "values ";
|
$sql .= "values ";
|
||||||
$sql .= "( ";
|
$sql .= "( ";
|
||||||
$sql .= "'".check_str($sip_profile_setting_uuid)."', ";
|
$sql .= "'".check_str($sip_profile_setting_uuid)."', ";
|
||||||
$sql .= "'".check_str($sip_profile_uuid)."', ";
|
$sql .= "'".check_str($sip_profile_uuid)."', ";
|
||||||
$sql .= "'".check_str($sip_profile_setting_name)."', ";
|
$sql .= "'".check_str($sip_profile_setting_name)."', ";
|
||||||
$sql .= "'".check_str($sip_profile_setting_value)."', ";
|
$sql .= "'".check_str($sip_profile_setting_value)."', ";
|
||||||
$sql .= "'".$sip_profile_setting_enabled."' ";
|
$sql .= "'".$sip_profile_setting_enabled."' ";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
//echo $sql."\n\n";
|
//echo $sql."\n\n";
|
||||||
$db->exec(check_sql($sql));
|
$db->exec(check_sql($sql));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@
|
|||||||
sql = "select p.sip_profile_name, p.sip_profile_description, s.sip_profile_setting_name, s.sip_profile_setting_value ";
|
sql = "select p.sip_profile_name, p.sip_profile_description, s.sip_profile_setting_name, s.sip_profile_setting_value ";
|
||||||
sql = sql .. "from v_sip_profiles as p, v_sip_profile_settings as s ";
|
sql = sql .. "from v_sip_profiles as p, v_sip_profile_settings as s ";
|
||||||
sql = sql .. "where s.sip_profile_setting_enabled = 'true' ";
|
sql = sql .. "where s.sip_profile_setting_enabled = 'true' ";
|
||||||
|
sql = sql .. "and s.sip_profile_enabled = 'true' ";
|
||||||
sql = sql .. "and (p.sip_profile_hostname = '" .. hostname.. "' or p.sip_profile_hostname is null or p.sip_profile_hostname = '') ";
|
sql = sql .. "and (p.sip_profile_hostname = '" .. hostname.. "' or p.sip_profile_hostname is null or p.sip_profile_hostname = '') ";
|
||||||
sql = sql .. "and p.sip_profile_uuid = s.sip_profile_uuid ";
|
sql = sql .. "and p.sip_profile_uuid = s.sip_profile_uuid ";
|
||||||
sql = sql .. "order by p.sip_profile_name asc ";
|
sql = sql .. "order by p.sip_profile_name asc ";
|
||||||
|
|||||||
@@ -2766,6 +2766,7 @@ if (!function_exists('save_sip_profile_xml')) {
|
|||||||
|
|
||||||
//get the sip profiles from the database
|
//get the sip profiles from the database
|
||||||
$sql = "select * from v_sip_profiles ";
|
$sql = "select * from v_sip_profiles ";
|
||||||
|
$sql .= "where sip_profile_enabled = 'true' ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
$prep_statement->execute();
|
$prep_statement->execute();
|
||||||
$result = $prep_statement->fetchAll();
|
$result = $prep_statement->fetchAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user