diff --git a/app/calls/call_edit.php b/app/calls/call_edit.php index 59192a9165..5825de73a8 100644 --- a/app/calls/call_edit.php +++ b/app/calls/call_edit.php @@ -22,6 +22,7 @@ Contributor(s): Mark J Crane + Luis Daniel Lucio Quiroz */ require_once "root.php"; require_once "resources/require.php"; @@ -123,6 +124,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $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"]); + $follow_me_caller_id_uuid = check_str($_POST["follow_me_caller_id_uuid"]); $destination_data_1 = check_str($_POST["destination_data_1"]); $destination_delay_1 = check_str($_POST["destination_delay_1"]); @@ -274,6 +276,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $follow_me->cid_name_prefix = $cid_name_prefix; $follow_me->cid_number_prefix = $cid_number_prefix; $follow_me->follow_me_enabled = $follow_me_enabled; + $follow_me->follow_me_caller_id_uuid = $follow_me_caller_id_uuid; $follow_me->destination_data_1 = $destination_data_1; $follow_me->destination_type_1 = $destination_type_1; @@ -395,6 +398,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $cid_name_prefix = $row["cid_name_prefix"]; $cid_number_prefix = $row["cid_number_prefix"]; $follow_me_enabled = $row["follow_me_enabled"]; + $follow_me_caller_id_uuid = $row["follow_me_caller_id_uuid"]; $sql = "select * from v_follow_me_destinations "; $sql .= "where follow_me_uuid = '$follow_me_uuid' "; @@ -561,10 +565,29 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; $on_click = "document.getElementById('forward_all_disabled').checked=true;"; - $on_click .= "document.getElementById('dnd_disabled').checked=true;"; + $on_click .= "document.getElementById('dnd_disabled').checked=true; document.getElementById('follow_me_caller_id_uuid').focus();"; echo " \n"; echo " \n"; unset($on_click); + echo "   "; + $sql_follow_me = "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_follow_me = $db->prepare(check_sql($sql_follow_me)); + $prep_statement_follow_me->execute(); + $result_follow_me = $prep_statement_follow_me->fetchAll(PDO::FETCH_ASSOC); + if (count($result_follow_me) > 0) { + echo " \n"; + } echo "
\n"; echo "
\n"; echo "\n"; @@ -748,4 +771,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //include the footer require_once "resources/footer.php"; -?> \ No newline at end of file +?> diff --git a/app/calls/resources/classes/follow_me.php b/app/calls/resources/classes/follow_me.php index eaabb0ee07..42e33e82a8 100644 --- a/app/calls/resources/classes/follow_me.php +++ b/app/calls/resources/classes/follow_me.php @@ -37,6 +37,7 @@ include "root.php"; public $cid_number_prefix; public $accountcode; public $follow_me_enabled; + public $follow_me_caller_id_uuid; private $extension; public $destination_data_1; @@ -85,6 +86,9 @@ include "root.php"; if (strlen($this->cid_number_prefix) > 0) { $sql .= "cid_number_prefix, "; } + if (strlen($this->follow_me_caller_id_uuid) > 0) { + $sql .= "follow_me_caller_id_uuid, "; + } $sql .= "follow_me_enabled "; $sql .= ")"; $sql .= "values "; @@ -95,6 +99,9 @@ include "root.php"; if (strlen($this->cid_number_prefix) > 0) { $sql .= "'$this->cid_number_prefix', "; } + if (strlen($this->follow_me_caller_id_uuid) > 0) { + $sql .= "'$this->follow_me_caller_id_uuid', "; + } $sql .= "'$this->follow_me_enabled' "; $sql .= ")"; if ($v_debug) { @@ -112,6 +119,7 @@ include "root.php"; $sql = "update v_follow_me set "; $sql .= "follow_me_enabled = '$this->follow_me_enabled', "; $sql .= "cid_name_prefix = '$this->cid_name_prefix', "; + $sql .= "follow_me_caller_id_uuid = '$this->follow_me_caller_id_uuid', "; $sql .= "cid_number_prefix = '$this->cid_number_prefix' "; $sql .= "where domain_uuid = '$this->domain_uuid' "; $sql .= "and follow_me_uuid = '$this->follow_me_uuid' "; @@ -324,19 +332,37 @@ include "root.php"; $dial_string .= ",extension_uuid=".$this->extension_uuid; $dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua"; + $dial_string_caller_id_name = "\${caller_id_name}"; + $dial_string_caller_id_number = "\${caller_id_number}"; + + if (strlen($this->follow_me_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->follow_me_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']; + } + if (strlen($row_caller['destination_number']) > 0) { + $dial_string_caller_id_number = $row_caller['destination_number']; + } + } + } + if (strlen($this->cid_name_prefix) > 0) { - $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."#\${caller_id_name}"; + $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."#$dial_string_caller_id_name"; } else { - $dial_string .= ",origination_caller_id_name=\${caller_id_name}"; + $dial_string .= ",origination_caller_id_name=$dial_string_caller_id_name"; } if (strlen($this->cid_number_prefix) > 0) { //$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix.""; - $dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."#\${caller_id_number}"; + $dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix."#dial_string_caller_id_number"; } else { - $dial_string .= ",origination_caller_id_number=\${caller_id_number}"; + $dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number"; } if (strlen($this->accountcode) > 0) { @@ -352,7 +378,7 @@ include "root.php"; //set the dial string if (strlen($_SESSION['domain']['dial_string']['text']) == 0) { $dial_string .= "["; - $dial_string .= "outbound_caller_id_number=\${caller_id_number},"; + $dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,"; $dial_string .= "presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].","; if ($row["follow_me_prompt"] == "1") { $dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,"; @@ -376,7 +402,7 @@ include "root.php"; } else { $dial_string .= "["; - $dial_string .= "outbound_caller_id_number=\${outbound_caller_id_number},"; + $dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,"; $dial_string .= "presence_id=".$this->extension."@".$_SESSION['domain_name'].","; if ($row["follow_me_prompt"] == "1") { $dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,"; @@ -434,4 +460,4 @@ include "root.php"; } //function } //class -?> \ No newline at end of file +?> diff --git a/app/follow_me/app_config.php b/app/follow_me/app_config.php index 92dac45912..0395365dec 100644 --- a/app/follow_me/app_config.php +++ b/app/follow_me/app_config.php @@ -114,6 +114,12 @@ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ""; $z++; + $apps[$x]['db'][$y]['fields'][$z]['name'] = "follow_me_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'] = ""; + $z++; //schema details $y = 1; //table array index @@ -160,4 +166,4 @@ $apps[$x]['db'][$y]['fields'][$z]['description']['en'] = ""; $z++; -?> \ No newline at end of file +?>