pari: branch 2.0 r4457 - in /branches/2.0: ./ config/ config/js/ scripts/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Jan 20 13:45:34 CST 2009


Author: pari
Date: Tue Jan 20 13:45:34 2009
New Revision: 4457

URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4457
Log:

 merging "DAHDI support"


Added:
    branches/2.0/config/hardware_dahdi.html
      - copied unchanged from r4456, team/pari/dahdi_support/config/hardware_dahdi.html
    branches/2.0/config/js/hardware_dahdi.js
      - copied unchanged from r4456, team/pari/dahdi_support/config/js/hardware_dahdi.js
Modified:
    branches/2.0/   (props changed)
    branches/2.0/config/digital.html
    branches/2.0/config/hardware.html
    branches/2.0/config/index.html
    branches/2.0/config/js/astman.js
    branches/2.0/config/js/index.js
    branches/2.0/config/js/jquery.js
    branches/2.0/config/js/paging.js
    branches/2.0/config/js/pbx.js
    branches/2.0/config/js/ringgroups.js
    branches/2.0/config/js/trunks_analog.js
    branches/2.0/config/js/trunks_digital.js
    branches/2.0/config/js/trunks_sps.js
    branches/2.0/config/js/trunks_voip.js
    branches/2.0/config/js/users.js
    branches/2.0/config/js/welcome.js
    branches/2.0/scripts/editzap.sh

Propchange: branches/2.0/
------------------------------------------------------------------------------
Binary property 'svnmerge-blocked' - no diff available.

Propchange: branches/2.0/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: branches/2.0/config/digital.html
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/digital.html?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/digital.html (original)
+++ branches/2.0/config/digital.html Tue Jan 20 13:45:34 2009
@@ -3,7 +3,11 @@
 if( parent.sessionData.PLATFORM.isAA50 ){
 	window.location.href='hardware_aa50.html';
 }else{
-	window.location.href='hardware.html';
+	if( parent.sessionData.DahdiChannelString == 'zapchan' ){
+		window.location.href='hardware.html';
+	}else{
+		window.location.href='hardware_dahdi.html';
+	}
 }
 
 </script>

Modified: branches/2.0/config/hardware.html
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/hardware.html?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/hardware.html (original)
+++ branches/2.0/config/hardware.html Tue Jan 20 13:45:34 2009
@@ -99,7 +99,7 @@
 
 <body bgcolor="#EFEFEF">
 <div class="iframeTitleBar">
-	<span id='iframeTitleBar_title'> Digital Card Configuration Wizard </span>
+	<span id='iframeTitleBar_title'> Hardware Configuration</span>
 	<span class='refresh_icon' onclick="window.location.reload();" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
 </div>
 

Modified: branches/2.0/config/index.html
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/index.html?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/index.html (original)
+++ branches/2.0/config/index.html Tue Jan 20 13:45:34 2009
@@ -71,7 +71,7 @@
 				// 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
 	DEBUG_LOG : [], // all the debug log messages will be stored in this array (If debug mode is enabled)
-	DEBUG_MODE : false, // set to true when debugging -- parent.sessionData.DEBUG_MODE
+	DEBUG_MODE : true, // set to true when debugging -- parent.sessionData.DEBUG_MODE
 	DEBUG_WHICH: { Ajax: true, Debug: true, Error: true, Console: true, Info: true, Warn: true } , // parent.sessionData.DEBUG_WHICH.Ajax/Debug/Error/Console/Info/Warn
 	REQUIRE_RESTART : false, // this flag is used to know if there are any updates in zapchan settings
 				// like if a FXS is assigned to a user or an analog trunk is created or something 
@@ -119,7 +119,7 @@
 			<div class="ui-accordion-link">Configure Hardware</div>
 			<div class="ui-accordion-desc">Configure your T1/E1/Analog Cards</div>
 		</div>
-		<div page='misdn.html' class='notinAA50'>
+		<div page='misdn.html' class='notinAA50' style='display:none'>
 			<div class="ui-accordion-link">mISDN Config</div>
 			<div class="ui-accordion-desc">mISDN configuration from the asterisk GUI</div>
 		</div>

Modified: branches/2.0/config/js/astman.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Tue Jan 20 13:45:34 2009
@@ -330,8 +330,9 @@
 		msg_notLoggedIn: 'Message: Authentication Required',
 		configfile : 'guipreferences.conf', // will be created if the file does not exist , ASTGUI.globals.configfile
 		g729RegInfo: 'g729reginfo.conf', // ASTGUI.globals.g729RegInfo, the sessionData.directories.script_Registerg729 script will read this file to generate tab delimited file
