mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Call Block: Outbound call support.
This commit is contained in:
@@ -99,6 +99,10 @@
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "call_block_direction";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select the direction of the calls to block.";
|
||||
$z++;
|
||||
$apps[$x]['db'][$y]['fields'][$z]['name'] = "extension_uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
|
||||
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
|
||||
|
||||
@@ -30,8 +30,8 @@ if ($domains_processed == 1) {
|
||||
$database = new database;
|
||||
$database->execute("DROP VIEW view_call_block;", null);
|
||||
$sql = "CREATE VIEW view_call_block AS ( \n";
|
||||
$sql .= " select c.domain_uuid, call_block_uuid, c.extension_uuid, call_block_name, call_block_country_code, \n";
|
||||
$sql .= " call_block_number, extension, number_alias, call_block_count, call_block_app, call_block_data, date_added, call_block_enabled, call_block_description \n";
|
||||
$sql .= " select c.domain_uuid, call_block_uuid, c.call_block_direction, c.extension_uuid, c.call_block_name, c.call_block_country_code, \n";
|
||||
$sql .= " c.call_block_number, e.extension, e.number_alias, c.call_block_count, c.call_block_app, c.call_block_data, c.date_added, c.call_block_enabled, c.call_block_description \n";
|
||||
$sql .= " from v_call_block as c \n";
|
||||
$sql .= " left join v_extensions as e \n";
|
||||
$sql .= " on c.extension_uuid = e.extension_uuid \n";
|
||||
|
||||
@@ -286,6 +286,48 @@ $text['label-inbound']['ru-ru'] = "Входящий";
|
||||
$text['label-inbound']['sv-se'] = "Inkommande";
|
||||
$text['label-inbound']['uk-ua'] = "Вихідний";
|
||||
|
||||
$text['label-outbound']['en-us'] = "Outbound";
|
||||
$text['label-outbound']['en-gb'] = "Outbound";
|
||||
$text['label-outbound']['ar-eg'] = "";
|
||||
$text['label-outbound']['de-at'] = "Ausgehend"; //copied from de-de
|
||||
$text['label-outbound']['de-ch'] = "Ausgehend"; //copied from de-de
|
||||
$text['label-outbound']['de-de'] = "Ausgehend";
|
||||
$text['label-outbound']['es-cl'] = "Salida";
|
||||
$text['label-outbound']['es-mx'] = "Salida"; //copied from es-cl
|
||||
$text['label-outbound']['fr-ca'] = "Sortant"; //copied from fr-fr
|
||||
$text['label-outbound']['fr-fr'] = "Sortant";
|
||||
$text['label-outbound']['he-il'] = "";
|
||||
$text['label-outbound']['it-it'] = "In Uscita";
|
||||
$text['label-outbound']['nl-nl'] = "";
|
||||
$text['label-outbound']['pl-pl'] = "Wychodzące";
|
||||
$text['label-outbound']['pt-br'] = "Saída"; //copied from pt-pt
|
||||
$text['label-outbound']['pt-pt'] = "Saída";
|
||||
$text['label-outbound']['ro-ro'] = "";
|
||||
$text['label-outbound']['ru-ru'] = "Исходящие";
|
||||
$text['label-outbound']['sv-se'] = "Utgående";
|
||||
$text['label-outbound']['uk-ua'] = "";
|
||||
|
||||
$text['label-destination']['en-us'] = "Destination";
|
||||
$text['label-destination']['en-gb'] = "Destination";
|
||||
$text['label-destination']['ar-eg'] = "";
|
||||
$text['label-destination']['de-at'] = "Ziel"; //copied from de-de
|
||||
$text['label-destination']['de-ch'] = "Ziel"; //copied from de-de
|
||||
$text['label-destination']['de-de'] = "Ziel";
|
||||
$text['label-destination']['es-cl'] = "Destino";
|
||||
$text['label-destination']['es-mx'] = "Destino"; //copied from es-cl
|
||||
$text['label-destination']['fr-ca'] = "Destination"; //copied from fr-fr
|
||||
$text['label-destination']['fr-fr'] = "Destination";
|
||||
$text['label-destination']['he-il'] = "";
|
||||
$text['label-destination']['it-it'] = "Destinazione";
|
||||
$text['label-destination']['nl-nl'] = "";
|
||||
$text['label-destination']['pl-pl'] = "Numer docelowy";
|
||||
$text['label-destination']['pt-br'] = "Número de destino";
|
||||
$text['label-destination']['pt-pt'] = "Destino";
|
||||
$text['label-destination']['ro-ro'] = "";
|
||||
$text['label-destination']['ru-ru'] = "Назначение";
|
||||
$text['label-destination']['sv-se'] = "Destination";
|
||||
$text['label-destination']['uk-ua'] = "Номер";
|
||||
|
||||
$text['label-edit-note']['en-us'] = "Block calls from a number. Edit the name and enable/disable below.";
|
||||
$text['label-edit-note']['en-gb'] = "Block calls from a number. Edit the name and enable/disable below.";
|
||||
$text['label-edit-note']['ar-eg'] = "";
|
||||
@@ -440,27 +482,27 @@ $text['label-count']['ru-ru'] = "Количество";
|
||||
$text['label-count']['sv-se'] = "Räkna";
|
||||
$text['label-count']['uk-ua'] = "Кількість";
|
||||
|
||||
$text['label-called-on']['en-us'] = "Called on";
|
||||
$text['label-called-on']['en-gb'] = "Called on";
|
||||
$text['label-called-on']['ar-eg'] = "تم الأتصال علي";
|
||||
$text['label-called-on']['de-at'] = "Anruf am"; //copied from de-de
|
||||
$text['label-called-on']['de-ch'] = "Anruf am"; //copied from de-de
|
||||
$text['label-called-on']['de-de'] = "Anruf am";
|
||||
$text['label-called-on']['el-gr'] = "Η κλήση πραγματοποιήθηκε";
|
||||
$text['label-called-on']['es-cl'] = "Llamó en";
|
||||
$text['label-called-on']['es-mx'] = "Llamó en"; //copied from es-cl
|
||||
$text['label-called-on']['fr-ca'] = "Appelé le"; //copied from fr-fr
|
||||
$text['label-called-on']['fr-fr'] = "Appelé le";
|
||||
$text['label-called-on']['he-il'] = "Opgeroepen op";
|
||||
$text['label-called-on']['it-it'] = "Chiamato il";
|
||||
$text['label-called-on']['nl-nl'] = "Aangeroepen op";
|
||||
$text['label-called-on']['pl-pl'] = "Zadzwoniono na";
|
||||
$text['label-called-on']['pt-br'] = "Chamada em ";
|
||||
$text['label-called-on']['pt-pt'] = "Chamado em";
|
||||
$text['label-called-on']['ro-ro'] = "Sunat pe";
|
||||
$text['label-called-on']['ru-ru'] = "Направление";
|
||||
$text['label-called-on']['sv-se'] = "Ringdes på";
|
||||
$text['label-called-on']['uk-ua'] = "Дзвінок здійснено";
|
||||
$text['label-called']['en-us'] = "Called";
|
||||
$text['label-called']['en-gb'] = "Called";
|
||||
$text['label-called']['ar-eg'] = "تم الأتصال علي";
|
||||
$text['label-called']['de-at'] = "Anruf"; //copied from de-de
|
||||
$text['label-called']['de-ch'] = "Anruf"; //copied from de-de
|
||||
$text['label-called']['de-de'] = "Anruf";
|
||||
$text['label-called']['el-gr'] = "Η κλήση πραγματοποιήθηκε";
|
||||
$text['label-called']['es-cl'] = "Llamó";
|
||||
$text['label-called']['es-mx'] = "Llamó"; //copied from es-cl
|
||||
$text['label-called']['fr-ca'] = "Appelé"; //copied from fr-fr
|
||||
$text['label-called']['fr-fr'] = "Appelé";
|
||||
$text['label-called']['he-il'] = "Opgeroepen";
|
||||
$text['label-called']['it-it'] = "Chiamato";
|
||||
$text['label-called']['nl-nl'] = "Aangeroepen";
|
||||
$text['label-called']['pl-pl'] = "Zadzwoniono";
|
||||
$text['label-called']['pt-br'] = "Chamada";
|
||||
$text['label-called']['pt-pt'] = "Chamado";
|
||||
$text['label-called']['ro-ro'] = "Sunat";
|
||||
$text['label-called']['ru-ru'] = "Направление";
|
||||
$text['label-called']['sv-se'] = "Ringdes";
|
||||
$text['label-called']['uk-ua'] = "Дзвінок здійснено";
|
||||
|
||||
$text['label-busy']['en-us'] = "Busy";
|
||||
$text['label-busy']['en-gb'] = "Busy";
|
||||
@@ -594,6 +636,49 @@ $text['label-action']['ru-ru'] = "Действие";
|
||||
$text['label-action']['sv-se'] = "Åtgärd";
|
||||
$text['label-action']['uk-ua'] = "Дія";
|
||||
|
||||
$text['label-direction']['en-us'] = "Direction";
|
||||
$text['label-direction']['en-gb'] = "Direction";
|
||||
$text['label-direction']['ar-eg'] = "";
|
||||
$text['label-direction']['de-at'] = "Richtung"; //copied from de-de
|
||||
$text['label-direction']['de-ch'] = "Richtung"; //copied from de-de
|
||||
$text['label-direction']['de-de'] = "Richtung";
|
||||
$text['label-direction']['es-cl'] = "Dirección";
|
||||
$text['label-direction']['es-mx'] = "Dirección"; //copied from es-cl
|
||||
$text['label-direction']['fr-ca'] = "Direction"; //copied from fr-fr
|
||||
$text['label-direction']['fr-fr'] = "Direction";
|
||||
$text['label-direction']['he-il'] = "";
|
||||
$text['label-direction']['it-it'] = "Direzione";
|
||||
$text['label-direction']['nl-nl'] = "";
|
||||
$text['label-direction']['pl-pl'] = "Kierunek";
|
||||
$text['label-direction']['pt-br'] = "Direção";
|
||||
$text['label-direction']['pt-pt'] = "Direcção";
|
||||
$text['label-direction']['ro-ro'] = "";
|
||||
$text['label-direction']['ru-ru'] = "Направление";
|
||||
$text['label-direction']['sv-se'] = "Riktning";
|
||||
$text['label-direction']['uk-ua'] = "Напрям";
|
||||
|
||||
$text['description-direction']['en-us'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['en-gb'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['ar-eg'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['de-at'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['de-ch'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['de-de'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['el-gr'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['es-cl'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['es-mx'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['fr-ca'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['fr-fr'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['he-il'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['it-it'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['nl-nl'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['pl-pl'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['pt-br'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['pt-pt'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['ro-ro'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['ru-ru'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['sv-se'] = "Select the direction of the calls to block.";
|
||||
$text['description-direction']['uk-ua'] = "Select the direction of the calls to block.";
|
||||
|
||||
$text['description-call_block_name']['en-us'] = "Enter the Caller ID Name to block.";
|
||||
$text['description-call_block_name']['en-gb'] = "Enter the Caller ID Name to block.";
|
||||
$text['description-call_block_name']['ar-eg'] = "";
|
||||
@@ -659,8 +744,8 @@ $text['description-call_block_number']['ru-ru'] = "";
|
||||
$text['description-call_block_number']['sv-se'] = "";
|
||||
$text['description-call_block_number']['uk-ua'] = "";
|
||||
|
||||
$text['description-extension']['en-us'] = "Select the extension to block.";
|
||||
$text['description-extension']['en-gb'] = "Select the extension to block.";
|
||||
$text['description-extension']['en-us'] = "Select the extension to be affected.";
|
||||
$text['description-extension']['en-gb'] = "Select the extension to be affected.";
|
||||
$text['description-extension']['ar-eg'] = "";
|
||||
$text['description-extension']['de-at'] = "";
|
||||
$text['description-extension']['de-ch'] = "";
|
||||
|
||||
@@ -203,7 +203,8 @@
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($result ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo th_order_by('extension', $text['label-extension'], $order_by, $order);
|
||||
echo th_order_by('call_block_direction', $text['label-direction'], $order_by, $order, null, "style='width: 1%;' class='center'");
|
||||
echo th_order_by('extension', $text['label-extension'], $order_by, $order, null, "class='center'");
|
||||
echo th_order_by('call_block_name', $text['label-name'], $order_by, $order);
|
||||
echo th_order_by('call_block_country_code', $text['label-country_code'], $order_by, $order);
|
||||
echo th_order_by('call_block_number', $text['label-number'], $order_by, $order);
|
||||
@@ -230,7 +231,13 @@
|
||||
echo " <input type='hidden' name='call_blocks[".$x."][uuid]' value='".escape($row['call_block_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
}
|
||||
echo " <td>";
|
||||
echo " <td class='center'>";
|
||||
switch ($row['call_block_direction']) {
|
||||
case "inbound": echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png' style='border: none;' title='".$text['label-inbound']."'>\n"; break;
|
||||
case "outbound": echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_answered.png' style='border: none;' title='".$text['label-outbound']."'>\n"; break;
|
||||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='center'>";
|
||||
if (strlen($row['extension']) == 0) {
|
||||
echo $text['label-all'];
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
$call_block_direction = $_POST["call_block_direction"];
|
||||
$extension_uuid = $_POST["extension_uuid"];
|
||||
$call_block_name = $_POST["call_block_name"];
|
||||
$call_block_country_code = $_POST["call_block_country_code"];
|
||||
@@ -84,6 +85,7 @@
|
||||
$xml_cdrs = $_POST['xml_cdrs'];
|
||||
if (permission_exists('call_block_add') && is_array($xml_cdrs) && @sizeof($xml_cdrs) != 0) {
|
||||
$obj = new call_block;
|
||||
$obj->call_block_direction = $call_block_direction;
|
||||
$obj->extension_uuid = $extension_uuid;
|
||||
$obj->call_block_app = $call_block_app;
|
||||
$obj->call_block_data = $call_block_data;
|
||||
@@ -161,6 +163,7 @@
|
||||
if ($action == "add") {
|
||||
$array['call_block'][0]['call_block_uuid'] = uuid();
|
||||
$array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][0]['call_block_direction'] = $call_block_direction;
|
||||
if (is_uuid($extension_uuid)) {
|
||||
$array['call_block'][0]['extension_uuid'] = $extension_uuid;
|
||||
}
|
||||
@@ -207,6 +210,7 @@
|
||||
|
||||
$array['call_block'][0]['call_block_uuid'] = $call_block_uuid;
|
||||
$array['call_block'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][0]['call_block_direction'] = $call_block_direction;
|
||||
if (is_uuid($extension_uuid)) {
|
||||
$array['call_block'][0]['extension_uuid'] = $extension_uuid;
|
||||
}
|
||||
@@ -244,6 +248,7 @@
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && sizeof($row) != 0) {
|
||||
$call_block_direction = $row["call_block_direction"];
|
||||
$extension_uuid = $row["extension_uuid"];
|
||||
$call_block_name = $row["call_block_name"];
|
||||
$call_block_country_code = $row["call_block_country_code"];
|
||||
@@ -322,6 +327,21 @@
|
||||
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
echo "<tr>\n";
|
||||
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
echo " ".$text['label-direction']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='call_block_direction'>\n";
|
||||
echo " <option value='inbound'>".$text['label-inbound']."</option>\n";
|
||||
echo " <option value='outbound' ".($call_block_direction == "outbound" ? "selected" : null).">".$text['label-outbound']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-direction']."\n";
|
||||
echo "\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
if (permission_exists('call_block_all')) {
|
||||
echo "<tr>\n";
|
||||
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
||||
@@ -465,57 +485,49 @@
|
||||
//get recent calls from the db (if not editing an existing call block record)
|
||||
if (!is_uuid($_REQUEST["id"])) {
|
||||
|
||||
if (permission_exists('call_block_all')) {
|
||||
$sql = "select caller_id_number, caller_id_name, caller_id_number, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid ";
|
||||
$sql .= "from v_xml_cdr where true ";
|
||||
$sql .= "and domain_uuid = :domain_uuid ";
|
||||
$sql .= "and direction != 'outbound' ";
|
||||
$sql .= "order by start_stamp desc ";
|
||||
$sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']);
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters);
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
//without block all permission, limit to assigned extension(s)
|
||||
if (!permission_exists('call_block_all') && is_array($_SESSION['user']['extension'])) {
|
||||
foreach ($_SESSION['user']['extension'] as $assigned_extension) {
|
||||
$assigned_extensions[$assigned_extension['extension_uuid']] = $assigned_extension['user'];
|
||||
}
|
||||
|
||||
$sql = "select caller_id_number, caller_id_name, caller_id_number, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid ";
|
||||
$sql .= "from v_xml_cdr ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
|
||||
$x = 0;
|
||||
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
|
||||
$sql_where_array[] = "extension_uuid = :extension_uuid_".$x;
|
||||
//$sql_where_array[] = "caller_id_number = :caller_id_number_".$x;
|
||||
//$sql_where_array[] = "destination_number = :destination_number_1_".$x;
|
||||
//$sql_where_array[] = "destination_number = :destination_number_2_".$x;
|
||||
$parameters['extension_uuid_'.$x] = $assigned_extension_uuid;
|
||||
//$parameters['caller_id_number_'.$x] = $assigned_extension;
|
||||
//$parameters['destination_number_1_'.$x] = $assigned_extension;
|
||||
//$parameters['destination_number_2_'.$x] = '*99'.$assigned_extension;
|
||||
$x++;
|
||||
}
|
||||
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
|
||||
$sql .= "and (".implode(' or ', $sql_where_array).") ";
|
||||
}
|
||||
unset($sql_where_array);
|
||||
if (is_array($assigned_extensions) && sizeof($assigned_extensions) != 0) {
|
||||
$x = 0;
|
||||
foreach ($assigned_extensions as $assigned_extension_uuid => $assigned_extension) {
|
||||
$sql_where_array[] = "extension_uuid = :extension_uuid_".$x;
|
||||
$parameters['extension_uuid_'.$x] = $assigned_extension_uuid;
|
||||
$x++;
|
||||
}
|
||||
$sql .= "order by start_stamp desc";
|
||||
$sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']);
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($sql_where_array) && sizeof($sql_where_array) != 0) {
|
||||
$sql_where .= "and (".implode(' or ', $sql_where_array).") ";
|
||||
}
|
||||
unset($sql_where_array);
|
||||
}
|
||||
}
|
||||
|
||||
//get recent calls
|
||||
$sql = "select caller_id_name, caller_id_number, caller_destination, start_epoch, direction, hangup_cause, duration, billsec, xml_cdr_uuid ";
|
||||
$sql .= "from v_xml_cdr where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and direction <> 'local' ";
|
||||
$sql .= $sql_where;
|
||||
$sql .= "order by start_stamp desc ";
|
||||
$sql .= limit_offset($_SESSION['call_block']['recent_call_limit']['text']);
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters);
|
||||
unset($sql, $parameters);
|
||||
|
||||
echo "<form id='form_list' method='post'>\n";
|
||||
echo "<input type='hidden' id='action' name='action' value='add'>\n";
|
||||
|
||||
echo "<div class='action_bar' id='action_bar_sub'>\n";
|
||||
echo " <div class='heading'><b id='heading_sub'>".$text['heading-recent_calls']."</b></div>\n";
|
||||
echo " <div class='heading'>";
|
||||
echo " <b id='heading_sub'>".$text['heading-recent_calls']."</b>";
|
||||
echo " <select class='formfld' name='call_block_direction' style='margin-bottom: 6px; margin-left: 15px;' onchange=\"show_direction(this.options[this.selectedIndex].value);\">\n";
|
||||
echo " <option value='' disabled='disabled'>".$text['label-direction']."</option>\n";
|
||||
echo " <option value='inbound'>".$text['label-inbound']."</option>\n";
|
||||
echo " <option value='outbound'>".$text['label-outbound']."</option>\n";
|
||||
echo " </select>\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','id'=>'action_bar_sub_button_back','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'collapse'=>'hide-xs','style'=>'display: none;','link'=>'call_block.php']);
|
||||
if ($result) {
|
||||
@@ -544,83 +556,112 @@
|
||||
echo modal::create(['id'=>'modal-block','type'=>'general','message'=>$text['confirm-block'],'actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_block','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_form_submit('form_list');"])]);
|
||||
}
|
||||
|
||||
echo "<table class='list'>\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($result ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
echo "<th style='width: 1%;'> </th>\n";
|
||||
echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order);
|
||||
echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order);
|
||||
echo th_order_by('start_stamp', $text['label-called-on'], $order_by, $order);
|
||||
echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "class='right hide-sm-dn'");
|
||||
echo "</tr>";
|
||||
foreach (['inbound','outbound'] as $direction) {
|
||||
echo "<table class='list' id='list_".$direction."' ".($direction == 'outbound' ? "style='display: none;'" : null).">\n";
|
||||
echo "<tr class='list-header'>\n";
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_".$direction."' name='checkbox_all' onclick=\"list_all_toggle('".$direction."');\" ".($result ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
echo "<th style='width: 1%;'> </th>\n";
|
||||
echo th_order_by('caller_id_name', $text['label-name'], $order_by, $order);
|
||||
echo th_order_by('caller_id_number', $text['label-number'], $order_by, $order);
|
||||
echo th_order_by('caller_id_number', $text['label-destination'], $order_by, $order);
|
||||
echo th_order_by('start_stamp', $text['label-called'], $order_by, $order);
|
||||
echo th_order_by('duration', $text['label-duration'], $order_by, $order, null, "class='right hide-sm-dn'");
|
||||
echo "</tr>";
|
||||
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
$x = 0;
|
||||
foreach ($result as $row) {
|
||||
$list_row_onclick_uncheck = "if (!this.checked) { document.getElementById('checkbox_all').checked = false; }";
|
||||
$list_row_onclick_toggle = "onclick=\"document.getElementById('checkbox_".$x."').checked = document.getElementById('checkbox_".$x."').checked ? false : true; ".$list_row_onclick_uncheck."\"";
|
||||
if (strlen($row['caller_id_number']) >= 7) {
|
||||
if ($_SESSION['domain']['time_format']['text'] == '24h') {
|
||||
$tmp_start_epoch = date('j M Y', $row['start_epoch'])." <span class='hide-sm-dn'>".date('H:i:s', $row['start_epoch']).'</span>';
|
||||
}
|
||||
else {
|
||||
$tmp_start_epoch = date('j M Y', $row['start_epoch'])." <span class='hide-sm-dn'>".date('h:i:s a', $row['start_epoch']).'</span>';
|
||||
}
|
||||
echo "<tr class='list-row' href='".$list_row_url."'>\n";
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' name='xml_cdrs[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"".$list_row_onclick_uncheck."\">\n";
|
||||
echo " <input type='hidden' name='xml_cdrs[$x][uuid]' value='".escape($row['xml_cdr_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
if (
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_answered.png")
|
||||
) {
|
||||
echo " <td class='center' ".$list_row_onclick_toggle.">";
|
||||
switch ($row['direction']) {
|
||||
case "inbound" :
|
||||
if ($row['billsec'] == 0) {
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_voicemail.png' style='border: none;' alt='".$text['label-inbound']." ".$text['label-missed']."'>\n";
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
foreach ($result as $x => $row) {
|
||||
if ($row['direction'] == $direction) {
|
||||
$list_row_onclick_uncheck = "if (!this.checked) { document.getElementById('checkbox_all_".$direction."').checked = false; }";
|
||||
$list_row_onclick_toggle = "onclick=\"document.getElementById('checkbox_".$x."').checked = document.getElementById('checkbox_".$x."').checked ? false : true; ".$list_row_onclick_uncheck."\"";
|
||||
if (strlen($row['caller_id_number']) >= 7) {
|
||||
if ($_SESSION['domain']['time_format']['text'] == '24h') {
|
||||
$tmp_start_epoch = date('j M Y', $row['start_epoch'])." <span class='hide-sm-dn'>".date('H:i:s', $row['start_epoch']).'</span>';
|
||||
}
|
||||
else {
|
||||
$tmp_start_epoch = date('j M Y', $row['start_epoch'])." <span class='hide-sm-dn'>".date('h:i:s a', $row['start_epoch']).'</span>';
|
||||
}
|
||||
echo "<tr class='list-row row_".$row['direction']."' href='".$list_row_url."'>\n";
|
||||
echo " <td class='checkbox'>\n";
|
||||
echo " <input type='checkbox' class='checkbox_".$row['direction']."' name='xml_cdrs[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"".$list_row_onclick_uncheck."\">\n";
|
||||
echo " <input type='hidden' name='xml_cdrs[$x][uuid]' value='".escape($row['xml_cdr_uuid'])."' />\n";
|
||||
echo " </td>\n";
|
||||
if (
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_voicemail.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_failed.png") &&
|
||||
file_exists($_SERVER["DOCUMENT_ROOT"]."/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound_answered.png")
|
||||
) {
|
||||
echo " <td class='center' ".$list_row_onclick_toggle.">";
|
||||
switch ($row['direction']) {
|
||||
case "inbound":
|
||||
if ($row['billsec'] == 0) {
|
||||
$title_mod = " ".$text['label-missed'];
|
||||
$file_mod = "_voicemail";
|
||||
}
|
||||
else {
|
||||
$file_mod = "_answered";
|
||||
}
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound".$file_mod.".png' style='border: none;' title='".$text['label-inbound'].$title_mod."'>\n";
|
||||
break;
|
||||
case "outbound":
|
||||
if ($row['billsec'] == 0) {
|
||||
$title_mod = " ".$text['label-failed'];
|
||||
$file_mod = "_failed";
|
||||
}
|
||||
else {
|
||||
$file_mod = "_answered";
|
||||
}
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_outbound".$file_mod.".png' style='border: none;' title='".$text['label-outbound'].$title_mod."'>\n";
|
||||
break;
|
||||
}
|
||||
else {
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_inbound_answered.png' style='border: none;' alt='".$text['label-inbound']."'>\n";
|
||||
}
|
||||
break;
|
||||
case "local" :
|
||||
if ($row['billsec'] == 0) {
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_failed.png' style='border: none;' alt='".$text['label-local']." ".$text['label-failed']."'>\n";
|
||||
}
|
||||
else {
|
||||
echo "<img src='/themes/".$_SESSION['domain']['template']['name']."/images/icon_cdr_local_answered.png' style='border: none;' alt='".$text['label-local']."'>\n";
|
||||
}
|
||||
break;
|
||||
echo " </td>\n";
|
||||
}
|
||||
else {
|
||||
echo " <td ".$list_row_onclick_toggle."> </td>";
|
||||
}
|
||||
echo " <td ".$list_row_onclick_toggle.">".$row['caller_id_name']." </td>\n";
|
||||
echo " <td ".$list_row_onclick_toggle.">".format_phone($row['caller_id_number'])."</td>\n";
|
||||
echo " <td ".$list_row_onclick_toggle.">".format_phone($row['caller_destination'])."</td>\n";
|
||||
echo " <td class='no-wrap' ".$list_row_onclick_toggle.">".$tmp_start_epoch."</td>\n";
|
||||
$seconds = ($row['hangup_cause'] == "ORIGINATOR_CANCEL") ? $row['duration'] : $row['billsec']; //if they cancelled, show the ring time, not the bill time.
|
||||
echo " <td class='right hide-sm-dn' ".$list_row_onclick_toggle.">".gmdate("G:i:s", $seconds)."</td>\n";
|
||||
echo "</tr>\n";
|
||||
}
|
||||
echo " </td>\n";
|
||||
}
|
||||
else {
|
||||
echo " <td ".$list_row_onclick_toggle."> </td>";
|
||||
}
|
||||
echo " <td ".$list_row_onclick_toggle.">".$row['caller_id_name']." </td>\n";
|
||||
echo " <td ".$list_row_onclick_toggle.">".format_phone($row['caller_id_number'])."</td>\n";
|
||||
echo " <td class='no-wrap' ".$list_row_onclick_toggle.">".$tmp_start_epoch."</td>\n";
|
||||
$seconds = ($row['hangup_cause'] == "ORIGINATOR_CANCEL") ? $row['duration'] : $row['billsec']; //if they cancelled, show the ring time, not the bill time.
|
||||
echo " <td class='right hide-sm-dn' ".$list_row_onclick_toggle.">".gmdate("G:i:s", $seconds)."</td>\n";
|
||||
echo "</tr>\n";
|
||||
$x++;
|
||||
}
|
||||
}
|
||||
unset($result);
|
||||
|
||||
echo "</table>\n";
|
||||
}
|
||||
unset($result);
|
||||
|
||||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
//handle hiding and showing of direction recent calls
|
||||
echo "<script>\n";
|
||||
echo " function show_direction(direction) {\n";
|
||||
echo " //determine other direction\n";
|
||||
echo " direction_other = direction == 'inbound' ? 'outbound' : 'inbound';\n";
|
||||
|
||||
echo " //hide other direction list\n";
|
||||
echo " document.getElementById('list_' + direction_other).style.display='none';\n";
|
||||
|
||||
echo " //uncheck all checkboxes\n";
|
||||
echo " var checkboxes = document.querySelectorAll(\"input[type='checkbox']\")\n";
|
||||
echo " if (checkboxes.length > 0) {\n";
|
||||
echo " for (var i = 0; i < checkboxes.length; ++i) {\n";
|
||||
echo " checkboxes[i].checked = false;\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " //show direction list\n";
|
||||
echo " document.getElementById('list_' + direction).style.display='inline';\n";
|
||||
echo " }\n";
|
||||
echo "</script>\n";
|
||||
|
||||
}
|
||||
|
||||
//make sub action bar sticky
|
||||
|
||||
@@ -23,6 +23,7 @@ if (!class_exists('call_block')) {
|
||||
/**
|
||||
* declare public variables
|
||||
*/
|
||||
public $call_block_direction;
|
||||
public $extension_uuid;
|
||||
public $call_block_app;
|
||||
public $call_block_data;
|
||||
@@ -307,7 +308,7 @@ if (!class_exists('call_block')) {
|
||||
|
||||
//get the caller id info from cdrs
|
||||
if (is_array($uuids) && @sizeof($uuids) != 0) {
|
||||
$sql = "select caller_id_name, caller_id_number from v_xml_cdr ";
|
||||
$sql = "select caller_id_name, caller_id_number, caller_destination from v_xml_cdr ";
|
||||
$sql .= "where xml_cdr_uuid in (".implode(', ', $uuids).") ";
|
||||
$database = new database;
|
||||
$rows = $database->select($sql, $parameters, 'all');
|
||||
@@ -322,11 +323,17 @@ if (!class_exists('call_block')) {
|
||||
if (permission_exists('call_block_all')) {
|
||||
$array['call_block'][$x]['call_block_uuid'] = uuid();
|
||||
$array['call_block'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][$x]['call_block_direction'] = $this->call_block_direction;
|
||||
if (is_uuid($this->extension_uuid)) {
|
||||
$array['call_block'][$x]['extension_uuid'] = $this->extension_uuid;
|
||||
}
|
||||
$array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]);
|
||||
$array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]);
|
||||
if ($this->call_block_direction == 'inbound') {
|
||||
$array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]);
|
||||
$array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]);
|
||||
}
|
||||
if ($this->call_block_direction == 'outbound') {
|
||||
$array['call_block'][$x]['call_block_number'] = trim($row["caller_destination"]);
|
||||
}
|
||||
$array['call_block'][$x]['call_block_count'] = 0;
|
||||
$array['call_block'][$x]['call_block_app'] = $this->call_block_app;
|
||||
$array['call_block'][$x]['call_block_data'] = $this->call_block_data;
|
||||
@@ -340,9 +347,15 @@ if (!class_exists('call_block')) {
|
||||
if (is_uuid($field['extension_uuid'])) {
|
||||
$array['call_block'][$x]['call_block_uuid'] = uuid();
|
||||
$array['call_block'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['call_block'][$x]['call_block_direction'] = $this->call_block_direction;
|
||||
$array['call_block'][$x]['extension_uuid'] = $field['extension_uuid'];
|
||||
$array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]);
|
||||
$array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]);
|
||||
if ($this->call_block_direction == 'inbound') {
|
||||
$array['call_block'][$x]['call_block_name'] = trim($row["caller_id_name"]);
|
||||
$array['call_block'][$x]['call_block_number'] = trim($row["caller_id_number"]);
|
||||
}
|
||||
if ($this->call_block_direction == 'outbound') {
|
||||
$array['call_block'][$x]['call_block_number'] = trim($row["caller_destination"]);
|
||||
}
|
||||
$array['call_block'][$x]['call_block_count'] = 0;
|
||||
$array['call_block'][$x]['call_block_app'] = $this->call_block_app;
|
||||
$array['call_block'][$x]['call_block_data'] = $this->call_block_data;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<context name="{v_context}">
|
||||
<extension name="call_block" number="" continue="true" app_uuid="b1b31930-d0ee-4395-a891-04df94599f1f" enabled="false" order="40">
|
||||
<condition field="${call_direction}" expression="^inbound$" >
|
||||
<condition field="${call_direction}" expression="^(inbound|outbound)$" >
|
||||
<action application="lua" data="app.lua call_block"/>
|
||||
</condition>
|
||||
</extension>
|
||||
|
||||
@@ -44,8 +44,10 @@
|
||||
if (session:ready()) then
|
||||
--session:setAutoHangup(false);
|
||||
domain_uuid = session:getVariable("domain_uuid");
|
||||
call_direction = session:getVariable("call_direction");
|
||||
caller_id_name = session:getVariable("caller_id_name");
|
||||
caller_id_number = session:getVariable("caller_id_number");
|
||||
destination_number = session:getVariable("destination_number");
|
||||
context = session:getVariable("context");
|
||||
call_block = session:getVariable("call_block");
|
||||
extension_uuid = session:getVariable("extension_uuid");
|
||||
@@ -93,6 +95,7 @@
|
||||
sql = "select * from v_call_block\n";
|
||||
sql = sql .. "where domain_uuid = :domain_uuid \n";
|
||||
sql = sql .. "and call_block_enabled = 'true' \n";
|
||||
sql = sql .. "and call_block_direction = :call_block_direction \n";
|
||||
sql = sql .. "and ( \n";
|
||||
sql = sql .. " (\n";
|
||||
sql = sql .. " call_block_name = :call_block_name \n";
|
||||
@@ -118,9 +121,19 @@
|
||||
sql = sql .. "and (extension_uuid is null or extension_uuid = :extension_uuid) ";
|
||||
end
|
||||
if (extension_uuid ~= nil) then
|
||||
params = {domain_uuid = domain_uuid, call_block_name = caller_id_name, call_block_number = caller_id_number, extension_uuid = extension_uuid};
|
||||
if (call_direction == 'inbound') then
|
||||
params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = caller_id_number, extension_uuid = extension_uuid};
|
||||
end
|
||||
if (call_direction == 'outbound') then
|
||||
params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = destination_number, extension_uuid = extension_uuid};
|
||||
end
|
||||
else
|
||||
params = {domain_uuid = domain_uuid, call_block_name = caller_id_name, call_block_number = caller_id_number};
|
||||
if (call_direction == 'inbound') then
|
||||
params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = caller_id_number};
|
||||
end
|
||||
if (call_direction == 'outbound') then
|
||||
params = {domain_uuid = domain_uuid, call_block_direction = call_direction, call_block_name = caller_id_name, call_block_number = destination_number};
|
||||
end
|
||||
end
|
||||
if (debug["sql"]) then
|
||||
freeswitch.consoleLog("notice", "[dialplan] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
|
||||
@@ -231,4 +244,4 @@
|
||||
freeswitch.consoleLog("notice", "[call_block] " .. call_block_cache_key .. " source: cache\n");
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user