How to force unembedded pbx interface instead?

jedaustin

Joined
Dec 30, 2008
Messages
34
Likes
0
Points
6
#1
I think the work that has been done on Elastix is outstanding with one minor exception:
I see no need whatsoever for your custom interface for the pbx configuration.
Minor upgrades, installing needed modules, etc break your interface very easily.
For example: I use voicepulse. They have a freepbx module to configure everything and it works great. The problem in Elastix is that as soon as I install it your interface breaks (I had to turn on errors to see this at all.. otherwise I just got a blank page):
Code:
Notice: Undefined variable: skip_astman in /var/www/html/admin/header.php on line 117

Warning: require_once(modules/core/functions.inc.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/html/admin/modules/voicepulse/functions.inc.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'modules/core/functions.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/admin/modules/voicepulse/functions.inc.php on line 2
Their php is compiled so I can't do anything to it to make it work with your custom interface.

The freepbx interface still works just fine (https://serverip/admin/index.php).
Is there a simple way to just put /admin/index.php in a frameset instead of having your custom interface that breaks easily? I'd recommend that in future releases you just use Freepbx's interface in a frame for the 'PBX Configuration' page.
 

jedaustin

Joined
Dec 30, 2008
Messages
34
Likes
0
Points
6
#2
It probably isn't the cleanest way to do it but I chopped almost all of the code out of the /var/www/html/modules/pbxadmin/index.php file
so that I only get the unembedded freepbx link on the PBX Configuration page.
It's preferable over a 'white screen of death'.

I don't see the value of recreating the FreePBX interface in Elastix;
yes it makes it look like the rest of the interface BUT it is way too easy to break
and must be a total pain to maintain considering how fast FreePBX moves.
Just wrap it like you do tigercrm, openfire, etc and be done with it!
JD

Code:
<?php
function _moduleContent(&$smarty, $module_name)
{
    require_once "libs/misc.lib.php";
    $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 $arrLang;
    global $arrLangModule;
    $arrLang = array_merge($arrLang,$arrLangModule);

    $salida="";
    $fromElastixAdminPBX=1;
    $headerFreePBX="
    <link href='/modules/pbxadmin/themes/default/mainstyle.css' rel='stylesheet' type='text/css'>
        
    <script type='text/javascript' src='/modules/pbxadmin/js/script.js.php'></script>
    <script type='text/javascript' src='/modules/pbxadmin/js/script.legacy.js'></script>
    <script type='text/javascript' src='/modules/pbxadmin/js/libfreepbx.javascripts.js'></script>
    ";

    $dir_base = "/var/www/html/modules/$module_name/themes";
    $local_templates_dir=(file_exists("$dir_base/".$arrConf['theme']))?"$dir_base/".$arrConf['theme']:"$dir_base/default";

    // Obtengo el {$HEADER} anterior y le agrego lo nuevo
    $headerNuevo = @$smarty->fetch("HEADER");
    $headerNuevo .= $headerFreePBX;
    $smarty->assign("HEADER", $headerNuevo);

    // Obtengo el {$BODYPARAMS} anterior y le agrego lo nuevo
    $bodyParams = @$smarty->fetch("BODYPARAMS");
    $bodyParams .= "onload='body_loaded();'";
    $smarty->assign("BODYPARAMS", $bodyParams);

    $_SESSION["AMP_user"]=NULL;
    /* benchmark */
    function microtime_float() { list($usec,$sec) = explode(' ',microtime()); return ((float)$usec+(float)$sec); }
    $benchmark_starttime = microtime_float();
    /*************/

    $type = isset($_REQUEST['type'])?$_REQUEST['type']:'setup';
    // Ojo, modifique ligeramente la sgte. linea para que la opcion por omision sea extensions
    if(isset($_REQUEST['display'])) {
        $display = $_REQUEST['display'];
    } else {
        $display = 'extensions';
        $_REQUEST['display'] = 'extensions';
    }
    $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']:null;
    $skip = isset($_REQUEST['skip'])?$_REQUEST['skip']:0;
    $action = isset($_REQUEST['action'])?$_REQUEST['action']:null;
    $quietmode = isset($_REQUEST['quietmode'])?$_REQUEST['quietmode']:'';

    // determine module type to show, default to 'setup'
    $type_names = array(
        'tool'=>'Tools',
        'setup'=>'Setup',
        'cdrcost'=>'Call Cost',
    );

    /*************************************************************/
    /* Este bloque pertenece en su mayoria al archivo header.php */
    /* ya que no estaban registrando ciertas variables globales; */
    /* asi que lo repito aqui y evito parchar dicho archivo y    */
    /* otros mas.                                                */
    /*************************************************************/
    // include base functions
    require_once('/var/www/html/admin/functions.inc.php');
    require_once('/var/www/html/admin/common/php-asmanager.php');

    // Hack to avoid patching admin/functions.inc.php
    $GLOBALS['amp_conf_defaults'] = $amp_conf_defaults;

    // get settings
    $amp_conf       = parse_amportal_conf("/etc/amportal.conf");
    $asterisk_conf  = parse_asterisk_conf($amp_conf["ASTETCDIR"]."/asterisk.conf");
    $astman         = new AGI_AsteriskManager();

    // attempt to connect to asterisk manager proxy
    if (!isset($amp_conf["ASTMANAGERPROXYPORT"]) || !$res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPROXYPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
            // attempt to connect directly to asterisk, if no proxy or if proxy failed
            if (!$res = $astman->connect("127.0.0.1:".$amp_conf["ASTMANAGERPORT"], $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
                    // couldn't connect at all
                    unset( $astman );
            }
    }

    $GLOBALS['amp_conf'] = $amp_conf;
    $GLOBALS['asterisk_conf']  = $asterisk_conf;
    $GLOBALS['astman'] = $astman;

    // Hack to avoid patching common/db_connect.php
    // I suppose the used database is mysql
    require_once('DB.php'); //PEAR must be installed
    $db_user = $amp_conf["AMPDBUSER"];
    $db_pass = $amp_conf["AMPDBPASS"];
    $db_host = $amp_conf["AMPDBHOST"];
    $db_name = $amp_conf["AMPDBNAME"];

    $datasource = 'mysql://'.$db_user.':'.$db_pass.'@'.$db_host.'/'.$db_name;
    $db = DB::connect($datasource); // attempt connection

    $GLOBALS['db'] = $db;

    if (!isset($_SESSION['AMP_user'])) {
        $_SESSION['AMP_user'] = new ampuser($amp_conf['AMPDBUSER']);
        $_SESSION['AMP_user']->setAdmin();
    }

    // Requiring header.php
    include('/var/www/html/admin/header.php');

    // The next block is to fix a music on hold issue
    $category = strtr(isset($_REQUEST['category'])?$_REQUEST['category']:''," ./\"\'\`", "------");
    if ($category == null) $category = 'default';

    if ($category == "default")
        $path_to_dir = $asterisk_conf['astvarlibdir']."/mohmp3"; //path to directory u want to read.
    else
        $path_to_dir = $asterisk_conf['astvarlibdir']."/mohmp3/$category"; //path to directory u want to read.

    $GLOBALS['path_to_dir'] = $path_to_dir;

    /*************************************************************/
    /* Fin del bloque                                            */
    /*************************************************************/

    $GLOBALS['title'] = isset($title)?$title:'';
    $GLOBALS['type']  = isset($type)?$type:'';
    $GLOBALS['display'] = isset($display)?$display:'';
    $GLOBALS['extdisplay'] = isset($extdisplay)?$extdisplay:'';
    $GLOBALS['skip'] = isset($skip)?$skip:'';
    $GLOBALS['action'] = isset($action)?$action:'';
    $GLOBALS['quietmode'] = isset($quietmode)?$quietmode:'';
    $GLOBALS['message'] = isset($message)?$message:'';
    $GLOBALS['fpbx_menu'] = isset($fpbx_menu)?$fpbx_menu:'';
    $GLOBALS['recordings_save_path'] = "/tmp/";

    //This _guielement_tabindex and _guielement_formfields fixed bug in extensions freePBX embedded
    $GLOBALS['_guielement_tabindex'] = 1;
    $GLOBALS['_guielement_formfields'] = 0;
    //This $fc_save var fixed bug in System Recording en freePBX embedeed 
    global $fc_save;
    global $fc_check; 



    $smarty->assign("Unembedded_freePBX", $arrLang['Unembedded freePBX']);
    $smarty->assign("htmlFPBX", $htmlFPBX);
    $salida .= $smarty->fetch("$local_templates_dir/main.tpl");
    return $salida;
}
?>
 

jeths

Joined
Mar 9, 2010
Messages
1
Likes
0
Points
0
#3
Hi there, very newbie here and am not sure if I posted it on the right topic. What I want is to make an interface for elastix with some other programs included. So in my menu, I would like to include the link the elastix PBX but when I open the link https://elastix-ip/modules/pbxadmin/index.php nothing is displayed. I dont want to use the link on the admin page for freepbx (https://elastix-ip/admin/index.php) coz the PBX page on elastix (https://elastix-ip/?menu=pbxconfig) is much much better in terms of design and color. I made a new folder within /var/www/html/myinterface/ and supposedly i will have my pages here which will connect to other programs/pages when clicked in the menu options. What link should I use to connect to PBX? I mean what filename and path should I use?

Please help....

Thanks
 

rollinsolo

Joined
Feb 11, 2009
Messages
279
Likes
0
Points
0
#4
Or even easier you can just download FreePBX and use that.
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,887
Members
17,565
Latest member
omarmenichetti
Top