aboutsummaryrefslogtreecommitdiffstats
path: root/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
diff options
context:
space:
mode:
Diffstat (limited to 'packages/freeswitch/freeswitch_dialplan_includes_edit.tmp')
-rw-r--r--packages/freeswitch/freeswitch_dialplan_includes_edit.tmp97
1 files changed, 50 insertions, 47 deletions
diff --git a/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp b/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
index 74b17272..93c40082 100644
--- a/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
+++ b/packages/freeswitch/freeswitch_dialplan_includes_edit.tmp
@@ -60,13 +60,13 @@ $parentid = $id;
if (isset($id) && $a_dialplan_includes[$id]) {
$pconfig['dialplanincludeid'] = $a_dialplan_includes[$id]['dialplanincludeid'];
$dialplanincludeid = $a_dialplan_includes[$id]['dialplanincludeid'];
- $pconfig['extensionname'] = $a_dialplan_includes[$id]['extensionname'];
- $pconfig['order'] = $a_dialplan_includes[$id]['order'];
+ $pconfig['extensionname'] = $a_dialplan_includes[$id]['extensionname'];
+ $pconfig['order'] = $a_dialplan_includes[$id]['order'];
$pconfig['context'] = $a_dialplan_includes[$id]['context'];
$pconfig['enabled'] = $a_dialplan_includes[$id]['enabled'];
$pconfig['descr'] = $a_dialplan_includes[$id]['descr'];
- $pconfig['opt1name'] = $a_dialplan_includes[$id]['opt1name'];
- $pconfig['opt1value'] = $a_dialplan_includes[$id]['opt1value'];
+ $pconfig['opt1name'] = $a_dialplan_includes[$id]['opt1name'];
+ $pconfig['opt1value'] = $a_dialplan_includes[$id]['opt1value'];
}
if ($_POST) {
@@ -96,59 +96,62 @@ if ($_POST) {
}
else {
//add
- $ent['dialplanincludeid'] = guid();
- }
+ $ent['dialplanincludeid'] = guid();
+ }
$ent['extensionname'] = $_POST['extensionname'];
$ent['order'] = $_POST['order'];
//$ent['context'] = $_POST['context'];
$ent['context'] = 'default';
$ent['enabled'] = $_POST['enabled'];
$ent['descr'] = $_POST['descr'];
- $ent['opt1name'] = $_POST['opt1name'];
+ $ent['opt1name'] = $_POST['opt1name'];
$ent['opt1value'] = $_POST['opt1value'];
if (isset($id) && $a_dialplan_includes[$id]) {
-
- foreach($config['freeswitchdialplanincludes']['config'] as $rowhelper) {
-
- //$rowhelper['dialplanincludeid'];
- //$rowhelper['extensionname'];
- //$rowhelper['context'];
- //$rowhelper['enabled'];
-
- $filenamechanged = false;
- if ($rowhelper['dialplanincludeid'] == $_POST['dialplanincludeid']) {
-
- if ($rowhelper['extensionname'] != $_POST['extensionname']) {
- //if the extension name has changed then remove the current dialplan xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($rowhelper['order'] != $_POST['order']) {
- //if the order has changed then remove the current dialplan xml file
- //to prepare for the new file
- $filenamechanged = true;
- }
- if ($_POST['enabled'] == "false") {
- //if the extension name is disabled then remove the dialplan xml file
- $filenamechanged = true;
- }
- if ($filenamechanged){
- $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
- if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) {
- unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename);
- }
- unset($dialplanincludefilename);
- }
-
- }
- unset($filenamechanged);
-
- } //end foreach
-
- //update the config
- $a_dialplan_includes[$id] = $ent;
+
+ $a_dialplan_includes = $config['freeswitchdialplanincludes']['config'];
+ if (count($a_dialplan_includes)>0) {
+ foreach($a_dialplan_includes as $rowhelper) {
+
+ //$rowhelper['dialplanincludeid'];
+ //$rowhelper['extensionname'];
+ //$rowhelper['context'];
+ //$rowhelper['enabled'];
+
+ $filenamechanged = false;
+ if ($rowhelper['dialplanincludeid'] == $_POST['dialplanincludeid']) {
+
+ if ($rowhelper['extensionname'] != $_POST['extensionname']) {
+ //if the extension name has changed then remove the current dialplan xml file
+ //to prepare for the new file
+ $filenamechanged = true;
+ }
+ if ($rowhelper['order'] != $_POST['order']) {
+ //if the order has changed then remove the current dialplan xml file
+ //to prepare for the new file
+ $filenamechanged = true;
+ }
+ if ($_POST['enabled'] == "false") {
+ //if the extension name is disabled then remove the dialplan xml file
+ $filenamechanged = true;
+ }
+ if ($filenamechanged){
+ $dialplanincludefilename = $rowhelper['order']."_".$rowhelper['extensionname'].".xml";
+ if (file_exists("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename)) {
+ unlink("/usr/local/freeswitch/conf/dialplan/default/".$dialplanincludefilename);
+ }
+ unset($dialplanincludefilename);
+ }
+
+ }
+ unset($filenamechanged);
+
+ } //end foreach
+ } //end count
+
+ //update the config
+ $a_dialplan_includes[$id] = $ent;
}
else {
//add to the config