you can fix your follow me caller id number/name

This commit is contained in:
luis daniel lucio quiroz
2015-02-28 02:32:25 +00:00
parent 606d8eb595
commit 8750662aca
3 changed files with 65 additions and 10 deletions

View File

@@ -22,6 +22,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
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 "</td>\n";
echo "<td class='vtable' align='left'>\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 " <label for='follow_me_disabled'><input type='radio' name='follow_me_enabled' id='follow_me_disabled' onclick=\"\" value='false' ".(($follow_me_enabled == "false" || $follow_me_enabled == "") ? "checked='checked'" : null)." /> ".$text['label-disabled']."</label> \n";
echo " <label for='follow_me_enabled'><input type='radio' name='follow_me_enabled' id='follow_me_enabled' onclick=\"$on_click\" value='true' ".(($follow_me_enabled == "true") ? "checked='checked'" : null)."/> ".$text['label-enabled']."</label> \n";
unset($on_click);
echo "&nbsp;&nbsp;&nbsp;";
$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 " <select name='follow_me_caller_id_uuid' id='follow_me_caller_id_uuid' class='formfld' >\n";
echo " <option></option>\n";
foreach ($result_follow_me as &$row_follow_me) {
$selected = $row_follow_me["destination_uuid"]==$follow_me_caller_id_uuid?"selected='selected' ":"";
if (strlen($row_follow_me["dialplan_uuid"]) == 0) {
echo " <option value='".$row_follow_me["destination_uuid"]."' style=\"font-weight:bold;\" $selected>".$row_follow_me["destination_number"]." ".$row_follow_me["destination_description"]."</option>\n";
}
else {
echo " <option value='".$row_follow_me["destination_uuid"]."' $selected>".$row_follow_me["destination_number"]." ".$row_follow_me["destination_description"]."</option>\n";
}
}
echo " </select>\n";
}
echo "<br />\n";
echo "<br />\n";
echo "</td>\n";
@@ -748,4 +771,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//include the footer
require_once "resources/footer.php";
?>
?>

View File

@@ -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
?>
?>

View File

@@ -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++;
?>
?>