-		hwcfgFile: 'gui_confighw.conf', // file to store configured hardware information
-		zaptelIncludeFile: 'zaptel_guiRead.conf', // file that will be used to read zapte.conf, ASTGUI.globals.zaptelIncludeFile
+		hwcfgFile: 'gui_confighw.conf', // file to store configured hardware information, to detect hardware changes
+		dahdiIncludeFile: 'dahdi_guiread.conf', // file that will be used to read zaptel.conf or dahdi/system.conf , ASTGUI.globals.dahdiIncludeFile
+		dahdiScanOutput: 'dahdi_scan.conf', // file that will be used to read output from ztscan or dahdi_scan, ASTGUI.globals.dahdiScanOutput
 		pingInterval : 5000,
 		app_factoryReset : '/bin/reset_config', // ASTGUI.globals.app_factoryReset
 		fnf : 'ERROR:FNF',
@@ -2746,6 +2747,10 @@
 		return (catfound)?cat : null ;
 	};
 
+	if( params.hasOwnProperty('configFile_output') ){
+		return toJSO( params.configFile_output );
+	};
+
 	ASTGUI.Log.Ajax("AJAX Request : reading '" +  params.filename + "'");
 
 	if( top.sessionData.FileCache.hasOwnProperty(params.filename) &&  top.sessionData.FileCache[params.filename].modified == false){ // if file is in cache and is not modified since

Modified: branches/2.0/config/js/index.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/index.js?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/js/index.js (original)
+++ branches/2.0/config/js/index.js Tue Jan 20 13:45:34 2009
@@ -242,7 +242,7 @@
 			}
 
 			ASTGUI.dialog.waitWhile('detecting Hardware ..');
-			onLogInFunctions.runZtscan();
+			onLogInFunctions.run_detectdahdi();
 		});
 	},
 
@@ -250,7 +250,6 @@
 		// onLogInFunctions.setGUI_Paths()
 		var ASTERISK_CONF = context2json({ filename:'asterisk.conf' , context : 'directories' , usf:1 });
 		if( ASTERISK_CONF === null ){ ASTERISK_CONF = new ASTGUI.customObject ; } // if context 'directories' not found in asterisk.conf
-
 		sessionData.directories.asteriskConfig =  ASTERISK_CONF.getProperty('astetcdir') ||  '/etc/asterisk/' ;
 		sessionData.directories.astvarlibdir = ASTERISK_CONF.getProperty('astvarlibdir') || '/var/lib/asterisk/' ;
 		sessionData.directories.AGIBIN = ASTERISK_CONF.getProperty('astagidir') || '/var/lib/asterisk/agi-bin/' ;
@@ -280,8 +279,10 @@
 		sessionData.directories.script_dldsoundpack = 'sh ' + sessionData.directories.scripts + 'dldsoundpack';
 		sessionData.directories.script_mastercsvexists = 'sh ' + sessionData.directories.scripts + 'mastercsvexists';
 		sessionData.directories.script_Registerg729 = 'sh ' + sessionData.directories.scripts + 'registerg729.sh';
-
-		sessionData.directories.app_Ztscan = 'ztscan > ' + sessionData.directories.asteriskConfig +'ztscan.conf' ;
+		sessionData.directories.script_detectdahdi = 'sh ' + sessionData.directories.scripts + 'detectdahdi.sh';
+
+		sessionData.directories.app_DahdiScan = 'dahdi_scan > ' + sessionData.directories.asteriskConfig + ASTGUI.globals.dahdiScanOutput ;
+		sessionData.directories.app_dahdi_genconf = 'dahdi_genconf'; // generates new /etc/dahdi/system.conf
 		sessionData.directories.app_mISDNscan = 'misdn-init scan' ;
 		sessionData.directories.app_flashupdate = 'flashupdate' ;
 	},
@@ -427,20 +428,35 @@
 				miscFunctions.hide_panel('digital.html');
 				onLogInFunctions.updatePanels4Platform();
 			}else{
-				onLogInFunctions.runZtscan();
+				onLogInFunctions.run_detectdahdi();
 			}
 		};
 		ASTGUI.systemCmdWithOutput( 's800iconfig' , after);
 	},
 
-	runZtscan : function(){ // onLogInFunctions.runZtscan()
+	run_detectdahdi : function(){ // onLogInFunctions.run_detectdahdi()
 		ASTGUI.dialog.waitWhile('detecting Hardware ..');
-		var cb = function(){
-			onLogInFunctions.updatePanels4Platform();
-		};
-		ASTGUI.systemCmd(top.sessionData.directories.app_Ztscan, cb);
-	},
-
+
+		ASTGUI.systemCmdWithOutput( sessionData.directories.script_detectdahdi , function(op){
+			op = op.toLowerCase();
+
+			sessionData.DahdiChannelString = 'dahdichan' ;
+			sessionData.DahdiDeviceString = 'DAHDI' ;
+
+			sessionData.directories.app_DahdiScan = 'dahdi_scan > ' + sessionData.directories.asteriskConfig + ASTGUI.globals.dahdiScanOutput ;
+
+			if( op.contains('zaptel') ){
+				sessionData.DahdiChannelString = 'zapchan' ;
+				sessionData.DahdiDeviceString = 'Zap' ;
+				sessionData.directories.app_DahdiScan = 'ztscan > ' + sessionData.directories.asteriskConfig + ASTGUI.globals.dahdiScanOutput ;
+				miscFunctions.hide_panel('misdn.html', 1);
+			}else{
+				miscFunctions.hide_panel('misdn.html', -1);
+			}
+
+			ASTGUI.systemCmd( sessionData.directories.app_DahdiScan , onLogInFunctions.updatePanels4Platform );
+		});
+	},
 
 	updatePanels4Platform: function(){
 		var tmp_continue = astgui_updateConfigFromOldGui(); // update configuration form 1.x gui if needed
@@ -507,7 +523,6 @@
 // 			});
 		}
 
