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
5 changed files with 192 additions and 33 deletions
+15
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";