SIP Status, Get the SIP profile list from the database instead of the file system.

This commit is contained in:
Mark Crane 2014-04-27 08:38:12 +00:00
parent 5a29b76237
commit 89bea49f38
1 changed files with 89 additions and 82 deletions

View File

@ -101,6 +101,14 @@ if ($_GET['a'] == "download") {
$gateways = $prep_statement->fetchAll(PDO::FETCH_NAMED);
unset ($prep_statement, $sql);
//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);
//sofia status
if ($fp && permission_exists('system_status_sofia_status')) {
$cmd = "api sofia xmlstatus";
@ -177,9 +185,9 @@ if ($_GET['a'] == "download") {
//sofia status profile
if (permission_exists('system_status_sofia_status_profile')) {
foreach (ListFiles($_SESSION['switch']['conf']['dir'].'/sip_profiles') as $key=>$sip_profile_file){
if (substr($sip_profile_file, -4) == ".xml") {
$sip_profile_name = str_replace(".xml", "", $sip_profile_file);
foreach ($sip_profiles as $row) {
$sip_profile_name = $row["sip_profile_name"];
if ($fp) {
$cmd = "api sofia xmlstatus profile ".$sip_profile_name."";
$xml_response = trim(event_socket_request($fp, $cmd));
@ -263,7 +271,6 @@ if ($_GET['a'] == "download") {
}
}
}
}
//status
if ($fp && permission_exists('sip_status_switch_status')) {