Fix the dial string for follow me.

This commit is contained in:
Mark Crane
2014-12-17 06:50:12 +00:00
parent 516778f3f3
commit e30ec28bb5
+13 -27
View File
@@ -321,6 +321,7 @@ include "root.php";
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name']; $dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];
$dial_string .= ",domain_name=".$_SESSION['domain_name']; $dial_string .= ",domain_name=".$_SESSION['domain_name'];
$dial_string .= ",domain=".$_SESSION['domain_name']; $dial_string .= ",domain=".$_SESSION['domain_name'];
$dial_string .= ",extension_uuid=".$extension_uuid;
$dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua"; $dial_string .= ",group_confirm_key=exec,group_confirm_file=lua confirm.lua";
if (strlen($this->cid_name_prefix) > 0) { if (strlen($this->cid_name_prefix) > 0) {
@@ -343,23 +344,8 @@ include "root.php";
} }
$dial_string .= "}"; $dial_string .= "}";
foreach ($result as &$row) { foreach ($result as &$row) {
$dial_string .= "["; $dial_string .= ",[";
if (extension_exists($row["follow_me_destination"])) { if (extension_exists($row["follow_me_destination"])) {
//get the extension uuid
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and (extension = '".$row["follow_me_destination"]."' or number_alias = '".$row["follow_me_destination"]."') ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$extension_result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$extension_uuid = '';
if (count($extension_result) > 0) {
foreach ($extension_result as &$field) {
$extension_uuid = $field["extension_uuid"];
}
}
unset ($prep_statement);
//set the dial string //set the dial string
if (strlen($_SESSION['domain']['dial_string']['text']) == 0) { if (strlen($_SESSION['domain']['dial_string']['text']) == 0) {
$dial_string .= "outbound_caller_id_number=\${caller_id_number},"; $dial_string .= "outbound_caller_id_number=\${caller_id_number},";
@@ -367,14 +353,13 @@ include "root.php";
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,";
} }
$dial_string .= "extension_uuid=".$extension_uuid.",";
$dial_string .= "leg_delay_start=".$row["follow_me_delay"].","; $dial_string .= "leg_delay_start=".$row["follow_me_delay"].",";
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]"; $dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
$dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")},"; $dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")}";
//$dial_string .= "user/".$row["follow_me_destination"]."@".$_SESSION['domain_name'].","; //$dial_string .= "user/".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
} }
else { else {
$replace_value = $row["follow_me_destination"].",extension_uuid=".$extension_uuid; $replace_value = $row["follow_me_destination"];
if ($row["follow_me_prompt"] == "1") { if ($row["follow_me_prompt"] == "1") {
$replace_value .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,"; $replace_value .= "group_confirm_key=exec,group_confirm_file=lua confirm.lua,confirm=true,";
} }
@@ -392,19 +377,20 @@ include "root.php";
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]"; $dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
if (is_numeric($row["follow_me_destination"])) { if (is_numeric($row["follow_me_destination"])) {
$bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $row["follow_me_destination"]); $bridge = outbound_route_to_bridge ($_SESSION['domain_uuid'], $row["follow_me_destination"]);
//if (strlen($bridge[0]) > 0) { if ($_SESSION['follow me']['bridge']['text'] == "bridge") {
// $dial_string .= "".$bridge[0].","; $dial_string .= $bridge[0].",";
//} }
//else { else {
$dial_string .= "loopback/".$row["follow_me_destination"].","; //$dial_string .= "loopback/".$row["follow_me_destination"].",";
//} $dial_string .= "loopback/".$row["follow_me_destination"]."/".$_SESSION['domain_name'];
}
} }
else { else {
$dial_string .= $row["follow_me_destination"].","; $dial_string .= $row["follow_me_destination"];
} }
} }
} }
$this->dial_string = trim($dial_string, ","); $this->dial_string = $dial_string;
} }
else { else {
$this->dial_string = ''; $this->dial_string = '';