[Pkg-voip-commits] r3699 - in freepbx/trunk/debian: . patches sqlite3
elcuco-guest at alioth.debian.org
elcuco-guest at alioth.debian.org
Tue Jun 26 13:59:27 UTC 2007
Author: elcuco-guest
Date: 2007-06-26 13:59:27 +0000 (Tue, 26 Jun 2007)
New Revision: 3699
Added:
freepbx/trunk/debian/patches/_add-sqlite3-support.dpatch
freepbx/trunk/debian/patches/_fix-module_admin.dpatch
freepbx/trunk/debian/patches/_fix-open-or-die.dpatch
freepbx/trunk/debian/patches/_quiet-retrieve.dpatch
Removed:
freepbx/trunk/debian/patches/add-sqlite3-support.dpatch
freepbx/trunk/debian/patches/fix-module_admin.dpatch
freepbx/trunk/debian/patches/fix-open-or-die.dpatch
freepbx/trunk/debian/patches/quiet-retrieve.dpatch
freepbx/trunk/debian/sqlite3/newinstall.sqlite3.sql
Modified:
freepbx/trunk/debian/changelog
freepbx/trunk/debian/freepbx-sqlite3.install
freepbx/trunk/debian/patches/00list
freepbx/trunk/debian/patches/use-conf-defaults.dpatch
Log:
freepbx 2.2.2:
* new upstream release: 2.2.2
* obsolete pacthes renamed to _* (and removed from 00list). soon from the svn.
* newinstall.sqlite3.sql is available upstream, same file.
* user-conf-defaults fixed, and bug re-opened upstream: http://freepbx.org/trac/ticket/1921#comment:2
Modified: freepbx/trunk/debian/changelog
===================================================================
--- freepbx/trunk/debian/changelog 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/changelog 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,3 +1,10 @@
+freepbx (2.2.2~dfsg-1) UNRELEASED; urgency=low
+
+ * New upstream release
+
+ -- Diego Iastrubni <diego.iastrubni at xorcom.com> Tue, 26 Jun 2007 14:25:11 +0300
+
+
freepbx (2.2.1~dfsg-1) UNRELEASED; urgency=low
* NOT RELEASED YET
Modified: freepbx/trunk/debian/freepbx-sqlite3.install
===================================================================
--- freepbx/trunk/debian/freepbx-sqlite3.install 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/freepbx-sqlite3.install 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,4 +1,3 @@
debian/sqlite3/amportal.conf usr/share/freepbx-common/
debian/sqlite3/install-sql usr/share/freepbx-common/
debian/sqlite3/remove-sql usr/share/freepbx-common/
-debian/sqlite3/newinstall.sqlite3.sql usr/share/freepbx-common/sql
Modified: freepbx/trunk/debian/patches/00list
===================================================================
--- freepbx/trunk/debian/patches/00list 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/patches/00list 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,8 +1,5 @@
# fix bugs
-fix-module_admin
use-conf-defaults
-fix-open-or-die
-quiet-retrieve
fix-mysql-real-escape-string
# debian/xorcom enhancements
@@ -19,9 +16,6 @@
fix-retrieve-op-panel-cfg
path-to-fop
-# backports from trunk
-add-sqlite3-support
-
# pending patches, still need to be ported
# to freepbx-2.2
#fix-wierd-email
Copied: freepbx/trunk/debian/patches/_add-sqlite3-support.dpatch (from rev 3676, freepbx/trunk/debian/patches/add-sqlite3-support.dpatch)
===================================================================
--- freepbx/trunk/debian/patches/_add-sqlite3-support.dpatch (rev 0)
+++ freepbx/trunk/debian/patches/_add-sqlite3-support.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -0,0 +1,275 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## add-sqlite3-support.dpatch by <diegolocal at localhost.localdomain>
+##
+## DP: Add sqlite3 support for freePBX. Note that most (if not) all this patch
+## DP: is commited usptream, and should be part of freePBX 2.2.2 or 2.2.3
+
+ at DPATCH@
+diff -urNad upstream~/amp_conf/bin/retrieve_conf upstream/amp_conf/bin/retrieve_conf
+--- upstream~/amp_conf/bin/retrieve_conf 2007-05-08 13:34:28.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_conf 2007-05-08 13:34:28.000000000 +0300
+@@ -223,6 +223,18 @@
+ $db->connect( $DSN );
+ break;
+
++ case "sqlite3":
++ if (!isset($amp_conf["AMPDBFILE"]))
++ die("You must setup properly AMPDBFILE in /etc/amportal.conf");
++
++ if (isset($amp_conf["AMPDBFILE"]) == "")
++ die("AMPDBFILE in /etc/amportal.conf cannot be blank");
++
++ require_once('DB/sqlite3.php');
++ $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";
++ $db = DB::connect($datasource);
++ break;
++
+ default:
+ die( "Unknown SQL engine: [$db_engine]");
+ }
+diff -urNad upstream~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_iax_conf_from_mysql.pl
+--- upstream~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
+@@ -60,6 +60,15 @@
+ my $db_file = $ampconf->{"AMPDBFILE"};
+ $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
+ }
++elsif ( $db_engine eq "sqlite3" ) {
++ if (!exists($ampconf->{"AMPDBFILE"})) {
++ print "No AMPDBFILE set in /etc/amportal.conf\n";
++ exit;
++ }
++
++ my $db_file = $ampconf->{"AMPDBFILE"};
++ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
++}
+
+ # Load the 'register' lines into iax_registrations.conf
+
+diff -urNad upstream~/amp_conf/bin/retrieve_op_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_op_conf_from_mysql.pl
+--- upstream~/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
+@@ -178,6 +178,15 @@
+ my $db_file = $ampconf->{"AMPDBFILE"};
+ $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
+ }
++elsif ( $db_engine eq "sqlite3" ) {
++ if (!exists($ampconf->{"AMPDBFILE"})) {
++ print "No AMPDBFILE set in /etc/amportal.conf\n";
++ exit;
++ }
++
++ my $db_file = $ampconf->{"AMPDBFILE"};
++ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
++}
+
+ open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ($!)\n";
+ print EXTEN $warning_banner;
+diff -urNad upstream~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_queues_conf_from_mysql.pl
+--- upstream~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
+@@ -56,8 +56,18 @@
+ my $db_file = $ampconf->{"AMPDBFILE"};
+ $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
+ }
++elsif ( $db_engine eq "sqlite3" ) {
++ if (!exists($ampconf->{"AMPDBFILE"})) {
++ print "No AMPDBFILE set in /etc/amportal.conf\n";
++ exit;
++ }
++
++ my $db_file = $ampconf->{"AMPDBFILE"};
++ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
++}
++
++$statement = "SELECT keyword,data from $table_name where id=0 and keyword <> 'account'";
+
+-$statement = "SELECT keyword,data from $table_name where id='-1' and keyword <> 'account'";
+ my $result = $dbh->selectall_arrayref($statement);
+ unless ($result) {
+ # check for errors after every single database call
+diff -urNad upstream~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_sip_conf_from_mysql.pl
+--- upstream~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
+@@ -60,6 +60,15 @@
+ my $db_file = $ampconf->{"AMPDBFILE"};
+ $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
+ }
++elsif ( $db_engine eq "sqlite3" ) {
++ if (!exists($ampconf->{"AMPDBFILE"})) {
++ print "No AMPDBFILE set in /etc/amportal.conf\n";
++ exit;
++ }
++
++ my $db_file = $ampconf->{"AMPDBFILE"};
++ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
++}
+
+ $statement = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1";
+ my $result = $dbh->selectall_arrayref($statement);
+diff -urNad upstream~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_zap_conf_from_mysql.pl
+--- upstream~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
+@@ -61,6 +61,15 @@
+ my $db_file = $ampconf->{"AMPDBFILE"};
+ $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
+ }
++elsif ( $db_engine eq "sqlite3" ) {
++ if (!exists($ampconf->{"AMPDBFILE"})) {
++ print "No AMPDBFILE set in /etc/amportal.conf\n";
++ exit;
++ }
++
++ my $db_file = $ampconf->{"AMPDBFILE"};
++ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
++}
+
+ $statement = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1";
+ my $result = $dbh->selectall_arrayref($statement);
+diff -urNad upstream~/amp_conf/htdocs/admin/common/db_connect.php upstream/amp_conf/htdocs/admin/common/db_connect.php
+--- upstream~/amp_conf/htdocs/admin/common/db_connect.php 2006-06-25 13:37:15.000000000 +0300
++++ upstream/amp_conf/htdocs/admin/common/db_connect.php 2007-05-08 13:34:28.000000000 +0300
+@@ -49,6 +49,18 @@
+ $db->connect( $DSN );
+ break;
+
++ case "sqlite3":
++ if (!isset($amp_conf["AMPDBFILE"]))
++ die("You must setup properly AMPDBFILE in /etc/amportal.conf");
++
++ if (isset($amp_conf["AMPDBFILE"]) == "")
++ die("AMPDBFILE in /etc/amportal.conf cannot be blank");
++
++ require_once('DB/sqlite3.php');
++ $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";
++ $db = DB::connect($datasource);
++ break;
++
+ default:
+ die( "Unknown SQL engine: [$db_engine]");
+ }
+diff -urNad upstream~/amp_conf/htdocs/admin/modules/core/functions.inc.php upstream/amp_conf/htdocs/admin/modules/core/functions.inc.php
+--- upstream~/amp_conf/htdocs/admin/modules/core/functions.inc.php 2007-01-25 09:14:53.000000000 +0200
++++ upstream/amp_conf/htdocs/admin/modules/core/functions.inc.php 2007-05-08 13:38:04.000000000 +0300
+@@ -1417,11 +1417,11 @@
+ global $db;
+ global $amp_conf;
+
+- if ( $amp_conf["AMPDBENGINE"] == "sqlite")
++ if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3") )
+ {
+ // TODO: sqlite work arround - diego
+ // need to reorder the trunks in PHP code
+- $unique_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUT_%' ORDER BY variable","getAll");
++ $unique_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUT\\_%' escape '\\' ORDER BY variable","getAll");
+ }
+ else
+ {
+@@ -1638,11 +1638,23 @@
+
+ //get outbound routes for a given trunk
+ function core_trunks_gettrunkroutes($trunknum) {
+- $results = sql("SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll");
++
++ global $amp_conf;
++
++ if ($amp_conf["AMPDBENGINE"] == "sqlite3")
++ $results = sql("SELECT DISTINCT context, priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll");
++ else
++ $results = sql("SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll");
+
+ foreach ($results as $row) {
+- $routes[$row[0]] = $row[1];
++ $t = ($amp_conf["AMPDBENGINE"] == "sqlite3") ? substr( $row[0], 7 ) : $row[0];
++ $r = $row[1];
++ $routes[ $r ] = $t;
++
++// original code was:
++// $routes[$row[0]] = $row[1];
+ }
++
+ // array(routename=>priority)
+ return isset($routes)?$routes:null;
+ }
+@@ -1666,10 +1678,16 @@
+ {
+ global $amp_conf;
+
+- if ( $amp_conf["AMPDBENGINE"] == "sqlite")
++ if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3") )
+ {
+- // TODO: sqlite work arround - diego
++ // SUBSTRING is not supported under sqlite3, we need to filter
++ // this in php. I am not sure why "6" and not "7"
++ // but I don't really care -> it works :)
+ $results = sql("SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ","getAll");
++ foreach( array_keys($results) as $idx )
++ {
++ $results[$idx][0] = substr( $results[$idx][0], 6);
++ }
+ }
+ else
+ {
+@@ -1753,6 +1771,8 @@
+ function core_routing_setroutepriority($routepriority, $reporoutedirection, $reporoutekey)
+ {
+ global $db;
++ global $amp_conf;
++
+ $counter=-1;
+ foreach ($routepriority as $tresult)
+ {
+@@ -1812,13 +1832,19 @@
+ die($result->getMessage(). $sql);
+ }
+ }
+-
+- $sql = "SELECT DISTINCT SUBSTRING(context,7) FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ";
++
++ if ( $amp_conf["AMPDBENGINE"] != "sqlite3")
++ $sql = "SELECT DISTINCT SUBSTRING(context,7) FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ";
++ else
++ $sql = "SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ";
++
+ // we SUBSTRING() to remove "outrt-"
+ $routepriority = $db->getAll($sql);
+ if(DB::IsError($routepriority)) {
+ die($routepriority->getMessage());
+ }
++
++ // TODO: strip the context on the sqlite3 backend
+ return ($routepriority);
+
+ }
+diff -urNad upstream~/install_amp upstream/install_amp
+--- upstream~/install_amp 2007-05-08 13:34:28.000000000 +0300
++++ upstream/install_amp 2007-05-08 13:34:28.000000000 +0300
+@@ -425,7 +425,8 @@
+ if ( (strtolower(substr($file,-4)) == ".sqlite") && ($db_engine == "sqlite") ) {
+ install_sqlupdate( $version, $file );
+ }
+- elseif ((strtolower(substr($file,-4)) == ".sql") && ( ($db_engine == "mysql") || ($db_engine == "pgsql")) ) {
++ elseif ((strtolower(substr($file,-4)) == ".sql") &&
++ ( ($db_engine == "mysql") || ($db_engine == "pgsql") || ($db_engine == "sqlite3") ) ) {
+ install_sqlupdate( $version, $file );
+ }
+ }
+@@ -983,6 +984,18 @@
+ $db->connect( $DSN );
+ break;
+
++ case "sqlite3":
++ if (!isset($amp_conf["AMPDBFILE"]))
++ die("You must setup properly AMPDBFILE in /etc/amportal.conf");
++
++ if (isset($amp_conf["AMPDBFILE"]) == "")
++ die("AMPDBFILE in /etc/amportal.conf cannot be blank");
++
++ require_once('DB/sqlite3.php');
++ $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";
++ $db = DB::connect($datasource);
++ break;
++
+ default:
+ die( "Unknown SQL engine: [$db_engine]");
+ }
Copied: freepbx/trunk/debian/patches/_fix-module_admin.dpatch (from rev 3676, freepbx/trunk/debian/patches/fix-module_admin.dpatch)
===================================================================
--- freepbx/trunk/debian/patches/_fix-module_admin.dpatch (rev 0)
+++ freepbx/trunk/debian/patches/_fix-module_admin.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -0,0 +1,80 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix-module_admin.dpatch by Diego Iastrubni <diego.iastrubni at xorcom.com>
+##
+## DP: Create a connection to the manager in the module_admin
+## DP: work around buggy freepbx-modules uninstall script (closes upstream 1731)
+## DP: Howver, when trying to query for the version of asterisk and no manager
+## DP: connection is available, ask asterisk directly via the console, about the
+## DP: version (closes upstream 1899, using changest http://www.freepbx.org/trac/changeset/3572)
+
+ at DPATCH@
+diff -urNad freepbx-2.2.1~dfsg~/amp_conf/bin/module_admin freepbx-2.2.1~dfsg/amp_conf/bin/module_admin
+--- freepbx-2.2.1~dfsg~/amp_conf/bin/module_admin 2007-01-31 10:18:14.000000000 +0200
++++ freepbx-2.2.1~dfsg/amp_conf/bin/module_admin 2007-04-12 14:55:08.000000000 +0300
+@@ -52,7 +52,7 @@
+ }
+
+ function init_amportal_environment($ampconfpath) {
+- global $amp_conf, $asterisk_conf, $db;
++ global $amp_conf, $asterisk_conf, $db, $astman;
+
+ if (!file_exists($ampconfpath)) {
+ fatal('Cannot find conf file: '.$ampconfpath);
+@@ -68,12 +68,18 @@
+ }
+ // include the functions file from WEBROOT
+ include(AMP_BASE_INCLUDE_PATH.'/functions.inc.php');
+-
++ include(AMP_BASE_INCLUDE_PATH.'/common/php-asmanager.php');
++
+ // now apply the real parse function (this makes some default assumptions and does a bit more error checking)
+ $amp_conf = parse_amportal_conf($ampconfpath);
+
+ $asterisk_conf = parse_asterisk_conf("/etc/asterisk/asterisk.conf");
+
++ $astman= new AGI_AsteriskManager();
++ if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
++ $astman = null;
++ }
++
+ // connect to database
+ if (!file_exists(AMP_BASE_INCLUDE_PATH.'/common/db_connect.php')) {
+ fatal('Cannot locate '.AMP_BASE_INCLUDE_PATH.'/common/db_connect.php');
+@@ -464,7 +470,7 @@
+ // freepbx modules will include the unsintall scripts
+ // using relative paths. why not modifiying the include dir...?
+ // fix for ticket:1731
+-chdir ( $amp_conf\["AMPWEBROOT"\] . "/admin/" );
++chdir ( $amp_conf["AMPWEBROOT"] . "/admin/" );
+
+ switch ($operation ) {
+ case 'list':
+diff -urNad freepbx-2.2.1~dfsg~/amp_conf/htdocs/admin/functions.inc.php freepbx-2.2.1~dfsg/amp_conf/htdocs/admin/functions.inc.php
+--- freepbx-2.2.1~dfsg~/amp_conf/htdocs/admin/functions.inc.php 2007-01-17 09:56:52.000000000 +0200
++++ freepbx-2.2.1~dfsg/amp_conf/htdocs/admin/functions.inc.php 2007-04-12 14:57:00.000000000 +0300
+@@ -180,13 +180,13 @@
+
+ switch ($amp_conf['AMPENGINE']) {
+ case 'asterisk':
+- if ($astman) {
++ if (isset($astman) /*&& $astman->connected()*/) {
+ //get version
+ $response = $astman->send_request('Command', array('Command'=>'show version'));
+ $verinfo = $response['data'];
+ } else {
+- // could not connect to asterisk manager
+- return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0');
++ // could not connect to asterisk manager, try console
++ $verinfo = exec('/usr/sbin/asterisk -V');
+ }
+
+ if (preg_match('/Asterisk SVN.+/', $verinfo)) {
+@@ -195,6 +195,8 @@
+ if (preg_match('/Asterisk (\d+(\.\d+)*)(-?(\S*))/', $verinfo, $matches)) {
+ return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4]);
+ }
++
++ return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0');
+ break;
+ }
+ return array('engine'=>'ERROR-UNSUPPORTED-ENGINE-'.$amp_conf['AMPENGINE'], 'version'=>'0', 'additional' => '0');
Copied: freepbx/trunk/debian/patches/_fix-open-or-die.dpatch (from rev 3676, freepbx/trunk/debian/patches/fix-open-or-die.dpatch)
===================================================================
--- freepbx/trunk/debian/patches/_fix-open-or-die.dpatch (rev 0)
+++ freepbx/trunk/debian/patches/_fix-open-or-die.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -0,0 +1,89 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## fix-open-or-die.dpatch by Diego Iastrubni <diego.iastrubni at xorcom.com>
+##
+## DP: Fix some perl syntax issues. Commited upstream at r3963, to be removed for 2.2.2 or 2.3.0
+
+ at DPATCH@
+diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_iax_conf_from_mysql.pl
+--- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
++++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-02-26 11:26:40.000000000 +0000
+@@ -75,8 +75,8 @@
+ exit;
+ }
+
+-open( EXTEN, ">$iax_conf" ) or die "Cannot create/overwrite IAX file: $iax_conf (!$)\n";
+-open( REG, ">$iax_reg" ) or die "Cannot create/overwrite IAX Registration file: $iax_reg (!$)\n";
++open( EXTEN, ">$iax_conf" ) or die "Cannot create/overwrite IAX file: $iax_conf ($!)\n";
++open( REG, ">$iax_reg" ) or die "Cannot create/overwrite IAX Registration file: $iax_reg ($!)\n";
+
+ print EXTEN $warning_banner;
+ print REG $warning_banner;
+diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_op_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_op_conf_from_mysql.pl
+--- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
++++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-02-26 11:27:04.000000000 +0000
+@@ -53,7 +53,7 @@
+
+ $zaplabel="Zap \%c";
+ $lastlabelnum=0;
+- open ZAPATA, "<$conffile" || die "Cannot open config file: $zapataconf\n";
++ open( ZAPATA, "<$conffile" ) or die "Cannot open config file: $zapataconf ($!)\n";
+ while( $line = <ZAPATA> ) {
+ next if $line =~ /^(\s)*$/;
+ chomp($line);
+@@ -179,7 +179,7 @@
+ $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
+ }
+
+-open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf (!$)\n";
++open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ($!)\n";
+ print EXTEN $warning_banner;
+
+ #First, populate extensions
+diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_parse_amportal_conf.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_parse_amportal_conf.pl
+--- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_parse_amportal_conf.pl 2007-02-26 11:23:40.000000000 +0000
++++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_parse_amportal_conf.pl 2007-02-26 11:27:16.000000000 +0000
+@@ -15,7 +15,7 @@
+ AMPENGINE => "asterisk",
+ );
+
+- open(AMPCONF, $filename) or die "Cannot open $filename";
++ open(AMPCONF, $filename) or die "Cannot open $filename ($!)";
+
+ while (<AMPCONF>)
+ {
+diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_queues_conf_from_mysql.pl
+--- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
++++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-02-26 11:27:31.000000000 +0000
+@@ -67,7 +67,7 @@
+ exit;
+ }
+
+-open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf (!$)\n";
++open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf ($!)\n";
+ print EXTEN $warning_banner;
+
+ $additional = "";
+diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_sip_conf_from_mysql.pl
+--- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
++++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-02-26 11:27:49.000000000 +0000
+@@ -71,7 +71,7 @@
+ exit;
+ }
+
+-open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite extensions file: $sip_conf (!$)\n";
++open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite extensions file: $sip_conf ($!)\n";
+ print EXTEN $warning_banner;
+
+ $additional = "";
+diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_zap_conf_from_mysql.pl
+--- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
++++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-02-26 11:28:00.000000000 +0000
+@@ -72,7 +72,7 @@
+ exit;
+ }
+
+-open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf (!$)\n";
++open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf ($!)\n";
+ print EXTEN $warning_banner;
+
+ $additional = "";
Copied: freepbx/trunk/debian/patches/_quiet-retrieve.dpatch (from rev 3676, freepbx/trunk/debian/patches/quiet-retrieve.dpatch)
===================================================================
--- freepbx/trunk/debian/patches/_quiet-retrieve.dpatch (rev 0)
+++ freepbx/trunk/debian/patches/_quiet-retrieve.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -0,0 +1,27 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## quiet-retrieve.dpatch by Diego Iastrubni <diego.iastrubni at xorcom.com>
+##
+## DP: when no address defined for the web root, ask to reload the server,
+## DP: and don't type an empty address. the code has been taken from install_amp
+## DP: comited upstream at 3981, to be removed for 2.2.2 or 2.3
+
+ at DPATCH@
+diff -urNad upstream~/amp_conf/bin/retrieve_conf upstream/amp_conf/bin/retrieve_conf
+--- upstream~/amp_conf/bin/retrieve_conf 2007-01-04 02:48:29.000000000 +0200
++++ upstream/amp_conf/bin/retrieve_conf 2007-05-14 16:15:19.000000000 +0300
+@@ -431,5 +431,14 @@
+
+ // **** Set reload flag for AMP admin
+ needreload();
+-out("Please Reload Asterisk by visiting http://".$amp_conf["AMPWEBADDRESS"]."/admin");
++if ($amp_conf["AMPWEBADDRESS"])
++{
++ out("Please update your modules and reload Asterisk by visiting http://".$amp_conf["AMPWEBADDRESS"]."/admin");
++}
++else
++{
++ out("Please update your modules and reload Asterisk by browsing to your server.");
++}
++
++
+ ?>
Deleted: freepbx/trunk/debian/patches/add-sqlite3-support.dpatch
===================================================================
--- freepbx/trunk/debian/patches/add-sqlite3-support.dpatch 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/patches/add-sqlite3-support.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,275 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## add-sqlite3-support.dpatch by <diegolocal at localhost.localdomain>
-##
-## DP: Add sqlite3 support for freePBX. Note that most (if not) all this patch
-## DP: is commited usptream, and should be part of freePBX 2.2.2 or 2.2.3
-
- at DPATCH@
-diff -urNad upstream~/amp_conf/bin/retrieve_conf upstream/amp_conf/bin/retrieve_conf
---- upstream~/amp_conf/bin/retrieve_conf 2007-05-08 13:34:28.000000000 +0300
-+++ upstream/amp_conf/bin/retrieve_conf 2007-05-08 13:34:28.000000000 +0300
-@@ -223,6 +223,18 @@
- $db->connect( $DSN );
- break;
-
-+ case "sqlite3":
-+ if (!isset($amp_conf["AMPDBFILE"]))
-+ die("You must setup properly AMPDBFILE in /etc/amportal.conf");
-+
-+ if (isset($amp_conf["AMPDBFILE"]) == "")
-+ die("AMPDBFILE in /etc/amportal.conf cannot be blank");
-+
-+ require_once('DB/sqlite3.php');
-+ $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";
-+ $db = DB::connect($datasource);
-+ break;
-+
- default:
- die( "Unknown SQL engine: [$db_engine]");
- }
-diff -urNad upstream~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_iax_conf_from_mysql.pl
---- upstream~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
-+++ upstream/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
-@@ -60,6 +60,15 @@
- my $db_file = $ampconf->{"AMPDBFILE"};
- $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
- }
-+elsif ( $db_engine eq "sqlite3" ) {
-+ if (!exists($ampconf->{"AMPDBFILE"})) {
-+ print "No AMPDBFILE set in /etc/amportal.conf\n";
-+ exit;
-+ }
-+
-+ my $db_file = $ampconf->{"AMPDBFILE"};
-+ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
-+}
-
- # Load the 'register' lines into iax_registrations.conf
-
-diff -urNad upstream~/amp_conf/bin/retrieve_op_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_op_conf_from_mysql.pl
---- upstream~/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
-+++ upstream/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
-@@ -178,6 +178,15 @@
- my $db_file = $ampconf->{"AMPDBFILE"};
- $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
- }
-+elsif ( $db_engine eq "sqlite3" ) {
-+ if (!exists($ampconf->{"AMPDBFILE"})) {
-+ print "No AMPDBFILE set in /etc/amportal.conf\n";
-+ exit;
-+ }
-+
-+ my $db_file = $ampconf->{"AMPDBFILE"};
-+ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
-+}
-
- open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ($!)\n";
- print EXTEN $warning_banner;
-diff -urNad upstream~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_queues_conf_from_mysql.pl
---- upstream~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
-+++ upstream/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
-@@ -56,8 +56,18 @@
- my $db_file = $ampconf->{"AMPDBFILE"};
- $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
- }
-+elsif ( $db_engine eq "sqlite3" ) {
-+ if (!exists($ampconf->{"AMPDBFILE"})) {
-+ print "No AMPDBFILE set in /etc/amportal.conf\n";
-+ exit;
-+ }
-+
-+ my $db_file = $ampconf->{"AMPDBFILE"};
-+ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
-+}
-+
-+$statement = "SELECT keyword,data from $table_name where id=0 and keyword <> 'account'";
-
--$statement = "SELECT keyword,data from $table_name where id='-1' and keyword <> 'account'";
- my $result = $dbh->selectall_arrayref($statement);
- unless ($result) {
- # check for errors after every single database call
-diff -urNad upstream~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_sip_conf_from_mysql.pl
---- upstream~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
-+++ upstream/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
-@@ -60,6 +60,15 @@
- my $db_file = $ampconf->{"AMPDBFILE"};
- $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
- }
-+elsif ( $db_engine eq "sqlite3" ) {
-+ if (!exists($ampconf->{"AMPDBFILE"})) {
-+ print "No AMPDBFILE set in /etc/amportal.conf\n";
-+ exit;
-+ }
-+
-+ my $db_file = $ampconf->{"AMPDBFILE"};
-+ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
-+}
-
- $statement = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1";
- my $result = $dbh->selectall_arrayref($statement);
-diff -urNad upstream~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl upstream/amp_conf/bin/retrieve_zap_conf_from_mysql.pl
---- upstream~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-05-08 13:34:27.000000000 +0300
-+++ upstream/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-05-08 13:34:28.000000000 +0300
-@@ -61,6 +61,15 @@
- my $db_file = $ampconf->{"AMPDBFILE"};
- $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
- }
-+elsif ( $db_engine eq "sqlite3" ) {
-+ if (!exists($ampconf->{"AMPDBFILE"})) {
-+ print "No AMPDBFILE set in /etc/amportal.conf\n";
-+ exit;
-+ }
-+
-+ my $db_file = $ampconf->{"AMPDBFILE"};
-+ $dbh = DBI->connect("dbi:SQLite:dbname=$db_file","","");
-+}
-
- $statement = "SELECT keyword,data from $table_name where id=-1 and keyword <> 'account' and flags <> 1";
- my $result = $dbh->selectall_arrayref($statement);
-diff -urNad upstream~/amp_conf/htdocs/admin/common/db_connect.php upstream/amp_conf/htdocs/admin/common/db_connect.php
---- upstream~/amp_conf/htdocs/admin/common/db_connect.php 2006-06-25 13:37:15.000000000 +0300
-+++ upstream/amp_conf/htdocs/admin/common/db_connect.php 2007-05-08 13:34:28.000000000 +0300
-@@ -49,6 +49,18 @@
- $db->connect( $DSN );
- break;
-
-+ case "sqlite3":
-+ if (!isset($amp_conf["AMPDBFILE"]))
-+ die("You must setup properly AMPDBFILE in /etc/amportal.conf");
-+
-+ if (isset($amp_conf["AMPDBFILE"]) == "")
-+ die("AMPDBFILE in /etc/amportal.conf cannot be blank");
-+
-+ require_once('DB/sqlite3.php');
-+ $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";
-+ $db = DB::connect($datasource);
-+ break;
-+
- default:
- die( "Unknown SQL engine: [$db_engine]");
- }
-diff -urNad upstream~/amp_conf/htdocs/admin/modules/core/functions.inc.php upstream/amp_conf/htdocs/admin/modules/core/functions.inc.php
---- upstream~/amp_conf/htdocs/admin/modules/core/functions.inc.php 2007-01-25 09:14:53.000000000 +0200
-+++ upstream/amp_conf/htdocs/admin/modules/core/functions.inc.php 2007-05-08 13:38:04.000000000 +0300
-@@ -1417,11 +1417,11 @@
- global $db;
- global $amp_conf;
-
-- if ( $amp_conf["AMPDBENGINE"] == "sqlite")
-+ if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3") )
- {
- // TODO: sqlite work arround - diego
- // need to reorder the trunks in PHP code
-- $unique_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUT_%' ORDER BY variable","getAll");
-+ $unique_trunks = sql("SELECT * FROM globals WHERE variable LIKE 'OUT\\_%' escape '\\' ORDER BY variable","getAll");
- }
- else
- {
-@@ -1638,11 +1638,23 @@
-
- //get outbound routes for a given trunk
- function core_trunks_gettrunkroutes($trunknum) {
-- $results = sql("SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll");
-+
-+ global $amp_conf;
-+
-+ if ($amp_conf["AMPDBENGINE"] == "sqlite3")
-+ $results = sql("SELECT DISTINCT context, priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll");
-+ else
-+ $results = sql("SELECT DISTINCT SUBSTRING(context,7), priority FROM extensions WHERE context LIKE 'outrt-%' AND (args LIKE 'dialout-trunk,".$trunknum.",%' OR args LIKE 'dialout-enum,".$trunknum.",%')ORDER BY context ","getAll");
-
- foreach ($results as $row) {
-- $routes[$row[0]] = $row[1];
-+ $t = ($amp_conf["AMPDBENGINE"] == "sqlite3") ? substr( $row[0], 7 ) : $row[0];
-+ $r = $row[1];
-+ $routes[ $r ] = $t;
-+
-+// original code was:
-+// $routes[$row[0]] = $row[1];
- }
-+
- // array(routename=>priority)
- return isset($routes)?$routes:null;
- }
-@@ -1666,10 +1678,16 @@
- {
- global $amp_conf;
-
-- if ( $amp_conf["AMPDBENGINE"] == "sqlite")
-+ if ( ($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3") )
- {
-- // TODO: sqlite work arround - diego
-+ // SUBSTRING is not supported under sqlite3, we need to filter
-+ // this in php. I am not sure why "6" and not "7"
-+ // but I don't really care -> it works :)
- $results = sql("SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ","getAll");
-+ foreach( array_keys($results) as $idx )
-+ {
-+ $results[$idx][0] = substr( $results[$idx][0], 6);
-+ }
- }
- else
- {
-@@ -1753,6 +1771,8 @@
- function core_routing_setroutepriority($routepriority, $reporoutedirection, $reporoutekey)
- {
- global $db;
-+ global $amp_conf;
-+
- $counter=-1;
- foreach ($routepriority as $tresult)
- {
-@@ -1812,13 +1832,19 @@
- die($result->getMessage(). $sql);
- }
- }
--
-- $sql = "SELECT DISTINCT SUBSTRING(context,7) FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ";
-+
-+ if ( $amp_conf["AMPDBENGINE"] != "sqlite3")
-+ $sql = "SELECT DISTINCT SUBSTRING(context,7) FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ";
-+ else
-+ $sql = "SELECT DISTINCT context FROM extensions WHERE context LIKE 'outrt-%' ORDER BY context ";
-+
- // we SUBSTRING() to remove "outrt-"
- $routepriority = $db->getAll($sql);
- if(DB::IsError($routepriority)) {
- die($routepriority->getMessage());
- }
-+
-+ // TODO: strip the context on the sqlite3 backend
- return ($routepriority);
-
- }
-diff -urNad upstream~/install_amp upstream/install_amp
---- upstream~/install_amp 2007-05-08 13:34:28.000000000 +0300
-+++ upstream/install_amp 2007-05-08 13:34:28.000000000 +0300
-@@ -425,7 +425,8 @@
- if ( (strtolower(substr($file,-4)) == ".sqlite") && ($db_engine == "sqlite") ) {
- install_sqlupdate( $version, $file );
- }
-- elseif ((strtolower(substr($file,-4)) == ".sql") && ( ($db_engine == "mysql") || ($db_engine == "pgsql")) ) {
-+ elseif ((strtolower(substr($file,-4)) == ".sql") &&
-+ ( ($db_engine == "mysql") || ($db_engine == "pgsql") || ($db_engine == "sqlite3") ) ) {
- install_sqlupdate( $version, $file );
- }
- }
-@@ -983,6 +984,18 @@
- $db->connect( $DSN );
- break;
-
-+ case "sqlite3":
-+ if (!isset($amp_conf["AMPDBFILE"]))
-+ die("You must setup properly AMPDBFILE in /etc/amportal.conf");
-+
-+ if (isset($amp_conf["AMPDBFILE"]) == "")
-+ die("AMPDBFILE in /etc/amportal.conf cannot be blank");
-+
-+ require_once('DB/sqlite3.php');
-+ $datasource = "sqlite3:///" . $amp_conf["AMPDBFILE"] . "?mode=0666";
-+ $db = DB::connect($datasource);
-+ break;
-+
- default:
- die( "Unknown SQL engine: [$db_engine]");
- }
Deleted: freepbx/trunk/debian/patches/fix-module_admin.dpatch
===================================================================
--- freepbx/trunk/debian/patches/fix-module_admin.dpatch 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/patches/fix-module_admin.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,80 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## fix-module_admin.dpatch by Diego Iastrubni <diego.iastrubni at xorcom.com>
-##
-## DP: Create a connection to the manager in the module_admin
-## DP: work around buggy freepbx-modules uninstall script (closes upstream 1731)
-## DP: Howver, when trying to query for the version of asterisk and no manager
-## DP: connection is available, ask asterisk directly via the console, about the
-## DP: version (closes upstream 1899, using changest http://www.freepbx.org/trac/changeset/3572)
-
- at DPATCH@
-diff -urNad freepbx-2.2.1~dfsg~/amp_conf/bin/module_admin freepbx-2.2.1~dfsg/amp_conf/bin/module_admin
---- freepbx-2.2.1~dfsg~/amp_conf/bin/module_admin 2007-01-31 10:18:14.000000000 +0200
-+++ freepbx-2.2.1~dfsg/amp_conf/bin/module_admin 2007-04-12 14:55:08.000000000 +0300
-@@ -52,7 +52,7 @@
- }
-
- function init_amportal_environment($ampconfpath) {
-- global $amp_conf, $asterisk_conf, $db;
-+ global $amp_conf, $asterisk_conf, $db, $astman;
-
- if (!file_exists($ampconfpath)) {
- fatal('Cannot find conf file: '.$ampconfpath);
-@@ -68,12 +68,18 @@
- }
- // include the functions file from WEBROOT
- include(AMP_BASE_INCLUDE_PATH.'/functions.inc.php');
--
-+ include(AMP_BASE_INCLUDE_PATH.'/common/php-asmanager.php');
-+
- // now apply the real parse function (this makes some default assumptions and does a bit more error checking)
- $amp_conf = parse_amportal_conf($ampconfpath);
-
- $asterisk_conf = parse_asterisk_conf("/etc/asterisk/asterisk.conf");
-
-+ $astman= new AGI_AsteriskManager();
-+ if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
-+ $astman = null;
-+ }
-+
- // connect to database
- if (!file_exists(AMP_BASE_INCLUDE_PATH.'/common/db_connect.php')) {
- fatal('Cannot locate '.AMP_BASE_INCLUDE_PATH.'/common/db_connect.php');
-@@ -464,7 +470,7 @@
- // freepbx modules will include the unsintall scripts
- // using relative paths. why not modifiying the include dir...?
- // fix for ticket:1731
--chdir ( $amp_conf\["AMPWEBROOT"\] . "/admin/" );
-+chdir ( $amp_conf["AMPWEBROOT"] . "/admin/" );
-
- switch ($operation ) {
- case 'list':
-diff -urNad freepbx-2.2.1~dfsg~/amp_conf/htdocs/admin/functions.inc.php freepbx-2.2.1~dfsg/amp_conf/htdocs/admin/functions.inc.php
---- freepbx-2.2.1~dfsg~/amp_conf/htdocs/admin/functions.inc.php 2007-01-17 09:56:52.000000000 +0200
-+++ freepbx-2.2.1~dfsg/amp_conf/htdocs/admin/functions.inc.php 2007-04-12 14:57:00.000000000 +0300
-@@ -180,13 +180,13 @@
-
- switch ($amp_conf['AMPENGINE']) {
- case 'asterisk':
-- if ($astman) {
-+ if (isset($astman) /*&& $astman->connected()*/) {
- //get version
- $response = $astman->send_request('Command', array('Command'=>'show version'));
- $verinfo = $response['data'];
- } else {
-- // could not connect to asterisk manager
-- return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0');
-+ // could not connect to asterisk manager, try console
-+ $verinfo = exec('/usr/sbin/asterisk -V');
- }
-
- if (preg_match('/Asterisk SVN.+/', $verinfo)) {
-@@ -195,6 +195,8 @@
- if (preg_match('/Asterisk (\d+(\.\d+)*)(-?(\S*))/', $verinfo, $matches)) {
- return array('engine'=>'asterisk', 'version' => $matches[1], 'additional' => $matches[4]);
- }
-+
-+ return array('engine'=>'ERROR-UNABLE-TO-CONNECT', 'version'=>'0', 'additional' => '0');
- break;
- }
- return array('engine'=>'ERROR-UNSUPPORTED-ENGINE-'.$amp_conf['AMPENGINE'], 'version'=>'0', 'additional' => '0');
Deleted: freepbx/trunk/debian/patches/fix-open-or-die.dpatch
===================================================================
--- freepbx/trunk/debian/patches/fix-open-or-die.dpatch 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/patches/fix-open-or-die.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,89 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## fix-open-or-die.dpatch by Diego Iastrubni <diego.iastrubni at xorcom.com>
-##
-## DP: Fix some perl syntax issues. Commited upstream at r3963, to be removed for 2.2.2 or 2.3.0
-
- at DPATCH@
-diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_iax_conf_from_mysql.pl
---- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
-+++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_iax_conf_from_mysql.pl 2007-02-26 11:26:40.000000000 +0000
-@@ -75,8 +75,8 @@
- exit;
- }
-
--open( EXTEN, ">$iax_conf" ) or die "Cannot create/overwrite IAX file: $iax_conf (!$)\n";
--open( REG, ">$iax_reg" ) or die "Cannot create/overwrite IAX Registration file: $iax_reg (!$)\n";
-+open( EXTEN, ">$iax_conf" ) or die "Cannot create/overwrite IAX file: $iax_conf ($!)\n";
-+open( REG, ">$iax_reg" ) or die "Cannot create/overwrite IAX Registration file: $iax_reg ($!)\n";
-
- print EXTEN $warning_banner;
- print REG $warning_banner;
-diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_op_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_op_conf_from_mysql.pl
---- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
-+++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_op_conf_from_mysql.pl 2007-02-26 11:27:04.000000000 +0000
-@@ -53,7 +53,7 @@
-
- $zaplabel="Zap \%c";
- $lastlabelnum=0;
-- open ZAPATA, "<$conffile" || die "Cannot open config file: $zapataconf\n";
-+ open( ZAPATA, "<$conffile" ) or die "Cannot open config file: $zapataconf ($!)\n";
- while( $line = <ZAPATA> ) {
- next if $line =~ /^(\s)*$/;
- chomp($line);
-@@ -179,7 +179,7 @@
- $dbh = DBI->connect("dbi:SQLite2:dbname=$db_file","","");
- }
-
--open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf (!$)\n";
-+open( EXTEN, ">$op_conf" ) or die "Cannot create/overwrite config file: $op_conf ($!)\n";
- print EXTEN $warning_banner;
-
- #First, populate extensions
-diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_parse_amportal_conf.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_parse_amportal_conf.pl
---- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_parse_amportal_conf.pl 2007-02-26 11:23:40.000000000 +0000
-+++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_parse_amportal_conf.pl 2007-02-26 11:27:16.000000000 +0000
-@@ -15,7 +15,7 @@
- AMPENGINE => "asterisk",
- );
-
-- open(AMPCONF, $filename) or die "Cannot open $filename";
-+ open(AMPCONF, $filename) or die "Cannot open $filename ($!)";
-
- while (<AMPCONF>)
- {
-diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_queues_conf_from_mysql.pl
---- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
-+++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_queues_conf_from_mysql.pl 2007-02-26 11:27:31.000000000 +0000
-@@ -67,7 +67,7 @@
- exit;
- }
-
--open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf (!$)\n";
-+open( EXTEN, ">$queues_conf" ) or die "Cannot create/overwrite extensions file: $queues_conf ($!)\n";
- print EXTEN $warning_banner;
-
- $additional = "";
-diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_sip_conf_from_mysql.pl
---- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
-+++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_sip_conf_from_mysql.pl 2007-02-26 11:27:49.000000000 +0000
-@@ -71,7 +71,7 @@
- exit;
- }
-
--open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite extensions file: $sip_conf (!$)\n";
-+open( EXTEN, ">$sip_conf" ) or die "Cannot create/overwrite extensions file: $sip_conf ($!)\n";
- print EXTEN $warning_banner;
-
- $additional = "";
-diff -urNad freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_zap_conf_from_mysql.pl
---- freepbx-2.2.0~dfsg~/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-02-26 11:23:37.000000000 +0000
-+++ freepbx-2.2.0~dfsg/amp_conf/bin/retrieve_zap_conf_from_mysql.pl 2007-02-26 11:28:00.000000000 +0000
-@@ -72,7 +72,7 @@
- exit;
- }
-
--open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf (!$)\n";
-+open( EXTEN, ">$zap_conf" ) or die "Cannot create/overwrite extensions file: $zap_conf ($!)\n";
- print EXTEN $warning_banner;
-
- $additional = "";
Deleted: freepbx/trunk/debian/patches/quiet-retrieve.dpatch
===================================================================
--- freepbx/trunk/debian/patches/quiet-retrieve.dpatch 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/patches/quiet-retrieve.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,27 +0,0 @@
-#! /bin/sh /usr/share/dpatch/dpatch-run
-## quiet-retrieve.dpatch by Diego Iastrubni <diego.iastrubni at xorcom.com>
-##
-## DP: when no address defined for the web root, ask to reload the server,
-## DP: and don't type an empty address. the code has been taken from install_amp
-## DP: comited upstream at 3981, to be removed for 2.2.2 or 2.3
-
- at DPATCH@
-diff -urNad upstream~/amp_conf/bin/retrieve_conf upstream/amp_conf/bin/retrieve_conf
---- upstream~/amp_conf/bin/retrieve_conf 2007-01-04 02:48:29.000000000 +0200
-+++ upstream/amp_conf/bin/retrieve_conf 2007-05-14 16:15:19.000000000 +0300
-@@ -431,5 +431,14 @@
-
- // **** Set reload flag for AMP admin
- needreload();
--out("Please Reload Asterisk by visiting http://".$amp_conf["AMPWEBADDRESS"]."/admin");
-+if ($amp_conf["AMPWEBADDRESS"])
-+{
-+ out("Please update your modules and reload Asterisk by visiting http://".$amp_conf["AMPWEBADDRESS"]."/admin");
-+}
-+else
-+{
-+ out("Please update your modules and reload Asterisk by browsing to your server.");
-+}
-+
-+
- ?>
Modified: freepbx/trunk/debian/patches/use-conf-defaults.dpatch
===================================================================
--- freepbx/trunk/debian/patches/use-conf-defaults.dpatch 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/patches/use-conf-defaults.dpatch 2007-06-26 13:59:27 UTC (rev 3699)
@@ -5,37 +5,308 @@
## DP: Needed to ensure that correct defaults are used when configuration
## DP: entries are missing from amportal.conf. Defaults are copied from
## DP: amp_conf/htdocs/admin/functions.inc.php
-## DP: Commited upstream at revision 3775. To be removed when packaging 2.2.1 or 2.3
+## DP: Commited upstream at revision 3775. To be removed when packaging 2.2.3 or 2.3
## DP: Contains a fix for upstream bug: http://freepbx.org/trac/ticket/1921
@DPATCH@
-diff -urNad freepbx-2.2.1~dfsg~/amp_conf/bin/retrieve_parse_amportal_conf.pl freepbx-2.2.1~dfsg/amp_conf/bin/retrieve_parse_amportal_conf.pl
---- freepbx-2.2.1~dfsg~/amp_conf/bin/retrieve_parse_amportal_conf.pl 2006-11-27 04:53:24.000000000 +0200
-+++ freepbx-2.2.1~dfsg/amp_conf/bin/retrieve_parse_amportal_conf.pl 2007-05-02 12:38:35.000000000 +0300
-@@ -9,7 +9,13 @@
- sub parse_amportal_conf
- {
- my $filename = $_[0];
-- my %ampconf;
-+ my %ampconf = (
-+ AMPDBENGINE => "mysql",
-+ AMPDBNAME => "asterisk",
-+ AMPENGINE => "asterisk",
-+ ASTETCDIR => "/etc/asterisk",
-+ ASTMANAGERPORT => "5038"
-+ );
+diff -urNad upstream~/amp_conf/bin/archive_recordings upstream/amp_conf/bin/archive_recordings
+--- upstream~/amp_conf/bin/archive_recordings 2007-05-03 19:31:38.000000000 +0300
++++ upstream/amp_conf/bin/archive_recordings 2007-06-26 16:40:54.000000000 +0300
+@@ -39,12 +39,47 @@
+ }
+
+ function parse_amportal_conf($filename) {
++ // defaults, if not specified in the file
++ $defaults = array(
++ 'AMPDBENGINE' => 'mysql',
++ 'AMPDBNAME' => 'asterisk',
++ 'AMPENGINE' => 'asterisk',
++ 'USECATEGORIES' => true,
++ 'ASTETCDIR' => '/etc/asterisk',
++ 'ASTMANAGERPORT' => '5038',
++ );
++ // boolean values, will be converted to true/false
++ // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false
++ $booleans = array('USECATEGORIES');
++
+ $file = file($filename);
+- foreach ($file as $line) {
+- if (preg_match("/^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches)) {
+- $conf[ $matches[1] ] = $matches[2];
++ if (is_array($file)) {
++ foreach ($file as $line) {
++ if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_<>\"\']+)\s*$/",$line,$matches)) {
++ $conf[ $matches[1] ] = $matches[2];
++ }
+ }
++ } else {
++ die("Missing or unreadable config file ($filename)...cannot continue");
+ }
++
++ // set defaults
++ foreach ($defaults as $key=>$val) {
++ if (!isset($conf[$key]) || $conf[$key] == '') {
++ $conf[$key] = $val;
++ }
++ }
++
++ // evaluate boolean values
++ foreach ($booleans as $key) {
++ $conf[$key] = isset($conf[$key]) && ($conf[$key] === true || strtolower($conf[$key]) == 'true' || $conf[$key] === 1 || $conf[$key] == '1' || strtolower($conf[$key]) == 'yes');
++ }
++
++/*
++ if (($amp_conf["AMPDBENGINE"] == "sqlite") && (!isset($amp_conf["AMPDBENGINE"])))
++ $amp_conf["AMPDBFILE"] = "/var/lib/freepbx/freepbx.sqlite";
++*/
++
+ return $conf;
+ }
+
+@@ -395,7 +430,6 @@
+ $db_pass = $amp_conf["AMPDBPASS"];
+ $db_host = 'localhost';
+ $db_name = 'asteriskcdrdb';
+-$db_engine = 'mysql';
+
+ $datasource = $db_engine.'://'.$db_user.':'.$db_pass.'@'.$db_host.'/'.$db_name;
+
+diff -urNad upstream~/amp_conf/bin/callback upstream/amp_conf/bin/callback
+--- upstream~/amp_conf/bin/callback 2007-05-03 19:31:38.000000000 +0300
++++ upstream/amp_conf/bin/callback 2007-06-26 16:40:54.000000000 +0300
+@@ -111,12 +111,47 @@
+
+
+ function parse_amportal_conf($filename) {
++ // defaults, if not specified in the file
++ $defaults = array(
++ 'AMPDBENGINE' => 'mysql',
++ 'AMPDBNAME' => 'asterisk',
++ 'AMPENGINE' => 'asterisk',
++ 'USECATEGORIES' => true,
++ 'ASTETCDIR' => '/etc/asterisk',
++ 'ASTMANAGERPORT' => '5038',
++ );
++ // boolean values, will be converted to true/false
++ // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false
++ $booleans = array('USECATEGORIES');
++
+ $file = file($filename);
+- foreach ($file as $line) {
+- if (preg_match("/^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches)) {
+- $conf[ $matches[1] ] = $matches[2];
++ if (is_array($file)) {
++ foreach ($file as $line) {
++ if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_<>\"\']+)\s*$/",$line,$matches)) {
++ $conf[ $matches[1] ] = $matches[2];
++ }
+ }
++ } else {
++ die("Missing or unreadable config file ($filename)...cannot continue");
++ }
++
++ // set defaults
++ foreach ($defaults as $key=>$val) {
++ if (!isset($conf[$key]) || $conf[$key] == '') {
++ $conf[$key] = $val;
++ }
++ }
++
++ // evaluate boolean values
++ foreach ($booleans as $key) {
++ $conf[$key] = isset($conf[$key]) && ($conf[$key] === true || strtolower($conf[$key]) == 'true' || $conf[$key] === 1 || $conf[$key] == '1' || strtolower($conf[$key]) == 'yes');
+ }
++
++/*
++ if (($amp_conf["AMPDBENGINE"] == "sqlite") && (!isset($amp_conf["AMPDBENGINE"])))
++ $amp_conf["AMPDBFILE"] = "/var/lib/freepbx/freepbx.sqlite";
++*/
++
+ return $conf;
+ }
+
+diff -urNad upstream~/amp_conf/bin/module_admin upstream/amp_conf/bin/module_admin
+--- upstream~/amp_conf/bin/module_admin 2007-05-03 19:31:38.000000000 +0300
++++ upstream/amp_conf/bin/module_admin 2007-06-26 16:40:54.000000000 +0300
+@@ -42,12 +42,47 @@
+
+
+ function install_parse_amportal_conf($filename) {
++ // defaults, if not specified in the file
++ $defaults = array(
++ 'AMPDBENGINE' => 'mysql',
++ 'AMPDBNAME' => 'asterisk',
++ 'AMPENGINE' => 'asterisk',
++ 'USECATEGORIES' => true,
++ 'ASTETCDIR' => '/etc/asterisk',
++ 'ASTMANAGERPORT' => '5038',
++ );
++ // boolean values, will be converted to true/false
++ // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false
++ $booleans = array('USECATEGORIES');
++
+ $file = file($filename);
+- foreach ($file as $line) {
+- if (preg_match("/^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches)) {
+- $conf[ $matches[1] ] = $matches[2];
++ if (is_array($file)) {
++ foreach ($file as $line) {
++ if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_<>\"\']+)\s*$/",$line,$matches)) {
++ $conf[ $matches[1] ] = $matches[2];
++ }
+ }
++ } else {
++ die("Missing or unreadable config file ($filename)...cannot continue");
++ }
++
++ // set defaults
++ foreach ($defaults as $key=>$val) {
++ if (!isset($conf[$key]) || $conf[$key] == '') {
++ $conf[$key] = $val;
++ }
++ }
++
++ // evaluate boolean values
++ foreach ($booleans as $key) {
++ $conf[$key] = isset($conf[$key]) && ($conf[$key] === true || strtolower($conf[$key]) == 'true' || $conf[$key] === 1 || $conf[$key] == '1' || strtolower($conf[$key]) == 'yes');
+ }
++
++/*
++ if (($amp_conf["AMPDBENGINE"] == "sqlite") && (!isset($amp_conf["AMPDBENGINE"])))
++ $amp_conf["AMPDBFILE"] = "/var/lib/freepbx/freepbx.sqlite";
++*/
++
+ return $conf;
+ }
+
+diff -urNad upstream~/amp_conf/bin/retrieve_conf upstream/amp_conf/bin/retrieve_conf
+--- upstream~/amp_conf/bin/retrieve_conf 2007-05-14 16:21:31.000000000 +0300
++++ upstream/amp_conf/bin/retrieve_conf 2007-06-26 16:40:54.000000000 +0300
+@@ -40,30 +40,47 @@
+
+
+ function parse_amportal_conf2($filename) {
++ // defaults, if not specified in the file
++ $defaults = array(
++ 'AMPDBENGINE' => 'mysql',
++ 'AMPDBNAME' => 'asterisk',
++ 'AMPENGINE' => 'asterisk',
++ 'USECATEGORIES' => true,
++ 'ASTETCDIR' => '/etc/asterisk',
++ 'ASTMANAGERPORT' => '5038',
++ );
++ // boolean values, will be converted to true/false
++ // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false
++ $booleans = array('USECATEGORIES');
++
+ $file = file($filename);
+- foreach ($file as $line) {
+- if (preg_match("/^\s*([\w]+)\s*=\s*\"?([\w\/\:\.\*\%-]*)\"?\s*([;#].*)?/",$line,$matches)) {
+- $conf[ $matches[1] ] = $matches[2];
++ if (is_array($file)) {
++ foreach ($file as $line) {
++ if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_<>\"\']+)\s*$/",$line,$matches)) {
++ $conf[ $matches[1] ] = $matches[2];
++ }
+ }
+- }
+-
+- // use same defaults as function.inc.php
+- if ( !isset($conf["AMPDBENGINE"]) || ($conf["AMPDBENGINE"] == "")) {
+- $conf["AMPDBENGINE"] = "mysql";
+- }
+-
+- if ( !isset($conf["AMPDBNAME"]) || ($conf["AMPDBNAME"] == "")) {
+- $conf["AMPDBNAME"] = "asterisk";
++ } else {
++ die("Missing or unreadable config file ($filename)...cannot continue");
+ }
- open(AMPCONF, $filename) or die "Cannot open $filename";
+- if ( !isset($conf["AMPENGINE"]) || ($conf["AMPENGINE"] == "")) {
+- $conf["AMPENGINE"] = "asterisk";
++ // set defaults
++ foreach ($defaults as $key=>$val) {
++ if (!isset($conf[$key]) || $conf[$key] == '') {
++ $conf[$key] = $val;
++ }
+ }
+
+- if ( !isset($conf["ASTMANAGERPORT"]) || ($conf["ASTMANAGERPORT"] == "")) {
+- $conf["ASTMANAGERPORT"] = "5038";
++ // evaluate boolean values
++ foreach ($booleans as $key) {
++ $conf[$key] = isset($conf[$key]) && ($conf[$key] === true || strtolower($conf[$key]) == 'true' || $conf[$key] === 1 || $conf[$key] == '1' || strtolower($conf[$key]) == 'yes');
+ }
+
++/*
++ if (($amp_conf["AMPDBENGINE"] == "sqlite") && (!isset($amp_conf["AMPDBENGINE"])))
++ $amp_conf["AMPDBFILE"] = "/var/lib/freepbx/freepbx.sqlite";
++*/
++
+ return $conf;
+ }
+
+diff -urNad upstream~/install_amp upstream/install_amp
+--- upstream~/install_amp 2007-06-09 04:55:31.000000000 +0300
++++ upstream/install_amp 2007-06-26 16:43:25.000000000 +0300
+@@ -103,26 +103,47 @@
+ }
+
+ function install_parse_amportal_conf($filename) {
++ // defaults, if not specified in the file
++ $defaults = array(
++ 'AMPDBENGINE' => 'mysql',
++ 'AMPDBNAME' => 'asterisk',
++ 'AMPENGINE' => 'asterisk',
++ 'USECATEGORIES' => true,
++ 'ASTETCDIR' => '/etc/asterisk',
++ 'ASTMANAGERPORT' => '5038',
++ );
++ // boolean values, will be converted to true/false
++ // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false
++ $booleans = array('USECATEGORIES');
++
+ $file = file($filename);
+- foreach ($file as $line) {
+- if (preg_match("/^\s*([a-zA-Z0-9]+)\s*=\s*(.*)\s*([;#].*)?/",$line,$matches)) {
+- $conf[ $matches[1] ] = $matches[2];
++ if (is_array($file)) {
++ foreach ($file as $line) {
++ if (preg_match("/^\s*([a-zA-Z0-9_]+)=([a-zA-Z0-9 .&-@=_<>\"\']+)\s*$/",$line,$matches)) {
++ $conf[ $matches[1] ] = $matches[2];
++ }
+ }
+- }
+-
+- // use same defaults as function.inc.php
+- if ( !isset($conf["AMPDBENGINE"]) || ($conf["AMPDBENGINE"] == "")) {
+- $conf["AMPDBENGINE"] = "mysql";
++ } else {
++ die("Missing or unreadable config file ($filename)...cannot continue");
+ }
-diff -urNad freepbx-2.2.1~dfsg~/amp_conf/htdocs/admin/functions.inc.php freepbx-2.2.1~dfsg/amp_conf/htdocs/admin/functions.inc.php
---- freepbx-2.2.1~dfsg~/amp_conf/htdocs/admin/functions.inc.php 2007-05-02 12:32:26.000000000 +0300
-+++ freepbx-2.2.1~dfsg/amp_conf/htdocs/admin/functions.inc.php 2007-05-02 12:38:15.000000000 +0300
-@@ -27,6 +27,8 @@
- 'AMPDBNAME' => 'asterisk',
- 'AMPENGINE' => 'asterisk',
- 'USECATEGORIES' => true,
-+ 'ASTETCDIR' => '/etc/asterisk/',
-+ 'ASTMANAGERPORT' => '5038'
- );
- // boolean values, will be converted to true/false
- // "yes", "true", 1 (case-insensitive) will be treated as true, everything else is false
+- if ( !isset($conf["AMPDBNAME"]) || ($conf["AMPDBNAME"] == "")) {
+- $conf["AMPDBNAME"] = "asterisk";
++ // set defaults
++ foreach ($defaults as $key=>$val) {
++ if (!isset($conf[$key]) || $conf[$key] == '') {
++ $conf[$key] = $val;
++ }
+ }
+-
+- if ( !isset($conf["AMPENGINE"]) || ($conf["AMPENGINE"] == "")) {
+- $conf["AMPENGINE"] = "asterisk";
++
++ // evaluate boolean values
++ foreach ($booleans as $key) {
++ $conf[$key] = isset($conf[$key]) && ($conf[$key] === true || strtolower($conf[$key]) == 'true' || $conf[$key] === 1 || $conf[$key] == '1' || strtolower($conf[$key]) == 'yes');
+ }
+
++/*
++ if (($amp_conf["AMPDBENGINE"] == "sqlite") && (!isset($amp_conf["AMPDBENGINE"])))
++ $amp_conf["AMPDBFILE"] = "/var/lib/freepbx/freepbx.sqlite";
++*/
++
+ return $conf;
+ }
+
Deleted: freepbx/trunk/debian/sqlite3/newinstall.sqlite3.sql
===================================================================
--- freepbx/trunk/debian/sqlite3/newinstall.sqlite3.sql 2007-06-24 09:17:26 UTC (rev 3698)
+++ freepbx/trunk/debian/sqlite3/newinstall.sqlite3.sql 2007-06-26 13:59:27 UTC (rev 3699)
@@ -1,450 +0,0 @@
--- MySQL dump 10.9
---
--- Host: localhost Database: asterisk
--- ------------------------------------------------------
--- Server version 4.1.20
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Table structure for table `Backup`
---
-
-DROP TABLE IF EXISTS `Backup`;
-CREATE TABLE `Backup` (
- `Name` varchar(50) default NULL,
- `Voicemail` varchar(50) default NULL,
- `Recordings` varchar(50) default NULL,
- `Configurations` varchar(50) default NULL,
- `CDR` varchar(55) default NULL,
- `FOP` varchar(50) default NULL,
- `Minutes` varchar(50) default NULL,
- `Hours` varchar(50) default NULL,
- `Days` varchar(50) default NULL,
- `Months` varchar(50) default NULL,
- `Weekdays` varchar(50) default NULL,
- `Command` varchar(200) default NULL,
- `Method` varchar(50) default NULL,
- `ID` integer NOT NULL PRIMARY KEY AUTOINCREMENT
-) ;
-
---
--- Dumping data for table `Backup`
---
-
-
-/*!40000 ALTER TABLE `Backup` DISABLE KEYS */;
--- /* TABLES `Backup` WRITE;
--- TABLES;*/
-/*!40000 ALTER TABLE `Backup` ENABLE KEYS */;
-
---
--- Table structure for table `admin`
---
-
-DROP TABLE IF EXISTS `admin`;
-CREATE TABLE `admin` (
- `variable` varchar(20) NOT NULL default '',
- `value` varchar(80) NOT NULL default '',
- PRIMARY KEY (`variable`)
-) ;
-
---
--- Dumping data for table `admin`
---
-
-
-/*!40000 ALTER TABLE `admin` DISABLE KEYS */;
--- TABLES `admin` WRITE;
-INSERT INTO `admin` VALUES ('need_reload','true');
-INSERT INTO `admin` VALUES ('version','2.2.0beta3');
--- TABLES;
-/*!40000 ALTER TABLE `admin` ENABLE KEYS */;
-
---
--- Table structure for table `ampusers`
---
-
-DROP TABLE IF EXISTS `ampusers`;
-CREATE TABLE `ampusers` (
- `username` varchar(20) NOT NULL default '',
- `password` varchar(20) NOT NULL default '',
- `extension_low` varchar(20) NOT NULL default '',
- `extension_high` varchar(20) NOT NULL default '',
- `deptname` varchar(20) NOT NULL default '',
- `sections` varchar(255) NOT NULL default '',
- PRIMARY KEY (`username`)
-) ;
-
---
--- Dumping data for table `ampusers`
---
-
-
-/*!40000 ALTER TABLE `ampusers` DISABLE KEYS */;
--- TABLES `ampusers` WRITE;
-INSERT INTO `ampusers` VALUES ('admin','admin','','','','*');
--- TABLES;
-/*!40000 ALTER TABLE `ampusers` ENABLE KEYS */;
-
---
--- Table structure for table `devices`
---
-
-DROP TABLE IF EXISTS `devices`;
-CREATE TABLE `devices` (
- `id` varchar(20) NOT NULL default '',
- `tech` varchar(10) NOT NULL default '',
- `dial` varchar(50) NOT NULL default '',
- `devicetype` varchar(5) NOT NULL default '',
- `user` varchar(50) default NULL,
- `description` varchar(50) default NULL,
- `emergency_cid` varchar(100) default NULL
-) ;
-
---
--- Dumping data for table `devices`
---
-
-
-/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
--- TABLES `devices` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
-
---
--- Table structure for table `extensions`
---
-
-DROP TABLE IF EXISTS `extensions`;
-CREATE TABLE `extensions` (
- `context` varchar(45) NOT NULL default 'default',
- `extension` varchar(45) NOT NULL default '',
- `priority` varchar(5) NOT NULL default '1',
- `application` varchar(45) NOT NULL default '',
- `args` varchar(255) default NULL,
- `descr` text,
- `flags` int(1) NOT NULL default '0',
- PRIMARY KEY (`context`,`extension`,`priority`)
-) ;
-
---
--- Dumping data for table `extensions`
---
-
-
-/*!40000 ALTER TABLE `extensions` DISABLE KEYS */;
--- TABLES `extensions` WRITE;
-INSERT INTO `extensions` VALUES ('outrt-001-9_outside','_9.','1','Macro','dialout-trunk,1,${EXTEN:1}',NULL,0);
-INSERT INTO `extensions` VALUES ('outrt-001-9_outside','_9.','2','Macro','outisbusy','No available circuits',0);
-INSERT INTO `extensions` VALUES ('outbound-allroutes','include','1','outrt-001-9_outside','','',2);
--- TABLES;
-/*!40000 ALTER TABLE `extensions` ENABLE KEYS */;
-
---
--- Table structure for table `featurecodes`
---
-
-DROP TABLE IF EXISTS `featurecodes`;
-CREATE TABLE `featurecodes` (
- `modulename` varchar(50) NOT NULL default '',
- `featurename` varchar(50) NOT NULL default '',
- `description` varchar(200) NOT NULL default '',
- `defaultcode` varchar(20) default NULL,
- `customcode` varchar(20) default NULL,
- `enabled` tinyint(4) NOT NULL default '0',
- PRIMARY KEY (`modulename`,`featurename`)
--- KEY `enabled` (`enabled`)
-) ;
-
---
--- Dumping data for table `featurecodes`
---
-
-
-/*!40000 ALTER TABLE `featurecodes` DISABLE KEYS */;
--- TABLES `featurecodes` WRITE;
-INSERT INTO `featurecodes` VALUES ('core','userlogon','User Logon','*11',NULL,1);
-INSERT INTO `featurecodes` VALUES ('core','userlogoff','User Logoff','*12',NULL,1);
-INSERT INTO `featurecodes` VALUES ('core','zapbarge','ZapBarge','888',NULL,1);
-INSERT INTO `featurecodes` VALUES ('core','simu_pstn','Simulate Incoming Call','7777',NULL,1);
-INSERT INTO `featurecodes` VALUES ('core','simu_fax','Simulate Incoming FAX Call','666',NULL,1);
-INSERT INTO `featurecodes` VALUES ('core','chanspy','ChanSpy','555',NULL,1);
-INSERT INTO `featurecodes` VALUES ('core','pickup','Call Pickup (Can be used with GXP-2000)','**',NULL,1);
--- TABLES;
-/*!40000 ALTER TABLE `featurecodes` ENABLE KEYS */;
-
---
--- Table structure for table `freepbx_log`
---
-
-DROP TABLE IF EXISTS `freepbx_log`;
-CREATE TABLE `freepbx_log` (
- `id` integer NOT NULL PRIMARY KEY AUTOINCREMENT,
- `time` datetime NOT NULL default '0000-00-00 00:00:00',
- `section` varchar(50) default NULL,
--- `level` enum('error','warning','debug','devel-debug') NOT NULL default 'error',
--- `level` enum('error','warning','debug','devel-debug') NOT NULL,
- `level` varchar(10),
- `status` int(11) NOT NULL default '0',
- `message` text NOT NULL
--- ,
--- PRIMARY KEY (`id`),
--- KEY `time` (`time`,`level`)
-) ;
-
---
--- Dumping data for table `freepbx_log`
---
-
-
-/*!40000 ALTER TABLE `freepbx_log` DISABLE KEYS */;
--- TABLES `freepbx_log` WRITE;
-INSERT INTO `freepbx_log` VALUES (1,'2006-11-06 01:55:36','retrieve_conf','devel-debug',0,'Started retrieve_conf, DB Connection OK');
-INSERT INTO `freepbx_log` VALUES (2,'2006-11-06 01:55:36','retrieve_conf','devel-debug',0,'Writing extensions_additional.conf');
--- TABLES;
-/*!40000 ALTER TABLE `freepbx_log` ENABLE KEYS */;
-
---
--- Table structure for table `globals`
---
-
-DROP TABLE IF EXISTS `globals`;
-CREATE TABLE `globals` (
- `variable` char(20) NOT NULL default '',
- `value` char(50) NOT NULL default '',
- PRIMARY KEY (`variable`)
-) ;
-
---
--- Dumping data for table `globals`
---
-
-
-/*!40000 ALTER TABLE `globals` DISABLE KEYS */;
--- /*TABLES*/ `globals` WRITE;
-INSERT INTO `globals` VALUES ('CALLFILENAME','\"\"');
-INSERT INTO `globals` VALUES ('DIAL_OPTIONS','tr');
-INSERT INTO `globals` VALUES ('TRUNK_OPTIONS','');
-INSERT INTO `globals` VALUES ('DIAL_OUT','9');
-INSERT INTO `globals` VALUES ('FAX','');
-INSERT INTO `globals` VALUES ('FAX_RX','system');
-INSERT INTO `globals` VALUES ('FAX_RX_EMAIL','fax at mydomain.com');
-INSERT INTO `globals` VALUES ('FAX_RX_FROM','freepbx at gmail.com');
-INSERT INTO `globals` VALUES ('INCOMING','group-all');
-INSERT INTO `globals` VALUES ('NULL','\"\"');
-INSERT INTO `globals` VALUES ('OPERATOR','');
-INSERT INTO `globals` VALUES ('OPERATOR_XTN','');
-INSERT INTO `globals` VALUES ('PARKNOTIFY','SIP/200');
-INSERT INTO `globals` VALUES ('RECORDEXTEN','\"\"');
-INSERT INTO `globals` VALUES ('RINGTIMER','15');
-INSERT INTO `globals` VALUES ('DIRECTORY','last');
-INSERT INTO `globals` VALUES ('AFTER_INCOMING','');
-INSERT INTO `globals` VALUES ('IN_OVERRIDE','forcereghours');
-INSERT INTO `globals` VALUES ('REGTIME','7:55-17:05');
-INSERT INTO `globals` VALUES ('REGDAYS','mon-fri');
-INSERT INTO `globals` VALUES ('DIRECTORY_OPTS','');
-INSERT INTO `globals` VALUES ('DIALOUTIDS','1');
-INSERT INTO `globals` VALUES ('OUT_1','ZAP/g0');
-INSERT INTO `globals` VALUES ('VM_PREFIX','*');
-INSERT INTO `globals` VALUES ('VM_OPTS','');
-INSERT INTO `globals` VALUES ('VM_GAIN','');
-INSERT INTO `globals` VALUES ('VM_DDTYPE','u');
-INSERT INTO `globals` VALUES ('TIMEFORMAT','kM');
-INSERT INTO `globals` VALUES ('TONEZONE','us');
-INSERT INTO `globals` VALUES ('ALLOW_SIP_ANON','no');
--- TABLES;
-/*!40000 ALTER TABLE `globals` ENABLE KEYS */;
-
---
--- Table structure for table `iax`
---
-
-DROP TABLE IF EXISTS `iax`;
-CREATE TABLE `iax` (
- `id` varchar(20) NOT NULL default '-1',
- `keyword` varchar(30) NOT NULL default '',
- `data` varchar(150) NOT NULL default '',
- `flags` int(1) NOT NULL default '0',
- PRIMARY KEY (`id`,`keyword`)
-) ;
-
---
--- Dumping data for table `iax`
---
-
-
-/*!40000 ALTER TABLE `iax` DISABLE KEYS */;
--- TABLES `iax` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `iax` ENABLE KEYS */;
-
---
--- Table structure for table `incoming`
---
-
-DROP TABLE IF EXISTS `incoming`;
-CREATE TABLE `incoming` (
- `cidnum` varchar(20) default NULL,
- `extension` varchar(20) default NULL,
- `destination` varchar(50) default NULL,
- `faxexten` varchar(20) default NULL,
- `faxemail` varchar(50) default NULL,
- `answer` tinyint(1) default NULL,
- `wait` int(2) default NULL,
- `privacyman` tinyint(1) default NULL,
- `alertinfo` varchar(32) default NULL,
- `channel` varchar(20) default NULL,
- `ringing` varchar(20) default NULL
-) ;
-
---
--- Dumping data for table `incoming`
---
-
-
-/*!40000 ALTER TABLE `incoming` DISABLE KEYS */;
--- TABLES `incoming` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `incoming` ENABLE KEYS */;
-
---
--- Table structure for table `modules`
---
-
-DROP TABLE IF EXISTS `modules`;
-CREATE TABLE `modules` (
- `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
- `modulename` varchar(50) NOT NULL default '',
- `version` varchar(20) NOT NULL default '',
- `enabled` tinyint(4) NOT NULL default '0'
-) ;
-
---
--- Dumping data for table `modules`
---
-
-
-/*!40000 ALTER TABLE `modules` DISABLE KEYS */;
--- TABLES `modules` WRITE;
-INSERT INTO `modules` VALUES (1,'core','1.2',1);
--- TABLES;
-/*!40000 ALTER TABLE `modules` ENABLE KEYS */;
-
---
--- Table structure for table `queues`
---
-
-DROP TABLE IF EXISTS `queues`;
-CREATE TABLE `queues` (
- `id` bigint(11) NOT NULL default '-1',
- `keyword` varchar(20) NOT NULL default '',
- `data` varchar(150) NOT NULL default '',
- `flags` int(1) NOT NULL default '0',
- PRIMARY KEY (`id`,`keyword`,`data`)
-) ;
-
---
--- Dumping data for table `queues`
---
-
-
-/*!40000 ALTER TABLE `queues` DISABLE KEYS */;
--- TABLES `queues` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `queues` ENABLE KEYS */;
-
---
--- Table structure for table `sip`
---
-
-DROP TABLE IF EXISTS `sip`;
-CREATE TABLE `sip` (
- `id` varchar(20) NOT NULL default '-1',
- `keyword` varchar(30) NOT NULL default '',
- `data` varchar(150) NOT NULL default '',
- `flags` int(1) NOT NULL default '0',
- PRIMARY KEY (`id`,`keyword`)
-) ;
-
---
--- Dumping data for table `sip`
---
-
-
-/*!40000 ALTER TABLE `sip` DISABLE KEYS */;
--- TABLES `sip` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `sip` ENABLE KEYS */;
-
---
--- Table structure for table `users`
---
-
-DROP TABLE IF EXISTS `users`;
-CREATE TABLE `users` (
- `extension` varchar(20) NOT NULL default '',
- `password` varchar(20) default NULL,
- `name` varchar(50) default NULL,
- `voicemail` varchar(50) default NULL,
- `ringtimer` int(3) default NULL,
- `noanswer` varchar(100) default NULL,
- `recording` varchar(50) default NULL,
- `outboundcid` varchar(50) default NULL,
- `directdid` varchar(50) default NULL,
- `didalert` varchar(50) default NULL,
- `faxexten` varchar(20) default NULL,
- `faxemail` varchar(50) default NULL,
- `answer` tinyint(1) default NULL,
- `wait` int(2) default NULL,
- `privacyman` tinyint(1) default NULL
-) ;
-
---
--- Dumping data for table `users`
---
-
-
-/*!40000 ALTER TABLE `users` DISABLE KEYS */;
--- TABLES `users` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `users` ENABLE KEYS */;
-
---
--- Table structure for table `zap`
---
-
-DROP TABLE IF EXISTS `zap`;
-CREATE TABLE `zap` (
- `id` varchar(20) NOT NULL default '-1',
- `keyword` varchar(30) NOT NULL default '',
- `data` varchar(150) NOT NULL default '',
- `flags` int(1) NOT NULL default '0',
- PRIMARY KEY (`id`,`keyword`)
-) ;
-
---
--- Dumping data for table `zap`
---
-
-
-/*!40000 ALTER TABLE `zap` DISABLE KEYS */;
--- TABLES `zap` WRITE;
--- TABLES;
-/*!40000 ALTER TABLE `zap` ENABLE KEYS */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
More information about the Pkg-voip-commits
mailing list