pari: branch 2.0 r4332 - /branches/2.0/config/js/index.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 10 12:18:05 CST 2008


Author: pari
Date: Wed Dec 10 12:18:05 2008
New Revision: 4332

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4332
Log:
 
  => if context 'directories' is not found in asterisk.conf
	


Modified:
    branches/2.0/config/js/index.js

Modified: branches/2.0/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/js/index.js?view=diff&rev=4332&r1=4331&r2=4332
==============================================================================
--- branches/2.0/config/js/index.js (original)
+++ branches/2.0/config/js/index.js Wed Dec 10 12:18:05 2008
@@ -231,12 +231,13 @@
 
 	setGUI_Paths: function(){
 		// onLogInFunctions.setGUI_Paths()
-		var ASTERISK_CONF = context2json({ filename:'asterisk.conf' , context : 'directories' , usf:1 }) ;
-
-		sessionData.directories.asteriskConfig = ( ASTERISK_CONF.hasOwnProperty('astetcdir') ) ? ASTERISK_CONF.astetcdir : '/etc/asterisk/' ;
-		sessionData.directories.astvarlibdir = ( ASTERISK_CONF.hasOwnProperty('astvarlibdir') ) ? ASTERISK_CONF.astvarlibdir : '/var/lib/asterisk/' ;
-		sessionData.directories.AGIBIN = ( ASTERISK_CONF.hasOwnProperty('astagidir') ) ? ASTERISK_CONF.astagidir : '/var/lib/asterisk/agi-bin/' ;
-		sessionData.directories.astspooldir = ( ASTERISK_CONF.hasOwnProperty('astspooldir') ) ? ASTERISK_CONF.astspooldir : '/var/spool/asterisk/' ;
+		var ASTERISK_CONF = context2json({ filename:'asterisk.conf' , context : 'directories' , usf:1 });
+		if( ASTERISK_CONF === null ){ ASTERISK_CONF = new ASTGUI.customObject ; } // if context 'directories' not found in asterisk.conf
+
+		sessionData.directories.asteriskConfig =  ASTERISK_CONF.getProperty('astetcdir') ||  '/etc/asterisk/' ;
+		sessionData.directories.astvarlibdir = ASTERISK_CONF.getProperty('astvarlibdir') || '/var/lib/asterisk/' ;
+		sessionData.directories.AGIBIN = ASTERISK_CONF.getProperty('astagidir') || '/var/lib/asterisk/agi-bin/' ;
+		sessionData.directories.astspooldir = ASTERISK_CONF.getProperty('astspooldir') || '/var/spool/asterisk/' ;
 
 		if( !sessionData.directories.asteriskConfig.endsWith('/') ){ sessionData.directories.asteriskConfig = sessionData.directories.asteriskConfig + '/' ; }
 		if( !sessionData.directories.astvarlibdir.endsWith('/') ){ sessionData.directories.astvarlibdir = sessionData.directories.astvarlibdir + '/' ; }




More information about the asterisk-gui-commits mailing list