Add a new version of ring groups. Added ability to confirm the call, call external destinations, and support for using a SIP URI in the destination. This change requires exporting the extenions defined in v_ring_group_extentions to v_ring_group_destinations.

This commit is contained in:
Mark Crane
2013-07-24 19:37:59 +00:00
parent 443e3451da
commit 17a329b187
7 changed files with 552 additions and 22 deletions

View File

@@ -122,16 +122,16 @@
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
//schema details
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_ring_group_extensions';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'ring_group_extension_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary';
$z++;
$apps[$x]['db'][$y]['table'] = 'v_ring_group_extensions';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
@@ -158,4 +158,43 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$y = 2; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_ring_group_destinations';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'ring_group_destination_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'ring_group_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_delay';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_timeout';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'destination_prompt';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric'; //confirm,announce
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
?>

View File

@@ -37,9 +37,7 @@
$text['label-description']['en-us'] = 'Description';
$text['message-delete']['en-us'] = 'Do you really want to delete this?';
$text['message-delete-done']['en-us'] = 'Delete Complete';
$text['message-delete']['en-us'] = 'Delete Complete';
$text['message-name']['en-us'] = 'Please provide: Name';
@@ -53,9 +51,9 @@
$text['message-enabled']['en-us'] = 'Please provide: Enabled';
$text['message-add-complete']['en-us'] = 'Add Complete';
$text['message-add']['en-us'] = 'Add Complete';
$text['message-update-complete']['en-us'] = 'Update Complete';
$text['message-update']['en-us'] = 'Update Complete';
$text['label-ring-group']['en-us'] = 'Ring Group';
@@ -81,8 +79,6 @@
$text['description-extensions']['en-us'] = 'Add an extension and ring parameters to the ring group.';
$text['button-add']['en-us'] = 'Add';
$text['description-extension']['en-us'] = 'Define an extension number for this ring group.';
$text['label-duration']['en-us'] = 'Duration';
@@ -91,9 +87,9 @@
$text['description-timeout']['en-us'] = 'Enter the total call timeout in seconds';
$text['label-destination']['en-us'] = 'Timeout Destination';
$text['label-timeout_destination']['en-us'] = 'Timeout Destination';
$text['description-destination']['en-us'] = 'Select the timeout destination for this ring group.';
$text['description-timeout_destination']['en-us'] = 'Select the timeout destination for this ring group.';
$text['label-cid-prefix']['en-us'] = 'CID Prefix';
@@ -125,4 +121,40 @@
$text['label-timeout']['en-us'] = 'Timeout';
$text['label-timeout']['pt-pt'] = '';
$text['label-destinations']['en-us'] = 'Destinations';
$text['label-destinations']['pt-pt'] = '';
$text['label-destination_number']['en-us'] = 'Destination';
$text['label-destination_number']['pt-pt'] = '';
$text['label-destination_delay']['en-us'] = 'Delay';
$text['label-destination_delay']['pt-pt'] = '';
$text['label-destination_timeout']['en-us'] = 'Timeout';
$text['label-destination_timeout']['pt-pt'] = '';
$text['label-destination_prompt']['en-us'] = 'Prompt';
$text['label-destination_prompt']['pt-pt'] = '';
$text['label-destination_prompt_confirm']['en-us'] = 'Confirm';
$text['label-destination_prompt_confirm']['pt-pt'] = '';
$text['label-destination_prompt_announce']['en-us'] = 'Announce';
$text['label-destination_prompt_announce']['pt-pt'] = '';
$text['description-destinations']['en-us'] = 'Add destinations and parameters to the ring group.';
$text['description-destinations']['pt-pt'] = '';
$text['button-add']['en-us'] = 'Add';
$text['button-add']['pt-pt'] = '';
$text['button-save']['en-us'] = 'Save';
$text['button-save']['pt-pt'] = '';
$text['confirm-delete']['en-us'] = 'Do you really want to delete this?';
$text['confirm-delete']['pt-pt'] = '';
$text['confirm-copy']['en-us'] = 'Do you really want to copy this?';
$text['confirm-copy']['en-us'] = '';
?>

View File

