Calls Active - Add eavesdrop function, and appropriate permission.

This commit is contained in:
fusionate 2023-12-08 01:37:22 +00:00
parent 47161fae80
commit 1ceb2fcbc9
No known key found for this signature in database
5 changed files with 192 additions and 33 deletions

View File

@ -31,25 +31,29 @@
//permission details
$y=0;
$apps[$x]['permissions'][0]['name'] = "call_active_view";
$apps[$x]['permissions'][0]['menu']['uuid'] = "eba3d07f-dd5c-6b7b-6880-493b44113ade";
$apps[$x]['permissions'][0]['groups'][] = "superadmin";
$apps[$x]['permissions'][0]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['name'] = "call_active_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "eba3d07f-dd5c-6b7b-6880-493b44113ade";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
//$y++;
//$apps[$x]['permissions'][1]['name'] = "call_active_transfer";
//$apps[$x]['permissions'][1]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['name'] = "call_active_transfer";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][2]['name'] = "call_active_hangup";
$apps[$x]['permissions'][2]['groups'][] = "superadmin";
$apps[$x]['permissions'][2]['groups'][] = "admin";
//$y++;
//$apps[$x]['permissions'][3]['name'] = "call_active_park";
//$apps[$x]['permissions'][3]['groups'][] = "superadmin";
//$y++;
//$apps[$x]['permissions'][4]['name'] = "call_active_rec";
//$apps[$x]['permissions'][4]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['name'] = "call_active_eavesdrop";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][5]['name'] = "call_active_all";
$apps[$x]['permissions'][5]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['name'] = "call_active_hangup";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
//$y++;
//$apps[$x]['permissions'][$y]['name'] = "call_active_park";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$y++;
//$apps[$x]['permissions'][$y]['name'] = "call_active_rec";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "call_active_all";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
?>

View File

