pari: branch asterisknow r2041 - /branches/asterisknow/config/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Dec 26 16:43:39 CST 2007


Author: pari
Date: Wed Dec 26 16:43:38 2007
New Revision: 2041

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=2041
Log:
Detect changes in analog hardware - onlogin

Modified:
    branches/asterisknow/config/cfgbasic.html
    branches/asterisknow/config/digital.html

Modified: branches/asterisknow/config/cfgbasic.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/cfgbasic.html?view=diff&rev=2041&r1=2040&r2=2041
==============================================================================
--- branches/asterisknow/config/cfgbasic.html (original)
+++ branches/asterisknow/config/cfgbasic.html Wed Dec 26 16:43:38 2007
@@ -30,6 +30,9 @@
 var FXS_PORTS_DETECTED = []; // so that we donot have to parse ztscan output each time where we want this list
 // note that the above FXO_PORTS_DETECTED, FXS_PORTS_DETECTED are the actual 'analog FXS, FXO' ports 
 // and NOT the channels on a digital span with FXS or FXO signalling
+var hwcfgfile = 'gui_confighw.conf'; // file to store configured hardware information
+var CONFIGURED_FXOPORTS = '';
+var CONFIGURED_FXSPORTS = '';
 
 var eventeater = new Object;
 var loggedon = -1;
@@ -70,6 +73,33 @@
 			}
 		);
 	}}
+
+
+	var hwcfgfile_parse = function(n){
+		if( n == "ERROR: CONFIG FILE NOT FOUND"){
+			// hwcfgfile does not exist, proceed to Ztscan
+			CONFIGURED_FXSPORTS = '';
+			CONFIGURED_FXOPORTS = '';
+
+		}else{
+			for( var l in n ){ if(n.hasOwnProperty(l)){ // l is location
+				if(l=='ANALOGPORTS'){
+					CONFIGURED_FXSPORTS = n[l]['FXS'];
+					CONFIGURED_FXOPORTS = n[l]['FXO'];
+				}else{ }
+			}}
+		}
+
+		if( CONFIGURED_FXOPORTS != FXO_PORTS_DETECTED.join(',') || CONFIGURED_FXSPORTS != FXS_PORTS_DETECTED.join(',') ){
+			alert('Changes detected in Ananlog Hardware !! \n\n' +
+				'You might have to reconfigure any previously assigned \n'
+				+ ' FXS stations or Analog Service Providers. \n\n'
+				+ "Note: Your Analog Hardware might not work properly until\n " 
+				+ " you click 'Apply Changes' button in 'Setup Hardware' panel" );
+		}
+
+	};
+	config2json(hwcfgfile, 1, hwcfgfile_parse);
 }
 
 function fit_toScreen(){

Modified: branches/asterisknow/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/digital.html?view=diff&rev=2041&r1=2040&r2=2041
==============================================================================
--- branches/asterisknow/config/digital.html (original)
+++ branches/asterisknow/config/digital.html Wed Dec 26 16:43:38 2007
@@ -114,9 +114,10 @@
 var CURRENT_SPAN; // span being edited
 var CONFIGUREDHARDWARE = {}; // configuration read from an existing hwcfgfile (if exists)
 var DETECTEDHARDWARE = {};
-var hwcfgfile = 'gui_confighw.conf'; // file to store configured hardware information
+var hwcfgfile = parent.hwcfgfile ;
 var spans_todelete = []; // we delete all the span_x entries in users.conf (and their extensions.conf counter parts) before writing back any new information.
 var hwchanged = true ; // -1 for no previous configuration found (first time), true for detected hardware changes, false for no hardware changes
+
 
 function detectHwChanges(){ // compare DETECTEDHARDWARE vs CONFIGUREDHARDWARE 
 // returns true if a hardware change is detected and false if there are no hardware changes
@@ -426,10 +427,11 @@
 				return;
 			}
 			CONFIGUREDHARDWARE = {};
-			for( var l in n ){ if(n.hasOwnProperty(l)){ // l is location
+			for( var l in n ){ if(n.hasOwnProperty(l) && l!='ANALOGPORTS' ){ // l is location
 				CONFIGUREDHARDWARE[l] = {};
 				CONFIGUREDHARDWARE[l]['device'] = n[l]['device'];
 				CONFIGUREDHARDWARE[l]['basechan'] = n[l]['basechan'];
+				CONFIGUREDHARDWARE[l]['type'] = n[l]['type'];
 			}}
 			loadConfigFiles.runZtscan();
 		};
@@ -668,6 +670,10 @@
 				uri += build_action('update', c, g , "basechan", DETECTEDHARDWARE[g]['basechan'] ); c++;
 				uri += build_action('update', c, g , "type", DETECTEDHARDWARE[g]['type'] ); c++;
 			}}
+
+			uri += build_action('newcat', c, 'ANALOGPORTS' , '', ''); c++;
+			uri += build_action('update', c, 'ANALOGPORTS' , 'FXS', parent.FXS_PORTS_DETECTED.join(',') ); c++;
+			uri += build_action('update', c, 'ANALOGPORTS' , 'FXO', parent.FXO_PORTS_DETECTED.join(',') ); c++;
 
 			makerequest('u', hwcfgfile, uri , function(t) {
 				// inform the user to restart




More information about the asterisk-gui-commits mailing list