pari: branch pari/dahdi_support r4315 - /team/pari/dahdi_support/config/js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Dec 8 18:21:08 CST 2008


Author: pari
Date: Mon Dec  8 18:21:08 2008
New Revision: 4315

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4315
Log:
saving some progress on DAHDI support



Modified:
    team/pari/dahdi_support/config/js/astman.js
    team/pari/dahdi_support/config/js/hardware.js
    team/pari/dahdi_support/config/js/index.js
    team/pari/dahdi_support/config/js/pbx.js

Modified: team/pari/dahdi_support/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/pari/dahdi_support/config/js/astman.js?view=diff&rev=4315&r1=4314&r2=4315
==============================================================================
--- team/pari/dahdi_support/config/js/astman.js (original)
+++ team/pari/dahdi_support/config/js/astman.js Mon Dec  8 18:21:08 2008
@@ -330,8 +330,9 @@
 		msg_notLoggedIn: 'Message: Authentication Required',
 		configfile : 'guipreferences.conf', // will be created if the file does not exist , ASTGUI.globals.configfile
 		g729RegInfo: 'g729reginfo.conf', // ASTGUI.globals.g729RegInfo, the sessionData.directories.script_Registerg729 script will read this file to generate tab delimited file
-		hwcfgFile: 'gui_confighw.conf', // file to store configured hardware information
-		zaptelIncludeFile: 'zaptel_guiRead.conf', // file that will be used to read zapte.conf, ASTGUI.globals.zaptelIncludeFile
+		hwcfgFile: 'gui_confighw.conf', // file to store configured hardware information, to detect hardware changes
+		dahdiIncludeFile: 'dahdi_guiread.conf', // file that will be used to read zapte.conf, ASTGUI.globals.zaptelIncludeFile
+		dahdiScanOutput: 'dahdi_scan.conf', // file that will be used to read output from ztscan or dahdi_scan, ASTGUI.globals.dahdiScanOutput
 		pingInterval : 5000,
 		app_factoryReset : '/bin/reset_config', // ASTGUI.globals.app_factoryReset
 		fnf : 'ERROR:FNF',

Modified: team/pari/dahdi_support/config/js/hardware.js
URL: http://svn.digium.com/view/asterisk-gui/team/pari/dahdi_support/config/js/hardware.js?view=diff&rev=4315&r1=4314&r2=4315
==============================================================================
--- team/pari/dahdi_support/config/js/hardware.js (original)
+++ team/pari/dahdi_support/config/js/hardware.js Mon Dec  8 18:21:08 2008
@@ -347,7 +347,7 @@
 		var n = config2json({filename:hwcfgfile, usf:1});
 		if( n.getOwnProperties().length == 0 ){ // if file not found or no previous hardware detected
 				hwchanged = -1;
-				loadConfigFiles.runZtscan();
+				loadConfigFiles.run_detectdahdi();
 				return;
 		}else{
 			CONFIGUREDHARDWARE = {};
@@ -357,28 +357,29 @@
 				CONFIGUREDHARDWARE[l]['basechan'] = n[l]['basechan'];
 				CONFIGUREDHARDWARE[l]['type'] = n[l]['type'];
 			}}
-			loadConfigFiles.runZtscan();
+			loadConfigFiles.run_detectdahdi();
 		}
 		ASTGUI.Log.Debug("end of function: loadConfigFiles.load_hwcfgfile()");
 	},
 