@ -600,6 +600,31 @@ $text['label-app']['zh-cn'] = "应用";
$text['label-app']['ja-jp'] = "応用";
$text['label-app']['ko-kr'] = "애플리케이션";
$text['label-eavesdrop']['en-us'] = "Eavesdrop";
$text['label-eavesdrop']['en-gb'] = "Eavesdrop";
$text['label-eavesdrop']['ar-eg'] = "التنصت";
$text['label-eavesdrop']['de-at'] = "Mithören";
$text['label-eavesdrop']['de-ch'] = "Mithören";
$text['label-eavesdrop']['de-de'] = "Mithören";
$text['label-eavesdrop']['el-gr'] = "Αφουγκράζομαι";
$text['label-eavesdrop']['es-cl'] = "Escuchar";
$text['label-eavesdrop']['es-mx'] = "Escuchar";
$text['label-eavesdrop']['fr-ca'] = "Espionner";
$text['label-eavesdrop']['fr-fr'] = "Espionner";
$text['label-eavesdrop']['he-il'] = "לְצוֹתֵת";
$text['label-eavesdrop']['it-it'] = "Ascolta";
$text['label-eavesdrop']['nl-nl'] = "Afluisteren";
$text['label-eavesdrop']['pl-pl'] = "Podsłuchiwanie";
$text['label-eavesdrop']['pt-br'] = "Investigar";
$text['label-eavesdrop']['pt-pt'] = "Bisbilhotar";
$text['label-eavesdrop']['ro-ro'] = "Trage cu urechea";
$text['label-eavesdrop']['ru-ru'] = "Подслушивать";
$text['label-eavesdrop']['sv-se'] = "Medlyssning";
$text['label-eavesdrop']['uk-ua'] = "підслуховувати";
$text['label-eavesdrop']['zh-cn'] = "窃听";
$text['label-eavesdrop']['ja-jp'] = "盗聴";
$text['label-eavesdrop']['ko-kr'] = "엿듣다";
$text['description-2']['en-us'] = "Use this to view all extensions and monitor and interact with active calls.";
$text['description-2']['en-gb'] = "Use this to view all extensions and monitor and interact with active calls.";
$text['description-2']['ar-eg'] = "استخدم هذا لعرض جميع الملحقات ومراقبة المكالمات النشطة والتفاعل معها.";
@ -650,6 +675,31 @@ $text['description']['zh-cn'] = "使用它来监视活动呼叫并与之交互
$text['description']['ja-jp'] = "これを使用して、アクティブな通話を監視し、対話します。";
$text['description']['ko-kr'] = "이를 사용하여 활성 통화를 모니터링하고 상호 작용합니다.";
$text['description-eavesdrop_destination']['en-us'] = "Select the Eavesdrop Destination";
$text['description-eavesdrop_destination']['en-gb'] = "Select the Eavesdrop Destination";
$text['description-eavesdrop_destination']['ar-eg'] = "حدد وجهة Eavesdrop";
$text['description-eavesdrop_destination']['de-at'] = "Wählen Sie ein Ziel zum Mithören";
$text['description-eavesdrop_destination']['de-ch'] = "Wählen Sie ein Ziel zum Mithören";
$text['description-eavesdrop_destination']['de-de'] = "Wählen Sie ein Ziel zum Mithören";
$text['description-eavesdrop_destination']['el-gr'] = "Επιλέξτε τον προορισμό EAVESDROP";
$text['description-eavesdrop_destination']['es-cl'] = "Seleccione el Eavesdrop Destino";
$text['description-eavesdrop_destination']['es-mx'] = "Seleccione el Eavesdrop Destino";
$text['description-eavesdrop_destination']['fr-ca'] = "Sélectionnez la destination d'espionnage";
$text['description-eavesdrop_destination']['fr-fr'] = "Sélectionnez la destination d'espionnage";
$text['description-eavesdrop_destination']['he-il'] = "בחר ביעד האזנת סתר";
$text['description-eavesdrop_destination']['it-it'] = "Seleziona la Destinazione d'Ascolto";
$text['description-eavesdrop_destination']['nl-nl'] = "Kies afluister bestemming";
$text['description-eavesdrop_destination']['pl-pl'] = "Wybierz destynację podsłuchiwanych rozmów";
$text['description-eavesdrop_destination']['pt-br'] = "Selecione o eavesdrop de destino";
$text['description-eavesdrop_destination']['pt-pt'] = "Selecione o Eavesdrop Destino";
$text['description-eavesdrop_destination']['ro-ro'] = "Selectați Destinația Eavesdrop";
$text['description-eavesdrop_destination']['ru-ru'] = "Выберите подслушивание пункта назначения";
$text['description-eavesdrop_destination']['sv-se'] = "Välj Medlyssning Destination";
$text['description-eavesdrop_destination']['uk-ua'] = "Виберіть пункт призначення підслуховувати";
$text['description-eavesdrop_destination']['zh-cn'] = "选择窃听目的地";
$text['description-eavesdrop_destination']['ja-jp'] = "盗聴先を選択";
$text['description-eavesdrop_destination']['ko-kr'] = "도청 대상 선택";
$text['confirm-socket']['en-us'] = "Connection to Event Socket failed.";
$text['confirm-socket']['en-gb'] = "Connection to Event Socket failed.";
$text['confirm-socket']['ar-eg'] = "فشل الاتصال بـ Event Socket.";
@ -700,6 +750,31 @@ $text['confirm-hangup']['zh-cn'] = "你真的要挂断这个电话吗?";
$text['confirm-hangup']['ja-jp'] = "本当にこの電話を切りますか?";
$text['confirm-hangup']['ko-kr'] = "이 전화를 끊으시겠습니까?";
$text['confirm-eavesdrop']['en-us'] = "Do you really want to eavesdrop on this call?";
$text['confirm-eavesdrop']['en-gb'] = "Do you really want to eavesdrop on this call?";
$text['confirm-eavesdrop']['ar-eg'] = "هل تريد حقًا التنصت على هذه المكالمة؟";
$text['confirm-eavesdrop']['de-at'] = "Wollen Sie diesen Anruf wirklich belauschen?";
$text['confirm-eavesdrop']['de-ch'] = "Wollen Sie diesen Anruf wirklich belauschen?";
$text['confirm-eavesdrop']['de-de'] = "Wollen Sie diesen Anruf wirklich belauschen?";
$text['confirm-eavesdrop']['el-gr'] = "Θέλετε πραγματικά να κρυφακούσετε αυτήν την κλήση;";
$text['confirm-eavesdrop']['es-cl'] = "¿De verdad quieres escuchar esta llamada?";
$text['confirm-eavesdrop']['es-mx'] = "¿De verdad quieres escuchar esta llamada?";
$text['confirm-eavesdrop']['fr-ca'] = "Voulez-vous vraiment écouter cet appel ?";
$text['confirm-eavesdrop']['fr-fr'] = "Voulez-vous vraiment écouter cet appel ?";
$text['confirm-eavesdrop']['he-il'] = "האם אתה באמת רוצה לצותת לשיחה הזו?";
$text['confirm-eavesdrop']['it-it'] = "Vuoi davvero origliare questa chiamata?";
$text['confirm-eavesdrop']['nl-nl'] = "Wilt u dit gesprek echt afluisteren?";
$text['confirm-eavesdrop']['pl-pl'] = "Czy na pewno chcesz podsłuchiwać tę rozmowę?";
$text['confirm-eavesdrop']['pt-br'] = "Você realmente quer escutar esta chamada?";
$text['confirm-eavesdrop']['pt-pt'] = "Você realmente quer escutar esta chamada?";
$text['confirm-eavesdrop']['ro-ro'] = "Chiar vrei să asculti cu urechea la acest apel?";
$text['confirm-eavesdrop']['ru-ru'] = "Вы действительно хотите подслушать этот звонок?";
$text['confirm-eavesdrop']['sv-se'] = "Vill du verkligen avlyssna det här samtalet?";
$text['confirm-eavesdrop']['uk-ua'] = "Ви дійсно хочете підслухати цей дзвінок?";
$text['confirm-eavesdrop']['zh-cn'] = "你真的想窃听这个电话吗?";
$text['confirm-eavesdrop']['ja-jp'] = "本当にこの通話を盗聴したいですか?";
$text['confirm-eavesdrop']['ko-kr'] = "정말로 이 통화를 엿듣고 싶으신가요?";
$text['confirm-hangups']['en-us'] = "Do you really want to hangup these calls?";
$text['confirm-hangups']['en-gb'] = "Do you really want to hangup these calls?";
$text['confirm-hangups']['ar-eg'] = "هل تريد حقًا إنهاء هذه المكالمات؟";

