In advanced -> default settings add the following cdr->format->text = xml,json and cdr->storage->text = db,dir

This commit is contained in:
Mark Crane
2014-06-14 07:07:04 +00:00
parent c324d5a1ce
commit 28097670de
2 changed files with 45 additions and 15 deletions

View File

@@ -193,6 +193,7 @@
}
//determine where the xml cdr will be archived
/*
$sql = "select * from v_vars ";
$sql .= "where var_name = 'xml_cdr_archive' ";
$row = $db->query($sql)->fetch();
@@ -217,14 +218,15 @@
$xml_cdr_archive = 'dir';
break;
}
*/
//if xml_cdr_archive is set to db then insert it.
if ($xml_cdr_archive == "xml" || $xml_cdr_archive == "db") {
//save to the database in xml format
if ($_SESSION['cdr']['format']['text'] == "xml" && $_SESSION['cdr']['storage']['text'] == "db") {
$database->fields['xml'] = check_str($xml_string);
}
//if xml_cdr_archive is set to db then insert it.
if ($xml_cdr_archive == "json") {
//save to the database in json format
if ($_SESSION['cdr']['format']['text'] == "json" && $_SESSION['cdr']['storage']['text'] == "db") {
$database->fields['json'] = json_encode($xml);
}
@@ -256,16 +258,24 @@
if(!file_exists($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
}
$tmp_file = $uuid.'.xml';
$fh = fopen($tmp_dir.'/'.$tmp_file, 'w');
fwrite($fh, $xml_string);
if ($_SESSION['cdr']['format']['text'] == "xml") {
$tmp_file = $uuid.'.xml';
$fh = fopen($tmp_dir.'/'.$tmp_file, 'w');
fwrite($fh, $xml_string);
}
else {
$tmp_file = $uuid.'.json';
$fh = fopen($tmp_dir.'/'.$tmp_file, 'w');
fwrite($fh, json_encode($xml));
}
fclose($fh);
if ($debug) {
echo $e->getMessage();
}
$error = "true";
}
//if xml_cdr_archive is set to dir, then store it.
if ($_SESSION['cdr']['storage']['text'] == "dir" && $error != "true") {
if ($xml_cdr_archive == "dir" && $error != "true") {
if (strlen($uuid) > 0) {
$tmp_time = strtotime($start_stamp);
@@ -276,9 +286,16 @@
if(!file_exists($tmp_dir)) {
mkdir($tmp_dir, 0777, true);
}
$tmp_file = $uuid.'.xml';
$fh = fopen($tmp_dir.'/'.$tmp_file, 'w');
fwrite($fh, $xml_string);
if ($_SESSION['cdr']['format']['text'] == "xml") {
$tmp_file = $uuid.'.xml';
$fh = fopen($tmp_dir.'/'.$tmp_file, 'w');
fwrite($fh, $xml_string);
}
else {
$tmp_file = $uuid.'.json';
$fh = fopen($tmp_dir.'/'.$tmp_file, 'w');
fwrite($fh, json_encode($xml));
}
fclose($fh);
}
}

View File

@@ -118,10 +118,23 @@ require_once "resources/paging.php";
foreach($result as $row) {
if ($previous_category != $row['default_setting_category']) {
echo "<tr><td colspan='4' align='left'>\n";
if ($previous_category != '') { echo "<br /><br />"; }
echo " <br />\n";
echo " <b>".ucfirst($row['default_setting_category'])."</b>&nbsp;</td></tr>\n";
echo "<tr>\n";
echo " <td colspan='4' align='left'>\n";
if ($previous_category != '') { echo " <br /><br />"; }
echo " <br />\n";
echo " <b>\n";
if (strtolower($row['default_setting_category']) == "cdr") {
echo " CDR";
}
elseif (strtolower($row['default_setting_category']) == "ldap") {
echo " LDAP";
}
else {
echo " ".ucfirst($row['default_setting_category']);
}
echo " </b>\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo th_order_by('default_setting_subcategory', $text['label-subcategory'], $order_by, $order);
echo th_order_by('default_setting_name', $text['label-type'], $order_by, $order);