-
 		//if( sessionData.PLATFORM.isAA50  ){
 			DOM_mainscreen.src = 'home.html?status=1';
 		//}
@@ -515,7 +530,7 @@
 		if( sessionData.PLATFORM.isAA50 && sessionData.PLATFORM.AA50_SKU.contains('800') ){
 			// no need to parse ztscan output for s800 SKU
 		}else{
-			readcfg.ztScanConf();
+			readcfg.dahdiScanConf();
 		}
 
 		miscFunctions.show_advancedMode();
@@ -560,15 +575,13 @@
 		return TI_LIST;
 	},
 
-	hide_panel: function(fname , show){ // parent.miscFunctions.hide_panel('page.html' , 0/1 )
+	hide_panel: function(fname , show){ // parent.miscFunctions.hide_panel('page.html' , 0/1/-1 ) , use -1 for deleteing a panel
 		var t = $('.ui-accordion-link') ;
 		for(var p=0; p < t.length ; p++){
 			if( $(t[p].parentNode).attr("page") == fname ){
-				if(show){
-					$(t[p].parentNode).show();
-				}else{
-					$(t[p].parentNode).hide();
-				}
+				if(!show) $(t[p].parentNode).hide();
+				if( show == -1 ) $(t[p].parentNode).remove();
+				if( show == 1) $(t[p].parentNode).show();
 				return;
 			}
 		}
@@ -1023,22 +1036,9 @@
 
 	if( sessionData.PLATFORM.isABE ){ // ABE-1600
 		try{
-			(function(){
-				var all_divs = $('div');
-				var i = 0;
-				while( all_divs[i] ){
-					var adi = all_divs[i];
-					var pg = $(adi).attr('page') ;
-					if( pg && pg == 'mohfiles.html' ){
-						adi.parentNode.removeChild(adi);
-						break;
-					}
-					i++;
-				}
-			})();
+			miscFunctions.hide_panel('mohfiles.html', -1);
 		}catch(err){}
 	}
-
 
 	var loadGUI = function(){
 		DOM_accordion_div = _$('accordion_div');

Modified: branches/2.0/config/js/jquery.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/jquery.js?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/js/jquery.js (original)
+++ branches/2.0/config/js/jquery.js Tue Jan 20 13:45:34 2009
@@ -2697,7 +2697,7 @@
 						if( !top.sessionData.FileCache.hasOwnProperty(tmp_filename) ){ top.sessionData.FileCache[tmp_filename] = {}; }
 						top.sessionData.FileCache[tmp_filename].modified = true;
 
-					if( s.url.contains('&srcfilename=http.conf&') || s.url.contains( '&srcfilename=' + ASTGUI.globals.zaptelIncludeFile + '&') ){
+					if( s.url.contains('&srcfilename=http.conf&') ){
 
 					}else{
 						ASTGUI.cookies.setCookie( 'configFilesChanged' , 'yes' );

Modified: branches/2.0/config/js/paging.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/paging.js?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/js/paging.js (original)
+++ branches/2.0/config/js/paging.js Tue Jan 20 13:45:34 2009
@@ -104,6 +104,31 @@
 };
 
 
+var GetDevice_UserName = function( device ){
+	// device = SIP/6002 or Zap/1, or DAHDI/1 or IAX2/6001
+	var tmp_ext = device.afterChar('/');
+	var tmp_techn = device.beforeChar('/');
+
+	if( tmp_techn.toLowerCase() == 'zap' || tmp_techn.toLowerCase() == 'dahdi' ){
+		for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
+			if( parent.sessionData.pbxinfo.users[q].hasOwnProperty('zapchan') && parent.sessionData.pbxinfo.users[q]['zapchan'] == tmp_ext ){
+				return q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname');
+			}
+			if( parent.sessionData.pbxinfo.users[q].hasOwnProperty('dahdichan') && parent.sessionData.pbxinfo.users[q]['dahdichan'] == tmp_ext ){
+				return q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname');
+			}
+		}}
+		return 'AnalogPort ' + tmp_ext ;
+	}else{
+		if( parent.sessionData.pbxinfo.users.hasOwnProperty(tmp_ext) ){
+			var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].getProperty('fullname');
+			return tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name
+		}
+		return tmp_ext + '(' + tmp_techn + ')' ;
+	}
+};
+
+
 var resetFields = function(){
 	if(isNewPgGrp){
 		_$('pagegroup_editdiv_title').innerHTML = 'New Page/Intercom Group';
@@ -111,30 +136,8 @@
 		ASTGUI.resetTheseFields([ DOM_text_pageGroup_Exten , DOM_select_pageGroup_Type , DOM_chk_pageGroup_beep ]);
 		ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 		ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
-		listOfDialDevices.each(function(device){ 
-			var tmp_ext = device.afterChar('/');
-			var tmp_techn = device.beforeChar('/');
-
-			if( tmp_techn.toLowerCase() == 'zap' ){
-
-				var this_analogStation_user = '';
-				for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-					if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-						this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-						ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device);
-						return;
-					}
-				}}
-
-			}else{
-
-				if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
-					var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
-				}else{
-					return;
-				}
-				ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-			}
+		listOfDialDevices.each( function(device){
+			ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
 		});
 
 		var tmp_allextensions = ASTGUI.cloneObject( parent.miscFunctions.getAllExtensions() );