View File

@ -61,20 +61,23 @@
?>
<script type="text/javascript">
//define refresh function, initial start
var refresh = 1980;
var refresh = 1980;
var source_url = 'calls_active_inc.php?';
var timer_id;
<?php
if ($show == 'all') {
echo "source_url = source_url + '&show=all';";
echo "&source_url = source_url + '&show=all';";
}
if (isset($_REQUEST["debug"])) {
echo "source_url = source_url + '&debug';";
echo "&source_url = source_url + '&debug';";
}
?>
var ajax_get = function () {
function ajax_get() {
url = source_url + '&eavesdrop_dest=' + ((document.getElementById('eavesdrop_dest')) ? document.getElementById('eavesdrop_dest').value : '');
$.ajax({
url: source_url, success: function(response){
url: url,
success: function(response){
$("#ajax_reponse").html(response);
}
});
@ -87,7 +90,7 @@
function refresh_stop() {
clearTimeout(timer_id);
//document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; margin-right: 20px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">";
document.getElementById('refresh_state').innerHTML = "<?php echo button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'pause','onclick'=>'refresh_start()']); ?>";
document.getElementById('refresh_state').innerHTML = "<?php echo button::create(['type'=>'button','title'=>$text['label-refresh_enable'],'icon'=>'pause','onclick'=>'refresh_start()']); ?>";
}
function refresh_start() {
@ -96,10 +99,48 @@
ajax_get();
}
//eavesdrop call
function eavesdrop_call(ext, chan_uuid) {
if (ext != '' && chan_uuid != '') {
cmd = get_eavesdrop_cmd(ext, chan_uuid, document.getElementById('eavesdrop_dest').value);
if (cmd != '') {
send_cmd(cmd);
}
}
}
function get_eavesdrop_cmd(ext, chan_uuid, destination) {
url = "calls_exec.php?action=eavesdrop&ext=" + ext + "&chan_uuid=" + chan_uuid + "&destination=" + destination;
return url;
}
//used by eavesdrop function
function send_cmd(url) {
if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById('cmd_response').innerHTML=xmlhttp.responseText;
}
</script>
<?php
//create simple array of users own extensions
unset($_SESSION['user']['extensions']);
if (is_array($_SESSION['user']['extension'])) {
foreach ($_SESSION['user']['extension'] as $assigned_extensions) {
$_SESSION['user']['extensions'][] = $assigned_extensions['user'];
}
}
echo "<div id='ajax_reponse'></div>\n";
echo "<div id='cmd_response' style='display: none;'></div>\n";
echo "<div id='time_stamp' style='visibility:hidden'>".date('Y-m-d-s')."</div>\n";
echo "<br><br><br>";
@ -118,4 +159,5 @@ require_once "resources/footer.php";
return escape(cmd);
}
*/
?>
?>

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019
Portions created by the Initial Developer are Copyright (C) 2008-2023
the Initial Developer. All Rights Reserved.
Contributor(s):
@ -116,6 +116,22 @@
echo " <div class='heading'><b>".$text['title']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
if (permission_exists('call_active_eavesdrop')) {
if (sizeof($_SESSION['user']['extensions']) > 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n";
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n";
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
if (is_array($_SESSION['user']['extensions'])) {
foreach ($_SESSION['user']['extensions'] as $user_extension) {
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n";
}
}
echo " </select>\n";
}
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n";
}
}
if (permission_exists('call_active_hangup') && $rows) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]);
}
@ -163,8 +179,8 @@
echo " <th>".$text['label-app']."</th>\n";
echo " <th>".$text['label-codec']."</th>\n";
echo " <th>".$text['label-secure']."</th>\n";
if (permission_exists('call_active_hangup')) {
echo " <td class='action-button'>&nbsp;</td>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <th>&nbsp;</th>\n";
}
echo "</tr>\n";
@ -222,13 +238,20 @@
echo " <td>".(!empty($application) ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n";
echo " <td>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n";
echo " <td>".escape($secure)."&nbsp;</td>\n";
if (permission_exists('call_active_hangup')) {
echo " <td class='action-button'>";
echo button::create(['type'=>'button','title'=>$text['label-hangup'],'icon'=>'phone-slash','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
echo " </td>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <td class='button right' style='padding-right: 0;'>\n";
//eavesdrop
if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && sizeof($_SESSION['user']['extensions']) > 0 && !in_array($cid_num, $_SESSION['user']['extensions'])) {
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
//hangup
if (permission_exists('call_active_hangup')) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
echo "</td>\n";
}
echo "</tr>\n";
//unset the domain name
unset($domain_name);
@ -246,4 +269,4 @@
}
?>
?>

View File

@ -91,6 +91,21 @@
header('Location: calls_active.php');
exit;
}
else if ($_REQUEST['action'] == 'eavesdrop' && permission_exists('call_active_eavesdrop')) {
$uuid_pattern = '/[^-A-Fa-f0-9]/';
$num_pattern = '/[^-A-Za-z0-9()*#]/';
$chan_uuid = preg_replace($uuid_pattern,'',$_GET['chan_uuid']);
$ext = preg_replace($num_pattern,'',$_GET['ext']);
$destination = preg_replace($num_pattern,'',$_GET['destination']);
$api_cmd = 'bgapi originate {origination_caller_id_name='.$text['label-eavesdrop'].',origination_caller_id_number='.$ext.'}user/'.$destination.'@'.$_SESSION['domain_name'].' &eavesdrop('.$chan_uuid.')';
//run the command
$switch_result = event_socket::api($api_cmd);
}
else {
echo "access denied";