Add. Support number_alias field as presence id in follow me/call forward (#2075)

This commit is contained in:
Alexey Melnichuk
2016-11-17 21:40:22 +03:00
committed by FusionPBX
parent 659d135802
commit 63ebb355fa
6 changed files with 96 additions and 65 deletions

View File

@@ -68,8 +68,7 @@ include "root.php";
//set the dial string
if ($this->forward_all_enabled == "true") {
$dial_string = "{presence_id=".$this->forward_all_destination."@".$_SESSION['domain_name'];
$dial_string .= ",instant_ringback=true";
$dial_string = "{instant_ringback=true";
$dial_string .= ",domain_uuid=".$_SESSION['domain_uuid'];
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];
$dial_string .= ",domain_name=".$_SESSION['domain_name'];
@@ -121,11 +120,20 @@ include "root.php";
}
}
$dial_string .= "}";
if (extension_exists($this->forward_all_destination)) {
// For support load_balance we need set `dialed_extension`
$dial_string .= ",dialed_extension=".$this->forward_all_destination;
// we do not need here presence_id because user dial-string already has one
$dial_string .= "}";
$dial_string .= "user/".$this->forward_all_destination."@".$_SESSION['domain_name'];
}
else {
// setting here presence_id equal extension not dialed number allows work BLF and intercept.
$presence_id = extension_presence_id($this->extension, $this->number_alias);
// $presence_id = $this->forward_all_destination;
$dial_string .= ",presence_id=".$presence_id."@".$_SESSION['domain_name'];
$dial_string .= "}";
if ($_SESSION['domain']['bridge']['text'] == "outbound" || $_SESSION['domain']['bridge']['text'] == "bridge") {
$bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $this->forward_all_destination);
$dial_string .= $bridge[0];

View File

@@ -43,6 +43,7 @@ include "root.php";
public $outbound_caller_id_name;
public $outbound_caller_id_number;
private $extension;
private $number_alias;
private $toll_allow;
public $destination_data_1;
@@ -248,6 +249,7 @@ include "root.php";
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
$this->toll_allow = $row["toll_allow"];
$this->number_alias = $row["number_alias"];
$this->outbound_caller_id_name = $row["outbound_caller_id_name"];
$this->outbound_caller_id_number = $row["outbound_caller_id_number"];
}
@@ -347,12 +349,15 @@ include "root.php";
if ($x > 0) {
$dial_string .= ",";
}
if (extension_exists($row["follow_me_destination"])) {
if (($presence_id = extension_presence_id($row["follow_me_destination"])) !== false) {
//set the dial string
// 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
// but it ignores DND/CallForwad settings
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
$dial_string .= "[";
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number,";
$dial_string .= "presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
$dial_string .= "presence_id=".$presence_id."@".$_SESSION['domain_name'].',';
if ($row["follow_me_prompt"] == "1") {
$dial_string .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}
@@ -374,6 +379,7 @@ include "root.php";
}
}
else {
$presence_id = extension_presence_id($this->extension, $this->number_alias);
$dial_string .= "[";
if ($_SESSION['cdr']['follow_me_fix']['boolean'] == "true"){
$dial_string .= "outbound_caller_id_name=".$this->outbound_caller_id_name;
@@ -384,7 +390,7 @@ include "root.php";
else{
$dial_string .= "outbound_caller_id_number=$dial_string_caller_id_number";
}
$dial_string .= ",presence_id=".$this->extension."@".$_SESSION['domain_name'];
$dial_string .= ",presence_id=".$presence_id."@".$_SESSION['domain_name'];
if ($row["follow_me_prompt"] == "1") {
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
}