Add ability to have global dialplan templates.
This commit is contained in:
@@ -73,7 +73,12 @@ include "root.php";
|
|||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
$sql .= "values ";
|
$sql .= "values ";
|
||||||
$sql .= "(";
|
$sql .= "(";
|
||||||
$sql .= "'".check_str($this->domain_uuid)."', ";
|
if (strlen($this->domain_uuid) > 0) {
|
||||||
|
$sql .= "'".check_str($this->domain_uuid)."', ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= "null, ";
|
||||||
|
}
|
||||||
$sql .= "'".check_str($this->app_uuid)."', ";
|
$sql .= "'".check_str($this->app_uuid)."', ";
|
||||||
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
||||||
$sql .= "'".check_str($this->dialplan_name)."', ";
|
$sql .= "'".check_str($this->dialplan_name)."', ";
|
||||||
@@ -99,7 +104,7 @@ include "root.php";
|
|||||||
$sql .= "dialplan_context = '".check_str($this->dialplan_context)."', ";
|
$sql .= "dialplan_context = '".check_str($this->dialplan_context)."', ";
|
||||||
$sql .= "dialplan_enabled = '".check_str($this->dialplan_enabled)."', ";
|
$sql .= "dialplan_enabled = '".check_str($this->dialplan_enabled)."', ";
|
||||||
$sql .= "dialplan_description = '".check_str($this->dialplan_description)."' ";
|
$sql .= "dialplan_description = '".check_str($this->dialplan_description)."' ";
|
||||||
$sql .= "where domain_uuid = '".check_str($this->domain_uuid)."' ";
|
$sql .= "where (domain_uuid = '".check_str($this->domain_uuid)."' or domain_uuid is null) ";
|
||||||
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
|
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
|
||||||
//echo "sql: ".$sql."<br />";
|
//echo "sql: ".$sql."<br />";
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
@@ -125,7 +130,12 @@ include "root.php";
|
|||||||
$sql .= "values ";
|
$sql .= "values ";
|
||||||
$sql .= "( ";
|
$sql .= "( ";
|
||||||
$sql .= "'".$dialplan_detail_uuid."', ";
|
$sql .= "'".$dialplan_detail_uuid."', ";
|
||||||
$sql .= "'".check_str($this->domain_uuid)."', ";
|
if (strlen($this->domain_uuid) == 0) {
|
||||||
|
$sql .= "null, ";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$sql .= "'".check_str($this->domain_uuid)."', ";
|
||||||
|
}
|
||||||
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
||||||
$sql .= "'".check_str($this->dialplan_detail_tag)."', ";
|
$sql .= "'".check_str($this->dialplan_detail_tag)."', ";
|
||||||
$sql .= "'".check_str($this->dialplan_detail_order)."', ";
|
$sql .= "'".check_str($this->dialplan_detail_order)."', ";
|
||||||
@@ -171,7 +181,7 @@ include "root.php";
|
|||||||
$sql .= "dialplan_detail_group = '".check_str($this->dialplan_detail_group)."', ";
|
$sql .= "dialplan_detail_group = '".check_str($this->dialplan_detail_group)."', ";
|
||||||
}
|
}
|
||||||
$sql .= "dialplan_detail_tag = '".check_str($this->dialplan_detail_tag)."' ";
|
$sql .= "dialplan_detail_tag = '".check_str($this->dialplan_detail_tag)."' ";
|
||||||
$sql .= "where domain_uuid = '".check_str($this->domain_uuid)."' ";
|
$sql .= "where (domain_uuid = '".check_str($this->domain_uuid)."' or domain_uuid is null) ";
|
||||||
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
|
$sql .= "and dialplan_uuid = '".check_str($this->dialplan_uuid)."' ";
|
||||||
//echo "sql: ".$sql."<br />";
|
//echo "sql: ".$sql."<br />";
|
||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
@@ -227,7 +237,7 @@ include "root.php";
|
|||||||
public function dialplan_exists() {
|
public function dialplan_exists() {
|
||||||
global $db;
|
global $db;
|
||||||
$sql = "select count(*) as num_rows from v_dialplans ";
|
$sql = "select count(*) as num_rows from v_dialplans ";
|
||||||
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
|
$sql .= "where (domain_uuid = '".$this->domain_uuid."' or domain_uuid is null)";
|
||||||
$sql .= "and dialplan_uuid = '".$this->dialplan_uuid."' ";
|
$sql .= "and dialplan_uuid = '".$this->dialplan_uuid."' ";
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
if ($prep_statement) {
|
if ($prep_statement) {
|
||||||
@@ -262,7 +272,7 @@ include "root.php";
|
|||||||
$dialplan = json_decode($json, true);
|
$dialplan = json_decode($json, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
//ensure the condition array uniform
|
//ensure the condition array is uniform
|
||||||
if (is_array($dialplan)) {
|
if (is_array($dialplan)) {
|
||||||
if (!is_array($dialplan['extension']['condition'][0])) {
|
if (!is_array($dialplan['extension']['condition'][0])) {
|
||||||
$tmp = $dialplan['extension']['condition'];
|
$tmp = $dialplan['extension']['condition'];
|
||||||
@@ -283,6 +293,11 @@ include "root.php";
|
|||||||
$this->dialplan_name = $dialplan['extension']['@attributes']['name'];
|
$this->dialplan_name = $dialplan['extension']['@attributes']['name'];
|
||||||
$this->dialplan_number = $dialplan['extension']['@attributes']['number'];
|
$this->dialplan_number = $dialplan['extension']['@attributes']['number'];
|
||||||
$this->dialplan_context = $dialplan['@attributes']['name'];
|
$this->dialplan_context = $dialplan['@attributes']['name'];
|
||||||
|
if (strlen($dialplan['extension']['@attributes']['global']) > 0) {
|
||||||
|
if ($dialplan['extension']['@attributes']['global'] == "true") {
|
||||||
|
$this->domain_uuid = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
if ($this->display_type == "text") {
|
if ($this->display_type == "text") {
|
||||||
echo " ".$this->dialplan_name.": added\n";
|
echo " ".$this->dialplan_name.": added\n";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user