mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-02-02 22:19:19 +00:00
Update call_block_cdr_add.php
This commit is contained in:
@@ -43,9 +43,8 @@
|
||||
//action add from cdr
|
||||
if (is_uuid($_REQUEST["cdr_id"])) {
|
||||
|
||||
$action = "cdr_add";
|
||||
$xml_cdr_uuid = $_REQUEST["cdr_id"];
|
||||
$call_block_name = $_REQUEST["name"];
|
||||
//get the uuid
|
||||
$xml_cdr_uuid = $_REQUEST["cdr_id"];
|
||||
|
||||
// get the caller id info from cdr the user chose
|
||||
$sql = "select caller_id_name, caller_id_number ";
|
||||
@@ -59,38 +58,36 @@
|
||||
//create data array
|
||||
$array['call_block'][0]['call_block_uuid'] = uuid();
|
||||
$array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][0]['call_block_name'] = $call_block_name == '' ? $result["caller_id_name"] : $call_block_name;
|
||||
$array['call_block'][0]['call_block_number'] = $result["caller_id_number"];
|
||||
$array['call_block'][0]['call_block_name'] = trim($result["caller_id_name"]);
|
||||
$array['call_block'][0]['call_block_number'] = trim($result["caller_id_number"]);
|
||||
$array['call_block'][0]['call_block_count'] = 0;
|
||||
$array['call_block'][0]['call_block_action'] = 'Reject';
|
||||
$array['call_block'][0]['call_block_enabled'] = 'true';
|
||||
$array['call_block'][0]['date_added'] = time();
|
||||
|
||||
//ensure call block is enabled in the dialplan
|
||||
if ($action == "add" || $action == "update") {
|
||||
$sql = "select dialplan_uuid from v_dialplans where true ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$sql .= "and app_uuid = 'b1b31930-d0ee-4395-a891-04df94599f1f' ";
|
||||
$sql .= "and dialplan_enabled <> 'true' ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters);
|
||||
$sql = "select dialplan_uuid from v_dialplans where true ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$sql .= "and app_uuid = 'b1b31930-d0ee-4395-a891-04df94599f1f' ";
|
||||
$sql .= "and dialplan_enabled <> 'true' ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters);
|
||||
|
||||
if (is_array($rows) && sizeof($rows) != 0) {
|
||||
foreach ($rows as $index => $row) {
|
||||
$array['dialplans'][$index]['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
$array['dialplans'][$index]['dialplan_enabled'] = 'true';
|
||||
}
|
||||
|
||||
$p = new permissions;
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
$p->delete('dialplan_edit', 'temp');
|
||||
if (is_array($rows) && sizeof($rows) != 0) {
|
||||
foreach ($rows as $index => $row) {
|
||||
$array['dialplans'][$index]['dialplan_uuid'] = $row['dialplan_uuid'];
|
||||
$array['dialplans'][$index]['dialplan_enabled'] = 'true';
|
||||
}
|
||||
|
||||
$p = new permissions;
|
||||
$p->add('dialplan_edit', 'temp');
|
||||
|
||||
$database = new database;
|
||||
$database->save($array);
|
||||
unset($array);
|
||||
|
||||
$p->delete('dialplan_edit', 'temp');
|
||||
}
|
||||
|
||||
//insert call block record
|
||||
@@ -108,4 +105,4 @@
|
||||
//redirect the browser
|
||||
header("Location: call_block.php");
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user