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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Dec 6 11:04:37 CST 2007


Author: pari
Date: Thu Dec  6 11:04:36 2007
New Revision: 1918

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1918
Log:
making sure we delete any span_x contexts in users.conf from any missing/removed hardware

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=1918&r1=1917&r2=1918
==============================================================================
--- branches/asterisknow/config/digital.html (original)
+++ branches/asterisknow/config/digital.html Thu Dec  6 11:04:36 2007
@@ -115,7 +115,7 @@
 var CONFIGUREDHARDWARE = {};
 var DETECTEDHARDWARE = {};
 var hwcfgfile = 'gui_confighw.conf'; // file to store configured hardware information
-
+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.
 
 function verify_priChLimit(){
 	var l = String(CURRENT_SPAN);
@@ -449,6 +449,7 @@
 
 			var abcd = function(){
 				var tmp;
+				var tmp_spantodelete = {};
 				for( var l in n ){ if(n.hasOwnProperty(l)){
 
 					if( n[l]['group'] && l !='general' ){
@@ -461,6 +462,12 @@
 					}
 
 					if( l.beginsWith('span_')) {
+						tmp_spantodelete = {};
+						tmp_spantodelete['spanName'] = l;
+						if( n[l]['context'] ){ tmp_spantodelete['spanContext'] = n[l]['context']; }
+
+						spans_todelete.push(tmp_spantodelete);
+
 						tmp = l.split('span_')[1];
 						//if (!SPANS[tmp]){ SPANS[tmp] = {}; }
 						if (!SPANS[tmp]){  //ztscan did not detect any such span as tmp
@@ -577,6 +584,26 @@
 		});
 		/* to run ztcfg and apply settings, you can do this call, but replace applysettings with ztcfg.
 		You can then read /var/lib/asterisk/static-http/config/ztcfg_output.html to look at ztcfg errors */
+	},
+
+	cleanUsersConf: function(){
+		var uri1 = ''; // for deleting old span info from users.conf
+		var uri2 = ''; // for deleting old span info from extensions.conf
+		var c = 0; f=0;
+
+		spans_todelete.each( function(item) {
+			uri1 += build_action('delcat', c, item['spanName'] , "", "");c++;
+			if(item['spanContext']){
+				uri2 += build_action('delete', f, 'globals', item['spanName'], "", ""); f++;
+				uri2 += build_action('delcat', f, item['spanContext'] , "", ""); f++;
+			}
+		});
+
+		makerequest('u', "users.conf", uri1, function(t){
+			makerequest('u', "extensions.conf", uri2, function(t) {
+				applySettings.updateUsersConf();
+			});
+		});
 	},
 
 	updateUsersConf: function(){
@@ -690,7 +717,7 @@
 
 
 		}();
-		makerequest('u', "applyzap.conf", uri , function(t) { applySettings.updateUsersConf(); });
+		makerequest('u', "applyzap.conf", uri , function(t) { applySettings.cleanUsersConf(); });
 	}
 };
 




More information about the asterisk-gui-commits mailing list