From: drowe67 Date: Sat, 1 Mar 2008 23:18:58 +0000 (+0000) Subject: fixed a few minor bugs, updated README X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=ef1e84c6dc051b10f4f0ad4f4643392fe7f1a73c;p=freetel-svn-tracking.git fixed a few minor bugs, updated README git-svn-id: https://svn.code.sf.net/p/freetel/code@2 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/freepbx-sandbox/Makefile b/freepbx-sandbox/Makefile index c655140d..03d3e8ae 100644 --- a/freepbx-sandbox/Makefile +++ b/freepbx-sandbox/Makefile @@ -83,7 +83,7 @@ sqlite: $(SQLITE_DIR)/.built $(ROOT)/lib/php/.db-installed: pear install DB - cd $(ROOT)/lib/php/DB; patch -p1 < $(TOP_DIR)/patch/common.patch + cd $(ROOT)/lib/php/DB; patch -p1 < $(TOPDIR)/patch/common.patch touch $(ROOT)/lib/php/.db-installed pear-db: $(ROOT)/lib/php/.db-installed @@ -371,6 +371,13 @@ freepbx-make-patch: $(AROOT)/admin/cdr/lib/defines.php \ >> patch/freepbx.patch + # trap missing cdr table error in Reports menu + + -diff -uN \ + $(AO)/amp_conf/htdocs/admin/cdr/lib/Class.Table.php \ + $(AROOT)/admin/cdr/lib/Class.Table.php \ + >> patch/freepbx.patch + # typo in newinstall.sqlite3.sql -diff -uN \ diff --git a/freepbx-sandbox/README.txt b/freepbx-sandbox/README.txt index e4a5e007..7f63c316 100644 --- a/freepbx-sandbox/README.txt +++ b/freepbx-sandbox/README.txt @@ -5,13 +5,15 @@ Introduction ------------ This directory contains a "sandbox" type development environment for -FreePBX using sqlite3. +FreePBX using sqlite3. It was used to develop patches against FreePBX +2.4.0 to progress sqlite3 support. The Makefile builds (almost) everything you need for FreePBX (web server, php etc) from scratch and runs it in a "sandbox" environment. The notable exception is that it doesn't build Asterisk (yet). -FreePBX is configured to use lighttpd and and sqlite3. +FreePBX is configured to use lighttpd (easier than building Apache) +and and sqlite3. All the files environment are confined to this directory, i.e. you mostly (except for Asterisk) don't need to mess with your PC's @@ -19,50 +21,76 @@ configuration. Inspired by buildroot. Used to model and test configuration for Blackfin port, but may be useful for general FreePBX development. +FreePBX Sqlite3 Status +---------------------- + +Most of the screens (Admin/Reports/Recording) present OK but have not +been extensively tested. The Flash Panel isn't working/hasn't been +tested. Reports/Recording is awaiting sqlite3 CDR support (e.g. in +Asterisk 1.6) for further testing. The amp_conf installer works OK. + +I have run some basic tests such as adding an extension/route/trunk +and it seems to work OK. + +This FreePBX/Sqlite3 development has been performed on a laptop +running Ubuntu (no zaptel hardware) with Asterisk 1.6 and FreePBX +2.4.0. + Motivation ---------- 1/ When I first tried to manually install FreePBX I had a lot of problems installing all the apps I needed, especially as I was new to -PHP/SQL/FreePBX. So I thought automating the installation might be a -good idea to save others some manual install pain. +PHP/SQL/FreePBX. So I thought about automating the installation (from +source). 2/ It may allow multiple installations of FreePBX, or for example lets you use a different PHP version to currently installed on your system. +Asterisk would also need to be sandboxed for this to work. 3/ It doesn't mess with your root filesystem. 4/ Let me collect all the code I needed in one dir tree, making source control easier. -5/ Stepping stone for Blackfin port. +5/ Stepping stone for a Blackfin port. Building and Running FreePBX-sqlite3 Sandbox -------------------------------------------- Building: -1/ Install Asterisk -2/ make -3/ You will eventually get prompted for your root passwd +1/ Install Asterisk 1.4.x and start Asterisk. + +2/ Build freepbx-sandbox + +[your home]$ svn co \ + https://freetel.svn.sourceforge.net/svnroot/freetel/freepbx-sandbox \ + freepbx-sandbox +[your home]$ cd freepbx +[freepbx-sandbox]$ make + +3/ You will eventually get prompted for your root passwd - this is + required for several stages of the installation. Running: 1/ Start the web server: - [freepbx-sandbox]$ sudo root/sbin/lighttpd -D -f root/etc/lighttpd.conf -2/ Start Asterisk: + [freepbx-sandbox]$ sudo ./root/sbin/lighttpd -D -f root/etc/lighttpd.conf +2/ If not already running start Asterisk: [freepbx-sandbox]$ sudo asterisk 3/ Point your browser at locahost Manual Installation of FreePBX with sqlite3 ------------------------------------------- -Here are some instructions for a regular (non-sandbox) installation of +Here is a rough guide for a regular (non-sandbox) installation of FreePBX with sqlite3. The Makefile automates FreePBX/sqlite3 installation in a sandbox -environment, use it as a reference for manual installation. See also -sqlite.readme in the FreePBX tar ball. +environment, use it as a reference for manual installation as I may +have missed a step in the steps below. See also sqlite.readme in the +FreePBX tar ball. 1/ Install and test a web server with PHP 5. @@ -75,14 +103,17 @@ sqlite.readme in the FreePBX tar ball. + cp files/sqlite3.php /your/php/path/DB/sqlite3.php. This is an updated version of the sqlite3.php file that comes with sqlite3-0.5 + make sure you install sqlite.so and update php.ini so it can find it. + + optional: see Test 2 in the next section 5/ tar xvzf freepbx-2.4.0.tar.gz -6/ Edit amportal.conf, cp to /etc (makes installer ask less questions) +6/ Edit amportal.conf for sqlite (see sqlite.readme), manually cp to + /etc (that way installer ask less questions). -7/ Create sqlite database (see sqlite.readme), create cdr database - file using 'touch /var/asteriskcdr.db' (to prevent recording screen - choking). +7/ Create sqlite database (see sqlite.readme). Create a dummy cdr + database file using 'touch /var/asteriskcdr.db' (this last step + prevents reports/recording screens choking in the absence of + Asterisk sqlite3 CDR records). 8/ Apply patch/freepbx.patch to freepbx-2.4.0 directory. @@ -122,10 +153,10 @@ sqlite3.php DB/PEAR backend is also required (files dir). 5/ Xdebug generates trace files in your /tmp directory. Useful to determine what went wrong. Also keep an eye on the lighttpd log. -6/ I used a laptop running Ubuntu for these tests - Asterisk had no -analog hardware installed so I didn't install Zaptel. Asterisk was -compiled in another directory in the usual way: ./configure && make && -sudo make install. +6/ I used a laptop running Ubuntu and Asterisk 1.4.4 for these tests - +Asterisk had no analog hardware installed so I didn't install Zaptel. +Asterisk was compiled in another directory in the usual way: +./configure && make && sudo make install. 7/ In files/testdb.php is a simple test script for exercising sqlite3 PEAR/DB support - useful for debugging any sqlite3 problems you might @@ -138,6 +169,20 @@ Suggested FreePBX Changes (for PEAR/DB). Patches are explained at the end of Makefile (freepbx-make-patch target). + Please note that some of the patches contain some hard-coded + information (e.g. changed paths), for example: + + admin/cdr/lib/defines.php (DBNAME & DBTYPE lines) + install_amp (AMP_CONF) + retrieve_conf (AMP_CONF) + + This is a consequence of the sandbox method I am using, and in some + cases current FreePBX sqlite3 support (e.g. the Asterisk CDR + database is hard coded in several places rather than being set in + amportal.conf). If checking into FreePBX source control this part + of the patch should not be applied. I will try and work out a + better way to generate patches in future. + 2/ It might be better to store the CDR database parameters in amportal.conf rather than hard coding them in recordings/includes/main.conf.php ($ASTERISKCDR_DBFILE, @@ -155,5 +200,19 @@ Suggested FreePBX Changes TODO ---- -1/ Try to get Asterisk 1.6 CDR working with sqlite3, see if recording -menus come alive, or at least bomb out in a useful way! +1/ Try to get Asterisk 1.6 CDR working with sqlite3, so we can further + develop the Reports/recordings menus. + +2/ Bunch of warnings from the web server I haven't worked out yet: + + a) when saving a new extension: + + + 2008-03-02 08:14:41: (mod_cgi.c.1231) cgi died ? + + b) lots of this sort of thing: + + + PHP Notice: Undefined offset: 2 in + /home/david/freepbx-sandbox/root/www/admin/modules/core/functions.inc.php + on line 2946 diff --git a/freepbx-sandbox/patch/common.patch b/freepbx-sandbox/patch/common.patch index 9ce4c051..0f1a9010 100644 --- a/freepbx-sandbox/patch/common.patch +++ b/freepbx-sandbox/patch/common.patch @@ -4,7 +4,7 @@ return $ret; } else { $this->last_parameters = array(); -+ $this->last_query = $query; ++ $this->last_query = $query; $result = $this->simpleQuery($query); if ($result === DB_OK || DB::isError($result)) { return $result; diff --git a/freepbx-sandbox/patch/freepbx.patch b/freepbx-sandbox/patch/freepbx.patch index 563d3b72..f3335470 100644 --- a/freepbx-sandbox/patch/freepbx.patch +++ b/freepbx-sandbox/patch/freepbx.patch @@ -1,5 +1,5 @@ --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/htdocs/admin/modules/core/functions.inc.php 2008-02-10 05:16:02.000000000 +1030 -+++ /home/david/freepbx-sandbox/root/www/admin/modules/core/functions.inc.php 2008-02-29 20:39:27.000000000 +1030 ++++ /home/david/freepbx-sandbox/root/www/admin/modules/core/functions.inc.php 2008-03-02 08:13:35.000000000 +1030 @@ -2886,6 +2886,7 @@ // TODO: sqlite work arround - diego // TODO: WILL NOT WORK, need to remove the usage of SUBSTRING @@ -22,7 +22,7 @@ else { --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/htdocs/admin/common/db_connect.php 2007-09-09 20:41:11.000000000 +0930 -+++ /home/david/freepbx-sandbox/root/www/admin/common/db_connect.php 2008-03-01 09:23:08.000000000 +1030 ++++ /home/david/freepbx-sandbox/root/www/admin/common/db_connect.php 2008-03-02 08:13:34.000000000 +1030 @@ -52,7 +52,11 @@ } @@ -37,7 +37,7 @@ default: --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/htdocs/recordings/includes/database.php 2006-05-01 01:05:45.000000000 +0930 -+++ /home/david/freepbx-sandbox/root/www/recordings/includes/database.php 2008-02-29 20:39:27.000000000 +1030 ++++ /home/david/freepbx-sandbox/root/www/recordings/includes/database.php 2008-03-02 08:13:34.000000000 +1030 @@ -43,18 +43,25 @@ // connect string if ($dbfile) { @@ -72,7 +72,7 @@ // attempt connection $dbh = DB::connect($datasource,$options); --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/htdocs/admin/cdr/lib/defines.php 2006-09-26 20:48:51.000000000 +0930 -+++ /home/david/freepbx-sandbox/root/www/admin/cdr/lib/defines.php 2008-03-01 09:26:19.000000000 +1030 ++++ /home/david/freepbx-sandbox/root/www/admin/cdr/lib/defines.php 2008-03-02 08:13:35.000000000 +1030 @@ -12,7 +12,7 @@ return $conf; } @@ -137,8 +137,23 @@ if(DB::isError($db)) { +--- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/htdocs/admin/cdr/lib/Class.Table.php 2006-09-26 20:48:51.000000000 +0930 ++++ /home/david/freepbx-sandbox/root/www/admin/cdr/lib/Class.Table.php 2008-03-02 09:06:05.000000000 +1030 +@@ -80,8 +80,11 @@ + + //$res=DbExec($link, $QUERY); + $res = $DBHandle -> query($QUERY); ++ if(DB::IsError($res)) { ++ print($res->getMessage()); ++ print("
Is Asterisk CDR database initialised?"); ++ } + +- + $num = $res -> numRows(); + + --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//SQL/newinstall.sqlite3.sql 2008-02-11 14:27:53.000000000 +1030 -+++ /home/david/freepbx-sandbox/freepbx-2.4.0//SQL/newinstall.sqlite3.sql 2008-02-29 19:21:08.000000000 +1030 ++++ /home/david/freepbx-sandbox/freepbx-2.4.0//SQL/newinstall.sqlite3.sql 2008-03-02 07:24:10.000000000 +1030 @@ -323,7 +323,7 @@ -- Dumping data for table `modules` -- @@ -149,7 +164,7 @@ `id` varchar(20) NOT NULL default 'xml', `time` int(11) NOT NULL default '0', --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//install_amp 2008-01-28 04:22:58.000000000 +1030 -+++ /home/david/freepbx-sandbox/freepbx-2.4.0//install_amp 2008-02-29 19:34:47.000000000 +1030 ++++ /home/david/freepbx-sandbox/freepbx-2.4.0//install_amp 2008-03-02 07:24:10.000000000 +1030 @@ -4,7 +4,7 @@ require_once ("libfreepbx.install.php"); @@ -176,7 +191,7 @@ // we still support older configurations, and fall back --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/htdocs/admin/modules/recordings/install.php 2007-08-08 14:34:58.000000000 +0930 -+++ /home/david/freepbx-sandbox/freepbx-2.4.0//amp_conf/htdocs/admin/modules/recordings/install.php 2008-02-29 20:23:06.000000000 +1030 ++++ /home/david/freepbx-sandbox/freepbx-2.4.0//amp_conf/htdocs/admin/modules/recordings/install.php 2008-03-02 07:24:10.000000000 +1030 @@ -22,7 +22,14 @@ unset($fcc); @@ -228,7 +243,7 @@ ?> --- /home/david/freepbx-sandbox/freepbx-2.4.0-orig//amp_conf/bin/retrieve_conf 2007-12-15 08:18:39.000000000 +1030 -+++ /home/david/freepbx-sandbox/freepbx-2.4.0//amp_conf/bin/retrieve_conf 2008-03-01 13:42:55.000000000 +1030 ++++ /home/david/freepbx-sandbox/freepbx-2.4.0//amp_conf/bin/retrieve_conf 2008-03-02 08:08:47.000000000 +1030 @@ -10,7 +10,7 @@ ini_set('error_reporting', E_ALL & ~E_NOTICE); @@ -246,7 +261,7 @@ -exec($script); +if ($amp_conf["AMPDBENGINE"] != 'sqlite3') { + // sqlite3 not supported just yet -+ if ($script = $amp_conf['AMPBIN'].'/retrieve_op_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); ++ $script = $amp_conf['AMPBIN'].'/retrieve_op_conf_from_mysql.pl '.$amportalconf.' '.rtrim($asterisk_conf['astetcdir'],DIRECTORY_SEPARATOR); + exec($script); +}