bkruse: branch asterisknow r1712 - in /branches/asterisknow/config: ./ scripts/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Oct 22 15:17:37 CDT 2007


Author: bkruse
Date: Mon Oct 22 15:17:36 2007
New Revision: 1712

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1712
Log:
Committing what I have to far on mISDN

Modified:
    branches/asterisknow/config/misdn.html
    branches/asterisknow/config/scripts/astman.js

Modified: branches/asterisknow/config/misdn.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/misdn.html?view=diff&rev=1712&r1=1711&r2=1712
==============================================================================
--- branches/asterisknow/config/misdn.html (original)
+++ branches/asterisknow/config/misdn.html Mon Oct 22 15:17:36 2007
@@ -71,6 +71,7 @@
 var oldLoadZone;
 var menu ; // document.getElementById('mymenu');
 var tot_spans = 0;
+var CARDS = 0;
 
 function hide_mymenu(){ menu.style.display="none"; }
 
@@ -218,8 +219,8 @@
 	_$('status_message').style.display="block";
 	setTimeout(function(){ _$('status_message').style.display='none';}, 1000);
 	preparemenus();
+	loadConfigFiles.runandread();
 	parent.loadscreen(this);
-	loadConfigFiles.readApplyzap();
 }
 
 var loadConfigFiles = {
@@ -230,15 +231,13 @@
 	//   (this way we know if any changes in digital hardware since the gui was last used)
 	// read users.conf - and read spans information
 
-	readApplyzap: function(){
+	runandread: function(){
 		
-		var applyZapParse = function(n){ // read applyzap.conf
+		var applyMParse = 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);
+				setTimeout( function(){ parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/applyzap.conf", function(){} ); } , 100);
 			}else{
 				try{
 					if ( n['default']['bridging'] ) { ASTGUI.selectbox.selectOption( _$('bridging'), n['general'][i].split('bridging=')[1]); }
@@ -256,14 +255,14 @@
 
 				}
 			}
-			loadConfigFiles.runZtscan(); // to next step - run ztscan and read ztscan.conf
+			loadConfigFiles.runmISDN(); // to next step - run ztscan and read ztscan.conf
 		};
-		config2json("applyzap.conf", 0, applyZapParse);
+		config2json("misdn.conf", 0, applyMParse);
 	},
 
-	runZtscan: function(){
-		parent.astmanEngine.run_tool(asterisk_guiMisdn + " scan", function(t) { // run ztscan and then try loading ztscan.conf
-			setTimeout( function(){ loadConfigFiles.loadMisdnConf();} , 2000); // leave some time for misdn-init to generate /etc/misdn-init.conf
+	runmISDN: function(){
+		parent.astmanEngine.run_tool(asterisk_guiMisdn_scan, function(t) { // run ztscan and then try loading ztscan.conf
+			setTimeout( function(){ loadConfigFiles.loadMisdnConf();} , 1000); // leave some time for misdn-init to generate /etc/misdn-init.conf
 		});
 	},
 
@@ -271,6 +270,7 @@
 
 		var makeSymLink = function() {
 			parent.astmanEngine.run_tool("/bin/touch /etc/asterisk/misdn-init.conf", function(t) { // touch misdn-init.conf so we can write to it
+				parent.astmanEngine.run_tool(asterisk_guiMisdn + " config", function(t) { return true});
 				var h= 0;
 				var uri = build_action('newcat', h, 'general', '', '', ''); h++;
 				uri += build_action('append', h, 'general', '#include "../misdn-init.conf" ;', '', '');
@@ -281,7 +281,33 @@
 		if( n == "ERROR: CONFIG FILE NOT FOUND"){
 			gui_feedback("First time running mISDN scan detected!");
 			makeSymLink();
-			loadConfigFile.loadMisdnConf();
+		//	loadConfigFile.loadMisdnConf();
+			/* We are setting up mISDN for the first time. */
+			new Ajax.Request("/asterisk/static/scan.html", {
+				method : "get",
+				asynchronous : true,
+				onComplete : function(c) {
+					records = c.responseText.split("\n");
+					for(var mn = 0; mn < records.length; mn++) {
+						CARDS = 0;
+						console.log("records["+mn+"] = "+records[mn]);
+						if(records[mn].beginsWith('card=')) { 
+							/* We found a 4 port mISDN card */
+							CARDS++;
+							for(z = 1; z <= 4; z++) {
+								SPANS[z] = {};
+								SPANS[z]['						
+							}
+						}
+					}
+					/* Here we would call something to setup a table for basic cards... (4 port BRI)*/
+				},
+				onFailure : function() {
+					gui_alert("For some reason, I could not grab scan.html, is the misdn-init tool installed?");
+					return false;
+				}
+			});
+
 		}
 			for( var l in n ){ if(n.hasOwnProperty(l)){
 				if( l =='general') { 
@@ -481,6 +507,11 @@
 	applySettings.updateZaptel();
 }
 
+function remove_misdn_conf() {
+	parent.astmanEngine.run_tool("rm /etc/asterisk/misdn-init.conf", function(t) { // touch misdn-init.conf so we can write to it
+	parent.href.location="misdn.html";
+	});
+}
 
 </script>
 <body onload="localajaxinit()" onunload="resetmainscreen()"  bgcolor="#EFEFEF">
@@ -490,7 +521,7 @@
 	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
 </div>
 
-<div class="pageheading">mISDN (b410p) Card Setup</div>
+<div class="pageheading">mISDN (b410p) Card Setup<br><a href="#" onClick="remove_misdn_conf();">Redo mISDN Setup</a></div>
 
 <div style="overflow:auto;left:40" id="div_digitalcardstable">
 	<table class="taglist" id="digitalcardstable" cellpadding=5 cellspacing=1 border=0 align=center></table>

Modified: branches/asterisknow/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/scripts/astman.js?view=diff&rev=1712&r1=1711&r2=1712
==============================================================================
--- branches/asterisknow/config/scripts/astman.js (original)
+++ branches/asterisknow/config/scripts/astman.js Mon Oct 22 15:17:36 2007
@@ -35,6 +35,7 @@
 var asterisk_guiZapscan = "/sbin/zapscan.bin" ;
 var asterisk_guiZtscan = "/sbin/ztscan";
 var asterisk_guiMisdn = "misdn-init";
+var asterisk_guiMisdn_scan = "misdn-init scan > /var/lib/asterisk/static-http/scan.html";
 var asterisk_guiEditZap = "sh " + asterisk_scriptsFolder + "editzap.sh";
 var asterisk_rawmanPath = "../../rawman" ;
 var asterisk_guiConfigFile = "guipreferences.conf"; // will be created in asterisk_configfolder, if the file does not exist 




More information about the asterisk-gui-commits mailing list