[asterisk-commits] mnicholson: branch mnicholson/asttest r191371 - /team/mnicholson/asttest/astt...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 30 12:48:58 CDT 2009


Author: mnicholson
Date: Thu Apr 30 12:48:55 2009
New Revision: 191371

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191371
Log:
Generate asterisk.conf and logger.conf when starting asterisk.

asterisk.conf is seeded with the proper directories for our work area.

logger.conf is generated with console output off and with full, messages, and
debug logging enabled.

Also it should be simple to add other automatically generated config files.  It
is also possible to modify the config files after they have been generated.

Modified:
    team/mnicholson/asttest/asttest/lua/astlib.lua

Modified: team/mnicholson/asttest/asttest/lua/astlib.lua
URL: http://svn.digium.com/svn-view/asterisk/team/mnicholson/asttest/asttest/lua/astlib.lua?view=diff&rev=191371&r1=191370&r2=191371
==============================================================================
--- team/mnicholson/asttest/asttest/lua/astlib.lua (original)
+++ team/mnicholson/asttest/asttest/lua/astlib.lua Thu Apr 30 12:48:55 2009
@@ -28,6 +28,10 @@
 	local a = self:_new()
 	a.configs = {}
 	a.asterisk_conf = a.work_area .. "/etc/asterisk/asterisk.conf"
+	a.essential_configs = {
+		["asterisk.conf"] = asterisk.generate_asterisk_conf,
+		["logger.conf"] = asterisk.generate_logger_conf,
+	}
 
 	setmetatable(a, self)
 	self.__index = self
@@ -37,6 +41,7 @@
 function asterisk:spawn()
 	self:clean_work_area()
 	self:create_work_area()
+	self:generate_essential_configs()
 	self:write_configs()
 	self:_spawn()
 end
@@ -69,6 +74,49 @@
 function asterisk:write_configs(directory)
 	for _, conf in pairs(self.configs) do
 		conf:write()
+	end
+end
+
+--- Setup default asterisk.conf with our work area directories.
+function asterisk:generate_asterisk_conf()
+	local c = self:new_config("asterisk.conf")
+	local s = c:new_section("directories")
+	s["astetcdir"] = self.work_area .. "/etc/asterisk"
+	s["astmoddir"] = self.work_area .. "/lib/asterisk/modules"
+	s["astvarlibdir"] = self.work_area .. "/var/lib/asterisk"
+	s["astdbdir"] = self.work_area .. "/var/lib/asterisk"
+	s["astkeydir"] = self.work_area .. "/var/lib/asterisk"
+	s["astdatadir"] = self.work_area .. "/var/lib/asterisk"
+	s["astagidir"] = self.work_area .. "/var/lib/asterisk/agi-bin"
+	s["astspooldir"] = self.work_area .. "/var/spool/asterisk"
+	s["astrundir"] = self.work_area .. "/var/run"
+	s["astlogdir"] = self.work_area .. "/var/log/asterisk"
+
+	s = c:new_section("options")
+	s["documentation_language"] = "en_US"
+
+	s = c:new_section("compat")
+	s["pbx_realtime"] = "1.6"
+	s["res_agi"] = "1.6"
+	s["app_set"] = "1.6"
+end
+
+--- Generate logger.conf with debug, messages, and full logs (disable console
+-- log).
+function asterisk:generate_logger_conf()
+	local c = self:new_config("logger.conf")
+	local s = c:new_section("general")
+	s = c:new_section("logfiles")
+	s["debug"] = "debug"
+	s["messages"] = "notice,warning,error"
+	s["full"] = "notice,warning,error,debug,verbose"
+end
+
+function asterisk:generate_essential_configs()
+	for conf, func in pairs(self.essential_configs) do
+		if not self.configs[conf] then
+			func(self)
+		end
 	end
 end
 




More information about the asterisk-commits mailing list