Update xml_cdr.php
This commit is contained in:
parent
3ef183169d
commit
3f2615431c
|
|
@ -193,13 +193,13 @@ if (!class_exists('xml_cdr')) {
|
|||
$f = 1;
|
||||
if (isset($this->fields)) {
|
||||
foreach ($this->fields as $field) {
|
||||
$field = preg_replace('#[^a-zA-Z0-9_\-]#', '', $field);
|
||||
//$field = preg_replace('#[^a-zA-Z0-9_\-]#', '', $field);
|
||||
if (isset($row[$field]) && strlen($row[$field]) > 0) {
|
||||
$sql .= ":".$field." \n";
|
||||
$parameters[$field] = $row[$field];
|
||||
}
|
||||
else {
|
||||
$sql .= "null";
|
||||
$sql .= "null\n";
|
||||
}
|
||||
if ($field_count != $f) {
|
||||
$sql .= ",";
|
||||
|
|
@ -256,29 +256,21 @@ if (!class_exists('xml_cdr')) {
|
|||
$duplicate_uuid = false;
|
||||
$uuid = urldecode($xml->variables->uuid);
|
||||
if($uuid != null && is_uuid($uuid)) {
|
||||
//Check in the database
|
||||
$sql = "select count(xml_cdr_uuid) ";
|
||||
$sql .= "from v_xml_cdr ";
|
||||
$sql .= "where xml_cdr_uuid = :xml_cdr_uuid ";
|
||||
$parameters['xml_cdr_uuid'] = $uuid;
|
||||
$database = new database;
|
||||
$count = $database->select($sql, $parameters, 'column');
|
||||
unset($parameters);
|
||||
if ($count > 0) {
|
||||
$duplicate_uuid = true;
|
||||
}
|
||||
unset($database);
|
||||
//Check in the array
|
||||
if (isset($this->array)) {
|
||||
foreach ($this->array as $row) {
|
||||
if (in_array($uuid,$row,true))
|
||||
$duplicate_uuid = true;
|
||||
}
|
||||
}
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
//process data if the call detail record is not a duplicate
|
||||
if ($duplicate_uuid == false && $uuid != null) {
|
||||
if ($duplicate_uuid == false && is_uuid($uuid)) {
|
||||
|
||||
//get the destination number
|
||||
if ($xml->variables->current_application == "bridge") {
|
||||
$current_application_data = urldecode($xml->variables->current_application_data);
|
||||
|
|
@ -619,14 +611,13 @@ if (!class_exists('xml_cdr')) {
|
|||
}
|
||||
|
||||
//insert the values
|
||||
if (strlen($uuid) > 0) {
|
||||
if ($this->debug) {
|
||||
//$time5_insert = microtime(true);
|
||||
//echo $sql."<br />\n";
|
||||
}
|
||||
try {
|
||||
$error = "false";
|
||||
//$this->db->exec(check_sql($sql));
|
||||
//$this->db->exec($sql);
|
||||
}
|
||||
catch(PDOException $e) {
|
||||
$tmp_dir = $_SESSION['switch']['log']['dir'].'/xml_cdr/failed/';
|
||||
|
|
@ -680,8 +671,7 @@ if (!class_exists('xml_cdr')) {
|
|||
//$insert_time+=microtime(true)-$time5_insert; //add this current query.
|
||||
//$insert_count++;
|
||||
//}
|
||||
}
|
||||
unset($sql);
|
||||
|
||||
} //if ($duplicate_uuid == false)
|
||||
} //function xml_array
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue