Add the new follow me. Needs a little more refinement.

This commit is contained in:
Mark Crane 2012-11-21 05:59:07 +00:00
parent d689d122a0
commit 95f2b6d100
6 changed files with 398 additions and 429 deletions

View File

@ -21,6 +21,9 @@
$text['label-enable']['en-us'] = 'Enable';
$text['label-enable']['pt-pt'] = 'Activar';
$text['label-disable']['en-us'] = 'Disable';
$text['label-disable']['pt-pt'] = 'Desactivo';
$text['label-disabled']['en-us'] = 'Disabled';
$text['label-disabled']['pt-pt'] = 'Desactivo';
@ -48,6 +51,12 @@
$text['label-ring-order']['en-us'] = 'Ring Order';
$text['label-ring-order']['pt-pt'] = 'Pedir Chamada';
$text['label-ring-delay']['en-us'] = 'Delay';
$text['label-ring-delay']['pt-pt'] = '';
$text['label-ring-timeout']['en-us'] = 'Timeout';
$text['label-ring-timeout']['pt-pt'] = '';
$text['check-sequence']['en-us'] = 'sequence';
$text['ckeck-sequence']['pt-pt'] = 'sequêncial';

View File

@ -46,15 +46,15 @@ else {
echo " <select class='formfld' style='width: 45px;' name='$select_name'>\n";
echo " <option value=''></option>\n";
$i=5;
while($i<=100) {
$i = 0;
while($i <= 100) {
if ($select_value == $i) {
echo " <option value='$i' selected='selected'>$i</option>\n";
}
else {
echo " <option value='$i'>$i</option>\n";
}
$i=$i+5;
$i = $i + 5;
}
echo "</select>\n";
}
@ -100,7 +100,7 @@ else {
$do_not_disturb = $row["do_not_disturb"];
$call_forward_all = $row["call_forward_all"];
$call_forward_busy = $row["call_forward_busy"];
$description = $row["description"];
$follow_me_uuid = $row["follow_me_uuid"];
break; //limit to 1 row
}
if (strlen($do_not_disturb) == 0) {
@ -116,21 +116,28 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$call_forward_enabled = check_str($_POST["call_forward_enabled"]);
$call_forward_number = check_str($_POST["call_forward_number"]);
$follow_me_enabled = check_str($_POST["follow_me_enabled"]);
$follow_me_type = check_str($_POST["follow_me_type"]);
$destination_data_1 = check_str($_POST["destination_data_1"]);
$destination_timeout_1 = check_str($_POST["destination_timeout_1"]);
$destination_data_2 = check_str($_POST["destination_data_2"]);
$destination_timeout_2 = check_str($_POST["destination_timeout_2"]);
$destination_data_3 = check_str($_POST["destination_data_3"]);
$destination_timeout_3 = check_str($_POST["destination_timeout_3"]);
$destination_data_4 = check_str($_POST["destination_data_4"]);
$destination_timeout_4 = check_str($_POST["destination_timeout_4"]);
$destination_data_5 = check_str($_POST["destination_data_5"]);
$destination_timeout_5 = check_str($_POST["destination_timeout_5"]);
$dnd_enabled = check_str($_POST["dnd_enabled"]);
$hunt_group_call_prompt = check_str($_POST["hunt_group_call_prompt"]);
if (strlen($follow_me_type) == 0) { $follow_me_type = "follow_me_sequence"; }
$destination_data_1 = check_str($_POST["destination_data_1"]);
$destination_delay_1 = check_str($_POST["destination_delay_1"]);
$destination_timeout_1 = check_str($_POST["destination_timeout_1"]);
$destination_data_2 = check_str($_POST["destination_data_2"]);
$destination_delay_2 = check_str($_POST["destination_delay_2"]);
$destination_timeout_2 = check_str($_POST["destination_timeout_2"]);
$destination_data_3 = check_str($_POST["destination_data_3"]);
$destination_delay_3 = check_str($_POST["destination_delay_3"]);
$destination_timeout_3 = check_str($_POST["destination_timeout_3"]);
$destination_data_4 = check_str($_POST["destination_data_4"]);
$destination_delay_4 = check_str($_POST["destination_delay_4"]);
$destination_timeout_4 = check_str($_POST["destination_timeout_4"]);
$destination_data_5 = check_str($_POST["destination_data_5"]);
$destination_delay_5 = check_str($_POST["destination_delay_5"]);
$destination_timeout_5 = check_str($_POST["destination_timeout_5"]);
$dnd_enabled = check_str($_POST["dnd_enabled"]);
if (strlen($call_forward_number) > 0) {
$call_forward_number = preg_replace("~[^0-9]~", "",$call_forward_number);
@ -150,49 +157,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($destination_data_5) > 0) {
$destination_data_5 = preg_replace("~[^0-9]~", "",$destination_data_5);
}
//set the default
if (strlen($hunt_group_call_prompt) == 0) {
$hunt_group_call_prompt = 'false';
}
//destination_1
if (strlen($destination_data_1) > 0) {
if (extension_exists($destination_data_1)) {
$destination_type_1 = 'extension';
}
else {
$destination_type_1 = 'sip uri';
}
}
//destination_2
if (extension_exists($destination_data_2)) {
$destination_type_2 = 'extension';
}
else {
$destination_type_2 = 'sip uri';
}
//destination_3
if (extension_exists($destination_data_3)) {
$destination_type_3 = 'extension';
}
else {
$destination_type_3 = 'sip uri';
}
//destination_4
if (extension_exists($destination_data_4)) {
$destination_type_4 = 'extension';
}
else {
$destination_type_4 = 'sip uri';
}
//destination_5
if (extension_exists($destination_data_5)) {
$destination_type_5 = 'extension';
}
else {
$destination_type_5 = 'sip uri';
}
}
//check for all required data
@ -229,68 +193,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//set the default action to add
$call_forward_action = "add";
$follow_me_action = "add";
//get the hunt group timeout
//add the destination timeouts together to create the hunt group timeout
if ($follow_me_type == "follow_me_sequence") {
if (strlen($destination_data_1) > 0) {
$hunt_group_timeout = $destination_timeout_1;
}
if (strlen($destination_data_2) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_2;
}
if (strlen($destination_data_3) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_3;
}
if (strlen($destination_data_4) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_4;
}
if (strlen($destination_data_5) > 0) {
$hunt_group_timeout = $hunt_group_timeout + $destination_timeout_5;
}
}
//find the highest timeout and set that as the hunt_group_timeout
if ($follow_me_type == "follow_me_simultaneous") {
if (strlen($destination_data_1) > 0) {
$hunt_group_timeout = $destination_timeout_1;
}
if (strlen($destination_data_2) > 0 && $hunt_group_timeout < $destination_timeout_2) {
$hunt_group_timeout = $destination_timeout_2;
}
if (strlen($destination_data_3) > 0 && $hunt_group_timeout < $destination_timeout_3) {
$hunt_group_timeout = $destination_timeout_3;
}
if (strlen($destination_data_4) > 0 && $hunt_group_timeout < $destination_timeout_4) {
$hunt_group_timeout = $destination_timeout_4;
}
if (strlen($destination_data_5) > 0 && $hunt_group_timeout < $destination_timeout_5) {
$hunt_group_timeout = $destination_timeout_5;
}
}
//hunt_group information used to determine if this is an add or an update
$sql = "select * from v_hunt_groups ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and hunt_group_extension = '$extension' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
if ($row["hunt_group_type"] == 'call_forward') {
$call_forward_action = "update";
$call_forward_uuid = $row["hunt_group_uuid"];
}
if ($row["hunt_group_type"] == 'follow_me_sequence') {
$follow_me_action = "update";
$follow_me_uuid = $row["hunt_group_uuid"];
}
if ($row["hunt_group_type"] == 'follow_me_simultaneous') {
$follow_me_action = "update";
$follow_me_uuid = $row["hunt_group_uuid"];
}
//determine if this is an add or an update
if (strlen($follow_me_uuid) == 0) {
$follow_me_action = "add";
}
else {
$follow_me_action = "update";
}
unset ($prep_statement);
//include the classes
include "includes/classes/switch_call_forward.php";
@ -325,51 +235,61 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
}
//follow me config
if (permission_exists('follow_me')) {
$follow_me = new follow_me;
$follow_me->domain_uuid = $_SESSION['domain_uuid'];
$follow_me->db_type = $db_type;
$follow_me->extension = $extension;
$follow_me->follow_me_enabled = $follow_me_enabled;
$follow_me->follow_me_type = $follow_me_type;
$follow_me->hunt_group_call_prompt = $hunt_group_call_prompt;
$follow_me->hunt_group_timeout = $hunt_group_timeout;
$follow_me->destination_data_1 = $destination_data_1;
$follow_me->destination_type_1 = $destination_type_1;
$follow_me->destination_delay_1 = $destination_delay_1;
$follow_me->destination_timeout_1 = $destination_timeout_1;
$follow_me->destination_data_2 = $destination_data_2;
$follow_me->destination_type_2 = $destination_type_2;
$follow_me->destination_delay_2 = $destination_delay_2;
$follow_me->destination_timeout_2 = $destination_timeout_2;
$follow_me->destination_data_3 = $destination_data_3;
$follow_me->destination_type_3 = $destination_type_3;
$follow_me->destination_delay_3 = $destination_delay_3;
$follow_me->destination_timeout_3 = $destination_timeout_3;
$follow_me->destination_data_4 = $destination_data_4;
$follow_me->destination_type_4 = $destination_type_4;
$follow_me->destination_delay_4 = $destination_delay_4;
$follow_me->destination_timeout_4 = $destination_timeout_4;
$follow_me->destination_data_5 = $destination_data_5;
$follow_me->destination_type_5 = $destination_type_5;
$follow_me->destination_delay_5 = $destination_delay_5;
$follow_me->destination_timeout_5 = $destination_timeout_5;
if ($follow_me_enabled == "true") {
if ($follow_me_action == "add") {
$follow_me->follow_me_uuid = uuid();
$follow_me_uuid = uuid();
$sql = "update v_extensions set ";
$sql .= "follow_me_uuid = '$follow_me_uuid' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
$follow_me->follow_me_uuid = $follow_me_uuid;
$follow_me->follow_me_add();
$follow_me->set();
}
}
if ($follow_me_action == "update") {
$follow_me->follow_me_uuid = $follow_me_uuid;
$follow_me->follow_me_update();
$follow_me->set();
}
unset($follow_me);
//synchronize the xml config
save_hunt_group_xml();
//synchronize the xml config
save_dialplan_xml();
}
@ -401,82 +321,52 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
//pre-populate the form
$sql = "select * from v_hunt_groups ";
$sql .= "where hunt_group_extension = '$extension' ";
$sql .= "and domain_uuid = '$domain_uuid' ";
$sql = "select * from v_follow_me ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and follow_me_uuid = '$follow_me_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$hunt_group_uuid = $row["hunt_group_uuid"];
$hunt_group_extension = $row["hunt_group_extension"];
$huntgroup_name = $row["hunt_group_name"];
$hunt_group_type = $row["hunt_group_type"];
$hunt_group_context = $row["hunt_group_context"];
$hunt_group_timeout = $row["hunt_group_timeout"];
$hunt_group_timeout_destination = $row["hunt_group_timeout_destination"];
$hunt_group_timeout_type = $row["hunt_group_timeout_type"];
$hunt_group_ring_back = $row["hunt_group_ringback"];
$hunt_group_cid_name_prefix = $row["hunt_group_cid_name_prefix"];
$hunt_group_pin = $row["hunt_group_pin"];
$hunt_group_call_prompt = $row["hunt_group_call_prompt"];
$huntgroup_caller_announce = $row["hunt_group_caller_announce"];
$hunt_group_user_list = $row["hunt_group_user_list"];
$hunt_group_enabled = $row["hunt_group_enabled"];
$hunt_group_description = $row["hunt_group_description"];
$follow_me_enabled = $row["follow_me_enabled"];
if ($row["hunt_group_type"] == 'call_forward') {
$call_forward_enabled = $hunt_group_enabled;
}
if ($row["hunt_group_type"] == 'follow_me_simultaneous') {
$follow_me_enabled = $hunt_group_enabled;
$follow_me_type = 'follow_me_simultaneous';
}
if ($row["hunt_group_type"] == 'follow_me_sequence') {
$follow_me_enabled = $hunt_group_enabled;
$follow_me_type = 'follow_me_sequence';
}
if ($row["hunt_group_type"] == 'call_forward' || $row["hunt_group_type"] == 'follow_me_sequence' || $row["hunt_group_type"] == 'follow_me_simultaneous') {
$sql = "select * from v_hunt_group_destinations ";
$sql .= "where hunt_group_uuid = '$hunt_group_uuid' ";
$sql .= "order by destination_order asc ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$x=1;
foreach ($result2 as &$row2) {
if ($row["hunt_group_type"] == 'call_forward') {
if (strlen($row2["destination_data"]) > 0) {
$call_forward_number = $row2["destination_data"];
}
}
if ($row["hunt_group_type"] == 'follow_me_sequence' || $row["hunt_group_type"] == 'follow_me_simultaneous') {
if ($x == 1) {
$destination_data_1 = $row2["destination_data"];
$destination_timeout_1 = $row2["destination_timeout"];
}
if ($x == 2) {
$destination_data_2 = $row2["destination_data"];
$destination_timeout_2 = $row2["destination_timeout"];
}
if ($x == 3) {
$destination_data_3 = $row2["destination_data"];
$destination_timeout_3 = $row2["destination_timeout"];
}
if ($x == 4) {
$destination_data_4 = $row2["destination_data"];
$destination_timeout_4 = $row2["destination_timeout"];
}
if ($x == 5) {
$destination_data_5 = $row2["destination_data"];
$destination_timeout_5 = $row2["destination_timeout"];
}
$x++;
}
$sql = "select * from v_follow_me_destinations ";
$sql .= "where follow_me_uuid = '$follow_me_uuid' ";
$sql .= "order by follow_me_order asc ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result2 = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$x = 1;
foreach ($result2 as &$row2) {
//$call_forward_number = $row2["destination_data"];
if ($x == 1) {
$destination_data_1 = $row2["follow_me_destination"];
$destination_delay_1 = $row2["follow_me_delay"];
$destination_timeout_1 = $row2["follow_me_timeout"];
}
unset ($prep_statement_2);
if ($x == 2) {
$destination_data_2 = $row2["follow_me_destination"];
$destination_delay_2 = $row2["follow_me_delay"];
$destination_timeout_2 = $row2["follow_me_timeout"];
}
if ($x == 3) {
$destination_data_3 = $row2["follow_me_destination"];
$destination_delay_3 = $row2["follow_me_delay"];
$destination_timeout_3 = $row2["follow_me_timeout"];
}
if ($x == 4) {
$destination_data_4 = $row2["follow_me_destination"];
$destination_delay_4 = $row2["follow_me_delay"];
$destination_timeout_4 = $row2["follow_me_timeout"];
}
if ($x == 5) {
$destination_data_5 = $row2["follow_me_destination"];
$destination_delay_5 = $row2["follow_me_delay"];
$destination_timeout_5 = $row2["follow_me_timeout"];
}
$x++;
}
unset ($prep_statement_2);
}
unset ($prep_statement);
@ -496,7 +386,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<form method='post' name='frm' action=''>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td align='left' width='30%' nowrap>\n";
echo "<td align='left' width='30%' nowrap='nowrap'>\n";
echo " <b>".$text['title']."</b>\n";
echo "</td>\n";
echo "<td width='70%' align='right'>\n";
@ -510,7 +400,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " <strong>".$text['label-call-forward'].":</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
@ -538,7 +428,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
@ -555,7 +445,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " <strong>".$text['label-follow-me'].":</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
@ -582,12 +472,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-ring-1'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_1' maxlength='255' value=\"$destination_data_1\">\n";
echo " Sec \n";
echo " ".$text['label-ring-delay']."\n";
destination_select('destination_delay_1', $destination_delay_1, '0');
echo " ".$text['label-ring-timeout']."\n";
destination_select('destination_timeout_1', $destination_timeout_1, '10');
//echo "<br />\n";
//echo "This number rings first.\n";
@ -595,12 +487,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-ring-2'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_2' maxlength='255' value=\"$destination_data_2\">\n";
echo " Sec \n";
echo " ".$text['label-ring-delay']."\n";
destination_select('destination_delay_2', $destination_delay_2, '0');
echo " ".$text['label-ring-timeout']."\n";
destination_select('destination_timeout_2', $destination_timeout_2, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
@ -608,12 +502,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-ring-3'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_3' maxlength='255' value=\"$destination_data_3\">\n";
echo " Sec \n";
echo " ".$text['label-ring-delay']."\n";
destination_select('destination_delay_3', $destination_delay_3, '0');
echo " ".$text['label-ring-timeout']."\n";
destination_select('destination_timeout_3', $destination_timeout_3, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
@ -621,12 +517,14 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-ring-4'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_4' maxlength='255' value=\"$destination_data_4\">\n";
echo " Sec \n";
echo " ".$text['label-ring-delay']."\n";
destination_select('destination_delay_4', $destination_delay_4, '0');
echo " ".$text['label-ring-timeout']."\n";
destination_select('destination_timeout_4', $destination_timeout_4, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
@ -634,68 +532,20 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-ring-5'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='destination_data_5' maxlength='255' value=\"$destination_data_5\">\n";
echo " Sec \n";
echo " ".$text['label-ring-delay']."\n";
destination_select('destination_delay_5', $destination_delay_5, '0');
echo " ".$text['label-ring-timeout']."\n";
destination_select('destination_timeout_5', $destination_timeout_5, '30');
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-ring-order'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<select class='formfld' name='follow_me_type'>\n";
echo "<option value=''></option>\n";
if ($follow_me_type == "follow_me_sequence") {
echo "<option value='follow_me_sequence' selected='selected'>sequence</option>\n";
}
else {
echo "<option value='follow_me_sequence'>sequence</option>\n";
}
if ($follow_me_type == "follow_me_simultaneous") {
echo "<option value='follow_me_simultaneous' selected='selected'>simultaneous</option>\n";
}
else {
echo "<option value='follow_me_simultaneous'>simultaneous</option>\n";
}
echo "</select>\n";
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-prompt'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo "<select class='formfld' name='hunt_group_call_prompt'>\n";
echo "<option value=''></option>\n";
if ($hunt_group_call_prompt == "true") {
echo "<option value='true' selected='selected'>true</option>\n";
}
else {
echo "<option value='true'>true</option>\n";
}
if ($hunt_group_call_prompt == "false") {
echo "<option value='false' selected='selected'>false</option>\n";
}
else {
echo "<option value='false'>false</option>\n";
}
echo "</select>\n";
//echo "<br />\n";
//echo "Enter the destination number.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " <br />\n";
@ -703,7 +553,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " <strong>".$text['label-dnd'].":</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";

View File

@ -0,0 +1,120 @@
<?php
//application details
$apps[$x]['name'] = 'Follow Me';
$apps[$x]['uuid'] = 'f5210fba-337d-4e05-86b6-7a2fd9dc7c42';
$apps[$x]['category'] = '';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en-us'] = '';
$apps[$x]['description']['es-mx'] = '';
$apps[$x]['description']['de'] = '';
$apps[$x]['description']['de-ch'] = '';
$apps[$x]['description']['de-at'] = '';
$apps[$x]['description']['fr'] = '';
$apps[$x]['description']['fr-ca'] = '';
$apps[$x]['description']['fr-ch'] = '';
$apps[$x]['description']['pt-pt'] = '';
$apps[$x]['description']['pt-br'] = '';
//menu details
$apps[$x]['menu'][0]['title']['en-us'] = 'Follow Me';
$apps[$x]['menu'][0]['title']['es-mx'] = '';
$apps[$x]['menu'][0]['title']['de'] = '';
$apps[$x]['menu'][0]['title']['de-ch'] = '';
$apps[$x]['menu'][0]['title']['de-at'] = '';
$apps[$x]['menu'][0]['title']['fr'] = '';
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
$apps[$x]['menu'][0]['title']['fr-ch'] = '';
$apps[$x]['menu'][0]['title']['pt-pt'] = '';
$apps[$x]['menu'][0]['title']['pt-br'] = '';
$apps[$x]['menu'][0]['uuid'] = 'a1144e12-873e-4722-9818-02da1adb6ba3';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/follow_me/follow_me.php';
//$apps[$x]['menu'][0]['groups'][] = 'user';
//$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = 'follow_me_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$apps[$x]['permissions'][$y]['groups'][] = 'user';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'follow_me_add';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'follow_me_edit';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$apps[$x]['permissions'][$y]['groups'][] = 'user';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'follow_me_delete';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_follow_me';
$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'] = 'follow_me_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'] = 'follow_me_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
//schema details
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_follow_me_destinations';
$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'] = 'follow_me_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'] = 'follow_me_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'] = 'follow_me_destination';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'follow_me_delay';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'follow_me_timeout';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'follow_me_order';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
?>

50
app/follow_me/root.php Normal file
View File

@ -0,0 +1,50 @@
<?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) 2008-2012
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
// make sure the PATH_SEPARATOR is defined
if (!defined("PATH_SEPARATOR")) {
if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
}
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
// if the project directory exists then add it to the include path otherwise add the document root to the include path
if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', '/fusionpbx'); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
}
else {
if(!defined('PROJECT_PATH')) { define('PROJECT_PATH', ''); }
set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
}
?>

View File

@ -67,7 +67,7 @@ include "root.php";
}
$sql = "update v_extensions set ";
$sql .= "do_not_disturb = '".$this->enabled."', ";
$sql .= "dial_string = '".$this->dial_string."', ";
// $sql .= "dial_string = '".$this->dial_string."', ";
$sql .= "dial_domain = '".$this->domain_name."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and extension = '".$this->extension."' ";

View File

@ -30,95 +30,50 @@ include "root.php";
public $domain_uuid;
public $db_type;
public $follow_me_uuid;
public $extension;
public $follow_me_enabled;
public $follow_me_type;
public $hunt_group_call_prompt;
public $hunt_group_timeout;
public $destination_data_1;
public $destination_type_1;
public $destination_delay_1;
public $destination_timeout_1;
public $destination_data_2;
public $destination_type_2;
public $destination_delay_2;
public $destination_timeout_2;
public $destination_data_3;
public $destination_type_3;
public $destination_delay_3;
public $destination_timeout_3;
public $destination_data_4;
public $destination_type_4;
public $destination_delay_4;
public $destination_timeout_4;
public $destination_data_5;
public $destination_type_5;
public $destination_delay_5;
public $destination_timeout_5;
public $destination_profile = 'internal';
public $destination_timeout = '';
public $destination_timeout = 0;
public $destination_order = 1;
public $destination_enabled = 'true';
public $destination_description = 'follow me';
public function follow_me_add() {
global $db;
$hunt_group_extension = $this->extension;
$hunt_group_name = 'follow_me_'.$this->extension;
$hunt_group_type = $this->follow_me_type;
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout = $this->hunt_group_timeout;
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
//$hunt_group_cid_name_prefix = '';
//$hunt_group_pin = '';
$huntgroup_caller_announce = 'false';
//$hunt_group_user_list = '';
$hunt_group_enabled = $this->follow_me_enabled;
$hunt_group_description = 'follow me '.$this->extension;
$sql = "insert into v_hunt_groups ";
$sql = "insert into v_follow_me ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "hunt_group_extension, ";
$sql .= "hunt_group_name, ";
$sql .= "hunt_group_type, ";
$sql .= "hunt_group_context, ";
$sql .= "hunt_group_timeout, ";
$sql .= "hunt_group_timeout_destination, ";
$sql .= "hunt_group_timeout_type, ";
$sql .= "hunt_group_ringback, ";
$sql .= "hunt_group_cid_name_prefix, ";
$sql .= "hunt_group_pin, ";
$sql .= "hunt_group_call_prompt, ";
$sql .= "hunt_group_caller_announce, ";
$sql .= "hunt_group_user_list, ";
$sql .= "hunt_group_enabled, ";
$sql .= "hunt_group_description ";
$sql .= "follow_me_uuid, ";
$sql .= "follow_me_enabled ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$hunt_group_extension', ";
$sql .= "'$hunt_group_name', ";
$sql .= "'$hunt_group_type', ";
$sql .= "'$hunt_group_context', ";
$sql .= "'$hunt_group_timeout', ";
$sql .= "'$hunt_group_timeout_destination', ";
$sql .= "'$hunt_group_timeout_type', ";
$sql .= "'$hunt_group_ring_back', ";
$sql .= "'$hunt_group_cid_name_prefix', ";
$sql .= "'$hunt_group_pin', ";
$sql .= "'$hunt_group_call_prompt', ";
$sql .= "'$huntgroup_caller_announce', ";
$sql .= "'$hunt_group_user_list', ";
$sql .= "'$hunt_group_enabled', ";
$sql .= "'$hunt_group_description' ";
$sql .= "'$this->follow_me_enabled' ";
$sql .= ")";
if ($v_debug) {
echo $sql."<br />";
@ -131,39 +86,10 @@ include "root.php";
public function follow_me_update() {
global $db;
$hunt_group_extension = $this->extension;
$hunt_group_name = 'follow_me_'.$this->extension;
$hunt_group_type = $this->follow_me_type;
$hunt_group_context = $_SESSION['context'];
$hunt_group_timeout = $this->hunt_group_timeout;
$hunt_group_timeout_destination = $this->extension;
$hunt_group_timeout_type = 'voicemail';
$hunt_group_ring_back = 'us-ring';
//$hunt_group_cid_name_prefix = '';
//$hunt_group_pin = '';
$huntgroup_caller_announce = 'false';
//$hunt_group_user_list = '';
$hunt_group_enabled = $this->follow_me_enabled;
$hunt_group_description = 'follow me '.$this->extension;
$sql = "update v_hunt_groups set ";
$sql .= "hunt_group_extension = '$hunt_group_extension', ";
$sql .= "hunt_group_name = '$hunt_group_name', ";
$sql .= "hunt_group_type = '$hunt_group_type', ";
$sql .= "hunt_group_context = '$hunt_group_context', ";
$sql .= "hunt_group_timeout = '$hunt_group_timeout', ";
$sql .= "hunt_group_timeout_destination = '$hunt_group_timeout_destination', ";
$sql .= "hunt_group_timeout_type = '$hunt_group_timeout_type', ";
$sql .= "hunt_group_ringback = '$hunt_group_ring_back', ";
$sql .= "hunt_group_cid_name_prefix = '$hunt_group_cid_name_prefix', ";
$sql .= "hunt_group_pin = '$hunt_group_pin', ";
$sql .= "hunt_group_call_prompt = '$this->hunt_group_call_prompt', ";
$sql .= "hunt_group_caller_announce = '$huntgroup_caller_announce', ";
$sql .= "hunt_group_user_list = '$hunt_group_user_list', ";
$sql .= "hunt_group_enabled = '$hunt_group_enabled', ";
$sql .= "hunt_group_description = '$hunt_group_description' ";
$sql = "update follow_me set ";
$sql .= "follow_me_enabled = '$this->follow_me_enabled' ";
$sql .= "where domain_uuid = '$this->domain_uuid' ";
$sql .= "and hunt_group_uuid = '$this->follow_me_uuid' ";
$sql .= "and follow_me_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
unset($sql);
$this->follow_me_destinations();
@ -172,24 +98,21 @@ include "root.php";
public function follow_me_destinations() {
global $db;
//delete related v_hunt_group_destinations
$sql = "delete from v_hunt_group_destinations where hunt_group_uuid = '$this->follow_me_uuid' ";
//delete related follow me destinations
$sql = "delete from v_follow_me_destinations where follow_me_uuid = '$this->follow_me_uuid' ";
$db->exec(check_sql($sql));
//insert the v_hunt_group_destinations set destination_data_1
//insert the follow me destinations
if (strlen($this->destination_data_1) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql = "insert into v_follow_me_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "follow_me_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= "follow_me_uuid, ";
$sql .= "follow_me_destination, ";
$sql .= "follow_me_timeout, ";
$sql .= "follow_me_delay, ";
$sql .= "follow_me_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
@ -197,30 +120,24 @@ include "root.php";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_1', ";
$sql .= "'$this->destination_type_1', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_1', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= "'$this->destination_delay_1', ";
$sql .= "'1' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_2) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql = "insert into v_follow_me_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "follow_me_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= "follow_me_uuid, ";
$sql .= "follow_me_destination, ";
$sql .= "follow_me_timeout, ";
$sql .= "follow_me_delay, ";
$sql .= "follow_me_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
@ -228,30 +145,24 @@ include "root.php";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_2', ";
$sql .= "'$this->destination_type_2', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_2', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= "'$this->destination_delay_2', ";
$sql .= "'2' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_3) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql = "insert into v_follow_me_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "follow_me_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= "follow_me_uuid, ";
$sql .= "follow_me_destination, ";
$sql .= "follow_me_timeout, ";
$sql .= "follow_me_delay, ";
$sql .= "follow_me_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
@ -259,30 +170,24 @@ include "root.php";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_3', ";
$sql .= "'$this->destination_type_3', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_3', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= "'$this->destination_delay_3', ";
$sql .= "'3' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_4) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql = "insert into v_follow_me_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "follow_me_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= "follow_me_uuid, ";
$sql .= "follow_me_destination, ";
$sql .= "follow_me_timeout, ";
$sql .= "follow_me_delay, ";
$sql .= "follow_me_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
@ -290,30 +195,24 @@ include "root.php";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_4', ";
$sql .= "'$this->destination_type_4', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_4', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= "'$this->destination_delay_4', ";
$sql .= "'4' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
if (strlen($this->destination_data_5) > 0) {
$sql = "insert into v_hunt_group_destinations ";
$sql = "insert into v_follow_me_destinations ";
$sql .= "(";
$sql .= "hunt_group_destination_uuid, ";
$sql .= "follow_me_destination_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "hunt_group_uuid, ";
$sql .= "destination_data, ";
$sql .= "destination_type, ";
$sql .= "destination_profile, ";
$sql .= "destination_timeout, ";
$sql .= "destination_order, ";
$sql .= "destination_enabled, ";
$sql .= "destination_description ";
$sql .= "follow_me_uuid, ";
$sql .= "follow_me_destination, ";
$sql .= "follow_me_timeout, ";
$sql .= "follow_me_delay, ";
$sql .= "follow_me_order ";
$sql .= ") ";
$sql .= "values ";
$sql .= "(";
@ -321,18 +220,59 @@ include "root.php";
$sql .= "'$this->domain_uuid', ";
$sql .= "'$this->follow_me_uuid', ";
$sql .= "'$this->destination_data_5', ";
$sql .= "'$this->destination_type_5', ";
$sql .= "'$this->destination_profile', ";
$sql .= "'$this->destination_timeout_5', ";
$sql .= "'$this->destination_order', ";
$sql .= "'$this->destination_enabled', ";
$sql .= "'$this->destination_description' ";
$sql .= "'$this->destination_delay_5', ";
$sql .= "'5' ";
$sql .= ")";
$db->exec(check_sql($sql));
$this->destination_order++;
unset($sql);
}
} //function
public function set() {
global $db;
//update the extension
if ($this->follow_me_enabled == "true") {
$sql = "select * from v_follow_me_destinations ";
$sql .= "where follow_me_uuid = '$this->follow_me_uuid' ";
$sql .= "order by follow_me_order asc ";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$dial_string = "{group_confirm_key=exec,group_confirm_file=lua confirm.lua,sip_invite_domain=".$_SESSION['domain_name']."}";
foreach ($result as &$row) {
$dial_string .= "[presence_id=".$row["follow_me_destination"]."@".$_SESSION['domain_name'].",";
$dial_string .= "leg_delay_start=".$row["follow_me_delay"].",";
$dial_string .= "leg_timeout=".$row["follow_me_timeout"]."]";
if (extension_exists($row["follow_me_destination"])) {
$dial_string .= "\${sofia_contact(".$row["follow_me_destination"]."@".$_SESSION['domain_name'].")},";
}
else {
$dial_string .= "loopback/".$row["follow_me_destination"].",";
}
}
$this->dial_string = trim($dial_string, ",");
}
else {
// $this->dial_string = "";
}
$sql = "update v_extensions set ";
$sql .= "do_not_disturb = 'false', ";
$sql .= "dial_string = '".$this->dial_string."', ";
$sql .= "dial_domain = '".$_SESSION['domain_name']."' ";
$sql .= "where domain_uuid = '".$this->domain_uuid."' ";
$sql .= "and follow_me_uuid = '".$this->follow_me_uuid."' ";
if ($this->debug) {
echo $sql."<br />";
}
$db->exec($sql);
unset($sql);
//syncrhonize configuration
save_extension_xml();
}
} //class
?>