Merge pull request #1206 from moteus/call_control_caller_id

Fix. Use same Outbound Caller info in extenstion and call control.
This commit is contained in:
FusionPBX 2015-10-26 12:05:04 -06:00
commit e1e01dac90
4 changed files with 72 additions and 22 deletions

View File

@ -536,7 +536,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('follow_me_cid_set')) {
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 ";
$sql_forward = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name 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);
@ -546,7 +546,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <option value='' disabled='disabled'></option>\n";
foreach ($result_forward as &$row_forward) {
$selected = $row_forward["destination_uuid"] == $forward_caller_id_uuid ? "selected='selected' " : '';
echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($row_forward["destination_number"])." : ".$row_forward["destination_description"]."</option>\n";
$caller_id_number = $row_forward['destination_caller_id_number'];
if(strlen($caller_id_number) == 0){
$caller_id_number = $row_forward['destination_number'];
}
$caller_id_name = $row_forward['destination_caller_id_name'];
if(strlen($caller_id_name) == 0){
$caller_id_name = $row_forward['destination_description'];
}
echo "<option value='".$row_forward["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
}
echo "</select>\n";
}
@ -603,7 +611,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (permission_exists('follow_me_cid_set')) {
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 ";
$sql_follow_me = "select destination_uuid, destination_number, destination_description, destination_caller_id_number, destination_caller_id_name 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);
@ -613,7 +621,17 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo " <option value='' disabled='disabled'></option>\n";
foreach ($result_follow_me as &$row_follow_me) {
$selected = $row_follow_me["destination_uuid"] == $follow_me_caller_id_uuid ? "selected='selected'" : '';
echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($row_follow_me["destination_number"])." : ".$row_follow_me["destination_description"]."</option>\n";
$caller_id_number = $row_follow_me['destination_caller_id_number'];
if(strlen($caller_id_number) == 0){
$caller_id_number = $row_follow_me['destination_number'];
}
$caller_id_name = $row_follow_me['destination_caller_id_name'];
if(strlen($caller_id_name) == 0){
$caller_id_name = $row_follow_me['destination_description'];
}
echo "<option value='".$row_follow_me["destination_uuid"]."' ".$selected.">".format_phone($caller_id_number)." : ".$caller_id_name."</option>\n";
}
echo "</select>\n";
}

View File

@ -84,17 +84,27 @@ include "root.php";
}
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'";
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name 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'];
$caller_id_number = $row_caller['destination_caller_id_number'];
if(strlen($caller_id_number) == 0){
$caller_id_number = $row_caller['destination_number'];
}
$caller_id_name = $row_caller['destination_caller_id_name'];
if(strlen($caller_id_name) == 0){
$caller_id_name = $row_caller['destination_description'];
}
if (strlen($caller_id_name) > 0) {
$dial_string_caller_id_name = $caller_id_name;
$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'];
if (strlen($caller_id_number) > 0) {
$dial_string_caller_id_number = $caller_id_number;
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
$dial_string .= ",outbound_caller_id_number=$dial_string_caller_id_number";
}

View File

@ -299,16 +299,26 @@ include "root.php";
$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'";
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name 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'];
$caller_id_number = $row_caller['destination_caller_id_number'];
if(strlen($caller_id_number) == 0){
$caller_id_number = $row_caller['destination_number'];
}
if (strlen($row_caller['destination_number']) > 0) {
$dial_string_caller_id_number = $row_caller['destination_number'];
$caller_id_name = $row_caller['destination_caller_id_name'];
if(strlen($caller_id_name) == 0){
$caller_id_name = $row_caller['destination_description'];
}
if (strlen($caller_id_name) > 0) {
$dial_string_caller_id_name = $caller_id_name;
}
if (strlen($caller_id_number) > 0) {
$dial_string_caller_id_number = $caller_id_number;
}
}
}

View File

@ -1368,11 +1368,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <select name='outbound_caller_id_name' id='outbound_caller_id_name' class='formfld'>\n";
echo " <option value=''></option>\n";
foreach ($destinations as &$row) {
if ($outbound_caller_id_name == $row["destination_caller_id_name"]) {
echo " <option value='".$row["destination_caller_id_name"]."' selected='selected'>".$row["destination_caller_id_name"]."</option>\n";
$tmp = $row["destination_caller_id_name"];
if(strlen($tmp) == 0){
$tmp = $row["destination_description"];
}
else {
echo " <option value='".$row["destination_caller_id_name"]."'>".$row["destination_caller_id_name"]."</option>\n";
if(strlen($tmp) > 0){
if ($outbound_caller_id_name == $tmp) {
echo " <option value='".$tmp."' selected='selected'>".$tmp."</option>\n";
}
else {
echo " <option value='".$tmp."'>".$tmp."</option>\n";
}
}
}
echo " </select>\n";
@ -1401,11 +1407,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <select name='outbound_caller_id_number' id='outbound_caller_id_number' class='formfld'>\n";
echo " <option value=''></option>\n";
foreach ($destinations as &$row) {
if ($outbound_caller_id_number == $row["destination_caller_id_number"]) {
echo " <option value='".$row["destination_caller_id_number"]."' selected='selected'>".$row["destination_caller_id_number"]."</option>\n";
$tmp = $row["destination_caller_id_number"];
if(strlen($tmp) == 0){
$tmp = $row["destination_number"];
}
else {
echo " <option value='".$row["destination_caller_id_number"]."'>".$row["destination_caller_id_number"]."</option>\n";
if(strlen($tmp) > 0){
if ($outbound_caller_id_number == $tmp) {
echo " <option value='".$tmp."' selected='selected'>".$tmp."</option>\n";
}
else {
echo " <option value='".$tmp."'>".$tmp."</option>\n";
}
}
}
echo " </select>\n";