@@ -0,0 +1,68 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('ring_group_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//get the id
if (count($_GET)>0) {
$id = check_str($_GET["id"]);
$ring_group_uuid = check_str($_GET["ring_group_uuid"]);
}
if (strlen($id)>0) {
//delete ring_group_destination
$sql = "delete from v_ring_group_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and ring_group_destination_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "resources/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ring_group_edit.php?id=$ring_group_uuid\">\n";
echo "<div align='center'>\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "resources/footer.php";
return;
?>

View File

@@ -0,0 +1,257 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
if (permission_exists('ring_group_add') || permission_exists('ring_group_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
require_once "app_languages.php";
foreach($text as $key => $value) {
$text[$key] = $value[$_SESSION['domain']['language']['code']];
}
//action add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$ring_group_destination_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//set the parent uuid
if (strlen($_GET["ring_group_uuid"]) > 0) {
$ring_group_uuid = check_str($_GET["ring_group_uuid"]);
}
//get http post variables and set them to php variables
if (count($_POST)>0) {
$ring_group_uuid = check_str($_POST["ring_group_uuid"]);
$destination_number = check_str($_POST["destination_number"]);
$destination_delay = check_str($_POST["destination_delay"]);
$destination_timeout = check_str($_POST["destination_timeout"]);
$destination_prompt = check_str($_POST["destination_prompt"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$ring_group_destination_uuid = check_str($_POST["ring_group_destination_uuid"]);
}
//check for all required data
//if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-domain_uuid']."<br>\n"; }
//if (strlen($ring_group_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-ring_group_uuid']."<br>\n"; }
//if (strlen($destination_number) == 0) { $msg .= $text['message-required']." ".$text['label-destination_number']."<br>\n"; }
//if (strlen($destination_delay) == 0) { $msg .= $text['message-required']." ".$text['label-destination_delay']."<br>\n"; }
//if (strlen($destination_timeout) == 0) { $msg .= $text['message-required']." ".$text['label-destination_timeout']."<br>\n"; }
//if (strlen($destination_prompt) == 0) { $msg .= $text['message-required']." ".$text['label-destination_prompt']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persistformvar.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('ring_group_add')) {
$sql = "insert into v_ring_group_destinations ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "ring_group_destination_uuid, ";
$sql .= "ring_group_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "ring_group_uuid, ";
$sql .= "destination_number, ";
$sql .= "destination_delay, ";
$sql .= "destination_timeout, ";
$sql .= "destination_prompt ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'".uuid()."', ";
$sql .= "'$ring_group_uuid', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$ring_group_uuid', ";
$sql .= "'$destination_number', ";
$sql .= "'$destination_delay', ";
$sql .= "'$destination_timeout', ";
$sql .= "'$destination_prompt' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "resources/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ring_group_edit.php?id=$ring_group_uuid\">\n";
echo "<div align='center'>\n";
echo " ".$text['message-add']."\n";
echo "</div>\n";
require_once "resources/footer.php";
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('ring_group_edit')) {
$sql = "update v_ring_group_destinations set ";
$sql .= "ring_group_uuid = '$ring_group_uuid', ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "ring_group_uuid = '$ring_group_uuid', ";
$sql .= "destination_number = '$destination_number', ";
$sql .= "destination_delay = '$destination_delay', ";
$sql .= "destination_timeout = '$destination_timeout', ";
$sql .= "destination_prompt = '$destination_prompt' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and ring_group_destination_uuid = '$ring_group_destination_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "resources/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ring_group_edit.php?id=$ring_group_uuid\">\n";
echo "<div align='center'>\n";
echo " ".$text['message-update']."\n";
echo "</div>\n";
require_once "resources/footer.php";
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
$ring_group_destination_uuid = check_str($_GET["id"]);
$sql = "select * from v_ring_group_destinations ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and ring_group_destination_uuid = '$ring_group_destination_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$ring_group_uuid = $row["ring_group_uuid"];
$destination_number = $row["destination_number"];
$destination_delay = $row["destination_delay"];
$destination_timeout = $row["destination_timeout"];
$destination_prompt = $row["destination_prompt"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//show the header
require_once "resources/header.php";
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing=''>\n";
echo "<tr class='border'>\n";
echo " <td align=\"left\">\n";
echo " <br>";
echo "<form method='post' name='frm' action=''>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap='nowrap'><b>".$text['title-ring_group_destination']."</b></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='ring_group_edit.php?id=$ring_group_uuid'\" value='".$text['button-back']."'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_number' maxlength='255' value=\"$destination_number\">\n";
echo "<br />\n";
echo $text['description-destination_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_delay'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_delay' maxlength='255' value='$destination_delay'>\n";
echo "<br />\n";
echo $text['description-destination_delay']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_timeout'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_timeout' maxlength='255' value='$destination_timeout'>\n";
echo "<br />\n";
echo $text['description-destination_timeout']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination_prompt'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_prompt' maxlength='255' value='$destination_prompt'>\n";
echo "<br />\n";
echo $text['description-destination_prompt']."\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='ring_group_uuid' value='$ring_group_uuid'>\n";
if ($action == "update") {
echo " <input type='hidden' name='ring_group_destination_uuid' value='$ring_group_destination_uuid'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -137,7 +137,7 @@ require_once "resources/paging.php";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['ring_group_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
echo " <a href='ring_groups_edit.php?id=".$row['ring_group_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='ring_groups_delete.php?id=".$row['ring_group_uuid']."' alt='delete' onclick=\"return confirm('".$text['message-delete']."')\">$v_link_label_delete</a>\n";
echo " <a href='ring_groups_delete.php?id=".$row['ring_group_uuid']."' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }

View File

@@ -99,7 +99,7 @@ else {
require_once "resources/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ring_groups.php\">\n";
echo "<div align='center'>\n";
echo $text['message-delete-done']."\n";
echo $text['message-delete']."\n";
echo "</div>\n";
require_once "resources/footer.php";
return;

View File

@@ -43,6 +43,7 @@ else {
//delete the user from the v_extension_users
if ($_GET["a"] == "delete" && permission_exists("user_delete")) {
/*
//set the variables
$ring_group_extension_uuid = check_str($_REQUEST["id"]);
$ring_group_uuid = check_str($_REQUEST["ring_group_uuid"]);
@@ -52,6 +53,16 @@ else {
$sql .= "and ring_group_extension_uuid = '$ring_group_extension_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
*/
//set the variables
$ring_group_destination_uuid = check_str($_REQUEST["id"]);
$ring_group_uuid = check_str($_REQUEST["ring_group_uuid"]);
//delete the extension from the ring_group
$sql = "delete from v_ring_group_destinations ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and ring_group_destination_uuid = '$ring_group_destination_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
//redirect the browser
require_once "resources/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=ring_groups_edit.php?id=$ring_group_uuid\">\n";
@@ -106,9 +117,13 @@ else {
$ring_group_timeout_array = explode(":", $ring_group_timeout_action);
$ring_group_timeout_app = array_shift($ring_group_timeout_array);
$ring_group_timeout_data = join(':', $ring_group_timeout_array);
$extension_uuid = check_str($_POST["extension_uuid"]);
$extension_delay = check_str($_POST["extension_delay"]);
$extension_timeout = check_str($_POST["extension_timeout"]);
// $extension_uuid = check_str($_POST["extension_uuid"]);
// $extension_delay = check_str($_POST["extension_delay"]);
// $extension_timeout = check_str($_POST["extension_timeout"]);
$destination_number = check_str($_POST["destination_number"]);
$destination_delay = check_str($_POST["destination_delay"]);
$destination_timeout = check_str($_POST["destination_timeout"]);
$destination_prompt = check_str($_POST["destination_prompt"]);
//set the context for users that are not in the superadmin group
if (!if_group("superadmin")) {
@@ -119,7 +134,6 @@ else {
$ring_group_context = "default";
}
}
}
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
@@ -221,7 +235,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if ($action == "update" || $action == "add") {
//if extension_uuid then add it to ring group extensions
if (strlen($extension_uuid) > 0) {
/* if (strlen($extension_uuid) > 0) {
$ring_group_extension_uuid = uuid();
$sql = "insert into v_ring_group_extensions ";
$sql .= "(";
@@ -247,6 +261,43 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} */
//if destination then add it to ring group destinations
if (strlen($destination_number) > 0) {
$ring_group_destination_uuid = uuid();
$sql = "insert into v_ring_group_destinations ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "ring_group_uuid, ";
$sql .= "ring_group_destination_uuid, ";
$sql .= "destination_delay, ";
$sql .= "destination_timeout, ";
$sql .= "destination_prompt, ";
$sql .= "destination_number ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'$ring_group_uuid', ";
$sql .= "'$ring_group_destination_uuid', ";
$sql .= "'$destination_delay', ";
if (strlen($destination_timeout) > 0) {
$sql .= "'$destination_timeout', ";
}
else {
$sql .= "'30', ";
}
if (strlen($destination_prompt) > 0) {
$sql .= "'$destination_prompt', ";
}
else {
$sql .= "null, ";
}
$sql .= "'$destination_number' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
//if it does not exist in the dialplan then add it
@@ -302,7 +353,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$database->fields['dialplan_detail_uuid'] = uuid();
$database->fields['dialplan_detail_tag'] = 'action'; //condition, action, antiaction
$database->fields['dialplan_detail_type'] = 'lua';
$database->fields['dialplan_detail_data'] = 'ring_group.lua';
$database->fields['dialplan_detail_data'] = 'app.lua ring_groups';
$database->fields['dialplan_detail_order'] = '030';
$database->add();
@@ -469,7 +520,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo $text['description-strategy']."\n";
echo "</td>\n";
echo "</tr>\n";
/*
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-extensions'].":</td>";
echo " <td class='vtable' align='left'>";
@@ -540,6 +591,89 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <br />\n";
echo " </td>";
echo " </tr>";
*/
echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-destinations'].":</td>";
echo " <td class='vtable' align='left'>";
if ($action == "update") {
echo " <table width='52%' border='0' cellpadding='0' cellspacing='0'>\n";
$sql = "SELECT * FROM v_ring_group_destinations ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and ring_group_uuid = '".$ring_group_uuid."' ";
$sql .= "order by destination_number asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
echo "<tr>\n";
echo " <td class='vtable'>".$text['label-destination_number']."</td>\n";
echo " <td class='vtable'>".$text['label-destination_delay']."</td>\n";
echo " <td class='vtable'>".$text['label-destination_timeout']."</td>\n";
echo " <td class='vtable'>".$text['label-destination_prompt']."</td>\n";
echo " <td></td>\n";
echo "</tr>\n";
foreach($result as $field) {
if (strlen($field['destination_delay']) == 0) { $field['destination_delay'] = "0"; }
if (strlen($field['destination_timeout']) == 0) { $field['destination_timeout'] = "30"; }
echo " <tr>\n";
echo " <td class='vtable'>\n";
echo " ".$field['destination_number'];
echo " </td>\n";
echo " <td class='vtable'>\n";
echo " ".$field['destination_delay']."&nbsp;\n";
echo " </td>\n";
echo " <td class='vtable'>\n";
echo " ".$field['destination_timeout']."&nbsp;\n";
echo " </td>\n";
echo " <td class='vtable'>\n";
if ($field['destination_prompt'] == "1") {
echo " ".$text['label-destination_prompt_confirm']."&nbsp;\n";
}
elseif ($field['destination_prompt'] == "2") {
echo " ".$text['label-destination_prompt_announce']."&nbsp;\n";
}
else {
echo " &nbsp;\n";
}
echo " </td>\n";
echo " <td>\n";
echo " <a href='ring_group_destination_edit.php?id=".$field['ring_group_destination_uuid']."&ring_group_uuid=".$field['ring_group_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
echo " <a href='ring_group_destination_delete.php?id=".$field['ring_group_destination_uuid']."&ring_group_uuid=".$ring_group_uuid."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
echo " </td>\n";
echo " </tr>\n";
}
echo " <tr>\n";
echo " <td>\n";
echo " <input type=\"text\" name=\"destination_number\" class=\"formfld\" style=\"width: 90%;\"value=\"\">\n";
echo " </td>\n";
echo " <td>\n";
destination_select('destination_delay', $destination_delay, '0');
echo " </td>\n";
echo " <td>\n";
destination_select('destination_timeout', $destination_timeout, '30');
echo " </td>\n";
echo " <td>\n";
echo " <select class='formfld' style='width: 90px;' name='destination_prompt'>\n";
echo " <option value=''></option>\n";
echo " <option value='1'>".$text['label-destination_prompt_confirm']."</option>\n";
//echo " <option value='2'>".$text['label-destination_prompt_announce]."</option>\n";
echo " </select>\n";
echo " </td>\n";
echo " <td>\n";
if ($action == "update") {
echo " <input type=\"submit\" class='btn' value=\"".$text['button-add']."\">\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
}
unset($sql, $result);
echo " ".$text['description-destinations']."\n";
echo " <br />\n";
echo " </td>";
echo " </tr>";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
@@ -554,13 +688,13 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-destination'].":\n";
echo " ".$text['label-timeout_destination'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//switch_select_destination(select_type, select_label, select_name, select_value, select_style, action);
switch_select_destination("dialplan", "", "ring_group_timeout_action", $ring_group_timeout_action, "", "");
echo " <br />\n";
echo " ".$text['description-destination']."\n";
echo " ".$text['description-timeout_destination']."\n";
echo "</td>\n";
echo "</tr>\n";