예제 #1
0
파일: index.php 프로젝트: hardikk/HNH
    protected function _formatReportForExtension($smarty, $module_name, $extension, &$respuesta)
    {
        $dsnAsteriskCDR = generarDSNSistema("asteriskuser", "asteriskcdrdb");
        $pDB = new paloDB($dsnAsteriskCDR);
        if (!empty($pDB->errMsg)) {
            $respuesta['status'] = 'error';
            $respuesta['message'] = _tr('Error at read yours calls.') . $pDB->errMsg;
        } else {
            $sql = <<<SQL_LLAMADAS_RECIBIDAS
SELECT calldate, src, duration, disposition FROM cdr
WHERE dst = ? OR SUBSTRING_INDEX(SUBSTRING_INDEX(dstchannel,'-',1),'/',-1) = ?
ORDER BY calldate DESC LIMIT ?
SQL_LLAMADAS_RECIBIDAS;
            $recordset = $pDB->fetchTable($sql, TRUE, array($extension, $extension, MAX_CALL_RECORDS));
            if (!is_array($recordset)) {
                $respuesta['status'] = 'error';
                $respuesta['message'] = _tr('Error at read yours calls.') . $pDB->errMsg;
            } elseif (count($recordset) <= 0) {
                $respuesta['html'] = _tr("You don't recibed calls");
            } else {
                $estadoLlamadas = array();
                foreach ($recordset as $tupla) {
                    $answ = $tupla['disposition'] == 'ANSWERED';
                    $estadoLlamadas[] = str_replace(array('{status}', '{date}', '{source}'), array($answ ? _tr('answered') : _tr('missed'), $tupla['calldate'], empty($tupla['src']) ? _tr('unknow') : $tupla['src']), _tr('call record')) . ($answ ? str_replace('{time}', $tupla['duration'], _tr('call duration')) : '.');
                }
                $respuesta['html'] = implode('<br/>', $estadoLlamadas);
            }
        }
    }