-	runZtscan: function(){
-		ASTGUI.Log.Debug("start function: loadConfigFiles.runZtscan()");
+	run_detectdahdi: function(){
+		ASTGUI.Log.Debug("start function: loadConfigFiles.run_detectdahdi()");
 
 		ASTGUI.miscFunctions.createConfig( 'applyzap.conf', function(){
-			parent.ASTGUI.systemCmd( top.sessionData.directories.app_Ztscan , function(){ // run ztscan and then try loading ztscan.conf
-				window.setTimeout( loadConfigFiles.readZtscanConf , 700 ); // leave some time for ztscan to generate ztscan.conf
+			parent.ASTGUI.systemCmd( top.sessionData.directories.app_DahdiScan , function(){ // run ztscan and then try loading ztscan.conf
+				window.setTimeout( loadConfigFiles.read_DahdiScanConf , 700 ); // leave some time for ztscan to generate ztscan.conf
 			});
-			ASTGUI.Log.Debug("end of function: loadConfigFiles.runZtscan()");
+			ASTGUI.Log.Debug("end of function: loadConfigFiles.run_detectdahdi()");
 		});
 	},
 
-	readZtscanConf: function(){
-		ASTGUI.Log.Debug("start function: loadConfigFiles.readZtscanConf()");
-		var ztsc = $.ajax({ url: ASTGUI.paths.rawman+'?action=getconfig&filename=ztscan.conf', async: false }).responseText;
+	//readZtscanConf: function(){
+	read_DahdiScanConf: function(){
+		ASTGUI.Log.Debug("start function: loadConfigFiles.read_DahdiScanConf()");
+		var ztsc = $.ajax({ url: ASTGUI.paths.rawman+'?action=getconfig&filename=' + ASTGUI.globals.dahdiScanOutput , async: false }).responseText;
 		var ztsc_Lower = ztsc.toLowerCase();
 		if( ztsc_Lower.contains('response: error') && ztsc_Lower.contains('message: config file not found') ){
-			parent.ASTGUI.dialog.waitWhile("Please check if <B>ztscan</B> is installed ? <BR> /etc/asterisk/ztscan.conf not found");
+			parent.ASTGUI.dialog.waitWhile("Please check if <B>ztscan</B> is installed ? <BR> /etc/asterisk/dahdi_scan.conf not found");
 			ASTGUI.feedback( { msg:"No Cards/Spans found,  No Config File found !!", showfor:2 });
 			return;
 		}
@@ -439,7 +440,7 @@
 			}}
 		}}
 		if(hwchanged != -1){ hwchanged = detectHwChanges(); }
-		ASTGUI.Log.Debug("end of function: loadConfigFiles.readZtscanConf()");
+		ASTGUI.Log.Debug("end of function: loadConfigFiles.read_DahdiScanConf()");
 		loadConfigFiles.readUsersConf(); // read span_x (where T1/E1 trunks are defined)
 	},
 
@@ -507,8 +508,12 @@
 					}
 					SPANS[tmp]['definedchans'] = 0;
 					for( var k in n[l] ){ if(n[l].hasOwnProperty(k)){
-						if( k == 'signalling' || k == 'zapchan' || k == 'switchtype' ){ SPANS[tmp][k] = n[l][k]; }
-						if( k=='zapchan'){ SPANS[tmp]['definedchans'] = efgh(n[l][k]); }
+						if( k == 'zapchan' || k == 'dahdichan' ){
+							SPANS[tmp]['dahdichan'] = n[l][k];
+						}else if( k == 'signalling' || k == 'switchtype' ){
+							SPANS[tmp][k] = n[l][k];
+						}
+						if( k=='zapchan' || k == 'dahdichan' ){ SPANS[tmp]['definedchans'] = efgh(n[l][k]); }
 					}}
 				}
 			}}
@@ -878,8 +883,8 @@
 				x.new_action('update', d , "context", e);
 				pri_trunk['context'] = e ;
 			}
-			x.new_action('update', d , "zapchan", SPANS[k]['zapchanstring']);
-				pri_trunk['zapchan'] = SPANS[k]['zapchanstring'] ;
+			x.new_action('update', d , sessionData.DahdiChannelString , SPANS[k]['dahdichanstring']);
+				pri_trunk[ sessionData.DahdiChannelString ] = SPANS[k]['dahdichanstring'] ;
 
 			parent.sessionData.pbxinfo['trunks']['pri'][d] = pri_trunk;
 		}}}
@@ -947,7 +952,7 @@
 				bchanstring += tmp2 + ppp;
 				dchanstring += tmp3 + SPANS[k]['reserved_ch'];
 			}
-			SPANS[k]['zapchanstring'] = ppp;
+			SPANS[k]['dahdichanstring'] = ppp;
 		}}}
 
 		for( var e in fxx ){ if(fxx.hasOwnProperty(e)){	x.new_action('append', context, e, fxx[e]);	}}

Modified: team/pari/dahdi_support/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/team/pari/dahdi_support/config/js/index.js?view=diff&rev=4315&r1=4314&r2=4315
==============================================================================
--- team/pari/dahdi_support/config/js/index.js (original)
+++ team/pari/dahdi_support/config/js/index.js Mon Dec  8 18:21:08 2008
@@ -225,14 +225,13 @@
 			}
 
 			ASTGUI.dialog.waitWhile('detecting Hardware ..');
-			onLogInFunctions.runZtscan();
+			onLogInFunctions.run_detectdahdi();
 		});
 	},
 
 	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/' ;
@@ -262,8 +261,9 @@
 		sessionData.directories.script_dldsoundpack = 'sh ' + sessionData.directories.scripts + 'dldsoundpack';
 		sessionData.directories.script_mastercsvexists = 'sh ' + sessionData.directories.scripts + 'mastercsvexists';
 		sessionData.directories.script_Registerg729 = 'sh ' + sessionData.directories.scripts + 'registerg729.sh';
