Index: /trunk/AMP/amp_conf/htdocs/admin/extensions.class.php
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/extensions.class.php (revision 841)
+++ /trunk/AMP/amp_conf/htdocs/admin/extensions.class.php (revision 842)
@@ -14,4 +14,10 @@
var $_sorted;
+
+ /** The filename to write this configuration to
+ */
+ function get_filename() {
+ return "extensions_additional.conf";
+ }
/** Add an entry to the extensions file
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/ringgroups/functions.inc.php
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/ringgroups/functions.inc.php (revision 840)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/ringgroups/functions.inc.php (revision 842)
@@ -18,5 +18,5 @@
}
-/* Generates dialplan for "core" components (extensions & inbound routing)
+/* Generates dialplan for ringgroups
We call this with retrieve_conf
*/
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/core/functions.inc.php
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/core/functions.inc.php (revision 835)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/core/functions.inc.php (revision 842)
@@ -1656,5 +1656,3 @@
/* end page.routing.php functions */
-
-
?>
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/module.ini
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/module.ini (revision 842)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/module.ini (revision 842)
@@ -0,0 +1,6 @@
+[module]
+name=Conferences
+version=1.0
+
+[menuitems]
+conferences=Conferences
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/install.sql
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/install.sql (revision 842)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/install.sql (revision 842)
@@ -0,0 +1,4 @@
+
+CREATE TABLE IF NOT EXISTS `meetme` ( `exten` VARCHAR( 50 ) NOT NULL , `options` VARCHAR( 15 ) , `userpin` VARCHAR( 50 ) , `adminpin` VARCHAR( 50 ) , `description` VARCHAR( 50 ));
+
+
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/functions.inc.php
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/functions.inc.php (revision 842)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/functions.inc.php (revision 842)
@@ -0,0 +1,86 @@
+_meetmes[$room] = $pin;
+ }
+ // return the output that goes in the file
+ function generateConf() {
+ $output = "";
+ foreach (array_keys($this->_meetmes) as $meetme) {
+ $output .= 'conf => '.$meetme."|".$this->_meetmes[$meetme]."\n";
+ }
+ return $output;
+ }
+}
+
+// returns a associative arrays with keys 'destination' and 'description'
+function conferences_destinations() {
+ //get the list of meetmes
+ $results = conferences_list();
+
+ // return an associative array with destination and description
+ if (isset($results)) {
+ foreach($results as $result){
+ $extens[] = array('destination' => 'ext-meetme,'.$result['0'].',1', 'description' => $result['1']." <".$result['0'].">");
+ }
+ }
+
+ return $extens;
+}
+
+
+/* Generates dialplan for conferences
+ We call this with retrieve_conf
+*/
+function conferences_get_config($engine) {
+ global $ext; // is this the best way to pass this?
+ global $conferences_conf;
+ switch($engine) {
+ case "asterisk":
+ foreach(conferences_list() as $item) {
+ $room = conferences_get(ltrim($item['0']));
+ // add dialplan
+ $ext->add('ext-meetme', ltrim($item['0']), '', new ext_macro('joinmeetme',"{$room['exten']},{$room['options']}"));
+ $ext->add('ext-meetme', ltrim($item['0']), '', new ext_macro('joinmeetmeadmin',"{$room['exten']},{$room['options']},{$room['userpin']},{$room['adminpin']}"));
+
+ // add meetme config
+ $conferences_conf->addMeetme($room['exten'],$room['userpin']);
+ }
+ break;
+ }
+}
+
+//get the existing meetme extensions
+function conferences_list() {
+ $results = sql("SELECT exten,description FROM meetme","getAll",DB_FETCHMODE_ASSOC);
+ foreach($results as $result){
+ // check to see if we are in-range for the current AMP User.
+ if (checkRange($result[0])){
+ // return this item's dialplan destination, and the description
+ $extens[] = array($result['exten'],$result['description']);
+ }
+ }
+ return $extens;
+}
+
+function conferences_get($account){
+ //get all the variables for the meetme
+ $results = sql("SELECT exten,options,userpin,adminpin,description FROM meetme WHERE exten = '$account'","getRow",DB_FETCHMODE_ASSOC);
+ return $results;
+}
+
+function conferences_del($account){
+ $results = sql("DELETE FROM meetme WHERE exten = \"$account\"","query");
+}
+
+function conferences_add($account,$name,$userpin,$adminpin,$options){
+ $results = sql("INSERT INTO meetme (exten,description,userpin,adminpin,options) values (\"$account\",\"$name\",\"$userpin\",\"$adminpin\",\"$options\")");
+}
+?>
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/uninstall.sql
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/uninstall.sql (revision 842)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/uninstall.sql (revision 842)
@@ -0,0 +1,2 @@
+
+DROP TABLE IF EXISTS meetme;
Index: /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/page.conferences.php
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/page.conferences.php (revision 842)
+++ /trunk/AMP/amp_conf/htdocs/admin/modules/conferences/page.conferences.php (revision 842)
@@ -0,0 +1,126 @@
+javascript:alert('"._("Warning! Extension")." $account "._("is not allowed for your account.")."');";
+} else {
+
+ //if submitting form, update database
+ switch ($action) {
+ case "add":
+ conferences_add($_REQUEST['account'],$_REQUEST['name'],$_REQUEST['userpin'],$_REQUEST['adminpin'],$_REQUEST['options']);
+ break;
+ case "delete":
+ conferences_del($extdisplay);
+ break;
+ case "edit": //just delete and re-add
+ conferences_del($_REQUEST['account']);
+ conferences_add($_REQUEST['account'],$_REQUEST['name'],$_REQUEST['userpin'],$_REQUEST['adminpin'],$_REQUEST['options']);
+ break;
+ }
+}
+
+//get meetme rooms
+//this function needs to be available to other modules (those that use goto destinations)
+//therefore we put it in globalfunctions.php
+$meetmes = conferences_list();
+?>
+
+
+
+
+
+
+
+
+
Conference '.$extdisplay.' deleted!
';
+} else {
+ if ($extdisplay){
+ //get details for this meetme
+ $thisMeetme = conferences_get($extdisplay);
+ //create variables
+ extract($thisMeetme);
+ }
+
+ $delURL = $_REQUEST['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'].'&action=delete';
+?>
+
+
+
+
+
+
+
Index: /trunk/AMP/amp_conf/htdocs/admin/page.modules.php
===================================================================
--- /trunk/AMP/amp_conf/htdocs/admin/page.modules.php (revision 839)
+++ /trunk/AMP/amp_conf/htdocs/admin/page.modules.php (revision 842)
@@ -2,9 +2,9 @@
// executes the SQL found in a module install.sql or uninstall.sql
-function runModuleSQL($modDir,$type){
+function runModuleSQL($moddir,$type){
global $db;
if (is_file("modules/{$moddir}/{$type}.sql")) {
// run sql script
- $fd = fopen("modules/{$moddir}/{$type}.sql");
+ $fd = fopen("modules/{$moddir}/{$type}.sql","r");
while (!feof($fd)) {
$data .= fread($fd, 1024);
Index: /trunk/AMP/amp_conf/bin/retrieve_conf
===================================================================
--- /trunk/AMP/amp_conf/bin/retrieve_conf (revision 827)
+++ /trunk/AMP/amp_conf/bin/retrieve_conf (revision 842)
@@ -206,26 +206,41 @@
}
+// create an object of the extensions class
require_once($amp_conf['AMPWEBROOT']."/admin/extensions.class.php");
$ext = new extensions;
-function generateConf($modules) {
- global $ext;
- $engine = "asterisk";
- foreach($modules as $module) {
- $funcname = $module."_get_config";
- if (function_exists($funcname)) {
- $funcname($engine);
- /*$config = $funcname($engine);
- foreach ($config as $file=>$contents) {
- echo $file;
- }*/
- }
- }
- echo $ext->generateConf();
-}
-
-
-generateConf($active_modules);
-
+// create objects for any module classes
+// currently only 1 class can be declared per module, not sure if that will be an issue
+foreach($active_modules as $active_module) {
+ $classname = $active_module."_conf";
+ if(class_exists($classname)) {
+ ${$classname} = new $classname;
+ }
+}
+
+
+// run all of the *_get_config functions, which will populate the appropriate objects
+$engine = "asterisk";
+foreach($active_modules as $module) {
+ $funcname = $module."_get_config";
+ if (function_exists($funcname)) {
+ $funcname($engine);
+ }
+}
+
+// extensions_additional.conf
+echo $ext->get_filename();
+echo $ext->generateConf();
+
+
+// now we write out our conf files for modules
+// check for any objects for each of the active modules
+foreach($active_modules as $active_module) {
+ $classname = $active_module."_conf";
+ if(class_exists($classname) && get_class(${$classname}) !== false) {
+ echo ${$classname}->get_filename();
+ echo ${$classname}->generateConf();
+ }
+}