Call Broadcast add start time
This commit is contained in:
@@ -17,23 +17,27 @@
|
||||
|
||||
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
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2020
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
|
||||
*/
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
if (permission_exists('call_broadcast_send')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//includes
|
||||
include "root.php";
|
||||
require_once "resources/require.php";
|
||||
require_once "resources/check_auth.php";
|
||||
|
||||
//chec permissions
|
||||
if (permission_exists('call_broadcast_send')) {
|
||||
//access granted
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
@@ -42,22 +46,23 @@ else {
|
||||
//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);
|
||||
//define the asynchronous command function
|
||||
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 &");
|
||||
}
|
||||
}
|
||||
else { //posix
|
||||
exec ($cmd ." /dev/null 2>&1 &");
|
||||
}
|
||||
}
|
||||
|
||||
//get the http get values and set as php variables
|
||||
$group_name = $_GET["group_name"];
|
||||
@@ -77,7 +82,7 @@ function cmd_async($cmd) {
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && sizeof($row) != 0) {
|
||||
$broadcast_name = $row["broadcast_name"];
|
||||
$broadcast_description = $row["broadcast_description"];
|
||||
$broadcast_start_time = $row["broadcast_start_time"];
|
||||
$broadcast_timeout = $row["broadcast_timeout"];
|
||||
$broadcast_concurrent_limit = $row["broadcast_concurrent_limit"];
|
||||
$recordingid = $row["recordingid"];
|
||||
@@ -88,6 +93,7 @@ function cmd_async($cmd) {
|
||||
$broadcast_destination_data = $row["broadcast_destination_data"];
|
||||
$broadcast_avmd = $row["broadcast_avmd"];
|
||||
$broadcast_accountcode = $row["broadcast_accountcode"];
|
||||
$broadcast_description = $row["broadcast_description"];
|
||||
//if (strlen($row["broadcast_destination_data"]) == 0) {
|
||||
// $broadcast_destination_application = '';
|
||||
// $broadcast_destination_data = '';
|
||||
@@ -100,6 +106,7 @@ function cmd_async($cmd) {
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
//set the defaults
|
||||
if (strlen($broadcast_caller_id_name) == 0) {
|
||||
$broadcast_caller_id_name = "anonymous";
|
||||
}
|
||||
@@ -109,9 +116,15 @@ function cmd_async($cmd) {
|
||||
if (strlen($broadcast_accountcode) == 0) {
|
||||
$broadcast_accountcode = $_SESSION['domain_name'];;
|
||||
}
|
||||
if (isset($broadcast_start_time) && is_numeric($broadcast_start_time)) {
|
||||
$sched_seconds = $broadcast_start_time;
|
||||
}
|
||||
else {
|
||||
$sched_seconds = '3';
|
||||
}
|
||||
|
||||
//get the recording name
|
||||
//$recording_filename = get_recording_filename($recordingid);
|
||||
//get the recording name
|
||||
//$recording_filename = get_recording_filename($recordingid);
|
||||
|
||||
//remove unsafe characters from the name
|
||||
$broadcast_name = str_replace(" ", "", $broadcast_name);
|
||||
@@ -144,7 +157,6 @@ function cmd_async($cmd) {
|
||||
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) {
|
||||
//set the variables
|
||||
$tmp_value = str_replace(";", "|", $tmp_value);
|
||||
@@ -160,8 +172,6 @@ function cmd_async($cmd) {
|
||||
$dialplan->outbound_routes($phone_1);
|
||||
$dialplan_variables = $dialplan->variables;
|
||||
$bridge_array[0] = $dialplan->bridges;
|
||||
//echo "var: ".$variables."\n";
|
||||
//echo "bridges: ".$bridges."\n";
|
||||
|
||||
//prepare the string
|
||||
$channel_variables = $dialplan_variables."ignore_early_media=true";
|
||||
@@ -237,148 +247,4 @@ function cmd_async($cmd) {
|
||||
require_once "resources/footer.php";
|
||||
}
|
||||
|
||||
/*
|
||||
//reserved for future use
|
||||
|
||||
require_once "resources/header.php";
|
||||
|
||||
echo "<div align='center'>";
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
|
||||
|
||||
echo "<tr>\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'> </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);
|
||||
|
||||
//remove the number formatting
|
||||
$phone_1 = preg_replace('{\D}', '', $tmp_value_array[0]);
|
||||
|
||||
if ($gateway == "loopback") {
|
||||
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$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."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$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_user_groups as m ";
|
||||
$sql .= "where u.user_uuid = m.user_uuid ";
|
||||
$sql .= "and u.user_enabled = 'true' ";
|
||||
$sql .= "and m.group_name = :group_name ";
|
||||
$sql .= "and u.user_category = :user_category ";
|
||||
$parameters['group_name'] = $group_name;
|
||||
$parameters['user_category'] = $user_category;
|
||||
}
|
||||
else {
|
||||
$sql = "select * from v_users as u ";
|
||||
$sql .= "where u.user_category = :user_category ";
|
||||
$sql .= "and u.user_enabled = 'true' ";
|
||||
$parameters['user_category'] = $user_category;
|
||||
}
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
$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', 'phone_1', $order_by, $order);
|
||||
echo th_order_by('user_phone_2', 'phone_2', $order_by, $order);
|
||||
echo "<tr>\n";
|
||||
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
foreach ($result as $row) {
|
||||
echo "<tr >\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[username]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_type]." </td>\n";
|
||||
//echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_category]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_first_name]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_last_name]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_company_name]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_phone_1]." </td>\n";
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>".$row[user_phone_2]." </td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
//if (strlen($gateway) > 0) {
|
||||
if ($phonetype1 == "phone_1" && strlen($row[user_phone_1]) > 0) { $phone_1 = $row[user_phone_1]; }
|
||||
if ($phonetype1 == "phone_2" && strlen($row[user_phone_2]) > 0) { $phone_1 = $row[user_phone_2]; }
|
||||
if ($phonetype1 == "cell" && strlen($row[user_phone_mobile]) > 0) { $phone_1 = $row[user_phone_mobile]; }
|
||||
if ($phonetype2 == "phone_1" && strlen($row[user_phone_2]) > 0) { $phone_2 = $row[user_phone_2]; }
|
||||
if ($phonetype2 == "phone_2" && strlen($row[user_phone_2]) > 0) { $phone_2 = $row[user_phone_2]; }
|
||||
if ($phonetype2 == "cell" && strlen($row[user_phone_mobile]) > 0) { $phone_2 = $row[user_phone_mobile]; }
|
||||
|
||||
//remove the number formatting
|
||||
$phone_1 = preg_replace('{\D}', '', $phone_1);
|
||||
$phone_2 = preg_replace('{\D}', '', $phone_2);
|
||||
|
||||
//make the call
|
||||
if (strlen($phone_1)> 0) {
|
||||
if ($gateway == "loopback") {
|
||||
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_1."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$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."/".$phone_1." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$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($phone_2)> 0) {
|
||||
if ($gateway == "loopback") {
|
||||
$cmd = $_SESSION['switch']['bin']['dir']."/fs_cli -x \"luarun call_broadcast_originate.lua {call_timeout=".$broadcast_timeout."}loopback/".$phone_2."/default/XML ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$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."/".$phone_2." ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$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; }
|
||||
}
|
||||
}
|
||||
unset($result, $row);
|
||||
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</div>";
|
||||
echo "<br><br>";
|
||||
|
||||
|
||||
require_once "resources/footer.php";
|
||||
unset ($result_count);
|
||||
unset ($result);
|
||||
unset ($key);
|
||||
unset ($val);
|
||||
unset ($c);
|
||||
*/
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user