Fix account code for call forward and Park slots to disabled by default.

This commit is contained in:
Mark Crane
2013-05-01 18:14:13 +00:00
parent ac9a4e1d8c
commit ce7a5f3458
4 changed files with 25 additions and 23 deletions

View File

@@ -35,14 +35,34 @@ include "root.php";
public $forward_all_destination;
public $forward_all_enabled;
private $dial_string;
public $accountcode;
public function set() {
//set the global variable
global $db;
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and extension_uuid = '".$this->extension_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
$this->accountcode = $row["accountcode"];
}
}
unset ($prep_statement);
//set the dial string
if ($this->forward_all_enabled == "true") {
$dial_string = "[presence_id=".$this->forward_all_destination."@".$_SESSION['domain_name'].",instant_ringback=true]";
$dial_string = "{presence_id=".$this->forward_all_destination."@".$_SESSION['domain_name'].",instant_ringback=true";
if (strlen($this->accountcode) > 0) {
$dial_string .= ",accountcode=".$this->accountcode;
}
$dial_string .= "}";
if (extension_exists($this->forward_all_destination)) {
$dial_string .= "\${sofia_contact(".$this->forward_all_destination."@".$_SESSION['domain_name'].")}";
}
@@ -61,20 +81,6 @@ include "root.php";
$this->dial_string = '';
}
//determine whether to update the dial string
$sql = "select * from v_extensions ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and extension_uuid = '".$this->extension_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
if (count($result) > 0) {
foreach ($result as &$row) {
$this->extension = $row["extension"];
}
}
unset ($prep_statement);
//update the extension
$sql = "update v_extensions set ";
$sql .= "forward_all_destination = '$this->forward_all_destination', ";

View File

@@ -298,7 +298,7 @@ include "root.php";
$dial_string .= ",origination_caller_id_name=".$this->cid_name_prefix."#\${caller_id_name}";
}
if (strlen($this->accountcode) > 0) {
$dial_string .= ",accountcode=".$this->accountcode."}";
$dial_string .= ",accountcode=".$this->accountcode;
}
$dial_string .= "}";
foreach ($result as &$row) {

View File

@@ -1,5 +1,5 @@
<context name="{v_context}">
<extension name="park_slots" app_uuid="f096f899-c78e-409c-8290-00f6d423b31c" enabled="false">
<extension name="park_slots" app_uuid="f096f899-c78e-409c-8290-00f6d423b31c" enabled="true">
<condition field="destination_number" expression="(^\*5901$|^\*5902$|^\*5903$)" >
<action application="set" data="park_extension=$1" />
<action application="set" data="park_direction=both" />

View File

@@ -116,7 +116,7 @@ if (strlen($_GET["id"]) > 0) {
if (strlen($search_all) == 0) {
$sql .= "and schema_uuid = '$schema_uuid' ";
if (strlen($data_parent_row_uuid) > 0) {
$sql .= " and data_parent_row_uuid = '$data_parent_row_uuid' ";
$sql .= "and data_parent_row_uuid = '$data_parent_row_uuid' ";
}
}
else {
@@ -182,7 +182,7 @@ if (strlen($_GET["id"]) > 0) {
if ($row["field_type"] != "label") {
if ($row["field_name"] != "domain_uuid") {
//$row["field_label"];
//$row["field_name"]
//$row["field_name"];
//$row["field_type"];
if ($row["field_name"] == "number") {
$sql .= "'".$row["field_name"]."' NUMERIC, ";
@@ -195,7 +195,6 @@ if (strlen($_GET["id"]) > 0) {
}
$sql .= "'domain_uuid' TEXT ";
$sql .= ");";
//echo "$sql<br /><br />\n";
$prep_statement = $db_memory->prepare($sql);
$prep_statement->execute();
unset ($prep_statement, $sql);
@@ -284,9 +283,6 @@ if (strlen($_GET["id"]) > 0) {
$sql .= "where domain_uuid = '$domain_uuid' \n";
$sql .= "limit $rows_per_page offset $offset \n";
//$sql .= "order by field_order asc \n";
//echo "<pre>\n";
//echo $sql;
//echo "</pre>\n";
$prep_statement = $db_memory->prepare($sql);
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_ASSOC);