예제 #2
0
function _moduleContent(&$smarty, $module_name)
{
    global $arrConf;
    //folder path for custom templates
    $local_templates_dir = getWebDirModule($module_name);
    //conexion resource
    $dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
    $pDB = new paloDB($dsn);
    //user credentials
    global $arrCredentials;
    $action = getAction();
    $content = "";
    switch ($action) {
        case 'delete':
            $content = deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case 'download':
            $content = downloadFile($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        case "display_record":
            $content = display_record($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
        default:
            $content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrCredentials);
            break;
    }
    return $content;
}
예제 #3
0
 function paloSantoReportCall(&$pDB_cdr, &$pDB_billing = null)
 {
     $this->CargarIdiomas();
     // Se recibe como parámetro una referencia a una conexión paloDB
     if (is_object($pDB_cdr)) {
         $this->_DB_cdr =& $pDB_cdr;
         $this->errMsg = $this->_DB_cdr->errMsg;
     } else {
         if ($pDB_cdr == '') {
             $pDB_cdr = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
         }
         $dsn = (string) $pDB_cdr;
         $this->_DB_cdr = new paloDB($dsn);
         if (!$this->_DB_cdr->connStatus) {
             $this->errMsg = $this->_DB_cdr->errMsg;
             // debo llenar alguna variable de error
         } else {
             // debo llenar alguna variable de error
         }
     }
     if (is_object($pDB_billing)) {
         $this->_DB_billing =& $pDB_billing;
         $this->errMsg = $this->_DB_billing->errMsg;
     } else {
         $dsn = (string) $pDB_billing;
         $this->_DB_billing = new paloDB($dsn);
         if (!$this->_DB_billing->connStatus) {
             $this->errMsg = $this->_DB_billing->errMsg;
             // debo llenar alguna variable de error
         } else {
             // debo llenar alguna variable de error
         }
     }
 }
예제 #4
0
파일: core.class.php 프로젝트: hardikk/HNH
 /**
  * Constructor
  *
  */
 public function core_AddressBook()
 {
     $this->_id_user = NULL;
     $this->_pACL = NULL;
     $this->errMsg = NULL;
     $this->_dbCache = array();
     $this->_astDSN = generarDSNSistema('asteriskuser', 'asterisk', $_SERVER['DOCUMENT_ROOT'] . '/');
 }
예제 #5
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoMyExtension.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    //conexion resource
    $arrConf['dsn_conn_database'] = generarDSNSistema('asteriskuser', 'asterisk');
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    $pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
    $pACL = new paloACL($pDBACL);
    $user = isset($_SESSION['elastix_user']) ? $_SESSION['elastix_user'] : "";
    $extension = $pACL->getUserExtension($user);
    $isAdministrator = $pACL->isUserAdministratorGroup($user);
    if ($extension == "" || is_null($extension)) {
        if ($isAdministrator) {
            $smarty->assign("mb_message", "<b>" . $arrLang["no_extension"] . "</b>");
        } else {
            $smarty->assign("mb_message", "<b>" . $arrLang["contact_admin"] . "</b>");
        }
        return "";
    }
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case "save_new":
            $content = saveNewMyExtension($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang, $extension, $isAdministrator);
            break;
        default:
            // view_form
            $content = viewFormMyExtension($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang, $extension);
            break;
    }
    return $content;
}
예제 #6
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoMissedCalls.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    // cdr connection
    $dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
    $pDB_cdr = new paloDB($dsn);
    // call_center connection
    $pDB_callcenter = new paloDB($arrConf['cadena_dsn']);
    $pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
    if (!empty($pDBACL->errMsg)) {
        return "ERROR DE DB: {$pDBACL->errMsg}";
    }
    $pACL = new paloACL($pDBACL);
    if (!empty($pACL->errMsg)) {
        return "ERROR DE ACL: {$pACL->errMsg}";
    }
    //actions
    $action = getAction();
    switch ($action) {
        case 'call2phone':
            $content = call2phone();
            break;
        default:
            $content = reportMissedCalls($smarty, $module_name, $local_templates_dir, $pDB_callcenter, $pDBACL, $pACL, $arrConf, $pDB_cdr);
            break;
    }
    return $content;
}
예제 #7
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoWeakKeys.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    //conexion resource
    $dsn_asterisk = generarDSNSistema("asteriskuser", "asterisk");
    $pDB = new paloDB($dsn_asterisk);
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrAMP = $pConfig->leer_configuracion(false);
    $pConfig = new paloConfig($arrAMP['ASTETCDIR']['valor'], "asterisk.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrAST = $pConfig->leer_configuracion(false);
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case "change":
            $content = editWeakKeys($smarty, $module_name, $local_templates_dir, $arrConf, $pDB);
            break;
        case "save":
            $content = saveNewKey($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrAST, $arrAMP);
            break;
        default:
            $content = reportWeakKeys($smarty, $module_name, $local_templates_dir, $pDB, $arrConf);
            break;
    }
    return $content;
}
예제 #8
0
 function Obtain_Protocol_Current_User($arrConf)
 {
     $pDB_acl = new paloDB($arrConf['elastix_dsn']['acl']);
     $pACL = new paloACL($pDB_acl);
     $username = $_SESSION["elastix_user"];
     $extension = $pACL->getUserExtension($username);
     if ($extension) {
         $dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
         $pDB = new paloDB($dsnAsterisk);
         $query = "SELECT dial, description, id FROM devices WHERE id={$extension}";
         $result = $pDB->getFirstRowQuery($query, TRUE);
         if ($result != FALSE) {
             return $result;
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
예제 #9
0
파일: index.php 프로젝트: hardikk/HNH
function formularioModificarCola($pDB, $smarty, $module_name, $local_templates_dir, $idCola)
{
    require_once "libs/paloSantoForm.class.php";
    require_once "libs/paloSantoQueue.class.php";
    // Si se ha indicado cancelar, volver a listado sin hacer nada más
    if (isset($_POST['cancel'])) {
        Header("Location: ?menu={$module_name}");
        return '';
    }
    $smarty->assign(array('FRAMEWORK_TIENE_TITULO_MODULO' => existeSoporteTituloFramework(), 'icon' => 'images/kfaxview.png', 'SAVE' => _tr('guardar'), 'CANCEL' => _tr('cancelar'), 'id_queue' => $idCola));
    // Leer todas las colas disponibles
    $dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
    $oDBAsterisk = new paloDB($dsnAsterisk);
    $oQueue = new paloQueue($oDBAsterisk);
    $arrQueues = $oQueue->getQueue();
    if (!is_array($arrQueues)) {
        $smarty->assign("mb_title", _tr('Unable to read queues'));
        $smarty->assign("mb_message", _tr('Cannot read queues') . ' - ' . $oQueue->errMsg);
        $arrQueues = array();
    }
    $oColas = new paloSantoColaEntrante($pDB);
    // Leer todos los datos de la cola entrante, si es necesario
    $arrColaEntrante = NULL;
    if (!is_null($idCola)) {
        $arrColaEntrante = $oColas->leerColas($idCola);
        if (!is_array($arrColaEntrante) || count($arrColaEntrante) == 0) {
            $smarty->assign("mb_title", _tr('Unable to read incoming queue'));
            $smarty->assign("mb_message", _tr('Cannot read incoming queue') . ' - ' . $oColas->errMsg);
            return '';
        }
    }
    /* Para nueva cola, se deben remover las colas ya usadas. Para cola 
     * modificada, sólo se muestra la cola que ya estaba asignada. */
    if (is_null($idCola)) {
        // Filtrar las colas que ya han sido usadas
        $arrFilterQueues = $oColas->filtrarColasUsadas($arrQueues);
    } else {
        // Colocar sólo la información de la cola asignada
        $arrFilterQueues = array();
        foreach ($arrQueues as $tuplaQueue) {
            if ($tuplaQueue[0] == $arrColaEntrante[0]['queue']) {
                $arrFilterQueues[] = $tuplaQueue;
            }
        }
    }
    $arrDataQueues = array();
    foreach ($arrFilterQueues as $tuplaQueue) {
        $arrDataQueues[$tuplaQueue[0]] = $tuplaQueue[1];
    }
    // Valores por omisión para primera carga
    if (is_null($idCola)) {
        if (!isset($_POST['select_queue']) && count($arrFilterQueues) > 0) {
            $_POST['select_queue'] = $arrFilterQueues[0][0];
        }
        if (!isset($_POST['rte_script'])) {
            $_POST['rte_script'] = '';
        }
    } else {
        $_POST['select_queue'] = $arrColaEntrante[0]['queue'];
        if (!isset($_POST['rte_script'])) {
            $_POST['rte_script'] = $arrColaEntrante[0]['script'];
        }
    }
    // rte_script es un HTML complejo que debe de construirse con Javascript.
    $smarty->assign("rte_script", adaptar_formato_rte($_POST['rte_script']));
    // Generación del objeto de formulario
    $form_campos = array("script" => array("LABEL" => _tr('Script'), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""), 'select_queue' => array("REQUIRED" => "yes", "LABEL" => is_null($idCola) ? _tr('Select Queue') . ' :' : _tr('Queue'), "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrDataQueues, "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""));
    $oForm = new paloForm($smarty, $form_campos);
    // Ejecutar el guardado de los cambios
    if (isset($_POST['save'])) {
        if (!$oForm->validateForm($_POST) || (!isset($_POST['rte_script']) || $_POST['rte_script'] == '')) {
            // Falla la validación básica del formulario
            $smarty->assign("mb_title", _tr("Validation Error"));
            $arrErrores = $oForm->arrErroresValidacion;
            $strErrorMsg = "<b>" . _tr('The following fields contain errors') . ":</b><br/>";
            if (is_array($arrErrores) && count($arrErrores) > 0) {
                foreach ($arrErrores as $k => $v) {
                    $strErrorMsg .= "{$k}, ";
                }
            }
            if (!isset($_POST['rte_script']) || $_POST['rte_script'] == '') {
                $strErrorMsg .= _tr("Script");
            }
            $strErrorMsg .= "";
            $smarty->assign("mb_message", $strErrorMsg);
        } else {
            $bExito = $oColas->iniciarMonitoreoCola($_POST['select_queue'], $_POST['rte_script']);
            if (!$bExito) {
                $smarty->assign("mb_title", _tr('Unable to save incoming queue'));
                $smarty->assign("mb_message", $oColas->errMsg);
            } else {
                Header("Location: ?menu={$module_name}");
            }
        }
    }
    return $oForm->fetchForm("{$local_templates_dir}/form.tpl", is_null($idCola) ? _tr('Select Queue') : _tr('Edit Queue'), null);
}
예제 #10
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoControlPanel.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    //conexion resource
    $arrConf['dsn_conn_database1'] = generarDSNSistema('asteriskuser', 'asterisk');
    $pDB1 = new paloDB($arrConf['dsn_conn_database1']);
    $pDB2 = new paloDB($arrConf['dsn_conn_database2']);
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case "call":
            $content = callAction($pDB1, $pDB2);
            break;
        case "voicemail":
            $content = voicemailAction($pDB1, $pDB2);
            break;
        case "hangup":
            $content = hangupAction($pDB1, $pDB2);
            break;
        case "refresh":
            $content = waitingChanges("refreshAction", $pDB1, $pDB2);
            break;
        case "getAllData":
            $content = getAllDataAction($pDB1, $pDB2);
            break;
        case "savechange":
            $content = savechangeAction($pDB1, $pDB2);
            break;
        case "savechange2":
            $content = savechange2Action($pDB1, $pDB2);
            break;
        case "saveresize":
            $content = saveresizeAction($pDB1, $pDB2);
            break;
        case "loadBoxes":
            $content = loadBoxesAction($pDB1, $pDB2, $module_name);
            break;
        case "loadArea":
            $content = loadAreaAction($pDB1, $pDB2, $module_name);
            break;
        case "saveEdit":
            $content = saveEditAction($pDB1, $pDB2);
            break;
        case "addExttoQueue":
            $content = addExttoQueueAction($pDB1, $pDB2);
            break;
        default:
            // view_form
            $content = viewFormControlPanel($smarty, $module_name, $local_templates_dir, $pDB1, $pDB2, $arrConf, $arrLang);
            break;
    }
    return $content;
}
 function Obtain_Protocol($extension)
 {
     if ($extension) {
         $dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
         $pDB = new paloDB($dsnAsterisk);
         $query = "SELECT dial, description, id FROM devices WHERE id=?";
         $result = $pDB->getFirstRowQuery($query, TRUE, array($extension));
         if ($result != FALSE) {
             return $result;
         } else {
             return FALSE;
         }
     } else {
         return FALSE;
     }
 }
예제 #12
0
  | The contents of this file are subject to the General Public License  |
  | (GPL) Version 2 (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.opensource.org/licenses/gpl-license.php                   |
  |                                                                      |
  | 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: Elastix Open Source.                           |
  | The Initial Developer of the Original Code is PaloSanto Solutions    |
  +----------------------------------------------------------------------+
  $Id: default.conf.php,v 1.1.1.1 2007/07/06 21:31:56 gcarrillo Exp $ */
global $arrConf;
$arrConf['dsn_mysql_elastix'] = generarDSNSistema("asteriskuser", "elxpbx");
$arrConf['elastix_dbdir'] = '/var/www/db';
$arrConf['elastix_dsn'] = array("elastix" => $arrConf['dsn_mysql_elastix'], "acl" => $arrConf['dsn_mysql_elastix'], "samples" => "sqlite3:///{$arrConf['elastix_dbdir']}/samples.db");
$arrConf['documentRoot'] = '/var/www/html';
$arrConf['basePath'] = '/var/www/html';
$arrConf['webCommon'] = 'web/_common';
$arrConf['elxPath'] = '/usr/share/elastix';
$arrConf['theme'] = 'default';
//theme personal para los modulos esencialmente
// Verifico si las bases del framework están, debido a la migración de dichas bases como archivos .db a archivos .sql
checkFrameworkDatabases($arrConf['elastix_dbdir']);
$arrConf['elastix_version'] = load_version_elastix($arrConf['basePath'] . "/");
//la version y le release  del sistema elastix
$arrConf['defaultMenu'] = 'config';
$arrConf['language'] = 'en';
$arrConf['cadena_dsn'] = "mysql://*****:*****@localhost/call_center";
예제 #13
0
function showMessageReload($module_name, &$pDB, $credentials)
{
    $pDBMySQL = new paloDB(generarDSNSistema("asteriskuser", "elxpbx"));
    $pAstConf = new paloSantoASteriskConfig($pDB);
    $params = array();
    $msgs = "";
    $query = "SELECT domain, id from organization";
    //si es superadmin aparece un link por cada organizacion que necesite reescribir su plan de mnarcada
    if ($credentials["userlevel"] != "superadmin") {
        $query .= " where id=?";
        $params[] = $credentials["id_organization"];
    }
    $mensaje = _tr("Click here to reload dialplan");
    $result = $pDB->fetchTable($query, false, $params);
    if (is_array($result)) {
        foreach ($result as $value) {
            if ($value[1] != 1) {
                $showmessage = $pAstConf->getReloadDialplan($value[0]);
                if ($showmessage == "yes") {
                    $append = $credentials["userlevel"] == "superadmin" ? " {$value['0']}" : "";
                    $msgs .= "<div id='msg_status_{$value['1']}' class='mensajeStatus'><a href='?menu={$module_name}&action=reloadAsterisk&organization_id={$value['1']}'/><b>" . $mensaje . $append . "</b></a></div>";
                }
            }
        }
    }
    return $msgs;
}
예제 #14
0
  +----------------------------------------------------------------------+
  | Elastix version 2.0.4-5                                               |
  | http://www.elastix.org                                               |
  +----------------------------------------------------------------------+
  | Copyright (c) 2006 Palosanto Solutions S. A.                         |
  +----------------------------------------------------------------------+
  | Cdla. Nueva Kennedy Calle E 222 y 9na. Este                          |
  | Telfs. 2283-268, 2294-440, 2284-356                                  |
  | Guayaquil - Ecuador                                                  |
  | http://www.palosanto.com                                             |
  +----------------------------------------------------------------------+
  | The contents of this file are subject to the General Public License  |
  | (GPL) Version 2 (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.opensource.org/licenses/gpl-license.php                   |
  |                                                                      |
  | 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: Elastix Open Source.                           |
  | The Initial Developer of the Original Code is PaloSanto Solutions    |
  +----------------------------------------------------------------------+
  $Id: default.conf.php,v 1.1 2011-05-13 11:05:31 Estefanía Morán Meza emoran@palosanto.com Exp $ */
global $arrConf;
global $arrConfModule;
$arrConfModule['module_name'] = 'sec_advanced_settings';
$arrConfModule['templates_dir'] = 'themes';
$arrConfModule['dsn_conn_database'] = generarDSNSistema('root', 'asterisk', '/var/www/html/');
$arrConfModule['arr_conf_file'] = array(array("name" => "amportal.conf", "pass_name" => "AMPDBPASS", "path" => "/etc/"), array("name" => "res_mysql.conf", "pass_name" => "dbpass", "path" => "/etc/asterisk/"), array("name" => "cbmysql.conf", "pass_name" => "password", "path" => "/etc/asterisk/"), array("name" => "cdr_mysql.conf", "pass_name" => "password", "path" => "/etc/asterisk/"));
예제 #15
0
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoCalendar.class.php";
    //    include_once "modules/$module_name/libs/JSON.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    //conexion resource
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case "save_new":
            $content = saveEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "edit":
            $content = viewForm_NewEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "delete":
            $content = deleteEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "save_edit":
            $content = saveEvent($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "get_lang":
            $content = getLanguages($arrLangModule, $arrConf);
            break;
        case "get_data":
            $content = getDataCalendar($arrLang, $pDB, $module_name, $arrConf);
            break;
        case "get_num_ext":
            $content = getNumExtesion($arrConf, $pDB, $arrLang);
            break;
        case "setData":
            $content = setDataCalendar($arrLang, $pDB, $arrConf);
            break;
        case "view_box":
            $content = viewBoxCalendar($arrConf, $arrLang, $pDB, $local_templates_dir, $smarty, $module_name);
            break;
        case "new_box":
            $content = newBoxCalendar($arrConf, $arrLang, $pDB, $local_templates_dir, $smarty, $module_name);
            break;
        case "delete_box":
            $content = deleteBoxCalendar($arrConf, $arrLang, $pDB, $module_name);
            break;
        case "download_icals":
            $content = download_icals($arrLang, $pDB, $module_name, $arrConf);
            break;
        case "get_contacts2":
            $content = getContactEmails2($arrConf);
            break;
        case "getTextToSpeach":
            $content = getTextToSpeach($arrLang, $pDB);
            break;
        case "display":
            $content = viewCalendarById($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
        case "phone_numbers":
            // Include language file for EN, then for local, and merge the two.
            $arrLangModule = NULL;
            include_once "modules/address_book/lang/en.lang";
            $lang_file = "modules/address_book/lang/{$lang}.lang";
            if (file_exists("{$base_dir}/{$lang_file}")) {
                $arrLanEN = $arrLangModule;
                include_once $lang_file;
                $arrLangModule = array_merge($arrLanEN, $arrLangModule);
            }
            $arrLang = array_merge($arrLang, $arrLangModule);
            //solo para obtener los devices (extensiones) creadas.
            $dsnAsterisk = generarDSNSistema('asteriskuser', 'asterisk');
            $pDB_addressbook = new paloDB($arrConf['dsn_conn_database3']);
            $pDB_acl = new paloDB($arrConf['dsn_conn_database1']);
            $html = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB_addressbook, $pDB_acl, $arrLang, $dsnAsterisk);
            $smarty->assign("CONTENT", $html);
            $smarty->assign("THEMENAME", $arrConf['mainTheme']);
            $smarty->assign("path", "");
            $content = $smarty->display("{$local_templates_dir}/address_book_list.tpl");
            break;
        default:
            // view_form
            $content = viewCalendar($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $arrLang);
            break;
    }
    return $content;
}
예제 #16
0
 private function _obtenerConexion($sConn)
 {
     global $arrConf;
     switch ($sConn) {
         case 'asterisk':
             if (!is_null($this->_oDB_asterisk)) {
                 return $this->_oDB_asterisk;
             }
             $sDSN = generarDSNSistema('asteriskuser', 'asterisk');
             $oDB = new paloDB($sDSN);
             if ($oDB->connStatus) {
                 $this->_errMsg = '(internal) Unable to create asterisk DB conn - ' . $oDB->errMsg;
                 die($this->_errMsg);
             }
             $this->_oDB_asterisk = $oDB;
             return $this->_oDB_asterisk;
             break;
         case 'call_center':
             if (!is_null($this->_oDB_call_center)) {
                 return $this->_oDB_call_center;
             }
             $sDSN = $arrConf['cadena_dsn'];
             $oDB = new paloDB($sDSN);
             if ($oDB->connStatus) {
                 $this->_errMsg = '(internal) Unable to create asterisk DB conn - ' . $oDB->errMsg;
                 die($this->_errMsg);
             }
             $this->_oDB_call_center = $oDB;
             return $this->_oDB_call_center;
             break;
         case 'ECCP':
             if (!is_null($this->_eccp)) {
                 return $this->_eccp;
             }
             $sUsernameECCP = 'agentconsole';
             $sPasswordECCP = 'agentconsole';
             // Verificar si existe la contraseña de ECCP, e insertar si necesario
             $dbConnCC = $this->_obtenerConexion('call_center');
             $md5_passwd = $dbConnCC->getFirstRowQuery('SELECT md5_password FROM eccp_authorized_clients WHERE username = ?', TRUE, array($sUsernameECCP));
             if (is_array($md5_passwd)) {
                 if (count($md5_passwd) <= 0) {
                     $dbConnCC->genQuery('INSERT INTO eccp_authorized_clients (username, md5_password) VALUES(?, md5(?))', array($sUsernameECCP, $sPasswordECCP));
                 }
             }
             $oECCP = new ECCP();
             // TODO: configurar credenciales
             $cr = $oECCP->connect("localhost", $sUsernameECCP, $sPasswordECCP);
             if (isset($cr->failure)) {
                 throw new ECCPUnauthorizedException(_tr('Failed to authenticate to ECCP') . ': ' . (string) $cr->failure->message);
             }
             if (!is_null($this->_agent)) {
                 $oECCP->setAgentNumber($this->_agent);
                 /* Privilegio de localhost - se puede recuperar la clave del
                  * agente sin tener que pedirla explícitamente */
                 $tupla = $dbConnCC->getFirstRowQuery("SELECT eccp_password FROM agent WHERE CONCAT(type,'/',number) = ? AND estatus='A'", FALSE, array($this->_agent));
                 if (!is_array($tupla)) {
                     throw new ECCPConnFailedException(_tr('Failed to retrieve agent password'));
                 }
                 if (count($tupla) <= 0) {
                     throw new ECCPUnauthorizedException(_tr('Agent not found'));
                 }
                 if (is_null($tupla[0])) {
                     throw new ECCPUnauthorizedException(_tr('Agent not authorized for ECCP - ECCP password not set'));
                 }
                 $oECCP->setAgentPass($tupla[0]);
                 // Filtrar los eventos sólo para el agente actual
                 $oECCP->filterbyagent();
             }
             $this->_eccp = $oECCP;
             return $this->_eccp;
             break;
     }
     return NULL;
 }
예제 #17
0
function getListMailbox()
{
    try {
        $userAccounts = array();
        $regexpUsuario = '/^[a-z0-9]+([\\._\\-]?[a-z0-9]+[_\\-]?)*@[a-z0-9]+([\\._\\-]?[a-z0-9]+)*(\\.[a-z0-9]{2,6})+$/';
        $arrDBConn = parseDSN(generarDSNSistema("asteriskuser", "elxpbx"));
        $conn = new PDO($arrDBConn["dsn"], $arrDBConn["user"], $arrDBConn["passwd"]);
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $sqlEmailInfo = <<<EMAIL_INFO
SELECT username FROM acl_user  
EMAIL_INFO;
        foreach ($conn->query($sqlEmailInfo) as $row) {
            if (preg_match($regexpUsuario, $row['username'])) {
                $userAccounts[] = $row['username'];
            }
        }
        return $userAccounts;
    } catch (PDOException $e) {
        wlog("ERR: failed to read account information - " . $e->getMessage() . "\n");
        return false;
    }
}
예제 #18
0
 function conectionAsteriskCDR()
 {
     $dsnAsteriskCDR = generarDSNSistema("asteriskuser", "asteriskcdrdb");
     $pDB = new paloDB($dsnAsteriskCDR);
     if (!empty($pDB->errMsg)) {
         return false;
     } else {
         return $pDB;
     }
 }
예제 #19
0
 function get_hint()
 {
     // We should always check the EXTUSER in case they logged into a device
     // but we will fall back to the old methond if $astman not open although
     // I'm pretty sure everything else will puke anyhow if not running
     //
     $error = "";
     $pDB = new paloDB(generarDSNSistema("asteriskuser", "elxpbx"));
     $astman = AsteriskManagerConnect($error);
     if ($astman != false) {
         //se obtine los dispositivos a los cuales la extension esta asociada
         $deviceDB = $astman->database_get("EXTUSER", $this->code . "/" . $this->exten . "/device");
         $device_arr = explode('&', $deviceDB);
         //se obtine como se marca a dichos dispositivos
         foreach ($device_arr as $device) {
             $tmp_dial = $astman->database_get("DEVICE", $this->code . "/" . $device . "/dial");
             if ($tmp_dial !== "ERROR") {
                 $dial[] = $tmp_dial;
             }
         }
     } else {
         $query = "SELECT dial from extension where exten=? and organization_domain=?";
         $arrayParam = array($this->exten, $this->domain);
         $results = $pDB->fetchTable($query, false, $arrayParam);
         //create an array of strings
         if (is_array($results)) {
             foreach ($results as $result) {
                 $dial[] = str_replace('ZAP', 'DAHDI', $result[0]);
             }
         }
     }
     //create a string with & delimiter
     if (isset($dial) && is_array($dial)) {
         $hint = implode($dial, "&");
     } else {
         $query = "SELECT dial from extension where exten=? and organization_domain=?";
         $results = $pDB->getFirstRowQuery($query, false, array($this->exten, $this->domain));
         if (isset($results[0])) {
             $hint = $results[0];
         } else {
             $hint = "";
         }
     }
     return $hint;
 }
예제 #20
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoMonitoring.class.php";
    include_once "libs/paloSantoACL.class.php";
    require_once "modules/{$module_name}/libs/JSON.php";
    require_once "modules/agent_console/getinfo.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    // Include language file for EN, then for local, and merge the two.
    include_once "modules/{$module_name}/lang/en.lang";
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        $arrLanEN = $arrLangModule;
        include_once $lang_file;
        $arrLangModule = array_merge($arrLanEN, $arrLangModule);
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    //conexion resource
    $arrConf['dsn_conn_database'] = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    $pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
    $pACL = new paloACL($pDBACL);
    $user = isset($_SESSION['elastix_user']) ? $_SESSION['elastix_user'] : "";
    //$extension = $pACL->getUserExtension($user);
    $extension = '6868';
    //$esAdministrador = $pACL->isUserAdministratorGroup($user);
    $esAdministrador = true;
    if ($extension == "" || is_null($extension)) {
        if ($esAdministrador) {
            $smarty->assign("mb_message", "<b>" . _tr("no_extension") . "</b>");
        } else {
            $smarty->assign("mb_message", "<b>" . _tr("contact_admin") . "</b>");
            return "";
        }
    }
    //actions
    $action = getAction();
    $content = "";
    switch ($action) {
        case 'delete':
            //$content = deleteRecord($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador);
            break;
        case 'download':
            $content = downloadFile($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador);
            break;
        case "display_record":
            $content = display_record($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador);
            break;
        case "viewNote":
            $content = viewNote();
            break;
        case "viewDelivery":
            $content = viewDelivery();
            break;
        default:
            $content = reportMonitoring($smarty, $module_name, $local_templates_dir, $pDB, $pACL, $arrConf, $user, $extension, $esAdministrador);
            break;
    }
    return $content;
}
예제 #21
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    require_once "modules/{$module_name}/libs/ringgroup.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    load_language_module($module_name);
    global $arrConf;
    global $arrConfModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    //folder path for custom templates
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    // DSN para consulta de cdrs
    $dsn = generarDSNSistema('asteriskuser', 'asteriskcdrdb');
    $pDB = new paloDB($dsn);
    $oCDR = new paloSantoCDR($pDB);
    $pDBACL = new paloDB($arrConf['elastix_dsn']['acl']);
    if (!empty($pDBACL->errMsg)) {
        return "ERROR DE DB: {$pDBACL->errMsg}";
    }
    $pACL = new paloACL($pDBACL);
    if (!empty($pACL->errMsg)) {
        return "ERROR DE ACL: {$pACL->errMsg}";
    }
    $exten = '6868';
    //$pACL->getUserExtension($_SESSION['elastix_user']);
    $isAdministrator = true;
    //$pACL->isUserAdministratorGroup($_SESSION['elastix_user']);
    if (is_null($exten) || $exten == "") {
        if (!$isAdministrator) {
            $smarty->assign('mb_message', "<b>" . _tr("contact_admin") . "</b>");
            return "";
        } else {
            $smarty->assign('mb_message', "<b>" . _tr("no_extension") . "</b>");
        }
    }
    // Para usuarios que no son administradores, se restringe a los CDR de la
    // propia extensión
    $sExtension = $isAdministrator ? '' : $pACL->getUserExtension($_SESSION['elastix_user']);
    // DSN para consulta de ringgroups
    $dsn_asterisk = generarDSNSistema('asteriskuser', 'asterisk');
    $pDB_asterisk = new paloDB($dsn_asterisk);
    $oRG = new RingGroup($pDB_asterisk);
    $dataRG = $oRG->getRingGroup();
    $dataRG[''] = _tr('(Any ringgroup)');
    // Cadenas estáticas en la plantilla
    $smarty->assign(array("Filter" => _tr("Filter")));
    $arrFormElements = array("date_start" => array("LABEL" => _tr("Start Date"), "REQUIRED" => "yes", "INPUT_TYPE" => "DATE", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^[[:digit:]]{1,2}[[:space:]]+[[:alnum:]]{3}[[:space:]]+[[:digit:]]{4}\$"), "date_end" => array("LABEL" => _tr("End Date"), "REQUIRED" => "yes", "INPUT_TYPE" => "DATE", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^[[:digit:]]{1,2}[[:space:]]+[[:alnum:]]{3}[[:space:]]+[[:digit:]]{4}\$"), "field_name" => array("LABEL" => _tr("Field Name"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => array("dst" => _tr("Destination"), "src" => _tr("Source"), "channel" => _tr("Src. Channel"), "accountcode" => _tr("Account Code"), "dstchannel" => _tr("Dst. Channel")), "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^(dst|src|channel|dstchannel|accountcode)\$"), "field_pattern" => array("LABEL" => _tr("Field"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "ereg", "VALIDATION_EXTRA_PARAM" => "^[\\*|[:alnum:]@_\\.,/\\-]+\$"), "status" => array("LABEL" => _tr("Status"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => array("ALL" => _tr("ALL"), "ANSWERED" => _tr("ANSWERED"), "BUSY" => _tr("BUSY"), "FAILED" => _tr("FAILED"), "NO ANSWER " => _tr("NO ANSWER")), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "ringgroup" => array("LABEL" => _tr("Ring Group"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $dataRG, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""));
    $oFilterForm = new paloForm($smarty, $arrFormElements);
    // Parámetros base y validación de parámetros
    $url = array('menu' => $module_name);
    $paramFiltroBase = $paramFiltro = array('date_start' => date("d M Y"), 'date_end' => date("d M Y"), 'field_name' => 'dst', 'field_pattern' => '', 'status' => 'ALL', 'ringgroup' => '');
    foreach (array_keys($paramFiltro) as $k) {
        if (!is_null(getParameter($k))) {
            $paramFiltro[$k] = getParameter($k);
        }
    }
    $oGrid = new paloSantoGrid($smarty);
    if ($paramFiltro['date_start'] === "") {
        $paramFiltro['date_start'] = " ";
    }
    if ($paramFiltro['date_end'] === "") {
        $paramFiltro['date_end'] = " ";
    }
    $valueFieldName = $arrFormElements['field_name']["INPUT_EXTRA_PARAM"][$paramFiltro['field_name']];
    $valueStatus = $arrFormElements['status']["INPUT_EXTRA_PARAM"][$paramFiltro['status']];
    $valueRingGRoup = $arrFormElements['ringgroup']["INPUT_EXTRA_PARAM"][$paramFiltro['ringgroup']];
    $oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Start Date") . " = " . $paramFiltro['date_start'] . ", " . _tr("End Date") . " = " . $paramFiltro['date_end'], $paramFiltro, array('date_start' => date("d M Y"), 'date_end' => date("d M Y")), true);
    $oGrid->addFilterControl(_tr("Filter applied: ") . $valueFieldName . " = " . $paramFiltro['field_pattern'], $paramFiltro, array('field_name' => "dst", 'field_pattern' => ""));
    $oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Status") . " = " . $valueStatus, $paramFiltro, array('status' => 'ALL'), true);
    $oGrid->addFilterControl(_tr("Filter applied: ") . _tr("Ring Group") . " = " . $valueRingGRoup, $paramFiltro, array('ringgroup' => ''));
    $htmlFilter = $oFilterForm->fetchForm("{$local_templates_dir}/filter.tpl", "", $paramFiltro);
    if (!$oFilterForm->validateForm($paramFiltro)) {
        $smarty->assign(array('mb_title' => _tr('Validation Error'), 'mb_message' => '<b>' . _tr('The following fields contain errors') . ':</b><br/>' . implode(', ', array_keys($oFilterForm->arrErroresValidacion))));
        $paramFiltro = $paramFiltroBase;
        unset($_POST['delete']);
        // Se aborta el intento de borrar CDRs, si había uno.
    }
    // Tradudir fechas a formato ISO para comparación y para API de CDRs.
    $url = array_merge($url, $paramFiltro);
    $paramFiltro['date_start'] = translateDate($paramFiltro['date_start']) . ' 00:00:00';
    $paramFiltro['date_end'] = translateDate($paramFiltro['date_end']) . ' 23:59:59';
    // Valores de filtrado que no se seleccionan mediante filtro
    if ($sExtension != '') {
        $paramFiltro['extension'] = $sExtension;
    }
    // Ejecutar el borrado, si se ha validado.
    if (isset($_POST['delete'])) {
        if ($isAdministrator) {
            if ($paramFiltro['date_start'] <= $paramFiltro['date_end']) {
                $r = $oCDR->borrarCDRs($paramFiltro);
                if (!$r) {
                    $smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => $oCDR->errMsg));
                }
            } else {
                $smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => _tr("Please End Date must be greater than Start Date")));
            }
        } else {
            $smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => _tr("Only administrators can delete CDRs")));
        }
    }
    $oGrid->setTitle(_tr("CDR Report"));
    $oGrid->pagingShow(true);
    // show paging section.
    $oGrid->enableExport();
    // enable export.
    $oGrid->setNameFile_Export(_tr("CDRReport"));
    $oGrid->setURL($url);
    //if($isAdministrator)
    //$oGrid->deleteList("Are you sure you wish to delete CDR(s) Report(s)?","delete",_tr("Delete"));
    $arrData = null;
    if (!isset($sExtension) || $sExtension == "" && !$isAdministrator) {
        $total = 0;
    } else {
        $total = $oCDR->contarCDRs($paramFiltro);
    }
    if ($oGrid->isExportAction()) {
        $limit = $total;
        $offset = 0;
        $arrColumns = array(_tr("Date"), _tr("Source"), _tr("Ring Group"), _tr("Destination"), _tr("Src. Channel"), _tr("Account Code"), _tr("Dst. Channel"), _tr("Status"), _tr("Duration"));
        $oGrid->setColumns($arrColumns);
        $arrResult = $oCDR->listarCDRs($paramFiltro, $limit, $offset);
        if (is_array($arrResult['cdrs']) && $total > 0) {
            foreach ($arrResult['cdrs'] as $key => $value) {
                $arrTmp[0] = date("d-m-Y H:i:s", strtotime($value[0]));
                $arrTmp[1] = $value[1];
                $arrTmp[2] = $value[11];
                $arrTmp[3] = $value[3];
                $arrTmp[4] = $value[9];
                $arrTmp[5] = $value[5];
                $iDuracion = $value[8];
                $iSec = $iDuracion % 60;
                $iDuracion = (int) (($iDuracion - $iSec) / 60);
                $iMin = $iDuracion % 60;
                $iDuracion = (int) (($iDuracion - $iMin) / 60);
                $sTiempo = "{$value[6]}s";
                if ($value[6] >= 60) {
                    if ($iDuracion > 0) {
                        $sTiempo .= " ({$iDuracion}h {$iMin}m {$iSec}s)";
                    } elseif ($iMin > 0) {
                        $sTiempo .= " ({$iMin}m {$iSec}s)";
                    }
                }
                $arrTmp[7] = $sTiempo;
                $arrData[] = $arrTmp;
            }
        }
        if (!is_array($arrResult)) {
            $smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => $oCDR->errMsg));
        }
    } else {
        $limit = 20;
        $oGrid->setLimit($limit);
        $oGrid->setTotal($total);
        $offset = $oGrid->calculateOffset();
        $arrResult = $oCDR->listarCDRs($paramFiltro, $limit, $offset);
        $arrColumns = array('STT', _tr("Date"), _tr("Source"), _tr("Destination"), _tr("Src. Channel"), _tr("Dst. Channel"), _tr("Status"), _tr("Duration"));
        $oGrid->setColumns($arrColumns);
        if (is_array($arrResult['cdrs']) && $total > 0) {
            $index = 0;
            foreach ($arrResult['cdrs'] as $key => $value) {
                $arrTmp[0] = $index;
                $arrTmp[1] = date("d-m-Y H:i:s", strtotime($value[0]));
                $arrTmp[2] = $value[1];
                $arrTmp[3] = $value[2];
                $arrTmp[4] = channel_lookup($pDB_asterisk, $value[3]);
                $arrTmp[5] = channel_lookup($pDB_asterisk, $value[4]);
                $arrTmp[6] = $value[5];
                $iDuracion = $value[8];
                $iSec = $iDuracion % 60;
                $iDuracion = (int) (($iDuracion - $iSec) / 60);
                $iMin = $iDuracion % 60;
                $iDuracion = (int) (($iDuracion - $iMin) / 60);
                $sTiempo = "{$value[8]}s";
                if ($value[7] >= 60) {
                    if ($iDuracion > 0) {
                        $sTiempo .= " ({$iDuracion}h {$iMin}m {$iSec}s)";
                    } elseif ($iMin > 0) {
                        $sTiempo .= " ({$iMin}m {$iSec}s)";
                    }
                }
                $arrTmp[7] = $sTiempo;
                $arrData[] = $arrTmp;
                $index++;
            }
        }
        if (!is_array($arrResult)) {
            $smarty->assign(array('mb_title' => _tr('ERROR'), 'mb_message' => $oCDR->errMsg));
        }
    }
    $oGrid->setData($arrData);
    $smarty->assign("SHOW", _tr("Show"));
    $oGrid->showFilter($htmlFilter);
    $content = $oGrid->fetchGrid();
    return $content;
}
예제 #22
0
 function _getAll_Trunk()
 {
     $dsn = generarDSNSistema('asteriskuser', 'asterisk');
     $pDBTrunk = new paloDB($dsn);
     $arrTrunks = getTrunks($pDBTrunk);
     $trunks = array();
     if (empty($arrTrunks)) {
         return $trunks;
     }
     if (is_array($arrTrunks) & count($arrTrunks) > 0) {
         foreach ($arrTrunks as $key => $trunk) {
             $tmp = explode("/", $trunk[1]);
             $trunks[] = $tmp[1];
         }
     }
     return $trunks;
 }
