parent
0a89b156f9
commit
dbc2a561f4
|
|
@ -45,6 +45,7 @@ include "root.php";
|
||||||
public $dialplan_continue;
|
public $dialplan_continue;
|
||||||
public $dialplan_order;
|
public $dialplan_order;
|
||||||
public $dialplan_context;
|
public $dialplan_context;
|
||||||
|
public $dialplan_global;
|
||||||
public $dialplan_enabled;
|
public $dialplan_enabled;
|
||||||
public $dialplan_description;
|
public $dialplan_description;
|
||||||
|
|
||||||
|
|
@ -66,6 +67,9 @@ include "root.php";
|
||||||
$database->connect();
|
$database->connect();
|
||||||
$this->db = $database->db;
|
$this->db = $database->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//set the default value
|
||||||
|
$this->dialplan_global = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dialplan_add() {
|
public function dialplan_add() {
|
||||||
|
|
@ -85,11 +89,11 @@ include "root.php";
|
||||||
$sql .= ")";
|
$sql .= ")";
|
||||||
$sql .= "values ";
|
$sql .= "values ";
|
||||||
$sql .= "(";
|
$sql .= "(";
|
||||||
if (strlen($this->domain_uuid) > 0) {
|
if ($this->dialplan_global) {
|
||||||
$sql .= "'".check_str($this->domain_uuid)."', ";
|
$sql .= "null, ";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$sql .= "null, ";
|
$sql .= "'".check_str($this->domain_uuid)."', ";
|
||||||
}
|
}
|
||||||
$sql .= "'".check_str($this->app_uuid)."', ";
|
$sql .= "'".check_str($this->app_uuid)."', ";
|
||||||
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
$sql .= "'".check_str($this->dialplan_uuid)."', ";
|
||||||
|
|
@ -142,7 +146,7 @@ include "root.php";
|
||||||
$sql .= "values ";
|
$sql .= "values ";
|
||||||
$sql .= "( ";
|
$sql .= "( ";
|
||||||
$sql .= "'".$dialplan_detail_uuid."', ";
|
$sql .= "'".$dialplan_detail_uuid."', ";
|
||||||
if (strlen($this->domain_uuid) == 0) {
|
if ($this->dialplan_global) {
|
||||||
$sql .= "null, ";
|
$sql .= "null, ";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -266,7 +270,7 @@ include "root.php";
|
||||||
public function import() {
|
public function import() {
|
||||||
if (strlen($this->xml) > 0) {
|
if (strlen($this->xml) > 0) {
|
||||||
//replace the variables
|
//replace the variables
|
||||||
$this->xml = str_replace("{v_context}", $this->default_context, $this->xml);
|
//$this->xml = str_replace("{v_context}", $this->default_context, $this->xml);
|
||||||
$this->xml = str_replace("{v_pin_number}", generate_password(8, 1), $this->xml);
|
$this->xml = str_replace("{v_pin_number}", generate_password(8, 1), $this->xml);
|
||||||
$this->xml = str_replace("{v_switch_recordings_dir}", $_SESSION['switch']['recordings']['dir'], $this->xml);
|
$this->xml = str_replace("{v_switch_recordings_dir}", $_SESSION['switch']['recordings']['dir'], $this->xml);
|
||||||
//convert the xml string to an xml object
|
//convert the xml string to an xml object
|
||||||
|
|
@ -303,9 +307,9 @@ include "root.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
//check if the dialplan app uuid exists
|
//check if the dialplan app uuid exists
|
||||||
foreach ($_SESSION['domains'] as $row) {
|
foreach ($_SESSION['domains'] as $domain) {
|
||||||
//get the domain_uuid
|
//get the domain_uuid
|
||||||
$this->domain_uuid = $row['domain_uuid'];
|
$this->domain_uuid = $domain['domain_uuid'];
|
||||||
|
|
||||||
//check if the dialplan exists
|
//check if the dialplan exists
|
||||||
if (!$this->app_uuid_exists()) {
|
if (!$this->app_uuid_exists()) {
|
||||||
|
|
@ -316,9 +320,10 @@ 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 = $row['domain_name'];
|
$this->dialplan_context = $row['domain_name'];
|
||||||
|
$this->dialplan_global = false;
|
||||||
if (strlen($dialplan['extension']['@attributes']['global']) > 0) {
|
if (strlen($dialplan['extension']['@attributes']['global']) > 0) {
|
||||||
if ($dialplan['extension']['@attributes']['global'] == "true") {
|
if ($dialplan['extension']['@attributes']['global'] == "true") {
|
||||||
$this->domain_uuid = null;
|
$this->dialplan_global = true;
|
||||||
$this->dialplan_context = '${domain_name}';
|
$this->dialplan_context = '${domain_name}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -340,7 +345,8 @@ include "root.php";
|
||||||
$x = 0;
|
$x = 0;
|
||||||
$group = 0;
|
$group = 0;
|
||||||
$order = 5;
|
$order = 5;
|
||||||
if (isset($dialplan['extension']['condition'])) foreach ($dialplan['extension']['condition'] as &$row) {
|
if (isset($dialplan['extension']['condition'])) {
|
||||||
|
foreach ($dialplan['extension']['condition'] as &$row) {
|
||||||
unset($this->dialplan_detail_break);
|
unset($this->dialplan_detail_break);
|
||||||
unset($this->dialplan_detail_inline);
|
unset($this->dialplan_detail_inline);
|
||||||
$this->dialplan_detail_tag = 'condition';
|
$this->dialplan_detail_tag = 'condition';
|
||||||
|
|
@ -371,7 +377,8 @@ include "root.php";
|
||||||
$order = $order + 5;
|
$order = $order + 5;
|
||||||
unset($this->dialplan_detail_break);
|
unset($this->dialplan_detail_break);
|
||||||
unset($this->dialplan_detail_inline);
|
unset($this->dialplan_detail_inline);
|
||||||
if (isset($row['action'])) foreach ($row['action'] as &$row2) {
|
if (isset($row['action'])) {
|
||||||
|
foreach ($row['action'] as &$row2) {
|
||||||
$this->dialplan_detail_tag = 'action';
|
$this->dialplan_detail_tag = 'action';
|
||||||
$this->dialplan_detail_type = $row2['@attributes']['application'];
|
$this->dialplan_detail_type = $row2['@attributes']['application'];
|
||||||
$this->dialplan_detail_data = $row2['@attributes']['data'];
|
$this->dialplan_detail_data = $row2['@attributes']['data'];
|
||||||
|
|
@ -383,7 +390,9 @@ include "root.php";
|
||||||
$this->dialplan_detail_add();
|
$this->dialplan_detail_add();
|
||||||
$order = $order + 5;
|
$order = $order + 5;
|
||||||
}
|
}
|
||||||
if (isset($row['anti-action'])) foreach ($row['anti-action'] as &$row2) {
|
}
|
||||||
|
if (isset($row['anti-action'])) {
|
||||||
|
foreach ($row['anti-action'] as &$row2) {
|
||||||
$this->dialplan_detail_tag = 'anti-action';
|
$this->dialplan_detail_tag = 'anti-action';
|
||||||
$this->dialplan_detail_type = $row2['@attributes']['application'];
|
$this->dialplan_detail_type = $row2['@attributes']['application'];
|
||||||
$this->dialplan_detail_data = $row2['@attributes']['data'];
|
$this->dialplan_detail_data = $row2['@attributes']['data'];
|
||||||
|
|
@ -393,6 +402,7 @@ include "root.php";
|
||||||
$order = $order + 5;
|
$order = $order + 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
$condition_self_closing_tag = true;
|
$condition_self_closing_tag = true;
|
||||||
}
|
}
|
||||||
|
|
@ -404,6 +414,7 @@ include "root.php";
|
||||||
$order = $order + 5;
|
$order = $order + 5;
|
||||||
$x++;
|
$x++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//end the transaction
|
//end the transaction
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue