diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 5825de73a8..4df91412c6 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -103,6 +103,7 @@ else { $forward_no_answer_destination = $row["forward_no_answer_destination"]; $forward_no_answer_enabled = $row["forward_no_answer_enabled"]; $follow_me_uuid = $row["follow_me_uuid"]; + $forward_caller_id_uuid = $row["forward_caller_id_uuid"]; break; //limit to 1 row } if (strlen($do_not_disturb) == 0) { @@ -121,6 +122,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $forward_busy_destination = check_str($_POST["forward_busy_destination"]); $forward_no_answer_enabled = check_str($_POST["forward_no_answer_enabled"]); $forward_no_answer_destination = check_str($_POST["forward_no_answer_destination"]); + $forward_caller_id_uuid = check_str($_POST["forward_caller_id_uuid"]); $cid_name_prefix = check_str($_POST["cid_name_prefix"]); $cid_number_prefix = check_str($_POST["cid_number_prefix"]); $follow_me_enabled = check_str($_POST["follow_me_enabled"]); @@ -239,6 +241,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $call_forward->accountcode = $accountcode; $call_forward->forward_all_destination = $forward_all_destination; $call_forward->forward_all_enabled = $forward_all_enabled; + $call_forward->forward_caller_id_uuid = $forward_caller_id_uuid; //$call_forward->set(); //unset($call_forward); } @@ -367,7 +370,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $sql .= "forward_busy_destination = '".$forward_busy_destination."', "; $sql .= "forward_busy_enabled = '".$forward_busy_enabled."', "; $sql .= "forward_no_answer_destination = '".$forward_no_answer_destination."', "; - $sql .= "forward_no_answer_enabled = '".$forward_no_answer_enabled."' "; + $sql .= "forward_no_answer_enabled = '".$forward_no_answer_enabled."', "; + $sql .= "forward_caller_id_uuid = '".$forward_caller_id_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "and extension_uuid = '".$extension_uuid."'"; $db->exec(check_sql($sql)); @@ -522,6 +526,27 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { unset($on_click); echo "   "; echo " \n"; + echo "   "; + $sql_forward = "select destination_uuid, destination_number, destination_description from v_destinations where domain_uuid = '$domain_uuid' and destination_type = 'inbound' order by destination_number asc "; + $prep_statement_forward = $db->prepare(check_sql($sql_forward)); + $prep_statement_forward->execute(); + $result_forward = $prep_statement_forward->fetchAll(PDO::FETCH_ASSOC); + if (count($result_forward) > 0) { + echo " \n"; + } + unset ($sql_forward, $prep_statement_forward, $result_forward, $row_forward); + echo "\n"; echo "\n"; @@ -588,6 +613,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { } echo " \n"; } + unset ($sql_follow_me, $prep_statement_follow_me, $result_follow_me, $row_follow_me); echo "
\n"; echo "
\n"; echo "\n"; diff --git a/app/calls/resources/classes/call_forward.php b/app/calls/resources/classes/call_forward.php index eb0c214e94..ae9ae23e67 100644 --- a/app/calls/resources/classes/call_forward.php +++ b/app/calls/resources/classes/call_forward.php @@ -37,6 +37,7 @@ include "root.php"; public $forward_all_enabled; private $dial_string; public $accountcode; + public $forward_caller_id_uuid; public function set() { //set the global variable @@ -69,6 +70,25 @@ include "root.php"; if (strlen($this->accountcode) > 0) { $dial_string .= ",accountcode=".$this->accountcode; } + + if (strlen($this->forward_caller_id_uuid) > 0){ + $sql_caller = "select destination_number, destination_description from v_destinations where domain_uuid = '$this->domain_uuid' and destination_type = 'inbound' and destination_uuid = '$this->forward_caller_id_uuid'"; + $prep_statement_caller = $db->prepare($sql_caller); + if ($prep_statement_caller) { + $prep_statement_caller->execute(); + $row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC); + if (strlen($row_caller['destination_description']) > 0) { + $dial_string_caller_id_name = $row_caller['destination_description']; + $dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name"; + } + if (strlen($row_caller['destination_number']) > 0) { + $dial_string_caller_id_number = $row_caller['destination_number']; + $dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number"; + $dial_string .= ",outbound_caller_id_number=$dial_string_caller_id_number"; + } + } + } + $dial_string .= "}"; if (extension_exists($this->forward_all_destination)) { $dial_string .= "user/".$this->forward_all_destination."@".$_SESSION['domain_name']; diff --git a/app/extensions/app_config.php b/app/extensions/app_config.php index a013acd0fe..fae61552a3 100644 --- a/app/extensions/app_config.php +++ b/app/extensions/app_config.php @@ -317,6 +317,12 @@ $apps[$x]['db'][$y]['fields'][$z]['name'] = "description"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; + $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "forward_caller_id_uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid"; + $apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text"; + $apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)"; + $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; $y = 1; //table array index $z = 0; //field array index @@ -363,4 +369,4 @@ $apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "user_uuid"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = ""; -?> \ No newline at end of file +?>