예제 #23
0
파일: action.php 프로젝트: hardikk/HNH
 private function _getConnection($sConn)
 {
     $arrConf['cadena_dsn'] = "mysql://*****:*****@localhost/call_center";
     switch ($sConn) {
         case 'asterisk':
             if (!is_null($this->_oDB_asterisk)) {
                 return $this->_oDB_asterisk;
             }
             $sDSN = generarDSNSistema('asteriskuser', 'asterisk');
             $oDB = new paloDB($sDSN);
             if ($oDB->connStatus) {
                 $this->_errMsg = '(internal) Unable to create asterisk DB conn - ' . $oDB->errMsg;
                 die($this->_errMsg);
             }
             $this->_oDB_asterisk = $oDB;
             return $this->_oDB_asterisk;
             break;
         case 'call_center':
             if (!is_null($this->_oDB_call_center)) {
                 return $this->_oDB_call_center;
             }
             $sDSN = $arrConf['cadena_dsn'];
             $oDB = new paloDB($sDSN);
             if ($oDB->connStatus) {
                 $this->_errMsg = '(internal) Unable to create asterisk DB conn - ' . $oDB->errMsg;
                 die($this->_errMsg);
             }
             $this->_oDB_asterisk = $oDB;
             return $this->_oDB_asterisk;
             break;
         case 'ECCP':
             if (!is_null($this->_eccp)) {
                 return $this->_eccp;
             }
             $sUsernameECCP = 'agentconsole';
             $sPasswordECCP = 'agentconsole';
             // Verificar si existe la contraseña de ECCP, e insertar si necesario
             $dbConnCC = $this->_getConnection('call_center');
             $md5_passwd = $dbConnCC->getFirstRowQuery('SELECT md5_password FROM eccp_authorized_clients WHERE username = ?', TRUE, array($sUsernameECCP));
             if (is_array($md5_passwd)) {
                 if (count($md5_passwd) <= 0) {
                     $dbConnCC->genQuery('INSERT INTO eccp_authorized_clients (username, md5_password) VALUES(?, md5(?))', array($sUsernameECCP, $sPasswordECCP));
                 }
             }
             $oECCP = new ECCP();
             // TODO: configurar credenciales
             $oECCP->connect("localhost", $sUsernameECCP, $sPasswordECCP);
             if (!is_null($this->_agent)) {
                 $oECCP->setAgentNumber($this->_agent);
                 // El siguiente código asume agente SIP/9000
                 if (preg_match('|^SIP/(\\d+)$|', $this->_agent, $regs)) {
                     $sAgentNumber = $regs[1];
                 } else {
                     $sAgentNumber = $this->_agent;
                 }
                 /* Privilegio de localhost - se puede recuperar la clave del
                  * agente sin tener que pedirla explícitamente */
                 $tupla = $dbConnCC->getFirstRowQuery('SELECT eccp_password FROM agent WHERE number = ? AND estatus="A"', FALSE, array($sAgentNumber));
                 if (!is_array($tupla)) {
                     throw new ECCPConnFailedException('Failed to retrieve agent password');
                 }
                 if (count($tupla) <= 0) {
                     throw new ECCPUnauthorizedException('Agent not found');
                 }
                 if (is_null($tupla[0])) {
                     throw new ECCPUnauthorizedException('Agent not authorized for ECCP - ECCP password not set');
                 }
                 $oECCP->setAgentPass($tupla[0]);
                 // Filtrar los eventos sólo para el agente actual
                 $oECCP->filterbyagent();
             }
             $this->_eccp = $oECCP;
             return $this->_eccp;
             break;
     }
     return NULL;
 }