@@ -161,43 +164,13 @@
 	ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 	var mbrs = ASTGUI.cloneObject(tmp_members) ; 
 	mbrs.each(function(device){
-		var tmp_ext = device.afterChar('/');
-		var tmp_techn = device.beforeChar('/');
-
-		if( tmp_techn.toLowerCase() == 'zap' ){
-			var this_analogStation_user = '';
-			for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-				if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-					this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-					ASTGUI.selectbox.append( DOM_select_ringthesechannels, this_analogStation_user , device );
-					return;
-				}
-			}}
-		}else{
-			var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname) || '?';
-			ASTGUI.selectbox.append( DOM_select_ringthesechannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-		}
+		ASTGUI.selectbox.append( DOM_select_ringthesechannels, GetDevice_UserName(device) , device );
 	});
 
 
 	ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
 	listOfDialDevices.each(function(device){ if( ! mbrs.contains(device) ){
-		var tmp_ext = device.afterChar('/');
-		var tmp_techn = device.beforeChar('/');
-
-		if( tmp_techn.toLowerCase() == 'zap' ){
-			var this_analogStation_user = '';
-			for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-				if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-					this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-					ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device );
-					return;
-				}
-			}}
-		}else{
-			var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname)  || '?' ;
-			ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-		}
+		ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device );
 	}});
 };
 
@@ -319,9 +292,9 @@
 				}
 			});
 			t = parent.sessionData.FXS_PORTS_DETECTED ;
-			t.each(function(fxs){
-				listOfDialDevices.push('Zap/' + fxs );
-			});
+			t.each( function(fxs){
+				listOfDialDevices.push( parent.sessionData.DahdiDeviceString + '/' + fxs );
+			} );
 	
 			ASTGUI.events.add( DOM_button_add_toringlist , 'click' , function(){
 				var t = DOM_select_fromlistofchannels.value ; if(!t){return;}
@@ -338,58 +311,18 @@
 			ASTGUI.events.add( DOM_button_removeall_fromringlist , 'click' , function(){
 				ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 				ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
-				listOfDialDevices.each(function(device){ 
-					var tmp_ext = device.afterChar('/');
-					var tmp_techn = device.beforeChar('/');
-		
-					if( tmp_techn.toLowerCase() == 'zap' ){
-						var this_analogStation_user = '';
-						for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-							if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-								this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-								ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device);
-								return;
-							}
-						}}
-					}else{
-						if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
-							var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
-						}else{
-							return;
-						}
-						ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-					}
+				listOfDialDevices.each(function(device){
+					ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device );
 				});
 			});
 	
 			ASTGUI.events.add( 'button_addall_toringlist' , 'click' , function(){
 				ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 				ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
-	
-				listOfDialDevices.each(function(device){ 
-					var tmp_ext = device.afterChar('/');
-					var tmp_techn = device.beforeChar('/');
-		
-					if( tmp_techn.toLowerCase() == 'zap' ){
-						var this_analogStation_user = '';
-						for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-							if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-								this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-								ASTGUI.selectbox.append( DOM_select_ringthesechannels, this_analogStation_user , device);
-								return;
-							}
-						}}
-					}else{
-						if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
-							var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
-						}else{
-							return;
-						}
-						ASTGUI.selectbox.append( DOM_select_ringthesechannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-					}
+				listOfDialDevices.each( function(device){
+					ASTGUI.selectbox.append( DOM_select_ringthesechannels, GetDevice_UserName(device) , device );
 				});
 			});
