diff --git a/issabel-pbx.spec b/issabel-pbx.spec index d7600d4..d91a578 100644 --- a/issabel-pbx.spec +++ b/issabel-pbx.spec @@ -2,7 +2,7 @@ Summary: Issabel PBX Module Name: issabel-pbx Version: 5.0.0 -Release: 5 +Release: 6 License: GPL Group: Applications/System Source0: issabel-%{modname}-%{version}.tar.gz @@ -311,3 +311,6 @@ fi /etc/cron.daily/asterisk_cleanup %changelog +* Tue Jun 30 2026 Trixocom - 5.0.0-6 +- monitoring: filter recordings by a group of extensions per user (acl_user.monitorexten) + diff --git a/modules/monitoring/index.php b/modules/monitoring/index.php index c786980..d9cdb19 100755 --- a/modules/monitoring/index.php +++ b/modules/monitoring/index.php @@ -52,11 +52,17 @@ function _moduleContent(&$smarty, $module_name) $pDBACL = new paloDB($arrConf['issabel_dsn']['acl']); $pACL = new paloACL($pDBACL); $user = isset($_SESSION['issabel_user'])?$_SESSION['issabel_user']:""; - $extension = $pACL->getUserExtension($user); - if ($extension == '') $extension = NULL; + $ownext = $pACL->getUserExtension($user); + if ($ownext == '') $ownext = NULL; - // Sólo el administrador puede consultar con $extension == NULL - if (is_null($extension)) { + // Lista de extensiones que el usuario puede monitorear. Si tiene definida + // la columna acl_user.monitorexten se usa esa lista; si no, su propia + // extensión (comportamiento clásico). $extension es SIEMPRE un arreglo. + $extension = $pACL->getUserMonitorExtensions($user); + if (count($extension) == 0 && !is_null($ownext)) $extension = array($ownext); + + // Sólo reportany (administrador) puede consultar sin ninguna extensión asociada + if (count($extension) == 0) { if (hasModulePrivilege($user, $module_name, 'reportany')) $smarty->assign("mb_message", ""._tr("no_extension").""); else{ diff --git a/modules/monitoring/libs/paloSantoMonitoring.class.php b/modules/monitoring/libs/paloSantoMonitoring.class.php index ebc396f..a2cb20f 100644 --- a/modules/monitoring/libs/paloSantoMonitoring.class.php +++ b/modules/monitoring/libs/paloSantoMonitoring.class.php @@ -94,18 +94,27 @@ function _construirWhereMonitoring_notempty($x) { return ($x != ''); } } } - // Extensión de fuente o destino, copiada de paloSantoCDR.class.php + // Extensión(es) de fuente o destino, copiada de paloSantoCDR.class.php. + // Acepta un valor escalar (comportamiento clásico) o un arreglo de + // extensiones (filtro por grupo de extensiones). if (isset($param['extension'])) { - $condSQL[] = << 0) { + $ph = implode(',', array_fill(0, count($extens), '?')); + $condSQL[] = <<_DB->getFirstRowQuery($sql, FALSE, - array($uniqueid, $extension, $extension, $extension, $extension)); + $params = array($uniqueid); + for ($i = 0; $i < 4; $i++) + foreach ($extens as $e) $params[] = $e; + $result = $this->_DB->getFirstRowQuery($sql, FALSE, $params); if (!is_array($result)) { $this->errMsg = $this->_DB->errMsg; return FALSE; diff --git a/modules/userlist/plugins/extension/index.php b/modules/userlist/plugins/extension/index.php index c70a204..590d450 100755 --- a/modules/userlist/plugins/extension/index.php +++ b/modules/userlist/plugins/extension/index.php @@ -64,6 +64,14 @@ function addFormElements($privileged) "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => "" ), + "monitorexten" => array( + "LABEL" => _tr("Monitor extensions"), + "REQUIRED" => "no", + "INPUT_TYPE" => "TEXT", + "INPUT_EXTRA_PARAM" => '', + "VALIDATION_TYPE" => "text", + "VALIDATION_EXTRA_PARAM" => "" + ), ); } else { return array( @@ -76,6 +84,15 @@ function addFormElements($privileged) "VALIDATION_EXTRA_PARAM" => "", 'EDITABLE' => 'no', ), + "monitorexten" => array( + "LABEL" => _tr("Monitor extensions"), + "REQUIRED" => "no", + "INPUT_TYPE" => "TEXT", + "INPUT_EXTRA_PARAM" => '', + "VALIDATION_TYPE" => "text", + "VALIDATION_EXTRA_PARAM" => "", + 'EDITABLE' => 'no', + ), ); } } @@ -85,6 +102,9 @@ function loadFormEditValues($username, $id_user) if (!isset($_POST['extension'])) { $_POST['extension'] = $this->_pACL->getUserExtension($username); } + if (!isset($_POST['monitorexten'])) { + $_POST['monitorexten'] = implode(',', $this->_pACL->getUserMonitorExtensions($username)); + } } function fetchForm($smarty, $oForm, $local_templates_dir, $pvars) @@ -97,6 +117,10 @@ function runPostCreateUser($smarty, $username, $id_user) { $r = $this->_pACL->setUserExtension($username, (trim($_POST['extension']) == '') ? NULL : trim($_POST['extension'])); + if ($r && isset($_POST['monitorexten'])) { + $r = $this->_pACL->setUserMonitorExtensions($username, + (trim($_POST['monitorexten']) == '') ? NULL : trim($_POST['monitorexten'])); + } if (!$r) { $smarty->assign(array( 'mb_title' => 'ERROR', diff --git a/modules/userlist/plugins/extension/lang/es.lang b/modules/userlist/plugins/extension/lang/es.lang index c11bf69..8b4e54f 100644 --- a/modules/userlist/plugins/extension/lang/es.lang +++ b/modules/userlist/plugins/extension/lang/es.lang @@ -26,5 +26,6 @@ $arrLangModule = array( "No extension associated" => "La extensión no ha sido asociada", "no extension" => "sin extensión", "PBX Profile" => "Perfil PBX", + "Monitor extensions" => "Extensiones a monitorear", ); ?> diff --git a/modules/userlist/plugins/extension/tpl/new_extension.tpl b/modules/userlist/plugins/extension/tpl/new_extension.tpl index 42732c2..8ac53ad 100755 --- a/modules/userlist/plugins/extension/tpl/new_extension.tpl +++ b/modules/userlist/plugins/extension/tpl/new_extension.tpl @@ -6,5 +6,10 @@ {$extension.INPUT}   + + {$monitorexten.LABEL}: + {$monitorexten.INPUT} + {$monitorexten.LABEL_HELP} +