-
-		sessionData.directories.app_Ztscan = 'ztscan > ' + sessionData.directories.asteriskConfig +'ztscan.conf' ;
+		sessionData.directories.script_detectdahdi = 'sh ' + sessionData.directories.scripts + 'detectdahdi.sh';
+
+		sessionData.directories.app_DahdiScan = 'dahdi_scan > ' + sessionData.directories.asteriskConfig + ASTGUI.globals.dahdiScanOutput ;
 		sessionData.directories.app_mISDNscan = 'misdn-init scan' ;
 		sessionData.directories.app_flashupdate = 'flashupdate' ;
 	},
@@ -405,20 +405,29 @@
 				miscFunctions.hide_panel('digital.html');
 				onLogInFunctions.updatePanels4Platform();
 			}else{
-				onLogInFunctions.runZtscan();
+				onLogInFunctions.run_detectdahdi();
 			}
 		};
 		ASTGUI.systemCmdWithOutput( 's800iconfig' , after);
 	},
 
-	runZtscan : function(){ // onLogInFunctions.runZtscan()
+	run_detectdahdi : function(){ // onLogInFunctions.run_detectdahdi()
 		ASTGUI.dialog.waitWhile('detecting Hardware ..');
-		var cb = function(){
-			onLogInFunctions.updatePanels4Platform();
-		};
-		ASTGUI.systemCmd(top.sessionData.directories.app_Ztscan, cb);
-	},
-
+
+		ASTGUI.systemCmdWithOutput( sessionData.directories.script_detectdahdi , function(op){
+			op = op.toLowerCase();
+
+			sessionData.DahdiChannelString = 'dahdichan' ;
+			sessionData.directories.app_DahdiScan = 'dahdi_scan > ' + sessionData.directories.asteriskConfig + ASTGUI.globals.dahdiScanOutput ;
+
+			if( op.contains('zaptel') ){
+				sessionData.DahdiChannelString = 'zapchan' ;
+				sessionData.directories.app_DahdiScan = 'ztscan > ' + sessionData.directories.asteriskConfig + ASTGUI.globals.dahdiScanOutput ;
+			} // else if( op.contains('dahdi') ){ }else if( op.contains('none') ){}
+
+			ASTGUI.systemCmd( sessionData.directories.app_DahdiScan , onLogInFunctions.updatePanels4Platform );
+		});
+	},
 
 	updatePanels4Platform: function(){
 		var tmp_continue = astgui_updateConfigFromOldGui(); // update configuration form 1.x gui if needed
@@ -485,7 +494,6 @@
 // 			});
 		}
 
-
 		//if( sessionData.PLATFORM.isAA50  ){
 			DOM_mainscreen.src = 'home.html?status=1';
 		//}
@@ -493,7 +501,7 @@
 		if( sessionData.PLATFORM.isAA50 && sessionData.PLATFORM.AA50_SKU.contains('800') ){
 			// no need to parse ztscan output for s800 SKU
 		}else{
-			readcfg.ztScanConf();
+			readcfg.dahdiScanConf();
 		}
 
 		miscFunctions.show_advancedMode();

Modified: team/pari/dahdi_support/config/js/pbx.js
URL: http://svn.digium.com/view/asterisk-gui/team/pari/dahdi_support/config/js/pbx.js?view=diff&rev=4315&r1=4314&r2=4315
==============================================================================
--- team/pari/dahdi_support/config/js/pbx.js (original)
+++ team/pari/dahdi_support/config/js/pbx.js Mon Dec  8 18:21:08 2008
@@ -518,13 +518,13 @@
 		}}
 	},
 
-	ztScanConf: function(){ // readcfg.ztScanConf();
-		// reads ztscan.conf and updates sessionData.FXO_PORTS_DETECTED and sessionData.FXS_PORTS_DETECTED
+	dahdiScanConf : function(){ // readcfg.dahdiScanConf();
+		// reads dahdi_scan.conf and updates sessionData.FXO_PORTS_DETECTED and sessionData.FXS_PORTS_DETECTED
 		// reads ASTGUI.globals.hwcfgFile and looks for analog hardware changes
 		sessionData.FXO_PORTS_DETECTED = [];
 		sessionData.FXS_PORTS_DETECTED = [];
 		var y;
-		var c = config2json({filename:'ztscan.conf', usf:0});
+		var c = config2json({filename: ASTGUI.globals.dahdiScanOutput , usf:0});
 		for( var d in c ){ if (c.hasOwnProperty(d) ) {
 			c[d].each( function( item ) {
 				if( item.beginsWith('port=') && item.contains('FXO') && !item.contains('FAILED') ){ // we are looking for item if it is in the format 'port=4,FXO'
@@ -563,7 +563,8 @@
 // 				hideNo: true
 // 			});
 // 		}
-	} // end of readcfg.ztScanConf();
+
+	} // end of readcfg.dahdiScanConf();
 }; // end of readcfg
 
 




More information about the asterisk-gui-commits mailing list