-	
 		})();
 		update_PageGroupsTable();
 	}catch(err){

Modified: branches/2.0/config/js/pbx.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/pbx.js?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/js/pbx.js (original)
+++ branches/2.0/config/js/pbx.js Tue Jan 20 13:45:34 2009
@@ -176,32 +176,47 @@
 		}
 
 		(function(){
-			var tmp_file = ASTGUI.globals.zaptelIncludeFile;
-			var s = $.ajax({ url: ASTGUI.paths.rawman+'?action=getconfig&filename=' + tmp_file , async: false }).responseText;
+			var runScript_detectdahdi = function(){
+				ASTGUI.systemCmd( sessionData.directories.script_detectdahdi , function(){
+					setTimeout( function(){
+						if( sessionData.DEBUG_MODE ){
+							alert(ASTGUI.globals.dahdiIncludeFile + 'not found, ran script ' + sessionData.directories.script_detectdahdi + ' \n Click OK to Reload');
+						}
+						window.location.reload();
+					} , 500 );
+				});
+			};
+
+			var s = $.ajax({ url: ASTGUI.paths.rawman+'?action=getconfig&filename=' + ASTGUI.globals.dahdiIncludeFile , async: false }).responseText;
 			if( s.contains('Response: Error') && s.contains('Message: Config file not found') ){
-				ASTGUI.miscFunctions.createConfig( tmp_file , function(){
-					var u = new listOfSynActions(tmp_file) ;
-					u.new_action('delcat', 'general', "", ""); 
-					u.new_action('newcat', 'general', "", ""); 
-					u.new_action('update', 'general', '#include "../zaptel.conf" ;', ' ;');
-					u.callActions();
+				sessionData.continueParsing = false ;
+				ASTGUI.systemCmd( sessionData.directories.app_dahdi_genconf , function(){
+					if( sessionData.DEBUG_MODE ){
+						alert( 'ran ' + sessionData.directories.app_dahdi_genconf + ' \n Click OK to Reload' );
+					}
+					window.location.reload() ;
 				});
 				return;
 			}else{
-				var q = config2json({ configFile_output:s , usf:0 });
-				if( q.hasOwnProperty('general') ){
-					q.general.each(function(line){
-						if ( !line.beginsWith('fx') ){ return ;}
-						if( line.beginsWith('fxoks=') || line.beginsWith('fxsks=') ){
-							var ksports = ASTGUI.miscFunctions.chanStringToArray( line.afterChar('=') );
-							sessionData.PORTS_SIGNALLING.ks = sessionData.PORTS_SIGNALLING.ks.concat(ksports);
-						}
-						if( line.beginsWith('fxols=') || line.beginsWith('fxsls=') ){
-							var lsports = ASTGUI.miscFunctions.chanStringToArray( line.afterChar('=') );
-							sessionData.PORTS_SIGNALLING.ls = sessionData.PORTS_SIGNALLING.ls.concat(lsports);
-						}
+				var q = context2json({ configFile_output:s, context: 'general', usf:0 });
+				if( q === null ){ // if context 'general' is not found
+					ASTGUI.systemCmd( sessionData.directories.script_detectdahdi , function(){
+						sessionData.continueParsing = false ;
+						runScript_detectdahdi();
+						return;
 					});
 				}
+				q.each(function(line){
+					if ( !line.beginsWith('fx') ){ return ;}
+					if( line.beginsWith('fxoks=') || line.beginsWith('fxsks=') ){
+						var ksports = ASTGUI.miscFunctions.chanStringToArray( line.afterChar('=') );
+						sessionData.PORTS_SIGNALLING.ks = sessionData.PORTS_SIGNALLING.ks.concat(ksports);
+					}
+					if( line.beginsWith('fxols=') || line.beginsWith('fxsls=') ){
+						var lsports = ASTGUI.miscFunctions.chanStringToArray( line.afterChar('=') );
+						sessionData.PORTS_SIGNALLING.ls = sessionData.PORTS_SIGNALLING.ls.concat(lsports);
+					}
+				});
 			}
 		})();
 
@@ -465,15 +480,16 @@
 			}
 
 			if( c[d].hasOwnProperty('hasexten') && c[d]['hasexten'] == 'no' && !d.beginsWith('span_') ){ // if context is a trunk - could be a analog, iax, sip
-				if( c[d]['hasiax'] == 'yes' ){ // if the context is for an iax trunk
+				if( c[d].hasOwnProperty('hasiax') && c[d]['hasiax'].isAstTrue() ){ // if the context is for an iax trunk
 					sessionData.pbxinfo['trunks']['iax'][d] = c[d] ;
 					continue;
 				}
-				if( c[d]['hassip'] == 'yes' ){ // if the context is for an sip trunk
+				if( c[d].hasOwnProperty('hassip') && c[d]['hassip'].isAstTrue() ){ // if the context is for an sip trunk
 					sessionData.pbxinfo['trunks']['sip'][d] = c[d];
 					continue;
 				}
-				if( c[d]['zapchan'] && (!c[d]['hasiax'] || c[d]['hasiax'] =='no') && (!c[d]['hassip'] || c[d]['hassip'] =='no')){
+//				if( c[d]['zapchan'] && (!c[d]['hasiax'] || c[d]['hasiax'] =='no') && (!c[d]['hassip'] || c[d]['hassip'] =='no')){
+				if( c[d].hasOwnProperty('zapchan') || c[d].hasOwnProperty('dahdichan') ){
 					// if is an analog trunk - note that here we are NOT expecting a 'FXO channel(FXS signalled) on a T1/E1'
 					// we assume that all the ports in zapchan are actual analog FXO ports
 					// a trunk for T1/E1 analog channels would begin with 'span_'
@@ -482,7 +498,7 @@
 				}
 			}
 
-			if( d.beginsWith('span_') && c[d]['zapchan'] ){ 
+			if( d.beginsWith('span_') && ( c[d].hasOwnProperty('zapchan') || c[d].hasOwnProperty('dahdichan') ) ){
 				sessionData.pbxinfo['trunks']['pri'][d] = c[d];
 				continue;
 			}
@@ -518,13 +534,13 @@
 		}}
 	},
 
-	ztScanConf: function(){ // readcfg.ztScanConf();
-		// reads ztscan.conf and updates sessionData.FXO_PORTS_DETECTED and sessionData.FXS_PORTS_DETECTED
+	dahdiScanConf : function(){ // readcfg.dahdiScanConf();
+		// reads dahdi_scan.conf and updates sessionData.FXO_PORTS_DETECTED and sessionData.FXS_PORTS_DETECTED
 		// reads ASTGUI.globals.hwcfgFile and looks for analog hardware changes
 		sessionData.FXO_PORTS_DETECTED = [];
 		sessionData.FXS_PORTS_DETECTED = [];
 		var y;
-		var c = config2json({filename:'ztscan.conf', usf:0});
+		var c = config2json({filename: ASTGUI.globals.dahdiScanOutput , usf:0});
 		var tmp_dahdi_contexts = c.getOwnProperties();
 		if( !tmp_dahdi_contexts.length ){ // no analog or digital hardware found, hide the hardware configuration & misdn panels
 			miscFunctions.hide_panel('digital.html', 0);
@@ -569,7 +585,8 @@
 // 				hideNo: true
 // 			});
 // 		}
-	} // end of readcfg.ztScanConf();
+
+	} // end of readcfg.dahdiScanConf();
 }; // end of readcfg
 
 
@@ -847,7 +864,16 @@
 	addAnalogTrunk: function(tr, cbf){ // creates a new analog trunk with the details metioned in tr object, cbf is callback function
 		// usage:: astgui_managetrunks.addAnalogTrunk({ 'zapchan':'2,3,4' , (optional) trunkname:'Ports 2,3,4'} , cbf) ;
 
-		if(! tr.hasOwnProperty('zapchan') ){return false;} // zapchan is a required parameter. 
+		if( !tr.hasOwnProperty('zapchan') &&  !tr.hasOwnProperty('dahdichan') ){return false;} // zapchan is a required parameter. 
+
+		if( tr.hasOwnProperty('zapchan') ){
+			var TMP_CHANNELS = tr.zapchan ;
+			delete tr.zapchan ;
+		}
+		if( tr.hasOwnProperty('dahdichan') ){
+			var TMP_CHANNELS = tr.dahdichan ;
+			delete tr.dahdichan ;
+		}
 
 		var trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
 		var group = astgui_managetrunks.misc.nextAvailableGroup();
@@ -863,10 +889,9 @@
 			sessionData.pbxinfo.trunks.analog[trunk] = new ASTGUI.customObject; // add new/reset analog trunk info in sessionData
 		x.new_action('append', trunk, 'group', group);
 			sessionData.pbxinfo.trunks.analog[trunk]['group'] = group;
-		x.new_action('append', trunk, 'zapchan', tr.zapchan);
-			sessionData.pbxinfo.trunks.analog[trunk]['zapchan'] = tr.zapchan ;
-		var zap_channels = ASTGUI.miscFunctions.chanStringToArray(tr.zapchan);
-		delete tr.zapchan ;
+		x.new_action('append', trunk, parent.sessionData.DahdiChannelString , TMP_CHANNELS);
+			sessionData.pbxinfo.trunks.analog[trunk][parent.sessionData.DahdiChannelString] = TMP_CHANNELS;
+		var zap_channels = ASTGUI.miscFunctions.chanStringToArray( TMP_CHANNELS );
 
 		x.new_action('append', trunk, 'hasexten', 'no');
 			sessionData.pbxinfo.trunks.analog[trunk]['hasexten'] = 'no';
@@ -886,11 +911,12 @@
 
 
 		// these fields are already added, delete before iterating through userinfo
-		if(! tr.hasOwnProperty('group') ){ delete tr.group ; }
-		if(! tr.hasOwnProperty('signalling') ){ delete tr.signalling ; } // we will set the signalling based on zaptel.conf, so ignore what ever signalling is passed
-		if(! tr.hasOwnProperty('hasiax') ){ delete tr.hasiax ; }
-		if(! tr.hasOwnProperty('hassip') ){ delete tr.hassip ; }
-		if(! tr.hasOwnProperty('trunkstyle') ){ delete tr.trunkstyle ; }
+		if( tr.hasOwnProperty('group') ){ delete tr.group ; }
+		if( tr.hasOwnProperty('signalling') ){ delete tr.signalling ; } // we will set the signalling based on zaptel.conf, so ignore what ever signalling is passed
+		if( tr.hasOwnProperty('hasiax') ){ delete tr.hasiax ; }
+		if( tr.hasOwnProperty('hassip') ){ delete tr.hassip ; }
+		if( tr.hasOwnProperty('trunkstyle') ){ delete tr.trunkstyle ; }
+
 		for( var d in tr ){ if( tr.hasOwnProperty(d) ) {
 			x.new_action( 'append', trunk , d, tr[d] );
 				sessionData.pbxinfo.trunks.analog[trunk][d] = tr[d];
@@ -912,7 +938,7 @@
 			v.new_action('newcat', ct + ASTGUI.contexts.TrunkDefaultSuffix , '', ''); // add context
 			v.new_action('append', ct , 'include', ct + ASTGUI.contexts.TrunkDefaultSuffix );
 
-			v.new_action('append', 'globals', trunk , 'Zap/g' + group);
+			v.new_action('append', 'globals', trunk , parent.sessionData.DahdiDeviceString + '/g' + group);
 
 			var h = v.callActions();
 			if( h.contains('Response: Success') ){

Modified: branches/2.0/config/js/ringgroups.js
URL: http://svn.digium.com/svn-view/asterisk-gui/branches/2.0/config/js/ringgroups.js?view=diff&rev=4457&r1=4456&r2=4457
==============================================================================
--- branches/2.0/config/js/ringgroups.js (original)
+++ branches/2.0/config/js/ringgroups.js Tue Jan 20 13:45:34 2009
@@ -131,6 +131,31 @@
 };
 
 
+var GetDevice_UserName = function( device ){
+	// device = SIP/6002 or Zap/1, or DAHDI/1 or IAX2/6001
+	var tmp_ext = device.afterChar('/');
+	var tmp_techn = device.beforeChar('/');
+
+	if( tmp_techn.toLowerCase() == 'zap' || tmp_techn.toLowerCase() == 'dahdi' ){
+		for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
+			if( parent.sessionData.pbxinfo.users[q].hasOwnProperty('zapchan') && parent.sessionData.pbxinfo.users[q]['zapchan'] == tmp_ext ){
+				return q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname');
+			}
+			if( parent.sessionData.pbxinfo.users[q].hasOwnProperty('dahdichan') && parent.sessionData.pbxinfo.users[q]['dahdichan'] == tmp_ext ){
+				return q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname');
+			}
+		}}
+		return 'AnalogPort ' + tmp_ext ;
+	}else{
+		if( parent.sessionData.pbxinfo.users.hasOwnProperty(tmp_ext) ){
+			var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].getProperty('fullname');
+			return tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name
+		}
+		return tmp_ext + '(' + tmp_techn + ')' ;
+	}
+};
+
+
 var resetFields = function(){
 
 	if(isNewRG){
@@ -140,33 +165,11 @@
 		//DOM_select_strategy.selectedIndex = -1 ;
 		ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 		ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
-		listOfDialDevices.each(function(device){ 
-			var tmp_ext = device.afterChar('/');
-			var tmp_techn = device.beforeChar('/');
-
-			if( tmp_techn.toLowerCase() == 'zap' ){
-
-				var this_analogStation_user = '';
-				for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-					if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-						this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-						ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device);
-						return;
-					}
-				}}
-
-			}else{
-
-				if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
-					var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
-				}else{
-					return;
-				}
-				ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-			}
-		});
+		listOfDialDevices.each(function(device){
+			ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
+		});
+
 		DOM_text_rgExten.value = '' ;
-
 		ASTGUI.selectbox.populateArray( DOM_rg_fb_select ,  parent.miscFunctions.getAllDestinations() );
 		ASTGUI.resetTheseFields([ DOM_rg_fb_select , DOM_select_strategy , DOM_text_ringTime ]);
 
@@ -185,44 +188,14 @@
 	ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 	var mbrs = ASTGUI.cloneObject(c['members']);
 	mbrs.each(function(device){ 
-		var tmp_ext = device.afterChar('/');
-		var tmp_techn = device.beforeChar('/');
-
-		if( tmp_techn.toLowerCase() == 'zap' ){
-			var this_analogStation_user = '';
-			for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-				if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-					this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-					ASTGUI.selectbox.append( DOM_select_ringthesechannels, this_analogStation_user , device );
-					return;
-				}
-			}}
-		}else{
-			var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname) || '?';
-			ASTGUI.selectbox.append( DOM_select_ringthesechannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-		}
+		ASTGUI.selectbox.append( DOM_select_ringthesechannels, GetDevice_UserName(device) , device);
 	});
 
-
 	ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
-	listOfDialDevices.each(function(device){ if( ! mbrs.contains(device) ){
-		var tmp_ext = device.afterChar('/');
-		var tmp_techn = device.beforeChar('/');
-
-		if( tmp_techn.toLowerCase() == 'zap' ){
-			var this_analogStation_user = '';
-			for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-				if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-					this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-					ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device );
-					return;
-				}
-			}}
-		}else{
-			var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname)  || '?' ;
-			ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-		}
-	}});
+	listOfDialDevices.each(function(device){
+		if( mbrs.contains(device) ){ return ; }
+		ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
+	});
 	DOM_text_rgExten.value = (c['extension'])?c['extension']:'' ;
 	DOM_text_ringTime.value = (c['ringtime'])?c['ringtime']:'' ;
 	DOM_edit_ignoreRedir.checked = (c['ignore']==true) ;
@@ -286,29 +259,8 @@
 		var TMP_MEMBERS = [];
 		var CDM = ASTGUI.cloneObject(c[d]['members']);
 		CDM.each(function(device){
-			var tmp_ext = device.afterChar('/');
-			var tmp_techn = device.beforeChar('/');
-
-			if( tmp_techn.toLowerCase() == 'zap' ){
-				var this_analogStation_user = '';
-				for( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-					if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-						this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-						TMP_MEMBERS.push( this_analogStation_user );
-						break;
-					}
-				}}
-				if(! this_analogStation_user ){
-					TMP_MEMBERS.push( 'AnalogPort ' + tmp_ext + ' ?' );
-				}
-			}else{
-				var tmp_name = (parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname)  || '?';
-				TMP_MEMBERS.push( tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name );
-			}
-
-
-		});
-		
+			TMP_MEMBERS.push( GetDevice_UserName(device) );
+		});
 		addCell( newRow , { html: TMP_MEMBERS.join(', ') } );
 		var tmp = "<span class='guiButton' onclick=\"edit_rg_form('" + d +"')\">Edit</span>" + 
 				"<span class='guiButtonDelete' onclick=\"delete_rg_confirm('" + d +"')\">Delete</span>" ;
@@ -344,7 +296,7 @@
 		});
 		t = parent.sessionData.FXS_PORTS_DETECTED ;
 		t.each(function(fxs){
-			listOfDialDevices.push('Zap/' + fxs );
+			listOfDialDevices.push( parent.sessionData.DahdiDeviceString + '/' + fxs ); // Zap/x or DAHDI/x
 		});
 
 		ASTGUI.events.add( DOM_button_add_toringlist , 'click' , function(){
@@ -362,27 +314,9 @@
 		ASTGUI.events.add( DOM_button_removeall_fromringlist , 'click' , function(){
 			ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 			ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
-			listOfDialDevices.each(function(device){ 
-				var tmp_ext = device.afterChar('/');
-				var tmp_techn = device.beforeChar('/');
-	
-				if( tmp_techn.toLowerCase() == 'zap' ){
-					var this_analogStation_user = '';
-					for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-						if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){
-							this_analogStation_user = q + '(AnalogPort ' + tmp_ext + ') ' + parent.sessionData.pbxinfo.users[q].getProperty('fullname') ;
-							ASTGUI.selectbox.append( DOM_select_fromlistofchannels, this_analogStation_user , device);
-							return;
-						}
-					}}
-				}else{
-					if( parent.sessionData.pbxinfo.users[tmp_ext] && parent.sessionData.pbxinfo.users[tmp_ext].fullname ){
-						var tmp_name = parent.sessionData.pbxinfo.users[tmp_ext].fullname || '?' ;
-					}else{
-						return;
-					}
-					ASTGUI.selectbox.append( DOM_select_fromlistofchannels, tmp_ext + '('+ tmp_techn +')' + ' ' + tmp_name , device);
-				}
+
+			listOfDialDevices.each( function(device){
+				ASTGUI.selectbox.append( DOM_select_fromlistofchannels, GetDevice_UserName(device) , device);
 			});
 		});
 
@@ -390,32 +324,11 @@
 			ASTGUI.selectbox.clear( DOM_select_ringthesechannels );
 			ASTGUI.selectbox.clear( DOM_select_fromlistofchannels );
 
-			listOfDialDevices.each(function(device){ 
-				var tmp_ext = device.afterChar('/');
-				var tmp_techn = device.beforeChar('/');
-	
-				if( tmp_techn.toLowerCase() == 'zap' ){
-					var this_analogStation_user = '';
-					for ( var q in parent.sessionData.pbxinfo.users ){ if( parent.sessionData.pbxinfo.users.hasOwnProperty(q) ){
-						if( parent.sessionData.pbxinfo.users[q].getProperty('zapchan') == tmp_ext ){

[... 332 lines stripped ...]



More information about the asterisk-gui-commits mailing list