diff options
author | mcrane <mctch@yahoo.com> | 2009-07-28 07:07:15 -0600 |
---|---|---|
committer | mcrane <mctch@yahoo.com> | 2009-07-28 07:07:15 -0600 |
commit | 7ccc368017533ea47ba728ad7a84215b149944ed (patch) | |
tree | 10136917f064664446f9452bf89610e8094804b3 /config/freeswitch_dev/v_dialplan_includes_edit.tmp | |
parent | f805de2a0fdc3e888f0144bfff6dab58f5e0b132 (diff) | |
download | pfsense-packages-7ccc368017533ea47ba728ad7a84215b149944ed.tar.gz pfsense-packages-7ccc368017533ea47ba728ad7a84215b149944ed.tar.bz2 pfsense-packages-7ccc368017533ea47ba728ad7a84215b149944ed.zip |
FreeSWITCH package finish package file rename.
Diffstat (limited to 'config/freeswitch_dev/v_dialplan_includes_edit.tmp')
-rw-r--r-- | config/freeswitch_dev/v_dialplan_includes_edit.tmp | 543 |
1 files changed, 543 insertions, 0 deletions
diff --git a/config/freeswitch_dev/v_dialplan_includes_edit.tmp b/config/freeswitch_dev/v_dialplan_includes_edit.tmp new file mode 100644 index 00000000..42fefc89 --- /dev/null +++ b/config/freeswitch_dev/v_dialplan_includes_edit.tmp @@ -0,0 +1,543 @@ +<?php +/* $Id$ */ +/* + v_dialplan_includes_edit.php + Copyright (C) 2008 Mark J Crane + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); +require("/usr/local/pkg/v_config.inc"); + + +//freeswitchdialplanincludes + //dialplanincludeid + //extensionname + //context + //default + //enabled + //descr + +// + + + +$a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config']; +$a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config']; + +$id = $_GET['id']; +if (isset($_POST['id'])) { + $id = $_POST['id']; +} +$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['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']; +} + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + if ($_GET['act'] == "del") { + if ($_GET['type'] == 'dialplanincludedetails') { + if ($a_dialplan_include_details[$_GET['id']]) { + unset($a_dialplan_include_details[$_GET['id']]); + write_config(); + sync_package_v_dialplan_includes(); + header("Location: v_dialplan_include_edit.php?id=".$_GET['id']); + exit; + } + } + } + + + if (!$input_errors) { + + $ent = array(); + if (strlen($_POST['dialplanincludeid']) > 0) { + //update + $ent['dialplanincludeid'] = $_POST['dialplanincludeid']; + } + else { + //add + $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['opt1value'] = $_POST['opt1value']; + + + if (isset($id) && $a_dialplan_includes[$id]) { + + 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 + $a_dialplan_includes[] = $ent; + } + + + write_config(); + sync_package_v_dialplan_includes(); + + header("Location: v_dialplan_includes.php"); + exit; + } +} + +include("head.inc"); + +?> + +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> + +<?php +include("fbegin.inc"); +echo "<p class=\"pgtitle\">$v_project_label: Dialplan: Edit</p>\n"; +?> + +<?php if ($input_errors) print_input_errors($input_errors); ?> + + +<div id="mainlevel"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<tr><td class="tabnavtbl"> +<?php + +display_top_tabs(build_menu()); + +?> +</td></tr> +</table> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td class="tabcont" > + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>Dialplan:<br> + </strong></span> + Dialplan Include general settings. + </span></p></td> + </tr> + </table> + <br /> + + <form action="v_dialplan_includes_edit.php" method="post" name="iform" id="iform"> + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td width="22%" valign="top" class="vncellreq">Extension Name</td> + <td width="78%" class="vtable"> + <input name="extensionname" type="text" class="formfld" id="extensionname" size="40" value="<?=htmlspecialchars($pconfig['extensionname']);?>"> + <br /> + Supported characters are 'a-z', 'A-Z', '0-9', underscore '_', and period '.'. + </td> + </tr> + <!-- + <tr> + <td width="22%" valign="top" class="vncellreq">Context</td> + <td width="78%" class="vtable"> + <input name="context" type="text" class="formfld" id="context" size="40" value="<?=htmlspecialchars($pconfig['context']);?>"> + <br /> + e.g. default + </td> + </tr> + --> + + <tr> + <td width="22%" valign="top" class="vncellreq">Enabled</td> + <td width="78%" class="vtable"> + <?php + echo " <select name='enabled' class='formfld'>\n"; + echo " <option></option>\n"; + switch (htmlspecialchars($pconfig['enabled'])) { + case "true": + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + break; + case "false": + echo " <option value='true'>true</option>\n"; + echo " <option value='false' selected='yes'>false</option>\n"; + + break; + default: + echo " <option value='true' selected='yes'>true</option>\n"; + echo " <option value='false'>false</option>\n"; + } + echo " </select>\n"; + ?> + </td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncellreq">Order</td> + <td width="78%" class="vtable"> + <?php + + echo " <select name='order' class='formfld'>\n"; + //echo " <option></option>\n"; + if (strlen(htmlspecialchars($pconfig['order']))> 0) { + echo " <option selected='yes' value='".htmlspecialchars($pconfig['order'])."'>".htmlspecialchars($pconfig['order'])."</option>\n"; + } + $i=0; + while($i<=999) { + if (strlen($i) == 1) { + echo " <option value='00$i'>00$i</option>\n"; + } + if (strlen($i) == 2) { + echo " <option value='0$i'>0$i</option>\n"; + } + if (strlen($i) == 3) { + echo " <option value='$i'>$i</option>\n"; + } + + $i++; + } + echo " </select>\n"; + ?> + <br /> + Processing of each dialplan include is determined by this order. + </td> + </tr> + + <tr> + <td width="22%" valign="top" class="vncell">Description</td> + <td width="78%" class="vtable"> + <input name="descr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>"> + <br> <span class="vexpl">You may enter a description here + for your reference (not parsed).</span></td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="dialplanincludeid" type="hidden" value="<?=htmlspecialchars($pconfig['dialplanincludeid']);?>"> + <?php + if (strlen($id) > 0 && $a_dialplan_includes[$id]) { + echo "\n"; + echo " <input name=\"id\" type=\"hidden\" value=\"$id\">\n"; + echo " <input name=\"opt1name\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1name'])."\">\n"; + echo " <input name=\"opt1value\" type=\"hidden\" value=\"".htmlspecialchars($pconfig['opt1value'])."\">\n"; + } + ?> + <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()"> + </td> + </tr> + </table> + </form> + + <br> + <br> + + <form action="v_dialplan_includes_edit.php" method="post" name="iform2" id="iform2"> + <?php + + //echo "<pre>"; + //print_r ($a_dialplan_includes); + //echo "</pre>"; + + //if ($savemsg) print_info_box($savemsg); + //if (file_exists($d_hostsdirty_path)): echo"<p>"; + //print_info_box_np("The FreeSWITCH recordings have been changed.<br>You must apply the changes in order for them to take effect."); + //echo"<br />"; + //endif; + + //create a temporary id for the array + $i = 0; + if (count($a_dialplan_include_details) > 0) { + foreach ($a_dialplan_include_details as $ent) { + $a_dialplan_include_details[$i]['id'] = $i; + $i++; + } + } + + //order the array + function cmp_number($a, $b) { + if ($a["fieldorder"] > $b["fieldorder"]) { + return 1; + } + else { + return 0; + } + } + if (count($a_dialplan_include_details) > 0) { usort($a_dialplan_include_details, "cmp_number"); } + + ?> + + + <table width="100%" border="0" cellpadding="6" cellspacing="0"> + <tr> + <td><p><span class="vexpl"><span class="red"><strong>Conditions and Actions<br /> + </strong></span> + The following conditions, actions and anti-actions are used in the dialplan to direct call flow. Each is processed in order until you reach the action tag which tells FreeSWITCH what action to perform. You are not limited to only one condition or action tag for a given extension. + </span></p></td> + </tr> + </table> + <br /> + + <table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td width="40" class="listhdrr">Tag</td> + <td width="40" class="listhdrr">Type</td> + <td width="50%" class="listhdrr">Data</td> + <td width="40" class="listhdrr">Order</td> + <td width="40" class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"><a href="v_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + <?php + + $i = 0; + if (count($a_dialplan_include_details) > 0) { + + foreach ($a_dialplan_include_details as $ent) { + if ($ent['tag'] == "condition" && $dialplanincludeid == $ent['dialplanincludeid']) { + ?> + <tr> + <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> + <?=$ent['tag']?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldtype'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fielddata'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldorder'];?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + } + $i++; + } + } + + $i = 0; + if (count($a_dialplan_include_details) > 0) { + + foreach ($a_dialplan_include_details as $ent) { + if ($ent['tag'] == "action" && $dialplanincludeid == $ent['dialplanincludeid']) { + ?> + <tr> + <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> + <?=$ent['tag']?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldtype'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fielddata'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldorder'];?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + } + $i++; + } + } + + $i = 0; + if (count($a_dialplan_include_details) > 0) { + + foreach ($a_dialplan_include_details as $ent) { + if ($ent['tag'] == "anti-action" && $dialplanincludeid == $ent['dialplanincludeid']) { + ?> + <tr> + <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> + <?=$ent['tag']?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldtype'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fielddata'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldorder'];?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + } + $i++; + } + } + + $i = 0; + if (count($a_dialplan_include_details) > 0) { + + foreach ($a_dialplan_include_details as $ent) { + if ($ent['tag'] == "param" && $dialplanincludeid == $ent['dialplanincludeid']) { + ?> + <tr> + <td class="listlr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'"> + <?=$ent['tag']?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldtype'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fielddata'];?> + </td> + <td class="listr" ondblclick="document.location='v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>';"> + <?=$ent['fieldorder'];?> + </td> + <td valign="middle" nowrap class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td valign="middle"><a href="v_dialplan_includes_details_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> + <td><a href="v_dialplan_includes_details.php?type=dialplanincludedetails&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>" onclick="return confirm('Do you really want to delete this?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + <?php + } + $i++; + } + } + ?> + <tr> + <td class="list" colspan="4"></td> + <td class="list"> + <table border="0" cellspacing="0" cellpadding="1"> + <tr> + <td width="17"></td> + <td valign="middle"><a href="v_dialplan_includes_details_edit.php?parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>&a=action"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> + </tr> + </table> + </td> + </tr> + + + <tr> + <td class="list" colspan="4"></td> + <td class="list"></td> + </tr> + </table> + + </form> + + + + + <br> + <br> + + </td> + </tr> +</table> + +</div> + +<?php include("fend.inc"); ?> +</body> +</html> |