aboutsummaryrefslogtreecommitdiffstats
path: root/config/freeswitch/freeswitch_hunt_group_edit.tmp
diff options
context:
space:
mode:
Diffstat (limited to 'config/freeswitch/freeswitch_hunt_group_edit.tmp')
-rw-r--r--config/freeswitch/freeswitch_hunt_group_edit.tmp412
1 files changed, 412 insertions, 0 deletions
diff --git a/config/freeswitch/freeswitch_hunt_group_edit.tmp b/config/freeswitch/freeswitch_hunt_group_edit.tmp
new file mode 100644
index 00000000..8e06429c
--- /dev/null
+++ b/config/freeswitch/freeswitch_hunt_group_edit.tmp
@@ -0,0 +1,412 @@
+<?php
+/* $Id$ */
+/*
+
+ freeswitch_hunt_group_edit.php
+ Copyright (C) 2008 Mark J Crane
+ All rights reserved.
+
+ FreeSWITCH (TM)
+ http://www.freeswitch.org/
+
+ 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/freeswitch.inc");
+
+
+$a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
+$a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
+
+
+$id = $_GET['id'];
+if (isset($_POST['id'])) {
+ $id = $_POST['id'];
+}
+$parentid = $id;
+
+
+
+if (isset($id) && $a_hunt_group[$id]) {
+ $pconfig['huntgroupid'] = $a_hunt_group[$id]['huntgroupid'];
+ $huntgroupid = $a_hunt_group[$id]['huntgroupid'];
+ $pconfig['huntgroupextension'] = $a_hunt_group[$id]['huntgroupextension'];
+ $pconfig['huntgroupname'] = $a_hunt_group[$id]['huntgroupname'];
+ $pconfig['huntgrouptype'] = $a_hunt_group[$id]['huntgrouptype'];
+ $pconfig['huntgroupcontext'] = $a_hunt_group[$id]['huntgroupcontext'];
+ $pconfig['huntgrouptimeout'] = $a_hunt_group[$id]['huntgrouptimeout'];
+ $pconfig['huntgrouptimeoutdestination'] = $a_hunt_group[$id]['huntgrouptimeoutdestination'];
+ $pconfig['huntgrouptimeouttype'] = $a_hunt_group[$id]['huntgrouptimeouttype'];
+ $pconfig['huntgroupdescr'] = $a_hunt_group[$id]['huntgroupdescr'];
+}
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+ if ($_GET['act'] == "del") {
+ if ($_GET['type'] == 'destinations') {
+ if ($a_hunt_group_destinations[$_GET['optionid']]) {
+ unset($a_hunt_group_destinations[$_GET['optionid']]);
+ write_config();
+ sync_package_freeswitch_hunt_group();
+ header("Location: freeswitch_hunt_group_edit.php?id=".$_GET['id']);
+ exit;
+ }
+ }
+ }
+
+
+ if (!$input_errors) {
+
+ $huntgroupent = array();
+ if (strlen($_POST['huntgroupid']) > 0) {
+ $huntgroupent['huntgroupid'] = $_POST['huntgroupid'];
+ }
+ else {
+ $huntgroupent['huntgroupid'] = guid();
+ }
+ $huntgroupent['huntgroupextension'] = $_POST['huntgroupextension'];
+ $huntgroupent['huntgroupname'] = $_POST['huntgroupname'];
+ $huntgroupent['huntgrouptype'] = $_POST['huntgrouptype'];
+ $huntgroupent['huntgroupcontext'] = $_POST['huntgroupcontext'];
+ $huntgroupent['huntgrouptimeout'] = $_POST['huntgrouptimeout'];
+ $huntgroupent['huntgrouptimeoutdestination'] = $_POST['huntgrouptimeoutdestination'];
+ $huntgroupent['huntgrouptimeouttype'] = $_POST['huntgrouptimeouttype'];
+ $huntgroupent['huntgroupdescr'] = $_POST['huntgroupdescr'];
+
+ if (isset($id) && $a_hunt_group[$id]) {
+ //update
+ $a_hunt_group[$id] = $huntgroupent;
+ }
+ else {
+ //add
+ $a_hunt_group[] = $huntgroupent;
+ }
+
+ //touch($d_hostsdirty_path);
+ write_config();
+ sync_package_freeswitch_hunt_group();
+
+ header("Location: freeswitch_hunt_group.php");
+ exit;
+ }
+}
+
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle">FreeSWITCH: Hunt Group: Edit</p>
+<?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>General Settings:<br>
+ </strong></span>
+ Hunt Group general settings.
+ </span></p></td>
+ </tr>
+ </table>
+ <br />
+
+ <form action="freeswitch_hunt_group_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</td>
+ <td width="78%" class="vtable">
+ <input name="huntgroupextension" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupextension']);?>">
+ <br> <span class="vexpl">e.g. <em>7002</em></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Hunt Group Name</td>
+ <td width="78%" class="vtable">
+ <input name="huntgroupname" type="text" class="formfld" id="huntgroupname" size="40" value="<?=htmlspecialchars($pconfig['huntgroupname']);?>">
+ </td>
+ </tr>
+
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Type</td>
+ <td width="78%" class="vtable">
+ <?php
+ echo " <select name='huntgrouptype' class='formfld'>\n";
+ echo " <option></option>\n";
+ if (htmlspecialchars($pconfig['huntgrouptype']) == "simultaneous") {
+ echo " <option selected='yes'>simultaneous</option>\n";
+ }
+ else {
+ echo " <option>simultaneous</option>\n";
+ }
+ if (htmlspecialchars($pconfig['huntgrouptype']) == "sequentially") {
+ echo " <option selected='yes'>sequentially</option>\n";
+ }
+ else {
+ echo " <option>sequentially</option>\n";
+ }
+ echo " </select>\n";
+ ?>
+ </td>
+ </tr>
+
+ <?php
+ if (strlen($pconfig['huntgrouptimeout']) == 0) {
+ $pconfig['huntgrouptimeout'] = 30; //set a default timeout
+ }
+ ?>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Context</td>
+ <td width="78%" class="vtable">
+ <input name="huntgroupcontext" type="text" class="formfld" id="huntgroupextension" size="40" value="<?=htmlspecialchars($pconfig['huntgroupcontext']);?>">
+ <br> <span class="vexpl">e.g. <em>default</em></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Timeout</td>
+ <td width="78%" class="vtable">
+ <input name="huntgrouptimeout" type="text" class="formfld" id="huntgrouptimeout" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeout']);?>">
+ <br>
+ <span class="vexpl">
+ The timeout sets the time in seconds to continue to call before timing out.
+ </span>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Timeout Destination</td>
+ <td width="78%" class="vtable">
+ <input name="huntgrouptimeoutdestination" type="text" class="formfld" id="huntgrouptimeoutdestination" size="40" value="<?=htmlspecialchars($pconfig['huntgrouptimeoutdestination']);?>">
+ <br> <span class="vexpl">Destination<br>
+ e.g. <em>1001</em></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Timeout Type</td>
+ <td width="78%" class="vtable">
+ <?php
+ echo " <select name='huntgrouptimeouttype' class='formfld'>\n";
+ echo " <option></option>\n";
+ if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "extension") {
+ echo " <option selected='yes'>extension</option>\n";
+ }
+ else {
+ echo " <option>extension</option>\n";
+ }
+ if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "voicemail") {
+ echo " <option selected='yes'>voicemail</option>\n";
+ }
+ else {
+ echo " <option>voicemail</option>\n";
+ }
+ if (htmlspecialchars($pconfig['huntgrouptimeouttype']) == "sip uri") {
+ echo " <option selected='yes'>sip uri</option>\n";
+ }
+ else {
+ echo " <option>sip uri</option>\n";
+ }
+ echo " </select>\n";
+ ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Description</td>
+ <td width="78%" class="vtable">
+ <input name="huntgroupdescr" type="text" class="formfld" id="descr" size="40" value="<?=htmlspecialchars($pconfig['huntgroupdescr']);?>">
+ <br> <span class="vexpl">You may enter a description here
+ for your reference (not parsed).</span></td>
+ </tr>
+
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
+ <input name="huntgroupid" type="hidden" value="<?=htmlspecialchars($pconfig['huntgroupid']);?>">
+ <?php if (isset($id) && $a_hunt_group[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ </td>
+ </tr>
+ </table>
+ </form>
+
+ <br>
+ <br>
+
+ <form action="freeswitch_hunt_group_edit.php" method="post" name="iform2" id="iform2">
+ <?php
+
+
+ //echo "<pre>";
+ //print_r ($a_hunt_group);
+ //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;
+
+ ?>
+
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td><p><span class="vexpl"><span class="red"><strong>Destinations<br />
+ </strong></span>
+ The following destinations will be called.
+ </span></p></td>
+ </tr>
+ </table>
+ <br />
+
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="20%" class="listhdrr">Destination</td>
+ <td width="25%" class="listhdrr">Type</td>
+ <td width="25%" class="listhdrr">Order</td>
+ <td width="45%" class="listhdr">Description</td>
+ <td width="10%" class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="freeswitch_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&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
+ //create a temporary id for the array
+ $i = 0;
+ if (count($a_hunt_group_destinations) > 0) {
+ foreach ($a_hunt_group_destinations as $ent) {
+ $a_hunt_group_destinations[$i]['id'] = $i;
+ $i++;
+ }
+ }
+
+ //order the array
+ function cmp_number($a, $b) {
+ if ($a["destinationorder"] > $b["destinationorder"]) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+ if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_number"); }
+
+ $i = 0;
+ if (count($a_hunt_group_destinations) > 0) {
+ foreach ($a_hunt_group_destinations as $ent) {
+ if ($huntgroupid == $ent['huntgroupid']) {
+ ?>
+ <tr>
+ <td class="listlr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>'">
+ <?=$ent['destinationnumber']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
+ <?=$ent['destinationtype'];?>&nbsp;
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
+ <?=$ent['destinationorder'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['destinationdescr']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="freeswitch_hunt_group_destinations_edit.php?id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td>
+ <td><a href="freeswitch_hunt_group_destinations.php?type=huntgroupdestinations&act=del&id=<?=$ent['id'];?>&parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>" onclick="return confirm('Do you really want to delete this recording?')"><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="freeswitch_hunt_group_destinations_edit.php?parentid=<?=$parentid;?>&huntgroupid=<?=$huntgroupid;?>&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>
+
+
+
+
+ </td>
+ </tr>
+
+
+ <tr>
+ <td class="list" colspan="3"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
+
+
+ <br>
+ <br>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>