예제 #24
0
function createFieldForm($goto, $destination, $faxes, $arrDetect, $music)
{
    $pDB = new paloDB(generarDSNSistema("asteriskuser", "elxpbx"));
    $oneToTen = generateOptionNum(1, 10);
    $oneToFifteen = generateOptionNum(1, 15);
    $twoToTen = generateOptionNum(2, 10);
    $arrLng = getLanguagePBX();
    $arrMusic = array("" => _tr("-don't music-"));
    foreach ($music as $key => $value) {
        $arrMusic[$key] = $value;
    }
    $arrFormElements = array("description" => array("LABEL" => _tr('Description'), "DESCRIPTION" => _tr("IN_description"), "REQUIRED" => "yes", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:200px"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "did_number" => array("LABEL" => _tr("DID Number"), "DESCRIPTION" => _tr("IN_didnumber"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:200px"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "cid_number" => array("LABEL" => _tr("Caller ID Number"), "DESCRIPTION" => _tr("IN_calleridnumber"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:200px"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "alertinfo" => array("LABEL" => _tr("Alert Info"), "DESCRIPTION" => _tr("IN_alertinfo"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:100px"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "cid_prefix" => array("LABEL" => _tr("CID Name Prefix"), "DESCRIPTION" => _tr("IN_cidnameprefix"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:100px"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "moh" => array("LABEL" => _tr("Music On Hold"), "DESCRIPTION" => _tr("IN_moh"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrMusic, "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""), "delay_answer" => array("LABEL" => _tr("Pause Before Answer"), "DESCRIPTION" => _tr("IN_pausebeforeanswer"), "REQUIRED" => "no", "INPUT_TYPE" => "TEXT", "INPUT_EXTRA_PARAM" => array("style" => "width:100px"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "max_attempt" => array("LABEL" => _tr("Max Attempts"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $oneToTen, "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""), "min_length" => array("LABEL" => _tr("Min Length"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $oneToFifteen, "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""), "language" => array("LABEL" => _tr("Language"), "DESCRIPTION" => _tr("IN_language"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrLng, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "goto" => array("LABEL" => _tr("Destine"), "DESCRIPTION" => _tr("IN_destiny"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $goto, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "destination" => array("LABEL" => _tr(""), "DESCRIPTION" => _tr("IN_destiny"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $destination, "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "primanager" => array("LABEL" => _tr("Privacy Manager"), "DESCRIPTION" => _tr("IN_privacymanager"), "REQUIRED" => "yes", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => array("yes" => _tr("Yes"), "no" => "No"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "ringing" => array("LABEL" => _tr("Signal RINGING"), "DESCRIPTION" => _tr("IN_signalring"), "REQUIRED" => "no", "INPUT_TYPE" => "CHECKBOX", "INPUT_EXTRA_PARAM" => "", "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "fax_time" => array("LABEL" => _tr("Fax Detection Time"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $oneToTen, "VALIDATION_TYPE" => "numeric", "VALIDATION_EXTRA_PARAM" => ""), "fax_type" => array("LABEL" => _tr("Fax Detection Type"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $arrDetect, "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""), "fax_detect" => array("LABEL" => _tr("Activate Fax Detection"), "DESCRIPTION" => _tr("IN_activatefaxdetection"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => array("yes" => _tr("Yes"), "no" => "No"), "VALIDATION_TYPE" => "text", "VALIDATION_EXTRA_PARAM" => ""), "fax_destiny" => array("LABEL" => _tr("Fax Extension"), "REQUIRED" => "no", "INPUT_TYPE" => "SELECT", "INPUT_EXTRA_PARAM" => $faxes, "VALIDATION_TYPE" => "", "VALIDATION_EXTRA_PARAM" => ""));
    return $arrFormElements;
}
예제 #25
0
파일: index.php 프로젝트: hardikk/HNH
function _moduleContent(&$smarty, $module_name)
{
    //include elastix framework
    include_once "libs/paloSantoGrid.class.php";
    include_once "libs/paloSantoValidar.class.php";
    include_once "libs/paloSantoConfig.class.php";
    include_once "libs/misc.lib.php";
    include_once "libs/paloSantoForm.class.php";
    include_once "libs/paloSantoACL.class.php";
    //include module files
    include_once "modules/{$module_name}/configs/default.conf.php";
    include_once "modules/{$module_name}/libs/paloSantoAdressBook.class.php";
    //include file language agree to elastix configuration
    //if file language not exists, then include language by default (en)
    $lang = get_language();
    $base_dir = dirname($_SERVER['SCRIPT_FILENAME']);
    $lang_file = "modules/{$module_name}/lang/{$lang}.lang";
    if (file_exists("{$base_dir}/{$lang_file}")) {
        include_once "{$lang_file}";
    } else {
        include_once "modules/{$module_name}/lang/en.lang";
    }
    //global variables
    global $arrConf;
    global $arrConfModule;
    global $arrLang;
    global $arrLangModule;
    $arrConf = array_merge($arrConf, $arrConfModule);
    $arrLang = array_merge($arrLang, $arrLangModule);
    $smarty->assign('MODULE_NAME', $module_name);
    //folder path for custom templates
    $templates_dir = isset($arrConf['templates_dir']) ? $arrConf['templates_dir'] : 'themes';
    $local_templates_dir = "{$base_dir}/modules/{$module_name}/" . $templates_dir . '/' . $arrConf['theme'];
    $pConfig = new paloConfig("/etc", "amportal.conf", "=", "[[:space:]]*=[[:space:]]*");
    $arrConfig = $pConfig->leer_configuracion(false);
    $dsn_agi_manager['password'] = $arrConfig['AMPMGRPASS']['valor'];
    $dsn_agi_manager['host'] = $arrConfig['AMPDBHOST']['valor'];
    $dsn_agi_manager['user'] = '******';
    //solo para obtener los devices (extensiones) creadas.
    $dsnAsterisk = generarDSNSistema('asteriskuser', 'call_center');
    $pDB = new paloDB($arrConf['dsn_conn_database']);
    // address_book
    $pDB_2 = new paloDB($arrConf['dsn_conn_database2']);
    // acl
    $pDB_customer = new paloDB($arrConf['cadena_dsn']);
    // address_book
    $action = getAction();
    $content = "";
    switch ($action) {
        case "new":
            $content = new_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "cancel":
            header("Location: ?menu={$module_name}");
            break;
        case "commit":
            $content = save_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk, true);
            break;
        case "edit":
            $content = view_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk, true);
            break;
        case "show":
            $content = view_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "save":
            $content = save_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "delete":
            $content = deleteContact($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "call2phone":
            $content = call2phone($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        case "transfer_call":
            $content = transferCALL($smarty, $module_name, $local_templates_dir, $pDB, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
        default:
            $content = report_adress_book($smarty, $module_name, $local_templates_dir, $pDB_customer, $pDB_2, $arrLang, $arrConf, $dsn_agi_manager, $dsnAsterisk);
            break;
    }
    return $content;
}
#!/usr/bin/php
<?php 
$elxPath = "/usr/share/elastix";
ini_set('include_path', "{$elxPath}:" . ini_get('include_path'));
require_once "libs/paloSantoDB.class.php";
require_once 'libs/misc.lib.php';
$arrDBConn = generarDSNSistema("asteriskuser", "elxpbx");
global $pDB;
$pDB = new paloDB($arrDBConn);
//coneccion a la base usada en el sistema
if ($pDB === false) {
    wlog(' DATABASE ERROR CONNECTION ' . $pDB->errMsg);
}
// Para silenciar avisos de fecha/hora
if (function_exists('date_default_timezone_get')) {
    load_default_timezone();
}
$arrLogs = array(0 => "/var/log/maillog", 1 => "/var/log/maillog.1", 2 => "/var/log/maillog.2", 3 => "/var/log/maillog.3");
$debug = true;
$argError = false;
$date = date("Y/m/d/H");
$date = explode("/", $date);
$argYear = $date[0];
$argMonth = $date[1];
$argDay = $date[2];
$argHour = $date[3];
wlog("The datetime is {$argYear}/{$argMonth}/{$argDay} {$argHour}" . ":00.\n");
// TODO: A quick check to si if the date is older than the log files. It could save time searching the logs contents one by one.
// TODO: Actually the datetime passed as argument is also being returned in the output. But its value is not accurate. I need to remove this key.
/* ====== MAIN PROGRAM ====== */
$arrStats = array();
예제 #27
0
 /**
  * Procedimiento para obtener los datos de la extension usada por el usuario dentro de
    asterisk
  * @param int $idUser Id del usuario del que se quiere obtener los datos de su extension
  * @return array $ext Devuelte un arreglo donde esta el numero de la extension, la tegnologia usada y el nombre del dispositivo usado
 */
 function getExtUser($id_user)
 {
     $arr_result2 = array();
     $pDB2 = new paloDB(generarDSNSistema("asteriskuser", "elxpbx"));
     if (!preg_match('/^[[:digit:]]+$/', "{$id_user}")) {
         $this->errMsg = _tr("User ID must be numeric");
     } else {
         $query = "SELECT a.extension, (Select domain from organization o where o.id=g.id_organization) FROM acl_user as a JOIN  acl_group as g on a.id_group=g.id where a.id=?";
         $arr_result = $this->_DB->getFirstRowQuery($query, false, array($id_user));
         if ($arr_result === false) {
             $this->errMsg = _tr("Can't get extension user") . $this->_DB->errMsg;
         } elseif (count($arr_result) == 0) {
             $this->errMsg = _tr("User doesn't have a associated extension");
         } else {
             $query2 = "SELECT id, exten, organization_domain, tech, dial, voicemail, device FROM extension where exten=? and  organization_domain=?";
             $arr_result2 = $pDB2->getFirstRowQuery($query2, true, array($arr_result[0], $arr_result[1]));
             if (!is_array($arr_result2) || count($arr_result2) == 0) {
                 $this->errMsg = _tr("Can't get extension user") . $pDB2->errMsg;
             }
         }
     }
     return $arr_result2;
 }
예제 #28
0
파일: core.class.php 프로젝트: hardikk/HNH
 /**
  * Functional point that sets the option do not Disturb to the extension of the authenticated user
  *
  * @param   boolean     $doNotDisturb   true the do not Disturb option will be set to on, false it will be set to off
  * @return  boolean     True if the do not Disturb option was set, or false if an error exists
  */
 public function setDoNotDisturb($doNotDisturb)
 {
     global $root;
     if (!isset($doNotDisturb)) {
         $this->errMsg["fc"] = 'ERROR';
         $this->errMsg["fm"] = 'Parameter Error';
         $this->errMsg["fd"] = 'The parameter doNotDisturb has not been sent';
         $this->errMsg["cn"] = get_class($this);
         return false;
     }
     $extension = $this->_leerExtension();
     $pDB = new paloDB(generarDSNSistema('asteriskuser', 'asterisk', $root . "/"));
     $pMyExtension = new paloSantoMyExtension($pDB);
     if (is_null($extension)) {
         return false;
     }
     if ($doNotDisturb) {
         $enableDND = "on";
     } else {
         $enableDND = "off";
     }
     $statusDND = $pMyExtension->setConfig_DoNotDisturb($enableDND, $extension);
     if (!$statusDND) {
         $this->errMsg["fc"] = 'ERROR';
         $this->errMsg["fm"] = 'Error Processing Do Not Disturb';
         $this->errMsg["fd"] = 'The Do Not Disturb state could not be set';
         $this->errMsg["cn"] = get_class($this);
         return false;
     }
     return true;
 }