Update follow_me.php
This commit is contained in:
parent
8404838b98
commit
2cfcb73c4f
|
|
@ -291,13 +291,16 @@ include "root.php";
|
||||||
$dial_string_caller_id_name = "\${effective_caller_id_name}";
|
$dial_string_caller_id_name = "\${effective_caller_id_name}";
|
||||||
$dial_string_caller_id_number = "\${effective_caller_id_number}";
|
$dial_string_caller_id_number = "\${effective_caller_id_number}";
|
||||||
|
|
||||||
if (strlen($this->follow_me_caller_id_uuid) > 0){
|
if (strlen($this->follow_me_caller_id_uuid) > 0) {
|
||||||
$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'";
|
$sql_caller = "select destination_number, destination_description, destination_caller_id_number, destination_caller_id_name ";
|
||||||
|
$sql_caller .= "from v_destinations ";
|
||||||
|
$sql_caller .= "where domain_uuid = '$this->domain_uuid' ";
|
||||||
|
$sql_caller .= "and destination_type = 'inbound' ";
|
||||||
|
$sql_caller .= "and destination_uuid = '$this->follow_me_caller_id_uuid'";
|
||||||
$prep_statement_caller = $db->prepare($sql_caller);
|
$prep_statement_caller = $db->prepare($sql_caller);
|
||||||
if ($prep_statement_caller) {
|
if ($prep_statement_caller) {
|
||||||
$prep_statement_caller->execute();
|
$prep_statement_caller->execute();
|
||||||
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
|
$row_caller = $prep_statement_caller->fetch(PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
$caller_id_number = $row_caller['destination_caller_id_number'];
|
$caller_id_number = $row_caller['destination_caller_id_number'];
|
||||||
if(strlen($caller_id_number) == 0){
|
if(strlen($caller_id_number) == 0){
|
||||||
$caller_id_number = $row_caller['destination_number'];
|
$caller_id_number = $row_caller['destination_number'];
|
||||||
|
|
@ -306,31 +309,10 @@ include "root.php";
|
||||||
if(strlen($caller_id_name) == 0){
|
if(strlen($caller_id_name) == 0){
|
||||||
$caller_id_name = $row_caller['destination_description'];
|
$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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($this->cid_name_prefix) > 0) {
|
//accountcode
|
||||||
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."$dial_string_caller_id_name";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$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."$dial_string_caller_id_number";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$dial_string .= ",origination_caller_id_number=$dial_string_caller_id_number";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($this->accountcode) == 0) {
|
if (strlen($this->accountcode) == 0) {
|
||||||
$dial_string .= ",sip_h_X-accountcode=\${accountcode}";
|
$dial_string .= ",sip_h_X-accountcode=\${accountcode}";
|
||||||
}
|
}
|
||||||
|
|
@ -339,6 +321,7 @@ include "root.php";
|
||||||
$dial_string .= ",accountcode=".$this->accountcode;
|
$dial_string .= ",accountcode=".$this->accountcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//toll allow
|
||||||
if ($this->toll_allow != '') {
|
if ($this->toll_allow != '') {
|
||||||
$dial_string .= ",toll_allow='".$this->toll_allow."'";
|
$dial_string .= ",toll_allow='".$this->toll_allow."'";
|
||||||
}
|
}
|
||||||
|
|
@ -352,11 +335,10 @@ include "root.php";
|
||||||
if (($presence_id = extension_presence_id($row["follow_me_destination"])) !== false) {
|
if (($presence_id = extension_presence_id($row["follow_me_destination"])) !== false) {
|
||||||
//set the dial string
|
//set the dial string
|
||||||
// using here `sofia_contact` instead of `user/` allows add registered device
|
// using here `sofia_contact` instead of `user/` allows add registered device
|
||||||
// so you can make follow me for extension `100` like `100` and avoid recusion
|
// so you can make follow me for extension `100` like `100` and avoid recursion
|
||||||
// but it ignores DND/CallForwad settings
|
// but it ignores DND/CallForwad settings
|
||||||
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
|
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
|
||||||
$dial_string .= "[";
|
$dial_string .= "[";
|
||||||
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,";
|
|
||||||
$dial_string .= "presence_id=".$presence_id."@".$_SESSION['domain_name'].',';
|
$dial_string .= "presence_id=".$presence_id."@".$_SESSION['domain_name'].',';
|
||||||
if ($row["follow_me_prompt"] == "1") {
|
if ($row["follow_me_prompt"] == "1") {
|
||||||
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
||||||
|
|
@ -385,6 +367,8 @@ include "root.php";
|
||||||
//add to the dial string
|
//add to the dial string
|
||||||
$dial_string .= "[";
|
$dial_string .= "[";
|
||||||
$dial_string .= $dial_string_variables;
|
$dial_string .= $dial_string_variables;
|
||||||
|
|
||||||
|
//group confirm
|
||||||
if ($row["follow_me_prompt"] == "1") {
|
if ($row["follow_me_prompt"] == "1") {
|
||||||
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true";
|
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true";
|
||||||
}
|
}
|
||||||
|
|
@ -395,15 +379,28 @@ include "root.php";
|
||||||
else {
|
else {
|
||||||
$presence_id = extension_presence_id($this->extension, $this->number_alias);
|
$presence_id = extension_presence_id($this->extension, $this->number_alias);
|
||||||
$dial_string .= "[";
|
$dial_string .= "[";
|
||||||
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true"){
|
|
||||||
$dial_string .= "outbound_caller_id_name=".$this->outbound_caller_id_name;
|
//set the caller id
|
||||||
$dial_string .= ",outbound_caller_id_number=".$this->outbound_caller_id_number;
|
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true") {
|
||||||
$dial_string .= ",origination_caller_id_name=".$this->outbound_caller_id_name;
|
if (strlen($this->outbound_caller_id_name) > 0) {
|
||||||
$dial_string .= ",origination_caller_id_number=".$this->outbound_caller_id_number;
|
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix.$this->outbound_caller_id_name;
|
||||||
|
}
|
||||||
|
if (strlen($this->outbound_caller_id_number) > 0) {
|
||||||
|
$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix.$this->outbound_caller_id_number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else {
|
||||||
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number";
|
if (strlen($caller_id_number) > 0) {
|
||||||
|
//set the caller id if it is set
|
||||||
|
if (strlen($caller_id_name) > 0) { $dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix.$caller_id_name; }
|
||||||
|
$dial_string .= ",origination_caller_id_number=".$this->cid_number_prefix.$caller_id_number;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//set the outbound caller id number if the caller id number is a user
|
||||||
|
$dial_string .= ",\${cond(\${user_exists id \${caller_id_number} \${domain_name}} == true ? origination_caller_id_name=".$this->cid_name_prefix."\${outbound_caller_id_name},origination_caller_id_number=".$this->cid_number_prefix."\${outbound_caller_id_number} : )}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$dial_string .= ",presence_id=".$presence_id."@".$_SESSION['domain_name'];
|
$dial_string .= ",presence_id=".$presence_id."@".$_SESSION['domain_name'];
|
||||||
if ($row["follow_me_prompt"] == "1") {
|
if ($row["follow_me_prompt"] == "1") {
|
||||||
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue