Update the array path after removing context tag
This commit is contained in:
parent
d31e854488
commit
d5850f154c
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Mark J Crane <markjcrane@fusionpbx.com>
|
Mark J Crane <markjcrane@fusionpbx.com>
|
||||||
Copyright (C) 2010-2019
|
Copyright (C) 2010-2023
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
|
|
@ -255,17 +255,17 @@
|
||||||
|
|
||||||
//ensure the condition array is 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['condition'][0])) {
|
||||||
$tmp = $dialplan['extension']['condition'];
|
$tmp = $dialplan['condition'];
|
||||||
unset($dialplan['extension']['condition']);
|
unset($dialplan['condition']);
|
||||||
$dialplan['extension']['condition'][0] = $tmp;
|
$dialplan['condition'][0] = $tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//determine if the dialplan already exists
|
//determine if the dialplan already exists
|
||||||
$app_uuid_exists = false;
|
$app_uuid_exists = false;
|
||||||
foreach($app_uuids as $row) {
|
foreach($app_uuids as $row) {
|
||||||
if ($dialplan['extension']['@attributes']['app_uuid'] == $row['app_uuid']) {
|
if ($dialplan['@attributes']['app_uuid'] == $row['app_uuid']) {
|
||||||
$app_uuid_exists = true;
|
$app_uuid_exists = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -273,19 +273,18 @@
|
||||||
//check if the dialplan exists
|
//check if the dialplan exists
|
||||||
if (!$app_uuid_exists) {
|
if (!$app_uuid_exists) {
|
||||||
|
|
||||||
//debug info
|
|
||||||
//echo " dialplan name ".$dialplan['extension']['@attributes']['name']." not found\n";
|
|
||||||
|
|
||||||
//dialplan global
|
//dialplan global
|
||||||
if (isset($dialplan['extension']['@attributes']['global']) && $dialplan['extension']['@attributes']['global'] == "true") {
|
if (isset($dialplan['@attributes']['global']) && $dialplan['@attributes']['global'] == "true") {
|
||||||
$dialplan_global = true;
|
$dialplan_global = true;
|
||||||
$dialplan_context = 'global';
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$dialplan_global = false;
|
$dialplan_global = false;
|
||||||
$dialplan_context = $dialplan['@attributes']['name'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//get the dialplan context
|
||||||
|
$dialplan_context = $dialplan['@attributes']['context'];
|
||||||
|
$dialplan_context = str_replace("\${domain_name}", $domain['domain_name'], $dialplan_context);
|
||||||
|
|
||||||
//set the domain_uuid
|
//set the domain_uuid
|
||||||
if ($dialplan_global) {
|
if ($dialplan_global) {
|
||||||
$domain_uuid = null;
|
$domain_uuid = null;
|
||||||
|
|
@ -299,31 +298,31 @@
|
||||||
|
|
||||||
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
$array['dialplans'][$x]['dialplan_uuid'] = $dialplan_uuid;
|
||||||
$array['dialplans'][$x]['domain_uuid'] = $domain_uuid;
|
$array['dialplans'][$x]['domain_uuid'] = $domain_uuid;
|
||||||
$array['dialplans'][$x]['app_uuid'] = $dialplan['extension']['@attributes']['app_uuid'];
|
$array['dialplans'][$x]['app_uuid'] = $dialplan['@attributes']['app_uuid'];
|
||||||
$array['dialplans'][$x]['dialplan_name'] = $dialplan['extension']['@attributes']['name'];
|
$array['dialplans'][$x]['dialplan_name'] = $dialplan['@attributes']['name'];
|
||||||
$array['dialplans'][$x]['dialplan_number'] = $dialplan['extension']['@attributes']['number'];
|
$array['dialplans'][$x]['dialplan_number'] = $dialplan['@attributes']['number'];
|
||||||
$array['dialplans'][$x]['dialplan_context'] = $dialplan_context;
|
$array['dialplans'][$x]['dialplan_context'] = $dialplan_context;
|
||||||
if (strlen($dialplan['extension']['@attributes']['destination']) > 0) {
|
if (strlen($dialplan['@attributes']['destination']) > 0) {
|
||||||
$array['dialplans'][$x]['dialplan_destination'] = $dialplan['extension']['@attributes']['destination'];
|
$array['dialplans'][$x]['dialplan_destination'] = $dialplan['@attributes']['destination'];
|
||||||
}
|
}
|
||||||
if (strlen($dialplan['extension']['@attributes']['continue']) > 0) {
|
if (strlen($dialplan['@attributes']['continue']) > 0) {
|
||||||
$array['dialplans'][$x]['dialplan_continue'] = $dialplan['extension']['@attributes']['continue'];
|
$array['dialplans'][$x]['dialplan_continue'] = $dialplan['@attributes']['continue'];
|
||||||
}
|
}
|
||||||
$array['dialplans'][$x]['dialplan_order'] = $dialplan['extension']['@attributes']['order'];
|
$array['dialplans'][$x]['dialplan_order'] = $dialplan['@attributes']['order'];
|
||||||
if (strlen($dialplan['extension']['@attributes']['enabled']) > 0) {
|
if (strlen($dialplan['@attributes']['enabled']) > 0) {
|
||||||
$array['dialplans'][$x]['dialplan_enabled'] = $dialplan['extension']['@attributes']['enabled'];
|
$array['dialplans'][$x]['dialplan_enabled'] = $dialplan['@attributes']['enabled'];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$array['dialplans'][$x]['dialplan_enabled'] = "true";
|
$array['dialplans'][$x]['dialplan_enabled'] = "true";
|
||||||
}
|
}
|
||||||
$array['dialplans'][$x]['dialplan_description'] = $dialplan['extension']['@attributes']['description'];
|
$array['dialplans'][$x]['dialplan_description'] = $dialplan['@attributes']['description'];
|
||||||
|
|
||||||
//loop through the condition array
|
//loop through the condition array
|
||||||
$y = 0;
|
$y = 0;
|
||||||
$group = 0;
|
$group = 0;
|
||||||
$order = 5;
|
$order = 5;
|
||||||
if (isset($dialplan['extension']['condition'])) {
|
if (isset($dialplan['condition'])) {
|
||||||
foreach ($dialplan['extension']['condition'] as &$row) {
|
foreach ($dialplan['condition'] as &$row) {
|
||||||
|
|
||||||
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
|
$array['dialplans'][$x]['dialplan_details'][$y]['domain_uuid'] = $domain_uuid;
|
||||||
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid;
|
$array['dialplans'][$x]['dialplan_details'][$y]['dialplan_uuid'] = $dialplan_uuid;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue