pari: branch asterisknow r1893 - /branches/asterisknow/config/digital.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Dec 4 14:39:38 CST 2007


Author: pari
Date: Tue Dec  4 14:39:38 2007
New Revision: 1893

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1893
Log:
Work in progress
Not done yet ..

bkruse .. I'm running into conflicts here.
please hold your changes till my updates are done.

-pari



Modified:
    branches/asterisknow/config/digital.html

Modified: branches/asterisknow/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/digital.html?view=diff&rev=1893&r1=1892&r2=1893
==============================================================================
--- branches/asterisknow/config/digital.html (original)
+++ branches/asterisknow/config/digital.html Tue Dec  4 14:39:38 2007
@@ -6,6 +6,8 @@
  * Copyright (C) 2006-2007, Digium, Inc.
  *
  * Brandon Kruse <bkruse at digium.com>
+ * & Pari Nannapaneni <pari at digium.com>
+ *
  *
  * See http://www.asterisk.org for more information about
  * the Asterisk project. Please do not directly contact
@@ -17,7 +19,31 @@
  * the GNU General Public License Version 2. See the LICENSE file
  * at the top of the source tree.
  *
--->
+ ** this page is designed to work with the following sample ztscan output 
+ ** - - - - - - begin ztscan output - - - - - - - - 
+ **   [1]
+ **   active=yes
+ **   alarms=UNCONFIGURED
+ **   description=T4XXP (PCI) Card 0 Span 1
+ **   name=TE4/0/1
+ **   manufacturer=Digium
+ **   devicetype=Wildcard TE410P/TE405P (1st Gen)
+ **   location=PCI Bus 02 Slot 04
+ **   basechan=1
+ **   totchans=24
+ **   irq=21
+ **   type=digital-T1
+ **   syncsrc=0
+ **   lbo=0 db (CSU)/0-133 feet (DSX-1)
+ **   coding_opts=B8ZS,AMI
+ **   framing_opts=ESF,D4
+ **   coding=
+ **   framing=
+ ** - - - - - - End of ztscan output - - - - - - - - 
+ ** if your ztscan outputs in some other wiered format, this page will go crazy and might not work as expected.
+ ** 
+ ** 
+ -->
 <script src="scripts/prototype.js"></script>
 <script src="scripts/astman.js"></script>
 <script src="scripts/tooltip.js"></script>
@@ -153,12 +179,19 @@
 			ASTGUI.selectbox.append(_$('editspan_fac'),'ESF/B8ZS', 'ESF/B8ZS');
 			ASTGUI.selectbox.append(_$('editspan_fac'),'D4/AMI', 'D4/AMI');
 		}else{
-			ASTGUI.selectbox.append(_$('editspan_fac'),'CAS/AMI', 'CAS/AMI');
 			ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/HDB3', 'CCS/HDB3');
 			ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/CRC4/HDB3', 'CCS/CRC4/HDB3');
 		}
 
-		ASTGUI.selectbox.selectOption( _$('editspan_fac') , SPANS[l]['fac'] );
+
+
+		if(SPANS[l]['framing'] && SPANS[l]['coding']) {
+			if( SPANS[l]['framing'] == 'CCS/CRC4' ){
+				ASTGUI.selectbox.selectOption( _$('editspan_fac') , 'CCS/CRC4/HDB3' );
+			}else{
+				ASTGUI.selectbox.selectOption( _$('editspan_fac') , SPANS[l]['framing'] + '/' + SPANS[l]['coding'] );
+			}
+		}
 
 		_$('editspan_channels').innerHTML = String(SPANS[l]['usedchans']) + "/" + String(SPANS[l]['totchans']) + " ("+SPANS[l]['spantype']+")";
 	
@@ -238,10 +271,11 @@
 		newCell1.align = "center";
 
 		var newCell2 = newRow.insertCell(2);
-		newCell2.innerHTML =  SPANS[span]['fac'];
+		newCell2.innerHTML =  (SPANS[span]['framing'] && SPANS[span]['coding']) ? SPANS[span]['framing'] + '/' + SPANS[span]['coding'] : '';
 
 		var newCell3 = newRow.insertCell(3);
-		newCell3.innerHTML = String(SPANS[span]['usedchans'])+"/"+String(SPANS[span]['totchans'])+" ("+SPANS[k]['spantype']+")";
+		//newCell3.innerHTML = String(SPANS[span]['usedchans'])+"/"+String(SPANS[span]['totchans'])+" ("+SPANS[k]['spantype']+")";
+		newCell3.innerHTML = String(SPANS[span]['totchans']); //for the time being
 		newCell3.align = "center";
 
 		var newCell4 = newRow.insertCell(4);
