espiceland: branch 2.0 r5143 - in /branches/2.0/config/js: index.js pbx2.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Fri Jan 14 17:20:05 CST 2011


Author: espiceland
Date: Fri Jan 14 17:20:03 2011
New Revision: 5143

URL: http://svnview.digium.com/svn/asterisk-gui?view=rev&rev=5143
Log:
Convert old trunk configurations when checking config on each GUI load.

Modified:
    branches/2.0/config/js/index.js
    branches/2.0/config/js/pbx2.js

Modified: branches/2.0/config/js/index.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/index.js?view=diff&rev=5143&r1=5142&r2=5143
==============================================================================
--- branches/2.0/config/js/index.js (original)
+++ branches/2.0/config/js/index.js Fri Jan 14 17:20:03 2011
@@ -560,7 +560,28 @@
 			readcfg.dahdiScanConf();
 		}
 
+		onLogInFunctions.checkTrunks();
+
 		miscFunctions.show_advancedMode();
+	},
+	checkTrunks: function(){
+		var trunklist = pbx.trunks.list({analog: true, bri: true, pri: true});
+		
+		trunklist.each(function(trunk){
+			var ded_group = parent.pbx.trunks.getDedicatedGroup(parent.pbx.trunks.getName(trunk));
+			if(!ded_group){
+				var new_ded_group = parent.pbx.trunks.makeDedicatedGroup();
+				parent.sessionData.pbxinfo.trunks[type][trunk]['group'] = new_ded_group;
+				var x = new listOfSynActions('users.conf');
+				x.new_action('update', trunk, 'group', new_ded_group);
+				x.callActions();
+				ded_group = new_ded_group;
+			}
+			var x = new listOfSynActions('extensions.conf');
+			x.new_action('update', 'globals', trunk, 'DAHDI/g' + ded_group);
+			x.new_action('update', 'globals', 'group_' + ded_group, 'DAHDI/g' + ded_group);
+			x.callActions();
+		});
 	}
 };
 

Modified: branches/2.0/config/js/pbx2.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/pbx2.js?view=diff&rev=5143&r1=5142&r2=5143
==============================================================================
--- branches/2.0/config/js/pbx2.js (original)
+++ branches/2.0/config/js/pbx2.js Fri Jan 14 17:20:03 2011
@@ -1346,15 +1346,17 @@
 	var a = [];
 	t.each(function(item){
 		var type = parent.pbx.trunks.getType(item);
-		var g = parent.sessionData.pbxinfo.trunks[type][item]['group'].toString().split(',');
-		g.each(function(h){
-			if(h == group){
-				var name = parent.sessionData.pbxinfo.trunks[type][item]['trunkname'];
-				if(!a.contains(name)){
-					a.push(parent.sessionData.pbxinfo.trunks[type][item]['trunkname']);
+		try{
+			var g = parent.sessionData.pbxinfo.trunks[type][item]['group'].toString().split(',');
+			g.each(function(h){
+				if(h == group){
+					var name = parent.sessionData.pbxinfo.trunks[type][item]['trunkname'];
+					if(!a.contains(name)){
+						a.push(parent.sessionData.pbxinfo.trunks[type][item]['trunkname']);
+					}
 				}
-			}
-		});
+			});
+		}catch(e){}
 	});
 	return a.sort();
 };
@@ -1406,12 +1408,13 @@
 	var a = [];
 	t.each(function(item){
 		var type = parent.pbx.trunks.getType(item);
-		var g = parent.sessionData.pbxinfo.trunks[type][item]['group'].toString().split(',');
-		g.each(function(h){
-			if(!a.contains(h)){
-				a.push(h);
-			}
-		});
+		try{ var g = parent.sessionData.pbxinfo.trunks[type][item]['group'].toString().split(','); 
+			g.each(function(h){
+				if(!a.contains(h)){
+					a.push(h);
+				}
+			});
+		} catch(e){}
 	});
 	return a.sort();
 };
@@ -1791,10 +1794,12 @@
 	for (var i = 0; i < trunks.length; i++){
 		trunk = trunks[i];
 		type = parent.pbx.trunks.getType(trunk);
-		var g = sessionData.pbxinfo.trunks[type][trunk]['group'].toString().split(',');
-		for(var j = 0; j < g.length; j++){
-			nums.push(g[j]);
-		}
+		try{
+			var g = sessionData.pbxinfo.trunks[type][trunk]['group'].toString().split(',');
+			for(var j = 0; j < g.length; j++){
+				nums.push(g[j]);
+			}
+		}catch(e){}
 	}
 	return nums.sort().firstAvailable();
 };




More information about the asterisk-gui-commits mailing list