aboutsummaryrefslogtreecommitdiffstats
path: root/config/freeswitch
diff options
context:
space:
mode:
authormcrane <mctch@yahoo.com>2009-05-28 03:47:17 -0600
committermcrane <mctch@yahoo.com>2009-05-28 03:47:17 -0600
commit23e1ab04471d14367023a7a11b08920b6a40b0b6 (patch)
tree59cb9071447f4168f1702d024bba41c648a5a2b2 /config/freeswitch
parent43d53ad267a29408fb9ef3598cd40db4c0c1d553 (diff)
downloadpfsense-packages-23e1ab04471d14367023a7a11b08920b6a40b0b6.tar.gz
pfsense-packages-23e1ab04471d14367023a7a11b08920b6a40b0b6.tar.bz2
pfsense-packages-23e1ab04471d14367023a7a11b08920b6a40b0b6.zip
FreeSWITCH package add huntgroup feature and outbound caller id to extension
Diffstat (limited to 'config/freeswitch')
-rw-r--r--config/freeswitch/freeswitch.inc361
-rw-r--r--config/freeswitch/freeswitch.xml2
-rw-r--r--config/freeswitch/freeswitch_dialplan_includes_edit.tmp16
-rw-r--r--config/freeswitch/freeswitch_extensions_edit.tmp80
-rw-r--r--config/freeswitch/freeswitch_features.tmp14
-rw-r--r--config/freeswitch/freeswitch_hunt_group.tmp174
-rw-r--r--config/freeswitch/freeswitch_hunt_group_destinations.tmp52
-rw-r--r--config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp230
-rw-r--r--config/freeswitch/freeswitch_hunt_group_edit.tmp412
9 files changed, 1286 insertions, 55 deletions
diff --git a/config/freeswitch/freeswitch.inc b/config/freeswitch/freeswitch.inc
index 4e0ab1ab..fc222125 100644
--- a/config/freeswitch/freeswitch.inc
+++ b/config/freeswitch/freeswitch.inc
@@ -65,6 +65,10 @@ function build_menu() {
if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_ivr_options_edit.php") { $menu_selected = true; }
if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_recordings.php") { $menu_selected = true; }
if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_recordings_edit.php") { $menu_selected = true; }
+ if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group.php") { $menu_selected = true; }
+ if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_edit.php") { $menu_selected = true; }
+ if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_destinations.php") { $menu_selected = true; }
+ if ($_SERVER["SCRIPT_NAME"] == "/packages/freeswitch/freeswitch_hunt_group_destinations_edit.php") { $menu_selected = true; }
$tab_array[] = array(gettext("Features"), $menu_selected, "/packages/freeswitch/freeswitch_features.php");
unset($menu_selected);
@@ -963,6 +967,339 @@ function sync_package_freeswitch_external()
}
+function sync_package_freeswitch_hunt_group()
+{
+
+ //Hunt Group Javascript Notes:
+ //get the domain
+ //loop through all Hunt Groups
+ //get the Hunt Group information such as the name and description
+ //add each Hunt Group to the dialplan
+ //get the list of destinations then build the Hunt Group javascript
+
+
+ global $config;
+ conf_mount_rw();
+ config_lock();
+
+
+ //get the domain
+ $password = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_password'];
+ $host = $config['interfaces']['lan']['ipaddr'];
+ $port = $config['installedpackages']['freeswitchsettings']['config'][0]['event_socket_port'];
+
+ if (pkg_is_service_running('freeswitch')) {
+ $fp = event_socket_create($host, $port, $password);
+ $cmd = "api global_getvar domain";
+ $domain = trim(event_socket_request($fp, $cmd));
+ }
+
+ $tmp = "";
+ $tmp .= "\n";
+ $tmp .= " var domain = \"".$domain."\"; //by default this is the ipv4 address of FreeSWITCH used for transfer to voicemail\n";
+ //$tmp .= " var exit = false;\n";
+ $tmp .= "\n";
+ $tmp .= "\n";
+
+ //loop through all Hunt Groups
+ $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
+ if (count($a_hunt_group) > 0) {
+ foreach($a_hunt_group as $rowhelper) {
+
+ //get the Hunt Group information such as the name and description
+ //$rowhelper['huntgroupid']
+ //$rowhelper['huntgroupextension']
+ //$rowhelper['huntgroupname']
+ //$rowhelper['huntgrouptype']
+ //$rowhelper['huntgrouptimeout']
+ //$rowhelper['huntgroupcontext']
+ //$rowhelper['huntgroupdescr']
+
+ //add each Hunt Group to the dialplan
+ $a_dialplan_includes = &$config['installedpackages']['freeswitchdialplanincludes']['config'];
+ $a_dialplan_include_details = &$config['installedpackages']['freeswitchdialplanincludedetails']['config'];
+
+
+ if (strlen($rowhelper['huntgroupid']) > 0) {
+ $action = 'add'; //set default action to add
+ $i = 0;
+ if (count($a_dialplan_includes) > 0) {
+
+ foreach($a_dialplan_includes as $row) {
+
+ //$row['dialplanincludeid'];
+ //$row['extensionname'];
+ //$row['context'];
+ //$row['enabled'];
+
+ if ($row['opt1name'] == "huntgroupid" && $row['opt1value'] == $rowhelper['huntgroupid']) {
+ //update
+ $action = 'update';
+ $dialplanincludeid = $row['dialplanincludeid'];
+ $extensionname = $row['extensionname'];
+ $order = $row['order'];
+ $context = $row['context'];
+ $enabled = $row['enabled'];
+ $descr = $row['descr'];
+ $opt1name = $row['opt1name'];
+ $opt1value = $row['opt1value'];
+ $id = $i;
+ //echo "update".$i."<br />\n";
+
+ }
+ $i++;
+
+ }
+ }
+
+
+ $ent = array();
+ if ($action == 'add') {
+
+ $dialplanincludeid = guid();
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['extensionname'] = $rowhelper['ivrextension'];
+ $ent['order'] = '9001'; //if update use the existing order number and extension name and desc
+ $ent['context'] = $rowhelper['huntgroupcontext'];
+ $ent['enabled'] = 'true';
+ $ent['descr'] = 'huntgroup';
+ $ent['opt1name'] = 'huntgroupid';
+ $ent['opt1value'] = $rowhelper['huntgroupid'];
+
+ //add to the config
+ $a_dialplan_includes[] = $ent;
+ unset($ent);
+
+ $ent = array();
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['tag'] = 'condition'; //condition, action, antiaction
+ $ent['fieldtype'] = 'destination_number';
+ $ent['fielddata'] = '^'.$rowhelper['huntgroupextension'].'$';
+ $a_dialplan_include_details[] = $ent;
+ unset($ent);
+
+ $huntgroupid = str_replace(array("{", "}"), "", $rowhelper['huntgroupid']);
+
+ $ent = array();
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['tag'] = 'action'; //condition, action, antiaction
+ $ent['fieldtype'] = 'javascript';
+ $ent['fielddata'] = 'huntgroup_'.$huntgroupid.'.js';
+ $a_dialplan_include_details[] = $ent;
+ unset($ent);
+
+ unset($huntgroupid);
+
+ }
+ if ($action == 'update') {
+
+ $ent['dialplanincludeid'] = $dialplanincludeid;
+ $ent['extensionname'] = $rowhelper['huntgroupextension'];
+ $ent['order'] = $order;
+ $ent['context'] = $context;
+ $ent['enabled'] = $enabled;
+ $ent['descr'] = $descr;
+ $ent['opt1name'] = $opt1name;
+ $ent['opt1value'] = $opt1value;
+
+ //update the config
+ $a_dialplan_includes[$id] = $ent;
+
+ unset($ent);
+ unset($extensionname);
+ unset($order);
+ unset($context);
+ unset($enabled);
+ unset($descr);
+ unset($opt1name);
+ unset($opt1value);
+ unset($id);
+ }
+ write_config();
+
+ sync_package_freeswitch_dialplan_includes();
+ unset($dialplanincludeid);
+
+ } //end if strlen huntgroupid; add the Hunt Group to the dialplan
+
+ //Get the list of destinations then build the Hunt Group javascript
+ $tmp = "";
+ $tmp .= " function get_sofia_contact(extension,domain_name){\n";
+ $tmp .= " session.execute(\"set\", \"sofia_contact_\"+extension+\"=\${sofia_contact(internal/\"+extension+\"@\"+domain_name+\")}\");\n";
+ $tmp .= " sofia_contact = session.getVariable(\"sofia_contact_\"+extension);\n";
+ $tmp .= " //console_log( \"info\", \"sofia_contact: \"+sofia_contact+\".\\n\" );\n";
+ $tmp .= " return sofia_contact;\n";
+ $tmp .= " }\n";
+ $tmp .= "\n";
+ $tmp .= " dialed_extension = session.getVariable(\"dialed_extension\");\n";
+ $tmp .= " domain_name = session.getVariable(\"domain_name\");\n";
+ $tmp .= " domain = session.getVariable(\"domain\");\n";
+ $tmp .= " us_ring = session.getVariable(\"us-ring\");\n";
+ $tmp .= " caller_id_name = session.getVariable(\"caller_id_name\");\n";
+ $tmp .= " caller_id_number = session.getVariable(\"caller_id_number\");\n";
+ $tmp .= "\n";
+ $tmp .= " session.execute(\"set\", \"ringback=\"+us_ring); //set to ringtone\n";
+ $tmp .= " session.execute(\"set\", \"transfer_ringback=\"+us_ring); //set to ringtone\n";
+ if ($rowhelper['huntgrouptimeout'] > 0) {
+ $tmp .= " session.execute(\"set\", \"call_timeout=".$rowhelper['huntgrouptimeout']."\");\n";
+ $tmp .= " session.execute(\"set\", \"continue_on_fail=true\");\n";
+ }
+ $tmp .= " session.execute(\"set\", \"hangup_after_bridge=true\");\n";
+ $tmp .= "\n";
+ $tmp .= " //console_log( \"info\", \"dialed extension:\"+dialed_extension+\".\\n\" );\n";
+ $tmp .= " //console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n";
+ $tmp .= " //console_log( \"info\", \"us_ring: \"+us_ring+\".\\n\" );\n";
+ $tmp .= " //console_log( \"info\", \"domain: \"+domain+\".\\n\" );\n";
+ $tmp .= " //console_log( \"info\", \"domain_name: \"+domain_name+\".\\n\" );\n";
+ $tmp .= "\n";
+
+ $tmp .= " //console_log( \"info\", \"action call now don't wait for dtmf\\n\" );\n";
+ $tmp .= " if ( session.ready() ) {\n";
+ $tmp .= " session.answer();\n";
+ $tmp .= "\n";
+
+ $a_hunt_group = &$config['installedpackages']['freeswitchhuntgroup']['config'];
+ if (isset($id) && $a_hunt_group[0]) {
+ $huntgrouptimeout = $a_hunt_group[$id]['huntgrouptimeout'];
+ $huntgrouptimeoutdestination = $a_hunt_group[$id]['huntgrouptimeoutdestination'];
+ }
+
+ //order the array
+ function cmp_hunt_group_order($a, $b) {
+ if ($a["destinationorder"] > $b["destinationorder"]) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+
+ $a_hunt_group_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
+ if (count($a_hunt_group_destinations) > 0) { usort($a_hunt_group_destinations, "cmp_hunt_group_order"); }
+ if (count($a_hunt_group_destinations) > 0) {
+ $x = 0;
+ foreach($a_hunt_group_destinations as $row) {
+
+ /*
+ $row['huntgroupid']
+ $row['destinationnumber']
+ $row['destinationtype']
+ $row['destinationorder']
+ $row['destinationdescr']
+ */
+
+ if ($row['huntgroupid'] == $rowhelper['huntgroupid']) {
+
+ if ($row['destinationtype'] == "extension") {
+ //$tmp .= " session.execute(\"transfer\", \"".$row['destinationnumber']." XML default\"); //".$row['destinationdescr']."\n";
+ $tmp .= " sofia_contact_".$row['destinationnumber']." = get_sofia_contact(\"".$row['destinationnumber']."\",domain_name);\n";
+ $tmp_sub_array["application"] = "bridge";
+ $tmp_sub_array["data"] = "sofia_contact_".$row['destinationnumber'];
+ $tmp_array[$x] = $tmp_sub_array;
+ unset($tmp_sub_array);
+ }
+ if ($row['destinationtype'] == "voicemail") {
+ //$tmp .= " session.execute(\"voicemail\", \"".$row['destinationnumber']." XML default\");\n";
+ $tmp .= " session.execute(\"voicemail\", \"default \"+domain+\" ".$row['destinationnumber']."\");\n";
+ $tmp_sub_array["application"] = "voicemail";
+ $tmp_sub_array["data"] = "default \"+domain+\" ".$row['destinationnumber'];
+ $tmp_array[$x] = $tmp_sub_array;
+ unset($tmp_sub_array);
+ }
+ if ($row['destinationtype'] == "sip uri") {
+ //$tmp .= " session.execute(\"transfer\", \"".$row['destinationnumber']." XML default\"); //".$row['destinationdescr']."\n";
+ //tmp .= " sofia_contact_".$row['destinationnumber']." = get_sofia_contact(\"".$row['destinationnumber']."\",domain_name);\n";
+ $tmp_sub_array["application"] = "bridge";
+ $tmp_sub_array["data"] = "\"".$row['destinationnumber']."\"";
+ $tmp_array[$x] = $tmp_sub_array;
+ unset($tmp_sub_array);
+ }
+ $x++;
+
+ } //end huntgroupid
+
+ } //end for each
+ unset($x);
+ } //if count
+
+
+
+ switch ($rowhelper['huntgrouptype']) {
+ case "simultaneous":
+ //print_r($tmp_array);
+ $x = 0;
+ foreach ($tmp_array as $row) {
+ if ($x < 1) {
+ $tmp_buffer = $row["data"];
+ }
+ else {
+ $tmp_buffer .= "+\",\"+".$row["data"];
+ }
+ $x++;
+ }
+
+ $delimiter = ",";
+
+ $tmp_application = $tmp_array[0]["application"];
+ $tmp .= "\n";
+ $tmp .= " session.execute(\"".$tmp_application."\", $tmp_buffer);\n";
+ //$tmp .= " session.execute(\"bridge\", sofia_contact_100+\",\"+sofia_contact_101+\",\"+sofia_contact_102+\",\"+sofia_contact_103+\",\"+sofia_contact_104);\n";
+ //$tmp .= " //session.execute(\"bridge\", \"sofia/gateway/flowroute.com/12081231234,\"+sofia_contact_101);\n";
+
+ break;
+ case "sequentially":
+
+ $tmp .= "\n";
+ //print_r($tmp_array);
+ $x = 0;
+ foreach ($tmp_array as $row) {
+ $tmp .= " session.execute(\"".$row["application"]."\", ".$row["data"].");\n";
+ }
+
+ break;
+ }
+
+
+ //set the timeout destination
+ $huntgrouptimeoutdestination = $a_hunt_group[0]['huntgrouptimeoutdestination'];
+ $huntgrouptimeouttype = $a_hunt_group[0]['huntgrouptimeouttype'];
+ if ($row['huntgrouptimeouttype'] == "extension") { $huntgrouptimeouttype = "bridge"; }
+ if ($row['huntgrouptimeouttype'] == "voicemail") { $huntgrouptimeouttype = "voicemail"; }
+ if ($row['huntgrouptimeouttype'] == "sip uri") { $huntgrouptimeouttype = "bridge"; }
+ $tmp .= "\n";
+ $tmp .= " //timeout\n";
+ $tmp .= " session.execute(\"".$huntgrouptimeouttype."\", \"default \"+domain+\" ".$huntgrouptimeoutdestination."\" );\n";
+
+
+ $tmp .= "\n";
+ $tmp .= " //clear variables\n";
+ $tmp .= " dialed_extension = \"\";\n";
+ $tmp .= " new_extension = \"\";\n";
+ $tmp .= " domain_name = \"\";\n";
+ $tmp .= " domain = \"\";";
+
+ $tmp .= "\n";
+ $tmp .= " } //end if session.ready\n";
+ $tmp .= "\n";
+
+ if (strlen($rowhelper['huntgroupid']) > 0) {
+ $huntgroupfilename = "huntgroup_".str_replace(array("{", "}"), "", $rowhelper['huntgroupid']).".js";
+ $fout = fopen("/usr/local/freeswitch/scripts/".$huntgroupfilename,"w");
+ fwrite($fout, $tmp);
+ unset($huntgroupfilename);
+ fclose($fout);
+ }
+
+
+ } //end foreach
+ } //end if count
+ conf_mount_ro();
+ config_unlock();
+
+} //end function
+
+
function get_recording_filename($id)
{
global $config;
@@ -1189,9 +1526,9 @@ function sync_package_freeswitch_ivr()
if ($row['optionaction'] == "action") {
$actioncount++;
if (strtolower($row['optionnumber']) == "n") { //direct the call now don't wait for dtmf
- $actiondirect = true;
- $actiondirecttype = $row['optiontype'];
- $actiondirectdest = $row['optiondest'];
+ $actiondirect = true;
+ $actiondirecttype = $row['optiontype'];
+ $actiondirectdest = $row['optiondest'];
}
}
}
@@ -1828,7 +2165,7 @@ function sync_package_freeswitch()
function freeswitch_php_install_command()
{
global $config;
- $freeswitch_package_version = "0.8.7.5";
+ $freeswitch_package_version = "0.8.8";
$freeswitch_build_version = "1.0.4 pre 6";
$freeswitch_build_revision = "13238";
@@ -1967,6 +2304,22 @@ function freeswitch_php_install_command()
exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_gateways_edit.tmp");
exec("cp /tmp/freeswitch_gateways_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_gateways_edit.php");
unlink_if_exists("/tmp/freeswitch_gateways_edit.tmp");
+
+ exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_hunt_group.tmp");
+ exec("cp /tmp/freeswitch_hunt_group.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group.php");
+ unlink_if_exists("/tmp/freeswitch_hunt_group.tmp");
+
+ exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_hunt_group_edit.tmp");
+ exec("cp /tmp/freeswitch_hunt_group_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_edit.php");
+ unlink_if_exists("/tmp/freeswitch_hunt_group_edit.tmp");
+
+ exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_hunt_group_destinations.tmp");
+ exec("cp /tmp/freeswitch_hunt_group_destinations.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_destinations.php");
+ unlink_if_exists("/tmp/freeswitch_hunt_group_destinations.tmp");
+
+ exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp");
+ exec("cp /tmp/freeswitch_hunt_group_destinations_edit.tmp /usr/local/www/packages/freeswitch/freeswitch_hunt_group_destinations_edit.php");
+ unlink_if_exists("/tmp/freeswitch_hunt_group_destinations_edit.tmp");
exec("cd /tmp/;fetch http://www.pfsense.com/packages/config/freeswitch/freeswitch_ivr.tmp");
exec("cp /tmp/freeswitch_ivr.tmp /usr/local/www/packages/freeswitch/freeswitch_ivr.php");
diff --git a/config/freeswitch/freeswitch.xml b/config/freeswitch/freeswitch.xml
index a8e57203..fc191c21 100644
--- a/config/freeswitch/freeswitch.xml
+++ b/config/freeswitch/freeswitch.xml
@@ -44,7 +44,7 @@
<requirements>Describe your package requirements here</requirements>
<faq>Currently there are no FAQ items provided.</faq>
<name>FreeSWITCH Settings</name>
- <version>0.8.7.5</version>
+ <version>0.8.8</version>
<title>FreeSWITCH: Settings</title>
<include_file>/usr/local/pkg/freeswitch.inc</include_file>
<menu>
diff --git a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp
index 1901608f..228ebab1 100644
--- a/config/freeswitch/freeswitch_dialplan_includes_edit.tmp
+++ b/config/freeswitch/freeswitch_dialplan_includes_edit.tmp
@@ -346,13 +346,13 @@ display_top_tabs(build_menu());
</td>
</tr>
- <?php
+ <?php
$i = 0;
if (count($a_dialplan_include_details) > 0) {
foreach ($a_dialplan_include_details as $ent) {
- if ($ent['tag'] == "condition" && $dialplanincludeid == $ent['dialplanincludeid']) {
+ if ($ent['tag'] == "condition" && $dialplanincludeid == $ent['dialplanincludeid']) {
?>
<tr>
<td class="listlr" ondblclick="document.location='freeswitch_dialplan_includes_details_edit.php?id=<?=$i;?>&parentid=<?=$parentid;?>&dialplanincludeid=<?=$dialplanincludeid;?>'">
@@ -373,9 +373,9 @@ display_top_tabs(build_menu());
</table>
</td>
</tr>
- <?php
- }
- $i++;
+ <?php
+ }
+ $i++;
}
}
@@ -404,7 +404,7 @@ display_top_tabs(build_menu());
</table>
</td>
</tr>
- <?php
+ <?php
}
$i++;
}
@@ -435,7 +435,7 @@ display_top_tabs(build_menu());
</table>
</td>
</tr>
- <?php
+ <?php
}
$i++;
}
@@ -466,7 +466,7 @@ display_top_tabs(build_menu());
</table>
</td>
</tr>
- <?php
+ <?php
}
$i++;
}
diff --git a/config/freeswitch/freeswitch_extensions_edit.tmp b/config/freeswitch/freeswitch_extensions_edit.tmp
index deb7a597..5cedd96d 100644
--- a/config/freeswitch/freeswitch_extensions_edit.tmp
+++ b/config/freeswitch/freeswitch_extensions_edit.tmp
@@ -204,22 +204,6 @@ display_top_tabs(build_menu());
<br><span class="vexpl">Enter the effective caller id number here.<br></span>
</td>
</tr>
- <!--
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Outbound Caller ID Name</td>
- <td width="75%" class="vtable">
- <input name="outbound_caller_id_name" type="text" class="formfld unknown" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
- <br><span class="vexpl">Enter the outbound caller id name here.<br></span>
- </td>
- </tr>
- <tr>
- <td width="25%" valign="top" class="vncellreq" nowrap>Outbound Caller ID Number</td>
- <td width="75%" class="vtable">
- <input name="outbound_caller_id_number" type="text" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
- <br><span class="vexpl">Enter the outbound caller id number here.<br></span>
- </td>
- </tr>
- -->
<tr>
<td width="25%" valign="top" class="vncellreq" nowrap>Voicemail Mail To</td>
<td width="75%" class="vtable">
@@ -269,32 +253,46 @@ display_top_tabs(build_menu());
</table>
<div id="showadvancedbox">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Show Advanced</td>
- <td width="75%" class="vtable">
- <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
- </td>
- </tr>
- </table>
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="25%" valign="top" class="vncell">Show Advanced</td>
+ <td width="75%" class="vtable">
+ <input type="button" onClick="show_advanced_config()" value="Advanced"></input></a>
+ </td>
+ </tr>
+ </table>
</div>
<div id="showadvanced" style="display:none">
- <table width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td width="25%" valign="top" class="vncell">Auth-ACL</td>
- <td width="75%" class="vtable">
- <input name="auth-acl" type="text" class="formfld unknown" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>">
- <br> <span class="vexpl">Enter the auth acl here.<br></span>
- </td>
- </tr>
- <tr>
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td width="25%" valign="top" class="vncell">Auth-ACL</td>
+ <td width="75%" class="vtable">
+ <input name="auth-acl" type="text" class="formfld unknown" id="auth-acl" size="40" value="<?=htmlspecialchars($pconfig['auth-acl']);?>">
+ <br> <span class="vexpl">Enter the auth acl here.<br></span>
+ </td>
+ </tr>
+ <tr>
<td valign="top" class="vncell">CIDR</td>
- <td class="vtable">
- <input name="cidr" type="text" class="formfld unknown" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>">
- <br> <span class="vexpl">Enter the cidr here.<br></span>
- </td>
- </tr>
- </table>
+ <td class="vtable">
+ <input name="cidr" type="text" class="formfld unknown" id="cidr" size="40" value="<?=htmlspecialchars($pconfig['cidr']);?>">
+ <br> <span class="vexpl">Enter the cidr here.<br></span>
+ </td>
+ </tr>
+ <tr>
+ <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Name</td>
+ <td width="75%" class="vtable">
+ <input name="outbound_caller_id_name" type="text" class="formfld unknown" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
+ <br><span class="vexpl">Enter the outbound caller id name here.<br></span>
+ </td>
+ </tr>
+ <tr>
+ <td width="25%" valign="top" class="vncell" nowrap>Outbound Caller ID Number</td>
+ <td width="75%" class="vtable">
+ <input name="outbound_caller_id_number" type="text" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
+ <br><span class="vexpl">Enter the outbound caller id number here.<br></span>
+ </td>
+ </tr>
+ </table>
</div>
<table width="100%" border="0" cellpadding="6" cellspacing="0">
@@ -308,9 +306,7 @@ display_top_tabs(build_menu());
<tr>
<td valign="top">&nbsp;</td>
<td>
- <input name="outbound_caller_id_name" type="hidden" class="formfld" id="outbound_caller_id_name" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_name']);?>">
- <input name="outbound_caller_id_number" type="hidden" class="formfld unknown" id="outbound_caller_id_number" size="40" value="<?=htmlspecialchars($pconfig['outbound_caller_id_number']);?>">
- <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
+ <input name="Submit" type="submit" class="formbtn" value="Save"> <input class="formbtn" type="button" value="Cancel" onclick="history.back()">
<?php if (isset($id) && $a_extensions[$id]): ?>
<input name="id" type="hidden" value="<?=$id;?>">
<?php endif; ?>
diff --git a/config/freeswitch/freeswitch_features.tmp b/config/freeswitch/freeswitch_features.tmp
index c55e4aa4..d97ebe9e 100644
--- a/config/freeswitch/freeswitch_features.tmp
+++ b/config/freeswitch/freeswitch_features.tmp
@@ -120,6 +120,20 @@ display_top_tabs(build_menu());
<br />
<br />
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td class="listtopic" colspan='2'>Hunt Group</td>
+ </tr>
+ <tr>
+ <td width='10%' class="vncell"><a href='freeswitch_hunt_group.php'>Open</a></td>
+ <td class="vtable">
+ Hunt Group is a group of destinations to call at once or in succession.
+ </td>
+ </tr>
+ </table>
+
+ <br />
+ <br />
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<tr>
diff --git a/config/freeswitch/freeswitch_hunt_group.tmp b/config/freeswitch/freeswitch_hunt_group.tmp
new file mode 100644
index 00000000..10a20eb8
--- /dev/null
+++ b/config/freeswitch/freeswitch_hunt_group.tmp
@@ -0,0 +1,174 @@
+<?php
+/* $Id$ */
+/*
+ freeswitch_hunt_group.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'];
+
+
+if ($_GET['act'] == "del") {
+ if ($_GET['type'] == 'hunt_group') {
+ if ($a_hunt_group[$_GET['id']]) {
+ unlink("/usr/local/freeswitch/scripts/hunt_group_".$_GET['huntgroupid'].".js");
+ unset($a_hunt_group[$_GET['id']]);
+ 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</p>
+
+<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" >
+
+<form action="freeswitch_hunt_group.php" method="post" name="iform" id="iform">
+
+ <table width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td><p><span class="vexpl"><span class="red"><strong>Hunt Group<br />
+ </strong></span>
+ Hunt Group is a group of destinations to call at once or in succession.
+ </span></p></td>
+ </tr>
+ </table>
+ <br />
+
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td width="20%" class="listhdrr">Extension</td>
+ <td width="25%" class="listhdrr">Name</td>
+ <td width="50%" 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_edit.php"><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_hunt_group) > 0) {
+ foreach ($a_hunt_group as $ent) {
+ if (strlen($ent['huntgroupid']) > 0) {
+
+ $huntgroupid = str_replace(array("{", "}"), "", $ent['huntgroupid']);
+
+ ?>
+ <tr>
+ <td class="listlr" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>'">
+ <?=$ent['huntgroupextension']?>
+ </td>
+ <td class="listr" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>';">
+ <?=$ent['huntgroupname'];?>&nbsp;
+ </td>
+ <td class="listbg" ondblclick="document.location='freeswitch_hunt_group_edit.php?id=<?=$i;?>';">
+ <font color="#FFFFFF"><?=htmlspecialchars($ent['huntgroupdescr']);?>&nbsp;
+ </td>
+ <td valign="middle" nowrap class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td valign="middle"><a href="freeswitch_hunt_group_edit.php?id=<?=$i;?>&huntgroupid=<?php echo $ent['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.php?type=huntgroup&act=del&id=<?=$i;?>&huntgroupid=<?php echo $huntgroupid; ?>" 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="3"></td>
+ <td class="list">
+ <table border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td width="17"></td>
+ <td valign="middle"><a href="freeswitch_hunt_group_edit.php"><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="3"></td>
+ <td class="list"></td>
+ </tr>
+ </table>
+
+</form>
+
+<br>
+<br>
+/usr/local/freeswitch/scripts/
+<br>
+<br>
+<br>
+<br>
+
+</td>
+</tr>
+</table>
+
+</div>
+
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
diff --git a/config/freeswitch/freeswitch_hunt_group_destinations.tmp b/config/freeswitch/freeswitch_hunt_group_destinations.tmp
new file mode 100644
index 00000000..7f1adaf0
--- /dev/null
+++ b/config/freeswitch/freeswitch_hunt_group_destinations.tmp
@@ -0,0 +1,52 @@
+<?php
+/* $Id$ */
+/*
+ freeswitch_hunt_group_destinations.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_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
+
+
+if ($_GET['act'] == "del") {
+ if ($_GET['type'] == 'huntgroupdestinations') {
+ if ($a_hunt_group_destinations[$_GET['id']]) {
+ unset($a_hunt_group_destinations[$_GET['id']]);
+ write_config();
+ sync_package_freeswitch_hunt_group();
+ header("Location: freeswitch_hunt_group_edit.php?id=".$_GET['parentid']);
+ exit;
+ }
+ }
+}
+
+?> \ No newline at end of file
diff --git a/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp b/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp
new file mode 100644
index 00000000..bd7f446b
--- /dev/null
+++ b/config/freeswitch/freeswitch_hunt_group_destinations_edit.tmp
@@ -0,0 +1,230 @@
+<?php
+/* $Id$ */
+/*
+
+ freeswitch_hunt_group_destinations_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_destinations = &$config['installedpackages']['freeswitchhuntgroupdestinations']['config'];
+
+
+$id = $_GET['id'];
+if (isset($_POST['id'])) {
+ $id = $_POST['id'];
+}
+
+$parentid = $_GET['parentid'];
+if (isset($_POST['parentid'])) {
+ $parentid = $_POST['parentid'];
+}
+
+$huntgroupid = $_GET['huntgroupid'];
+if (isset($_POST['huntgroupid'])) {
+ $huntgroupid = $_POST['huntgroupid'];
+}
+
+
+if (isset($id) && $a_hunt_group_destinations[$id]) {
+ $pconfig['destinationnumber'] = $a_hunt_group_destinations[$id]['destinationnumber'];
+ $pconfig['destinationtype'] = $a_hunt_group_destinations[$id]['destinationtype'];
+ $pconfig['destinationorder'] = $a_hunt_group_destinations[$id]['destinationorder'];
+ $pconfig['destinationdescr'] = $a_hunt_group_destinations[$id]['destinationdescr'];
+}
+else {
+ if (isset($_GET['a'])) {
+ //if ($_GET['a'] == "action"){ $pconfig['destinationaction'] = "action"; }
+ //if ($_GET['a'] == "antiaction"){ $pconfig['destinationaction'] = "anti-action"; }
+ }
+}
+
+
+if ($_POST) {
+
+ unset($input_errors);
+ $pconfig = $_POST;
+
+
+ if (!$input_errors) {
+
+ $huntgroupdestinationent = array();
+ $huntgroupdestinationent['huntgroupid'] = $_POST['huntgroupid'];
+ $huntgroupdestinationent['destinationnumber'] = $_POST['destinationnumber'];
+ $huntgroupdestinationent['destinationtype'] = $_POST['destinationtype'];
+ $huntgroupdestinationent['destinationorder'] = $_POST['destinationorder'];
+ $huntgroupdestinationent['destinationdescr'] = $_POST['destinationdescr'];
+
+ if (isset($id) && $a_hunt_group_destinations[$id]) {
+ //update
+ $a_hunt_group_destinations[$id] = $huntgroupdestinationent;
+ }
+ else {
+ //add
+ $a_hunt_group_destinations[] = $huntgroupdestinationent;
+ }
+
+
+ write_config();
+ sync_package_freeswitch_hunt_group();
+
+ header("Location: freeswitch_hunt_group_edit.php?id=".$parentid);
+ exit;
+ }
+}
+
+include("head.inc");
+
+?>
+
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+<p class="pgtitle">FreeSWITCH: Hunt Group: Destinations: 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" >
+ <br />
+ <form action="freeswitch_hunt_group_destinations_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">Destination</td>
+ <td width="78%" class="vtable">
+ <input name="destinationnumber" type="text" class="formfld" id="destinationnumber" size="40" value="<?=htmlspecialchars($pconfig['destinationnumber']);?>">
+ <br> <span class="vexpl">Destination<br>
+ e.g. <em>1001</em></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Type</td>
+ <td width="78%" class="vtable">
+ <?php
+ echo " <select name='destinationtype' class='formfld'>\n";
+ echo " <option></option>\n";
+ if (htmlspecialchars($pconfig['destinationtype']) == "extension") {
+ echo " <option selected='yes'>extension</option>\n";
+ }
+ else {
+ echo " <option>extension</option>\n";
+ }
+ if (htmlspecialchars($pconfig['destinationtype']) == "voicemail") {
+ echo " <option selected='yes'>voicemail</option>\n";
+ }
+ else {
+ echo " <option>voicemail</option>\n";
+ }
+ if (htmlspecialchars($pconfig['destinationtype']) == "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">Order</td>
+ <td width="78%" class="vtable">
+ <?php
+ echo " <select name='destinationorder' class='formfld'>\n";
+ //echo " <option></option>\n";
+ if (strlen(htmlspecialchars($pconfig['destinationorder']))> 0) {
+ echo " <option selected='yes' value='".htmlspecialchars($pconfig['destinationorder'])."'>".htmlspecialchars($pconfig['destinationorder'])."</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 destination is determined by this order.
+
+ <br> <span class="vexpl"></span></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncell">Description</td>
+ <td width="78%" class="vtable">
+ <input name="destinationdescr" type="text" class="formfld" id="destinationdescr" size="40" value="<?=htmlspecialchars($pconfig['destinationdescr']);?>">
+ <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="huntgroupid" type="hidden" value="<?=$huntgroupid;?>">
+ <input name="parentid" type="hidden" value="<?=$parentid;?>">
+ <?php if (isset($id) && $a_hunt_group_destinations[$id]): ?>
+ <input name="id" type="hidden" value="<?=$id;?>">
+ <?php endif; ?>
+ <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>
+ <br>
+ <br>
+ <br>
+ <br>
+
+ </td>
+ </tr>
+</table>
+
+</div>
+
+<?php include("fend.inc"); ?>
+</body>
+</html>
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>