[Pkg-voip-commits] r3353 - in freepbx/modules-2.2/modules/freepbx-module-zapauto: . debian share

Diego Iastrubni elcuco-guest at alioth.debian.org
Sun Apr 1 14:47:03 UTC 2007


Author: elcuco-guest
Date: 2007-04-01 14:47:02 +0000 (Sun, 01 Apr 2007)
New Revision: 3353

Modified:
   freepbx/modules-2.2/modules/freepbx-module-zapauto/debian/changelog
   freepbx/modules-2.2/modules/freepbx-module-zapauto/freepbx-module-zapauto.spec
   freepbx/modules-2.2/modules/freepbx-module-zapauto/share/fix_ast_db
Log:
new version 0.6.2, fixed configuration bootstrap in fix_ast_db.
updated sped and debian/changelog to reflect new version



Modified: freepbx/modules-2.2/modules/freepbx-module-zapauto/debian/changelog
===================================================================
--- freepbx/modules-2.2/modules/freepbx-module-zapauto/debian/changelog	2007-03-31 22:23:02 UTC (rev 3352)
+++ freepbx/modules-2.2/modules/freepbx-module-zapauto/debian/changelog	2007-04-01 14:47:02 UTC (rev 3353)
@@ -1,3 +1,11 @@
+freepbx-module-zapauto (2.2-0.6.2-1) unstable; urgency=low
+
+  * New release
+  * Better, smarter configuration bootstrap
+  * Astribank BRI detection has been added
+
+ -- Diego Iastrubni <diego.iastrubni at xorcom.com>  Sun, 1 Apr 2007 17:45:00 +0200
+
 freepbx-module-zapauto (2.2-0.6.1-1) unstable; urgency=low
 
   * New release

Modified: freepbx/modules-2.2/modules/freepbx-module-zapauto/freepbx-module-zapauto.spec
===================================================================
--- freepbx/modules-2.2/modules/freepbx-module-zapauto/freepbx-module-zapauto.spec	2007-03-31 22:23:02 UTC (rev 3352)
+++ freepbx/modules-2.2/modules/freepbx-module-zapauto/freepbx-module-zapauto.spec	2007-04-01 14:47:02 UTC (rev 3353)
@@ -1,6 +1,6 @@
 Summary: FreePBX module - Zaptel AutoConfiguration
 Name: freepbx-module-zapauto
-Version: 0.6.1
+Version: 0.6.2
 Release: 1
 License: GPL
 Group: Applications/System
@@ -58,6 +58,11 @@
 /var/lib/asterisk/bin/zap.template
 
 %changelog
+* Sun Apr 1 2007 Diego Iastrubni <diego.iastrubni at xorcom.com> - 0.6.2-1
+- New release
+- Better, smarter configuration bootstrap
+- Astribank BRI detection has been added
+
 * Tue Feb 20 2007 Diego Iastrubni <diego.iastrubni at xorcom.com> - 0.6.1-1
 - New release
 - Less vebose configuration

Modified: freepbx/modules-2.2/modules/freepbx-module-zapauto/share/fix_ast_db
===================================================================
--- freepbx/modules-2.2/modules/freepbx-module-zapauto/share/fix_ast_db	2007-03-31 22:23:02 UTC (rev 3352)
+++ freepbx/modules-2.2/modules/freepbx-module-zapauto/share/fix_ast_db	2007-04-01 14:47:02 UTC (rev 3353)
@@ -33,13 +33,59 @@
 // the assumption is that asterisk is running, and there is a user defined 
 // in amportal.conf
 
-ini_set( "include_path", "/usr/share/freepbx/:" . ini_get("include_path") );
 
+function fix_ast_db_parse_amportal_conf($filename) {
+        // defaults, if not specified in the file
+        $defaults = array(
+                'AMPDBENGINE' => 'mysql',
+                'AMPDBNAME' => 'asterisk',
+                'AMPENGINE' => 'asterisk',
+                'USECATEGORIES' => true,
+                );
+        // 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);
+        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("<h1>Missing or unreadable config file ($filename)...cannot continue</h1>");
+        }
+
+        // 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;
+}
+
+
+$amp_conf = fix_ast_db_parse_amportal_conf("/etc/amportal.conf");
+
+ini_set( "include_path", $amp_conf["AMPWEBROOT"] . "/admin/:" . ini_get("include_path") );
+
 require_once( 'common/php-asmanager.php' );
 require_once( 'functions.inc.php' );
-require_once( '/usr/share/freepbx/modules/core/functions.inc.php' );
+require_once( $amp_conf["AMPWEBROOT"] . '/admin/modules/core/functions.inc.php' );
 
-$amp_conf = parse_amportal_conf("/etc/amportal.conf");
 $astman         = new AGI_AsteriskManager();
 if (! $res = $astman->connect("127.0.0.1", $amp_conf["AMPMGRUSER"] , $amp_conf["AMPMGRPASS"])) {
         unset( $astman );




More information about the Pkg-voip-commits mailing list