Call Broadcast add start time
This commit is contained in:
parent
cea2f610ba
commit
a6977be1dc
|
|
@ -99,6 +99,10 @@
|
|||
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "broadcast_start_time";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "broadcast_timeout";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
|
||||
|
|
|
|||
|
|
@ -127,6 +127,28 @@ $text['label-view-calls']['ru-ru'] = "Показать вызовы";
|
|||
$text['label-view-calls']['sv-se'] = "Granska Samtal";
|
||||
$text['label-view-calls']['uk-ua'] = "Перегляд дзвінків";
|
||||
|
||||
$text['label-start_time']['en-us'] = "Start Time";
|
||||
$text['label-start_time']['en-gb'] = "Start Time";
|
||||
$text['label-start_time']['ar-eg'] = "Start Time";
|
||||
$text['label-start_time']['de-at'] = "Start Time"; //copied from de-de
|
||||
$text['label-start_time']['de-ch'] = "Start Time"; //copied from de-de
|
||||
$text['label-start_time']['de-de'] = "Start Time";
|
||||
$text['label-start_time']['es-cl'] = "Start Time";
|
||||
$text['label-start_time']['es-mx'] = "Start Time"; //copied from es-cl
|
||||
$text['label-start_time']['fr-ca'] = "Start Time"; //copied from fr-fr
|
||||
$text['label-start_time']['fr-fr'] = "Start Time";
|
||||
$text['label-start_time']['he-il'] = "Start Time";
|
||||
$text['label-start_time']['it-it'] = "Start Time";
|
||||
$text['label-start_time']['nl-nl'] = "Start Time";
|
||||
$text['label-start_time']['pl-pl'] = "Start Time";
|
||||
$text['label-start_time']['pt-br'] = "Start Time";
|
||||
$text['label-start_time']['pt-pt'] = "Start Time";
|
||||
$text['label-start_time']['ro-ro'] = "Start Time";
|
||||
$text['label-start_time']['ru-ru'] = "Start Time";
|
||||
$text['label-start_time']['sv-se'] = "Start Time";
|
||||
$text['label-start_time']['uk-ua'] = "Start Time";
|
||||
|
||||
|
||||
$text['label-timeout']['en-us'] = "Timeout";
|
||||
$text['label-timeout']['en-gb'] = "Timeout";
|
||||
$text['label-timeout']['ar-eg'] = "";
|
||||
|
|
@ -421,6 +443,48 @@ $text['label-list_example']['ru-ru'] = "Number|First,Last\nNumber|First,Last\n..
|
|||
$text['label-list_example']['sv-se'] = "Number|First,Last\nNumber|First,Last\n...";
|
||||
$text['label-list_example']['uk-ua'] = "Number|First,Last\nNumber|First,Last\n...";
|
||||
|
||||
$text['description-start_time']['en-us'] = "Is the time in seconds to start sending calls.";
|
||||
$text['description-start_time']['en-gb'] = "";
|
||||
$text['description-start_time']['ar-eg'] = "";
|
||||
$text['description-start_time']['de-at'] = ""; //copied from de-de
|
||||
$text['description-start_time']['de-ch'] = ""; //copied from de-de
|
||||
$text['description-start_time']['de-de'] = "";
|
||||
$text['description-start_time']['es-cl'] = "";
|
||||
$text['description-start_time']['es-mx'] = "";
|
||||
$text['description-start_time']['fr-ca'] = "";
|
||||
$text['description-start_time']['fr-fr'] = "";
|
||||
$text['description-start_time']['he-il'] = "";
|
||||
$text['description-start_time']['it-it'] = "";
|
||||
$text['description-start_time']['nl-nl'] = "";
|
||||
$text['description-start_time']['pl-pl'] = "";
|
||||
$text['description-start_time']['pt-br'] = ""; //copied from pt-pt
|
||||
$text['description-start_time']['pt-pt'] = "";
|
||||
$text['description-start_time']['ro-ro'] = "";
|
||||
$text['description-start_time']['ru-ru'] = "";
|
||||
$text['description-start_time']['sv-se'] = "";
|
||||
$text['description-start_time']['uk-ua'] = "";
|
||||
|
||||
$text['description-accountcode']['en-us'] = "Account code used most often used for billing systems.";
|
||||
$text['description-accountcode']['en-gb'] = "";
|
||||
$text['description-accountcode']['ar-eg'] = "";
|
||||
$text['description-accountcode']['de-at'] = ""; //copied from de-de
|
||||
$text['description-accountcode']['de-ch'] = ""; //copied from de-de
|
||||
$text['description-accountcode']['de-de'] = "";
|
||||
$text['description-accountcode']['es-cl'] = "";
|
||||
$text['description-accountcode']['es-mx'] = "";
|
||||
$text['description-accountcode']['fr-ca'] = "";
|
||||
$text['description-accountcode']['fr-fr'] = "";
|
||||
$text['description-accountcode']['he-il'] = "";
|
||||
$text['description-accountcode']['it-it'] = "";
|
||||
$text['description-accountcode']['nl-nl'] = "";
|
||||
$text['description-accountcode']['pl-pl'] = "";
|
||||
$text['description-accountcode']['pt-br'] = ""; //copied from pt-pt
|
||||
$text['description-accountcode']['pt-pt'] = "";
|
||||
$text['description-accountcode']['ro-ro'] = "";
|
||||
$text['description-accountcode']['ru-ru'] = "";
|
||||
$text['description-accountcode']['sv-se'] = "";
|
||||
$text['description-accountcode']['uk-ua'] = "";
|
||||
|
||||
$text['description-timeout']['en-us'] = "Specify the absolute timeout in seconds.";
|
||||
$text['description-timeout']['en-gb'] = "Specify the absolute timeout in seconds.";
|
||||
$text['description-timeout']['ar-eg'] = "";
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@
|
|||
//get the http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
$broadcast_name = $_POST["broadcast_name"];
|
||||
$broadcast_description = $_POST["broadcast_description"];
|
||||
$broadcast_start_time = $_POST["broadcast_start_time"];
|
||||
$broadcast_timeout = $_POST["broadcast_timeout"];
|
||||
$broadcast_concurrent_limit = $_POST["broadcast_concurrent_limit"];
|
||||
$broadcast_caller_id_name = $_POST["broadcast_caller_id_name"];
|
||||
|
|
@ -102,6 +102,7 @@
|
|||
$broadcast_phone_numbers = $_POST["broadcast_phone_numbers"];
|
||||
$broadcast_avmd = $_POST["broadcast_avmd"];
|
||||
$broadcast_destination_data = $_POST["broadcast_destination_data"];
|
||||
$broadcast_description = $_POST["broadcast_description"];
|
||||
|
||||
if (if_group("superadmin")) {
|
||||
$broadcast_accountcode = $_POST["broadcast_accountcode"];
|
||||
|
|
@ -222,7 +223,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
//common array items
|
||||
$array['call_broadcasts'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['call_broadcasts'][0]['broadcast_name'] = $broadcast_name;
|
||||
$array['call_broadcasts'][0]['broadcast_description'] = $broadcast_description;
|
||||
$array['call_broadcasts'][0]['broadcast_start_time'] = $broadcast_start_time;
|
||||
$array['call_broadcasts'][0]['broadcast_timeout'] = strlen($broadcast_timeout) != 0 ? $broadcast_timeout : null;
|
||||
$array['call_broadcasts'][0]['broadcast_concurrent_limit'] = strlen($broadcast_concurrent_limit) != 0 ? $broadcast_concurrent_limit : null;
|
||||
$array['call_broadcasts'][0]['broadcast_caller_id_name'] = $broadcast_caller_id_name;
|
||||
|
|
@ -232,6 +233,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$array['call_broadcasts'][0]['broadcast_avmd'] = $broadcast_avmd;
|
||||
$array['call_broadcasts'][0]['broadcast_destination_data'] = $broadcast_destination_data;
|
||||
$array['call_broadcasts'][0]['broadcast_accountcode'] = $broadcast_accountcode;
|
||||
$array['call_broadcasts'][0]['broadcast_description'] = $broadcast_description;
|
||||
|
||||
//execute
|
||||
$database = new database;
|
||||
|
|
@ -261,7 +263,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$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"];
|
||||
$broadcast_caller_id_name = $row["broadcast_caller_id_name"];
|
||||
|
|
@ -271,6 +273,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
$broadcast_avmd = $row["broadcast_avmd"];
|
||||
$broadcast_destination_data = $row["broadcast_destination_data"];
|
||||
$broadcast_accountcode = $row["broadcast_accountcode"];
|
||||
$broadcast_description = $row["broadcast_description"];
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
}
|
||||
|
|
@ -319,6 +322,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
|
||||
echo " ".$text['label-start_time']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='number' name='broadcast_start_time' value=\"".escape($broadcast_start_time)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo "".$text['description-start_time']."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (if_group("superadmin")){
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
|
|
|
|||
|
|
@ -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')) {
|
||||
|
||||
//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 {
|
||||
}
|
||||
else {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -42,7 +46,8 @@ else {
|
|||
//set the max execution time to 1 hour
|
||||
ini_set(max_execution_time,3600);
|
||||
|
||||
function cmd_async($cmd) {
|
||||
//define the asynchronous command function
|
||||
function cmd_async($cmd) {
|
||||
//windows
|
||||
if (stristr(PHP_OS, 'WIN')) {
|
||||
$descriptorspec = array(
|
||||
|
|
@ -57,7 +62,7 @@ function cmd_async($cmd) {
|
|||
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,8 +116,14 @@ 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
|
||||
//get the recording name
|
||||
//$recording_filename = get_recording_filename($recordingid);
|
||||
|
||||
//remove unsafe characters from the 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);
|
||||
*/
|
||||
|
||||
?>
|
||||
|
|
@ -0,0 +1,156 @@
|
|||
--
|
||||
-- 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>
|
||||
-- Copyright (C) 2010
|
||||
-- the Initial Developer. All Rights Reserved.
|
||||
--
|
||||
-- Contributor(s):
|
||||
-- Mark J Crane <markjcrane@fusionpbx.com>
|
||||
|
||||
--predefined variables
|
||||
predefined_destination = "";
|
||||
max_tries = "3";
|
||||
digit_timeout = "5000";
|
||||
|
||||
--define the trim function
|
||||
require "resources.functions.trim";
|
||||
|
||||
--define the explode function
|
||||
require "resources.functions.explode";
|
||||
|
||||
--answer the call
|
||||
if (session:ready()) then
|
||||
session:answer();
|
||||
end
|
||||
|
||||
--get and save the variables
|
||||
if (session:ready()) then
|
||||
pin_number = session:getVariable("pin_number");
|
||||
sounds_dir = session:getVariable("sounds_dir");
|
||||
caller_id_name = session:getVariable("caller_id_name");
|
||||
caller_id_number = session:getVariable("caller_id_number");
|
||||
predefined_destination = session:getVariable("predefined_destination");
|
||||
digit_min_length = session:getVariable("digit_min_length");
|
||||
digit_max_length = session:getVariable("digit_max_length");
|
||||
gateway = session:getVariable("gateway");
|
||||
context = session:getVariable("context");
|
||||
privacy = session:getVariable("privacy");
|
||||
end
|
||||
|
||||
--set the sounds path for the language, dialect and voice
|
||||
if (session:ready()) then
|
||||
default_language = session:getVariable("default_language");
|
||||
default_dialect = session:getVariable("default_dialect");
|
||||
default_voice = session:getVariable("default_voice");
|
||||
if (not default_language) then default_language = 'en'; end
|
||||
if (not default_dialect) then default_dialect = 'us'; end
|
||||
if (not default_voice) then default_voice = 'callie'; end
|
||||
end
|
||||
|
||||
--set defaults
|
||||
if (digit_min_length) then
|
||||
--do nothing
|
||||
else
|
||||
digit_min_length = "2";
|
||||
end
|
||||
|
||||
if (digit_max_length) then
|
||||
--do nothing
|
||||
else
|
||||
digit_max_length = "11";
|
||||
end
|
||||
|
||||
--if the pin number is provided then require it
|
||||
if (session:ready() and pin_number) then
|
||||
min_digits = string.len(pin_number);
|
||||
max_digits = string.len(pin_number)+1;
|
||||
digits = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-please_enter_pin_followed_by_pound.wav", "", "\\d+");
|
||||
if (digits == pin_number) then
|
||||
--pin is correct
|
||||
else
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-pin_or_extension_is-invalid.wav");
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-im_sorry.wav");
|
||||
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-goodbye.wav");
|
||||
session:hangup("NORMAL_CLEARING");
|
||||
return;
|
||||
end
|
||||
end
|
||||
|
||||
--if a predefined_destination is provided then set the number to the predefined_destination
|
||||
if (session:ready()) then
|
||||
if (predefined_destination) then
|
||||
destination_number = predefined_destination;
|
||||
else
|
||||
dtmf = ""; --clear dtmf digits to prepare for next dtmf request
|
||||
destination_number = session:playAndGetDigits(digit_min_length, digit_max_length, max_tries, digit_timeout, "#", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-enter_destination_telephone_number.wav", "", "\\d+");
|
||||
--if (string.len(destination_number) == 10) then destination_number = "1"..destination_number; end
|
||||
end
|
||||
end
|
||||
|
||||
--set the caller id name and number
|
||||
if (session:ready()) then
|
||||
if (string.len(destination_number) < 7) then
|
||||
if (caller_id_name) then
|
||||
--caller id name provided do nothing
|
||||
else
|
||||
caller_id_number = session:getVariable("effective_caller_id_name");
|
||||
end
|
||||
if (caller_id_number) then
|
||||
--caller id number provided do nothing
|
||||
else
|
||||
caller_id_number = session:getVariable("effective_caller_id_number");
|
||||
end
|
||||
else
|
||||
if (caller_id_name) then
|
||||
--caller id name provided do nothing
|
||||
else
|
||||
caller_id_number = session:getVariable("outbound_caller_id_name");
|
||||
end
|
||||
if (caller_id_number) then
|
||||
--caller id number provided do nothing
|
||||
else
|
||||
caller_id_number = session:getVariable("outbound_caller_id_number");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--transfer or bridge the call
|
||||
if (session:ready()) then
|
||||
if (string.len(destination_number) < 7) then
|
||||
--local call
|
||||
session:execute("transfer", destination_number .. " XML " .. context);
|
||||
else
|
||||
--remote call
|
||||
if (gateway) then
|
||||
gateway_table = explode(",",gateway);
|
||||
for index,value in pairs(gateway_table) do
|
||||
session:execute("bridge", "{continue_on_fail=true,hangup_after_bridge=true,origination_caller_id_name="..caller_id_name..",origination_caller_id_number="..caller_id_number.."}sofia/gateway/"..value.."/"..destination_number);
|
||||
end
|
||||
else
|
||||
session:execute("set", "effective_caller_id_name="..caller_id_name);
|
||||
session:execute("set", "effective_caller_id_number="..caller_id_number);
|
||||
session:execute("transfer", destination_number .. " XML " .. context);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--alternate method
|
||||
--local session2 = freeswitch.Session("{ignore_early_media=true}sofia/gateway/flowroute.com/"..destination_number);
|
||||
--t1 = os.date('*t');
|
||||
--call_start_time = os.time(t1);
|
||||
--freeswitch.bridge(session, session2);
|
||||
Loading…
Reference in New Issue