@@ -263,7 +297,7 @@
 
 function localajaxinit(){
 	menu = document.getElementById('mymenu');
-	setWindowTitle("Digital Setup Wizard");
+	setWindowTitle("Digital Cards(T1/E1) Configuration");
 	top._$('mainscreen').width= 798;
 	_$('save_b').disabled = true;
 	_$('cancel_b').disabled = true;
@@ -276,7 +310,8 @@
 	setTimeout("_$('status_message').style.display='none';", 1000);
 	preparemenus();
 	parent.loadscreen(this);
-	loadConfigFiles.readApplyzap();
+	//loadConfigFiles.readApplyzap();
+	loadConfigFiles.runZtscan();
 }
 
 var loadConfigFiles = {
@@ -288,37 +323,6 @@
 	// read users.conf - and read spans information 
 	//   check if the channels in zapchan are within max and min
 	//   if yes then set the current range values
-
-	readApplyzap: function(){
-		
-		var applyZapParse = function(n){ // read applyzap.conf
-			if( ASTGUI.checkType.isString(n) &&  n=="ERROR: CONFIG FILE NOT FOUND" ){ 
-				// applyzap.conf not found - probably running this page for the first time 
-				// touch applyzap.conf - we need to have a file to be a able to write to it
-				oldSpanCount = 0;
-				oldLoadZone ='us';
-				 setTimeout( function(){ parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/applyzap.conf", function(){} ); } , 100);
-
-			}else{
-				try{
-					for (var i=0; i < n['general'].length; i++){
-						if( n['general'][i].beginsWith('span=') ){ oldSpanCount++; continue; }
-						if( n['general'][i].contains('loadzone=') ){
-							oldLoadZone = n['general'][i].split('loadzone=')[1]; 
-							ASTGUI.selectbox.selectOption( _$('loadZone') , oldLoadZone );
-							continue;
-						}
-	
-					}
-				}catch(err){
-
-				}
-			}
-			loadConfigFiles.runZtscan(); // to next step - run ztscan and read ztscan.conf
-		};
-		config2json("applyzap.conf", 0, applyZapParse);
-	},
-
 	runZtscan: function(){
 		parent.astmanEngine.run_tool(asterisk_guiZtscan, function(t) { // run ztscan and then try loading ztscan.conf
 			setTimeout( function(){ loadConfigFiles.readZtscanConf(); } , 700); // leave some time for ztscan to generate ztscan.conf
@@ -335,51 +339,29 @@
 				//_$('tablecontainer').style.display="none";
 				return false;
 			}
-			var q = 0;
 			for( var l in n ){ if(n.hasOwnProperty(l)){
-				if( l =='general') { 
-					if(n[l]['continue'] && n[l]['continue'] == "no") {
-						_$('errmsg').innerHTML = "No digital Cards detected (found 0 spans)! <BR> Error: " + n[l]['error'];
-						_$('errmsg').style.display = '';
-						_$('div_digitalcardstable').style.display = 'none';
-						gui_feedback("No Cards/Spans found !!");
-						//_$('tablecontainer').style.display="none";
-						return false;
-					}
-					if(n[l]['continue'] && n[l]['continue'] == "yes") {
-						//var t = (n[l]['totalspans']) ? n[l]['totalspans'] : 'Unknown';
-						if(n[l]['isnew'] && n[l]['isnew'] == "yes") {
-							var uri = build_action('update', 0, 'general', 'isnew', 'no', '');
-							makerequest('u','ztscan.conf', uri, function(t){ return true;} );
-						}
-					}
-					continue;
-				}
+				if(n[l]['type'] == 'analog'){continue;} // in this page, we care only about digital spans
 				SPANS[l] = {};
 				for( var k in n[l] ){ if(n[l].hasOwnProperty(k)){ 
-					SPANS[l][k] = n[l][k];
+					SPANS[l][k] = n[l][k]; // store all the other fields in spans[l]
 					if( k == 'totchans' ){
-						SPANS[l]['spantype'] = ( Number(n[l][k]) <= 24) ? "T1" : "E1";
-						SPANS[l]['min_ch'] = q + 1;
-						SPANS[l]['max_ch'] = q + Number(n[l][k]) ;
-						SPANS[l]['reserved_ch'] = q + ( (Number(n[l][k])<=24)? 24 : 16 );
+						SPANS[l]['spantype'] = n[l]['type'].split('-')[1]; // part after '-' in 'digital-T1' or 'digital-E1'
+						SPANS[l]['min_ch'] = Number(n[l]['basechan']); 
+						SPANS[l]['max_ch'] =  Number(n[l]['basechan']) + Number(n[l]['totchans']) - 1 ; 
+						SPANS[l]['reserved_ch'] = Number(n[l]['basechan']) + ( (Number(n[l]['totchans'])==24)? 23 : 15 );
 						SPANS[l]['definedchans'] = 1; // default value
-						q += Number(n[l][k]);
 					}
 					if( k == 'lbo' ) {
-						if(n[l][k] == "(null)") { SPANS[l]['lbo'] = 0; }
-					}
-					if( k == 'fac' ) {
-						if(n[l][k] == "CAS/ ???") { SPANS[l]['fac'] = "UNCONFIGURED"; }
+						//if(n[l][k] == "(null)") { SPANS[l]['lbo'] = 0; }
 					}
 				}}
 			}}
-			loadConfigFiles.checkHardwareChanges();
+			loadConfigFiles.readUsersConf(); // read span_x (where T1/E1 trunks are defined)
 		};
 		config2json("ztscan.conf", 1, digitalparse);
 	},
 
-	checkHardwareChanges: function(){
+	readUsersConf: function(){
 		var usersparse = function(n){ // read users.conf and load switchtype, signalling, zapchan into the SPANS object
 			if( n == "ERROR: CONFIG FILE NOT FOUND"){
 				_$('errmsg').innerHTML = "/etc/asterisk/users.conf not found";
@@ -419,10 +401,14 @@
 				for( var l in n ){ if(n.hasOwnProperty(l)){
 					if( l.beginsWith('span_')) {
 						tmp = l.split('span_')[1];
-						if (!SPANS[tmp]){SPANS[tmp] = {};}
-						for( var k in n[l] ){ if(n[l].hasOwnProperty(k)){ 
-							SPANS[tmp][k] = n[l][k];
-							if( k=='zapchan' || k=='fxochannels'){ SPANS[tmp]['definedchans'] = efgh(n[l][k]); }
+						if (!SPANS[tmp]){ SPANS[tmp] = {}; }
+						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' || k=='fxochannels'){ SPANS[tmp]['definedchans'] = efgh(n[l][k]); }
+							if( k=='zapchan' ){ SPANS[tmp]['definedchans'] = efgh(n[l][k]); }
+							// i totally forgot why i added that 'fxochannels' thing is and what i was using it for,
+							// this is exactly why i should comment my code more often, well atleast from now on.
 						}}
 					}
 				}}
@@ -468,7 +454,15 @@
 	}
 
 	var b = String( menu.span_value );
-	SPANS[b]['fac'] = _$('editspan_fac').value;
+
+	if( _$('editspan_fac').value == 'CCS/CRC4/HDB3' ){
+		SPANS[b]['framing'] = 'CCS/CRC4';
+		SPANS[b]['coding'] = 'HDB3';
+	}else{
+		SPANS[b]['framing'] = _$('editspan_fac').value.split('/')[0];
+		SPANS[b]['coding'] = _$('editspan_fac').value.split('/')[1];;
+	}
+
 	SPANS[b]['signalling'] = _$('editspan_signalling').value;
 	SPANS[b]['switchtype'] = _$('editspan_switchtype').value;
 	SPANS[b]['syncsrc'] = _$('editspan_syncsrc').value;
@@ -565,12 +559,13 @@
 			uri = build_action('delcat', c, context,"", ""); c++;
 			uri += build_action('newcat', c , context, "", ""); c++;
 
-
-			for( var k in SPANS ){ if( SPANS.hasOwnProperty(k) ){ if(SPANS[k]['signalling'] && SPANS[k]['fac'] != 'UNCONFIGURED' ){
+			for( var k in SPANS ){ if( SPANS.hasOwnProperty(k) ){ if(SPANS[k]['signalling'] ){
 				firstpart = "span";
 				/* XXX Timing source for card is being set to zero? */
 				/* LBO is being set to 0 */
  
+				SPANS[k]['fac'] = SPANS[k]['framing'] + '/' + SPANS[k]['coding'];
+
 				if(SPANS[k]['lbo'] == "") { SPANS[k]['lbo'] = 0; }
 				if(SPANS[k]['syncsrc'] == "") { SPANS[k]['syncsrc'] = 0; }
 				secondpart = k + "," + SPANS[k]['syncsrc']  + "," + SPANS[k]['lbo'] + "," + SPANS[k]['fac'].toLowerCase().replace("/", ",");




More information about the asterisk-gui-commits mailing list