Add a missing file sip_profile_copy.php to the dev branch.

This commit is contained in:
Mark Crane
2012-06-04 14:58:40 +00:00
commit af103e9c41
1240 changed files with 164946 additions and 0 deletions
+120
View File
@@ -0,0 +1,120 @@
<?php
//application details
$apps[$x]['name'] = "Call Broadcast";
$apps[$x]['uuid'] = 'efc11f6b-ed73-9955-4d4d-3a1bed75a056';
$apps[$x]['category'] = 'Switch';;
$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'] = 'Schedule to immediately make multiple calls to the extension an IVR Menu, Conference Room, or any other number.';
//menu details
$apps[$x]['menu'][0]['title']['en'] = 'Call Broadcast';
$apps[$x]['menu'][0]['uuid'] = '50153bbf-78c5-b49e-7bd9-4b3e4b1134e6';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
$apps[$x]['menu'][0]['path'] = '/app/call_broadcast/v_call_broadcast.php';
//permission details
$apps[$x]['permissions'][0]['name'] = 'call_broadcast_view';
$apps[$x]['permissions'][0]['groups'][] = 'admin';
$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
$apps[$x]['permissions'][1]['name'] = 'call_broadcast_add';
$apps[$x]['permissions'][1]['groups'][] = 'admin';
$apps[$x]['permissions'][1]['groups'][] = 'superadmin';
$apps[$x]['permissions'][2]['name'] = 'call_broadcast_edit';
$apps[$x]['permissions'][2]['groups'][] = 'admin';
$apps[$x]['permissions'][2]['groups'][] = 'superadmin';
$apps[$x]['permissions'][3]['name'] = 'call_broadcast_delete';
$apps[$x]['permissions'][3]['groups'][] = 'admin';
$apps[$x]['permissions'][3]['groups'][] = 'superadmin';
$apps[$x]['permissions'][4]['name'] = 'call_broadcast_send';
$apps[$x]['permissions'][4]['groups'][] = 'admin';
$apps[$x]['permissions'][4]['groups'][] = 'superadmin';
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_call_broadcasts';
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'id';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'call_broadcast_id';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'serial';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'integer';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'INT NOT NULL AUTO_INCREMENT';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'call_call_broadcast_uuid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'broadcast_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']['type'] = 'primary';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$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']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'v_id';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = 'true';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'broadcast_description';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'broadcast_desc';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_timeout';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_concurrent_limit';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = 'recording_uuid';
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = 'recordingid';
$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]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_caller_id_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_caller_id_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_destination_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_phone_numbers';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'broadcast_destination_data';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = '';
?>
+50
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'] );
}
?>
+151
View File
@@ -0,0 +1,151 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
require_once "includes/header.php";
require_once "includes/paging.php";
//get the http get variables and set them to php variables
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//show the content
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br>";
echo "<table width='100%' border='0'><tr>\n";
echo "<td width='50%' nowrap='nowrap' align='left'><b>Call Broadcast List</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr></table>\n";
$sql = "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$num_rows = count($result);
unset ($prep_statement, $result, $sql);
$rows_per_page = 10;
$param = "";
$page = $_GET['page'];
if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; }
list($paging_controls, $rows_per_page, $var_3) = paging($num_rows, $param, $rows_per_page);
$offset = $rows_per_page * $page;
$sql = "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$sql .= " limit $rows_per_page offset $offset ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
echo th_order_by('broadcast_name', 'Name', $order_by, $order);
echo th_order_by('broadcast_concurrent_limit', 'Concurrent Limit', $order_by, $order);
echo th_order_by('broadcast_description', 'Description', $order_by, $order);
//echo th_order_by('recordingid', 'Recording', $order_by, $order);
echo "<td align='right' width='42'>\n";
if (permission_exists('call_broadcast_add')) {
echo " <a href='v_call_broadcast_edit.php' alt='add'>$v_link_label_add</a>\n";
}
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['broadcast_name']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['broadcast_concurrent_limit']."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['recordingid']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['broadcast_description']."&nbsp;</td>\n";
echo " <td valign='top' align='right'>\n";
if (permission_exists('call_broadcast_edit')) {
echo " <a href='v_call_broadcast_edit.php?id=".$row['call_broadcast_uuid']."' alt='edit'>$v_link_label_edit</a>\n";
}
if (permission_exists('call_broadcast_delete')) {
echo " <a href='v_call_broadcast_delete.php?id=".$row['call_broadcast_uuid']."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "<tr>\n";
echo "<td colspan='5' align='left'>\n";
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td width='33.3%' nowrap>&nbsp;</td>\n";
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
echo " <td width='33.3%' align='right'>\n";
if (permission_exists('call_broadcast_add')) {
echo " <a href='v_call_broadcast_edit.php' alt='add'>$v_link_label_add</a>\n";
}
echo " </td>\n";
echo " </tr>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
?>
@@ -0,0 +1,61 @@
<?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>
*/
require "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//get the id
if (count($_GET)>0) {
$id = $_GET["id"];
}
//delete the call broadcast entry
if (strlen($id)>0) {
$sql = "delete from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$id' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($sql);
}
//redirect the user
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_broadcast.php\">\n";
echo "<div align='center'>\n";
echo "Delete Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
?>
@@ -0,0 +1,560 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the action with add or update
if (isset($_REQUEST["id"])) {
$action = "update";
$call_broadcast_uuid = check_str($_REQUEST["id"]);
}
else {
$action = "add";
}
//get the http post variables and set them to php variables
if (count($_POST)>0) {
$broadcast_name = check_str($_POST["broadcast_name"]);
$broadcast_description = check_str($_POST["broadcast_description"]);
$broadcast_timeout = check_str($_POST["broadcast_timeout"]);
$broadcast_concurrent_limit = check_str($_POST["broadcast_concurrent_limit"]);
//$recording_uuid = check_str($_POST["recording_uuid"]);
$broadcast_caller_id_name = check_str($_POST["broadcast_caller_id_name"]);
$broadcast_caller_id_number = check_str($_POST["broadcast_caller_id_number"]);
$broadcast_destination_type = check_str($_POST["broadcast_destination_type"]);
$broadcast_phone_numbers = check_str($_POST["broadcast_phone_numbers"]);
$broadcast_destination_data = check_str($_POST["broadcast_destination_data"]);
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$call_broadcast_uuid = check_str($_POST["call_broadcast_uuid"]);
}
//check for all required data
if (strlen($broadcast_name) == 0) { $msg .= "Please provide: Name<br>\n"; }
//if (strlen($broadcast_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
//if (strlen($broadcast_timeout) == 0) { $msg .= "Please provide: Timeout<br>\n"; }
//if (strlen($broadcast_concurrent_limit) == 0) { $msg .= "Please provide: Concurrent Limit<br>\n"; }
//if (strlen($recording_uuid) == 0) { $msg .= "Please provide: Recording<br>\n"; }
//if (strlen($broadcast_caller_id_name) == 0) { $msg .= "Please provide: Caller ID Name<br>\n"; }
//if (strlen($broadcast_caller_id_number) == 0) { $msg .= "Please provide: Caller ID Number<br>\n"; }
//if (strlen($broadcast_destination_type) == 0) { $msg .= "Please provide: Type<br>\n"; }
//if (strlen($broadcast_phone_numbers) == 0) { $msg .= "Please provide: Phone Number List<br>\n"; }
//if (strlen($broadcast_destination_data) == 0) { $msg .= "Please provide: Destination<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "includes/header.php";
require_once "includes/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 "includes/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add" && permission_exists('call_broadcast_add')) {
$call_broadcast_uuid = uuid();
$sql = "insert into v_call_broadcasts ";
$sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "call_broadcast_uuid, ";
$sql .= "broadcast_name, ";
$sql .= "broadcast_description, ";
$sql .= "broadcast_timeout, ";
$sql .= "broadcast_concurrent_limit, ";
//$sql .= "recording_uuid, ";
$sql .= "broadcast_caller_id_name, ";
$sql .= "broadcast_caller_id_number, ";
$sql .= "broadcast_destination_type, ";
$sql .= "broadcast_phone_numbers, ";
$sql .= "broadcast_destination_data ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$domain_uuid', ";
$sql .= "'$call_broadcast_uuid', ";
$sql .= "'$broadcast_name', ";
$sql .= "'$broadcast_description', ";
if (strlen($broadcast_timeout) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'$broadcast_timeout', ";
}
if (strlen($broadcast_concurrent_limit) == 0) {
$sql .= "null, ";
}
else {
$sql .= "'$broadcast_concurrent_limit', ";
}
//$sql .= "'$recording_uuid', ";
$sql .= "'$broadcast_caller_id_name', ";
$sql .= "'$broadcast_caller_id_number', ";
$sql .= "'$broadcast_destination_type', ";
$sql .= "'$broadcast_phone_numbers', ";
$sql .= "'$broadcast_destination_data' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_broadcast.php\">\n";
echo "<div align='center'>\n";
echo "Add Complete\n";
echo "</div>\n";
require_once "includes/footer.php";
return;
} //if ($action == "add")
if ($action == "update" && permission_exists('call_broadcast_edit')) {
$sql = "update v_call_broadcasts set ";
$sql .= "broadcast_name = '$broadcast_name', ";
$sql .= "broadcast_description = '$broadcast_description', ";
if (strlen($broadcast_timeout) == 0) {
$sql .= "broadcast_timeout = null, ";
}
else {
$sql .= "broadcast_timeout = '$broadcast_timeout', ";
}
if (strlen($broadcast_concurrent_limit) == 0) {
$sql .= "broadcast_concurrent_limit = null, ";
}
else {
$sql .= "broadcast_concurrent_limit = '$broadcast_concurrent_limit', ";
}
//$sql .= "recording_uuid = '$recording_uuid', ";
$sql .= "broadcast_caller_id_name = '$broadcast_caller_id_name', ";
$sql .= "broadcast_caller_id_number = '$broadcast_caller_id_number', ";
$sql .= "broadcast_destination_type = '$broadcast_destination_type', ";
$sql .= "broadcast_phone_numbers = '$broadcast_phone_numbers', ";
$sql .= "broadcast_destination_data = '$broadcast_destination_data' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid'";
$db->exec(check_sql($sql));
unset($sql);
require_once "includes/header.php";
echo "<meta http-equiv=\"refresh\" content=\"2;url=v_call_broadcast.php\">\n";
echo "<div align='center'>\n";
echo "Update Complete\n";
echo "</div>\n";
require_once "includes/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") {
$call_broadcast_uuid = $_GET["id"];
$sql = "";
$sql .= "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
$broadcast_name = $row["broadcast_name"];
$broadcast_description = $row["broadcast_description"];
$broadcast_timeout = $row["broadcast_timeout"];
$broadcast_concurrent_limit = $row["broadcast_concurrent_limit"];
//$recording_uuid = $row["recording_uuid"];
$broadcast_caller_id_name = $row["broadcast_caller_id_name"];
$broadcast_caller_id_number = $row["broadcast_caller_id_number"];
$broadcast_destination_type = $row["broadcast_destination_type"];
$broadcast_phone_numbers = $row["broadcast_phone_numbers"];
$broadcast_destination_data = $row["broadcast_destination_data"];
break; //limit to 1 row
}
unset ($prep_statement);
}
//begin header
require_once "includes/header.php";
//begin 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";
if ($action == "add") {
echo "<td width='30%' align='left' nowrap='nowrap'><b>Call Broadcast</b></td>\n";
}
if ($action == "update") {
echo "<td width='30%' align='left' nowrap='nowrap'><b>Call Broadcast Edit</b></td>\n";
}
echo "<td width='70%' align='right'>\n";
echo " <input type='button' class='btn' name='back' alt='back' onclick=\"window.location='v_call_broadcast.php'\" value='Back'>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap>\n";
echo " Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_name' maxlength='255' value=\"$broadcast_name\">\n";
echo "<br />\n";
echo "Enter a name here.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Timeout:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_timeout' maxlength='255' value=\"$broadcast_timeout\">\n";
echo "<br />\n";
echo "Limit the length of the call. Leave this empty for no limit.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Concurrent Limit:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_concurrent_limit' maxlength='255' value=\"$broadcast_concurrent_limit\">\n";
echo "<br />\n";
echo "Limit the approximate number of concurrent calls. Leave this empty for no limit.\n";
echo "</td>\n";
echo "</tr>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
//echo " Recording:\n";
//echo "</td>\n";
//echo "<td class='vtable' align='left'>\n";
//echo " <select name='recording_uuid' class='formfld'>\n";
//echo " <option></option>\n";
//$sql = "";
//$sql .= "select * from v_recordings ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
//$prep_statement = $db->prepare(check_sql($sql));
//$prep_statement->execute();
//while($row = $prep_statement->fetch()) {
// if ($recording_uuid == $row['recording_uuid']) {
// echo " <option value='".$row['recording_uuid']."' selected='yes'>".$row['recordingname']."</option>\n";
// }
// else {
// echo " <option value='".$row['recording_uuid']."'>".$row['recordingname']."</option>\n";
// }
//}
//unset ($prep_statement);
//echo " </select>\n";
//echo "<br />\n";
//echo "Recording to play when the call is answered.<br />\n";
//echo "\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Caller ID Name:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_caller_id_name' maxlength='255' value=\"$broadcast_caller_id_name\">\n";
echo "<br />\n";
echo "Applicable if the provider allow the Caller ID Name to be set. default: anonymous\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Caller ID Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_caller_id_number' maxlength='255' value=\"$broadcast_caller_id_number\">\n";
echo "<br />\n";
echo "Applicable if the provider that allow the Caller ID number to be sent. default: 0000000000\n";
echo "</td>\n";
echo "</tr>\n";
/*
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_destination_type' maxlength='255' value=\"$broadcast_destination_type\">\n";
echo "<br />\n";
echo "Optional, Destination Type: bridge, transfer, voicemail, conference, fifo, etc.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Destination:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_destination_data' maxlength='255' value=\"$broadcast_destination_data\">\n";
echo "<br />\n";
echo "Optional, send the call to an auto attendant, conference room, or any other destination. <br /><br />\n";
echo "conference (8khz): 01-\${domain}@default <br />\n";
echo "bridge (external number): sofia/gateway/gatewayname/12081231234 <br />\n";
echo "bridge (auto attendant): sofia/internal/5002@\${domain} <br />\n";
echo "transfer (external number): 12081231234 XML default <br />\n";
echo "</td>\n";
echo "</tr>\n";
*/
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Destination Number:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_destination_data' maxlength='255' value=\"$broadcast_destination_data\">\n";
echo "<br />\n";
echo "Send the call to the extension an IVR Menu, Conference Room, or any other number. <br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Phone Number List:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <textarea class='formfld' type='text' name='broadcast_phone_numbers' rows='10'>$broadcast_phone_numbers</textarea>\n";
echo "<br />\n";
echo "Optional, set a list of phone numbers one per row in the following format: 123-123-1234|Last Name, First Name <br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Description:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='broadcast_description' maxlength='255' value=\"$broadcast_description\">\n";
echo "<br />\n";
echo "Enter a description here.\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='call_broadcast_uuid' value='$call_broadcast_uuid'>\n";
echo " <input type='button' class='btn' name='' alt='back' onclick=\"window.location='v_call_broadcast_send.php?call_broadcast_uuid=$call_broadcast_uuid'\" value='Send Broadcast'>\n";
}
echo " <input type='submit' name='submit' class='btn' value='Save'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo "<br />\n";
echo "<br />\n";
echo "<br />\n";
/*
if ($action == "update") {
echo "<table width='100%' border='0'>\n";
echo "<tr>\n";
echo "<td width='50%' nowrap><b>Call Broadcast</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<form method='get' name='frm' action='v_call_broadcast_send.php'>\n";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Category:\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select name='user_category' class='formfld'>\n";
echo " <option></option>\n";
$sql = "";
$sql .= "select distinct(user_category) as user_category from v_users ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
if ($user_category == $row['user_category']) {
echo " <option value='".$row['user_category']."' selected='yes'>".$row['user_category']."</option>\n";
}
else {
echo " <option value='".$row['user_category']."'>".$row['user_category']."</option>\n";
}
}
unset ($prep_statement);
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Group:\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select name='group_name' class='formfld'>\n";
echo " <option></option>\n";
$sql = "";
$sql .= "select * from v_groups ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
if ($recording_uuid == $row['group_name']) {
echo " <option value='".$row['group_name']."' selected='yes'>".$row['group_name']."</option>\n";
}
else {
echo " <option value='".$row['group_name']."'>".$row['group_name']."</option>\n";
}
}
unset ($prep_statement);
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap>\n";
echo " Gateway:\n";
echo "</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select name='gateway' class='formfld'>\n";
echo " <option></option>\n";
$sql = "";
$sql .= "select * from v_gateways ";
//$sql .= "where domain_uuid = '$domain_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
if ($gateway == $row['gateway']) {
echo " <option value='".$row['gateway']."' selected='yes'>".$row['gateway']."</option>\n";
}
else {
echo " <option value='".$row['gateway']."'>".$row['gateway']."</option>\n";
}
}
unset ($prep_statement);
echo " <option value='loopback'>loopback</option>\n";
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Phone Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='phonetype1' class='formfld'>\n";
echo " <option></option>\n";
echo " <option value='phone1'>phone1</option>\n";
echo " <option value='phone2'>phone2</option>\n";
echo " <option value='cell'>cell</option>\n";
//echo " <option value='zzz'>cell</option>\n";
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " Phone Type:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select name='phonetype2' class='formfld'>\n";
echo " <option></option>\n";
echo " <option value='phone1'>phone1</option>\n";
echo " <option value='phone2'>phone2</option>\n";
echo " <option value='cell'>cell</option>\n";
//echo " <option value='zzz'>cell</option>\n";
echo " </select>\n";
echo "<br />\n";
//echo "zzz.<br />\n";
echo "\n";
echo "</td>\n";
echo "</tr>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
echo " <input type='hidden' name='call_broadcast_uuid' value='$call_broadcast_uuid'>\n";
echo " <input type='submit' name='submit' class='btn' value='Send Broadcast'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
}
*/
echo " </td>";
echo " </tr>";
echo "</table>";
echo "</div>";
require_once "includes/footer.php";
?>
@@ -0,0 +1,374 @@
<?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>
*/
include "root.php";
require_once "includes/require.php";
require_once "includes/checkauth.php";
if (permission_exists('call_broadcast_send')) {
//access granted
}
else {
echo "access denied";
exit;
}
//set the max execution time to 1 hour
ini_set(max_execution_time,3600);
function cmd_async($cmd) {
//windows
if (stristr(PHP_OS, 'WIN')) {
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w") // stderr
);
$process = proc_open("start ".$cmd, $descriptorspec, $pipes);
//sleep(1);
proc_close($process);
}
else { //posix
exec ($cmd ." /dev/null 2>&1 &");
}
}
//get the http get values and set as php variables
$group_name = $_GET["group_name"];
$call_broadcast_uuid = $_GET["call_broadcast_uuid"];
$user_category = $_GET["user_category"];
$gateway = $_GET["gateway"];
$phonetype1 = $_GET["phonetype1"];
$phonetype2 = $_GET["phonetype2"];
//get the call broadcast details from the database
$sql = "";
$sql .= "select * from v_call_broadcasts ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and call_broadcast_uuid = '$call_broadcast_uuid' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
while($row = $prep_statement->fetch()) {
$broadcast_name = $row["broadcast_name"];
$broadcast_description = $row["broadcast_description"];
$broadcast_timeout = $row["broadcast_timeout"];
$broadcast_concurrent_limit = $row["broadcast_concurrent_limit"];
$recordingid = $row["recordingid"];
$broadcast_caller_id_name = $row["broadcast_caller_id_name"];
$broadcast_caller_id_number = $row["broadcast_caller_id_number"];
$broadcast_destination_type = $row["broadcast_destination_type"];
$broadcast_phone_numbers = $row["broadcast_phone_numbers"];
$broadcast_destination_data = $row["broadcast_destination_data"];
//if (strlen($row["broadcast_destination_data"]) == 0) {
// $broadcast_destination_application = '';
// $broadcast_destination_data = '';
//}
//else {
// $broadcast_destination_array = explode(":", $row["broadcast_destination_data"]);
// $broadcast_destination_application = $broadcast_destination_array[0];
// $broadcast_destination_data = $broadcast_destination_array[1];
//}
break; //limit to 1 row
}
unset ($prep_statement);
if (strlen($broadcast_caller_id_name) == 0) {
$broadcast_caller_id_name = "anonymous";
}
if (strlen($broadcast_caller_id_number) == 0) {
$broadcast_caller_id_number = "0000000000";
}
//get the recording name
//$recording_filename = get_recording_filename($recordingid);
//remove unsafe characters from the name
$broadcast_name = str_replace(" ", "", $broadcast_name);
$broadcast_name = str_replace("'", "", $broadcast_name);
//create the event socket connection
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
//get information over event socket
if (!$fp) {
require_once "includes/header.php";
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1'><strong>$msg</strong></td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
require_once "includes/footer.php";
}
else {
//show the header
require_once "includes/header.php";
//send the call broadcast
if (strlen($broadcast_phone_numbers) > 0) {
$broadcast_phone_number_array = explode ("\n", $broadcast_phone_numbers);
$count = 1;
$sched_seconds = '3';
foreach ($broadcast_phone_number_array as $tmp_value) {
$tmp_value = str_replace(";", "|", $tmp_value);
$tmp_value_array = explode ("|", $tmp_value);
//make sure the phone numbers are correct
$phone1 = trim($tmp_value_array[0]);
$phone1 = str_replace("-", "", $phone1);
$phone1 = str_replace("(", "", $phone1);
$phone1 = str_replace(")", "", $phone1);
$phone1 = str_replace(" ", "", $phone1);
$phone1 = str_replace(".", "", $phone1);
//get the correct gateway
$bridge_array = outbound_route_to_bridge ($phone1);
//prepare the string
$channel_variables = "ignore_early_media=true,origination_number=$phone1,origination_caller_id_name='$broadcast_caller_id_name',origination_caller_id_number=$broadcast_caller_id_number";
$origination_url = "{".$channel_variables."}".$bridge_array[0]."";
//get the context
if (count($_SESSION["domains"]) > 1) {
$context = $_SESSION['domain_name'];
}
else {
$context = "default";
}
//set the command
$cmd = "bgapi sched_api +".$sched_seconds." none bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context";
//if the event socket connection is lost then re-connect
if (!$fp) {
$fp = eventsocket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
}
//method 1
$response = trim(event_socket_request($fp, 'api '.$cmd));
//method 2
//cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";");
//spread the calls out so that they are scheduled with different times
if (strlen($broadcast_concurrent_limit) > 0 && strlen($broadcast_timeout) > 0) {
if ($broadcast_concurrent_limit == $count) {
$sched_seconds = $sched_seconds + $broadcast_timeout;
$count=0;
}
}
$count++;
}
fclose($fp);
//echo "<meta http-equiv=\"refresh\" content=\"2;url=".PROJECT_PATH."/app/calls_active/v_calls_active.php\">\n";
echo "<div align='center'>\n";
echo "<table width='50%'>\n";
echo "<tr>\n";
echo "<th align='left'>Message</th>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='row_style1' align='center'>\n";
echo " <strong>Call Broadcast $broadcast_name has been started.</strong>\n";
echo " <br /><br />\n";
echo " <table width='100%'>\n";
echo " <tr>\n";
echo " <td align='center'>\n";
echo " <a href='".PROJECT_PATH."/app/calls_active/v_calls_active.php'>View Calls</a>\n";
echo " </td>\n";
echo " </table>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "</div>\n";
}
//show the footer
require_once "includes/footer.php";
}
/*
//reserved for future use
require_once "includes/header.php";
echo "<div align='center'>";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
echo "<tr class='border'>\n";
echo " <td align=\"center\">\n";
echo " <br>";
echo "<table width='100%' border='0'><tr>\n";
echo "<td width='50%' nowrap><b>Contact List</b></td>\n";
echo "<td width='50%' align='right'>&nbsp;</td>\n";
echo "</tr></table>\n";
$broadcast_phone_number_array = explode ("\n", $broadcast_phone_numbers);
foreach ($broadcast_phone_number_array as $tmp_value) {
$tmp_value = str_replace(";", "|", $tmp_value);
$tmp_value_array = explode ("|", $tmp_value);
//make sure the phone numbers are correct
$phone1 = trim($tmp_value_array[0]);
$phone1 = str_replace("-", "", $phone1);
$phone1 = str_replace("(", "", $phone1);
$phone1 = str_replace(")", "", $phone1);
$phone1 = str_replace(" ", "", $phone1);
$phone1 = str_replace(".", "", $phone1);
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
echo $cmd."<br />\n";
cmd_async($cmd);
//sleep(60);
}
if (strlen($group_name) > 0) {
$sql = " select * from v_users as u, v_group_users as m ";
$sql .= " where u.user_uuid = m.user_uuid ";
$sql .= " and m.group_name = '".$group_name."' ";
$sql .= " and u.user_category = '".$user_category."' ";
//echo $sql."<br />";
}
else {
$sql = " select * from v_users as u ";
$sql .= " where u.user_category = '".$user_category."' ";
//echo $sql."<br />";
}
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
$result_count = count($result);
unset ($prep_statement, $sql);
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
//echo th_order_by('username', 'Username', $order_by, $order);
echo th_order_by('user_type', 'Type', $order_by, $order);
//echo th_order_by('user_category', 'Category', $order_by, $order);
echo th_order_by('user_first_name', 'First Name', $order_by, $order);
echo th_order_by('user_last_name', 'Last Name', $order_by, $order);
echo th_order_by('user_company_name', 'Organization', $order_by, $order);
echo th_order_by('user_phone_1', 'Phone1', $order_by, $order);
echo th_order_by('user_phone_2', 'Phone2', $order_by, $order);
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[username]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_type]."&nbsp;</td>\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_category]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_first_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_last_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_company_name]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_phone_1]."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_phone_2]."&nbsp;</td>\n";
echo "</tr>\n";
//if (strlen($gateway) > 0) {
if ($phonetype1 == "phone1" && strlen($row[user_phone_1]) > 0) { $phone1 = $row[user_phone_1]; }
if ($phonetype1 == "phone2" && strlen($row[user_phone_2]) > 0) { $phone1 = $row[user_phone_2]; }
if ($phonetype1 == "cell" && strlen($row[user_phone_mobile]) > 0) { $phone1 = $row[user_phone_mobile]; }
if ($phonetype2 == "phone1" && strlen($row[user_phone_2]) > 0) { $phone2 = $row[user_phone_2]; }
if ($phonetype2 == "phone2" && strlen($row[user_phone_2]) > 0) { $phone2 = $row[user_phone_2]; }
if ($phonetype2 == "cell" && strlen($row[user_phone_mobile]) > 0) { $phone2 = $row[user_phone_mobile]; }
//make sure the phone numbers are correct
$phone1 = str_replace("-", "", $phone1);
$phone1 = str_replace("(", "", $phone1);
$phone1 = str_replace(")", "", $phone1);
$phone1 = str_replace(" ", "", $phone1);
$phone1 = str_replace(".", "", $phone1);
$phone2 = str_replace("-", "", $phone2);
$phone2 = str_replace("(", "", $phone2);
$phone2 = str_replace(")", "", $phone2);
$phone2 = str_replace(" ", "", $phone2);
$phone2 = str_replace(".", "", $phone2);
//make the call
if (strlen($phone1)> 0) {
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone1." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
//echo $cmd."<br />\n";
cmd_async($cmd);
}
if (strlen($phone2)> 0) {
if ($gateway == "loopback") {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
else {
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}sofia/gateway/".$gateway."/".$phone2." ".$_SESSION['switch']['recordings']['dir']."/".$recording_filename." '".$broadcast_caller_id_name."' ".$broadcast_caller_id_number." ".$broadcast_timeout." '".$broadcast_destination_application."' '".$broadcast_destination_data."'\";";
}
//echo $cmd."<br />\n";
cmd_async($cmd);
}
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);
} //end if results
echo "</table>";
echo "</div>";
echo "<br><br>";
echo "<br><br>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</div>";
echo "<br><br>";
require_once "includes/footer.php";
unset ($result_count);
unset ($result);
unset ($key);
unset ($val);
unset ($c);
*/
?>