diff --git a/app/gateways/gateway_edit.php b/app/gateways/gateway_edit.php
index eb6e896dc4..8daad0d4d3 100644
--- a/app/gateways/gateway_edit.php
+++ b/app/gateways/gateway_edit.php
@@ -365,6 +365,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
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
if (strlen($enabled) == 0) { $enabled = "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 "\n";
echo "
\n";
- if (strlen($profile) == 0) { $profile = "external"; }
- echo " \n";
+ echo " \n";
echo " \n";
echo $text['description-profile']."\n";
echo " | \n";
diff --git a/app/sip_profiles/app_defaults.php b/app/sip_profiles/app_defaults.php
index 85b2e92d72..fab6a7643f 100644
--- a/app/sip_profiles/app_defaults.php
+++ b/app/sip_profiles/app_defaults.php
@@ -77,6 +77,7 @@
$json = json_encode($xml);
$sip_profile = json_decode($json, true);
$sip_profile_name = $sip_profile['@attributes']['name'];
+ $sip_profile_enabled = $sip_profile['@attributes']['enabled'];
//echo "sip profile name: ".$sip_profile_name."\n";
if ($sip_profile_name != "{v_sip_profile_name}") {
@@ -101,53 +102,56 @@
$sip_profile_description .= '';
}
- //add the sip profile
- $sip_profile_uuid = uuid();
- $sql = "insert into v_sip_profiles";
- $sql .= "(";
- $sql .= "sip_profile_uuid, ";
- $sql .= "sip_profile_name, ";
- $sql .= "sip_profile_description ";
- $sql .= ") ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".check_str($sip_profile_uuid)."', ";
- $sql .= "'".check_str($sip_profile_name)."', ";
- $sql .= "'".check_str($sip_profile_description)."' ";
- $sql .= ")";
- //echo $sql."\n\n";
- $db->exec(check_sql($sql));
- unset($sql);
+ //add the sip profile if it is not false
+ if ($sip_profile_enabled != "false") {
+ //insert the sip profile name, description
+ $sip_profile_uuid = uuid();
+ $sql = "insert into v_sip_profiles";
+ $sql .= "(";
+ $sql .= "sip_profile_uuid, ";
+ $sql .= "sip_profile_name, ";
+ $sql .= "sip_profile_description ";
+ $sql .= ") ";
+ $sql .= "values ";
+ $sql .= "( ";
+ $sql .= "'".check_str($sip_profile_uuid)."', ";
+ $sql .= "'".check_str($sip_profile_name)."', ";
+ $sql .= "'".check_str($sip_profile_description)."' ";
+ $sql .= ")";
+ //echo $sql."\n\n";
+ $db->exec(check_sql($sql));
+ unset($sql);
- //add the sip profile settings
- foreach ($sip_profile['settings']['param'] as $row) {
- //get the name and value pair
- $sip_profile_setting_name = $row['@attributes']['name'];
- $sip_profile_setting_value = $row['@attributes']['value'];
- $sip_profile_setting_enabled = $row['@attributes']['enabled'];
- if ($sip_profile_setting_enabled != "false") { $sip_profile_setting_enabled = "true"; }
- //echo "name: $name value: $value\n";
- //add the profile settings into the database
- $sip_profile_setting_uuid = uuid();
- $sql = "insert into v_sip_profile_settings ";
- $sql .= "(";
- $sql .= "sip_profile_setting_uuid, ";
- $sql .= "sip_profile_uuid, ";
- $sql .= "sip_profile_setting_name, ";
- $sql .= "sip_profile_setting_value, ";
- $sql .= "sip_profile_setting_enabled ";
- $sql .= ") ";
- $sql .= "values ";
- $sql .= "( ";
- $sql .= "'".check_str($sip_profile_setting_uuid)."', ";
- $sql .= "'".check_str($sip_profile_uuid)."', ";
- $sql .= "'".check_str($sip_profile_setting_name)."', ";
- $sql .= "'".check_str($sip_profile_setting_value)."', ";
- $sql .= "'".$sip_profile_setting_enabled."' ";
- $sql .= ")";
- //echo $sql."\n\n";
- $db->exec(check_sql($sql));
- }
+ //add the sip profile settings
+ foreach ($sip_profile['settings']['param'] as $row) {
+ //get the name and value pair
+ $sip_profile_setting_name = $row['@attributes']['name'];
+ $sip_profile_setting_value = $row['@attributes']['value'];
+ $sip_profile_setting_enabled = $row['@attributes']['enabled'];
+ if ($sip_profile_setting_enabled != "false") { $sip_profile_setting_enabled = "true"; }
+ //echo "name: $name value: $value\n";
+ //add the profile settings into the database
+ $sip_profile_setting_uuid = uuid();
+ $sql = "insert into v_sip_profile_settings ";
+ $sql .= "(";
+ $sql .= "sip_profile_setting_uuid, ";
+ $sql .= "sip_profile_uuid, ";
+ $sql .= "sip_profile_setting_name, ";
+ $sql .= "sip_profile_setting_value, ";
+ $sql .= "sip_profile_setting_enabled ";
+ $sql .= ") ";
+ $sql .= "values ";
+ $sql .= "( ";
+ $sql .= "'".check_str($sip_profile_setting_uuid)."', ";
+ $sql .= "'".check_str($sip_profile_uuid)."', ";
+ $sql .= "'".check_str($sip_profile_setting_name)."', ";
+ $sql .= "'".check_str($sip_profile_setting_value)."', ";
+ $sql .= "'".$sip_profile_setting_enabled."' ";
+ $sql .= ")";
+ //echo $sql."\n\n";
+ $db->exec(check_sql($sql));
+ }
+ }
}
}
diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua
index 5c20c1ff39..5ed263237f 100644
--- a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua
+++ b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/sofia.conf.lua
@@ -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 = sql .. "from v_sip_profiles as p, v_sip_profile_settings as s ";
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_uuid = s.sip_profile_uuid ";
sql = sql .. "order by p.sip_profile_name asc ";
diff --git a/resources/switch.php b/resources/switch.php
index 4bc741b567..2791a1cebb 100644
--- a/resources/switch.php
+++ b/resources/switch.php
@@ -2766,6 +2766,7 @@ if (!function_exists('save_sip_profile_xml')) {
//get the sip profiles from the database
$sql = "select * from v_sip_profiles ";
+ $sql .= "where sip_profile_enabled = 'true' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll();