bkruse: branch bkruse/dahdi_integration r4149 - in /team/bkruse/dahdi_integra...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Nov 19 14:23:58 CST 2008


Author: bkruse
Date: Wed Nov 19 14:23:57 2008
New Revision: 4149

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4149
Log:
Updating to 2.0 branch (merge)

Added:
    team/bkruse/dahdi_integration/developer_info/CODING-GUIDELINES
      - copied unchanged from r4148, branches/2.0/developer_info/CODING-GUIDELINES
    team/bkruse/dahdi_integration/developer_info/Flow Chart.odp
      - copied unchanged from r4148, branches/2.0/developer_info/Flow Chart.odp
Removed:
    team/bkruse/dahdi_integration/developer_info/GUI_loading_Sequence_OverView.jpg
Modified:
    team/bkruse/dahdi_integration/config/js/astman.js
    team/bkruse/dahdi_integration/config/js/index.js
    team/bkruse/dahdi_integration/config/js/pbx.js
    team/bkruse/dahdi_integration/config/js/tooltip.js
    team/bkruse/dahdi_integration/config/trunks_voip.html
    team/bkruse/dahdi_integration/config/users.html

Modified: team/bkruse/dahdi_integration/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/astman.js?view=diff&rev=4149&r1=4148&r2=4149
==============================================================================
--- team/bkruse/dahdi_integration/config/js/astman.js (original)
+++ team/bkruse/dahdi_integration/config/js/astman.js Wed Nov 19 14:23:57 2008
@@ -447,7 +447,9 @@
 		return true;
 	},
 
-	cliCommand : function(cmd) { // ASTGUI.cliCommand(cmd);
+	cliCommand : function(cmd) { 
+		// ASTGUI.cliCommand(cmd);
+		//	Execute an asterisk CLI command and return the output
 		if( typeof cmd != 'string' ) {
 			ASTGUI.Log.Warn( 'cliCommand: Expecting cmd as String' );
 			return '';
@@ -456,7 +458,9 @@
 		return makeSyncRequest ( { action :'command', command: cmd } );
 	},
 
-	getUser_DeviceStatus : function( usr ){ // ASTGUI.getUser_DeviceStatus(usr) 
+	getUser_DeviceStatus : function( usr ){ 
+		// ASTGUI.getUser_DeviceStatus(usr) 
+		//	Get the DeviceStatus for a UserExtension
 		if( typeof usr == 'number' ) usr = String(usr);
 		if( typeof usr != 'string' ){
 			ASTGUI.Log.Warn( 'getUser_DeviceStatus: Expecting usr as String' );
@@ -471,7 +475,9 @@
 		return null;
 	},
 
-	getUser_DeviceStatus_Image : function( usr ){ // ASTGUI.getUser_DeviceStatus_Image(usr) 
+	getUser_DeviceStatus_Image : function( usr ){
+		// ASTGUI.getUser_DeviceStatus_Image(usr) 
+		//	Get the DeviceStatus Image for a UserExtension
 		var s =  this.getUser_DeviceStatus(usr) ;
 		switch(s){
 			case 'F': // No Device is Busy/InUse
@@ -490,7 +496,11 @@
 		}
 	},
 
-	mailboxCount : function(mbox){ // ASTGUI.mailboxCount(mox) ; --> returns the number of New/Old Messages in mbox's mailbox
+	mailboxCount : function(mbox){
+		// ASTGUI.mailboxCount(mbox)
+		//	returns the number of New/Old Voicemail Messages for a user
+		//	returns an object "{count_new: 1, count_old: 2}"
+
 		var tr = { count_new:0 , count_old : 0 };
 		if( typeof mbox == 'number' ) mbox = String(mbox);
 		if( typeof mbox != 'string' ){
@@ -517,11 +527,15 @@
 	},
 
 	doTransfer : function(from, to) {
+		// ASTGUI.doTransfer(from, to)
+		//	issue channel redirect
 		ASTGUI.Log.Debug("About to transfer " + from + " to " + to);
 		return makeSyncRequest ( { action :'redirect', channel :from, exten :to, context :'default', priority :'1' } );
 	},
 
 	doHangup : function(chan) {
+		// ASTGUI.doHangup(chan)
+		//	Hangsup a given channel
 		ASTGUI.Log.Debug("Executing hangup on channel : '" + chan + "'");
 		return makeSyncRequest ( { action :'hangup', channel: chan } );
 	},
@@ -782,17 +796,23 @@
 			}
 		},
 
-		waitWhile : function(msg){ 
+		waitWhile : function(msg){
+			// ASTGUI.dialog.waitWhile('Saving...');
+			//	use this dialog when you want to inform the user about an action in progress - Ex: 'Saving...' or 'Applying CHanges..' or 'Reloading Asteisk...' etc
 			top.alertmsgtype = 2 ;
 			this.load_iframe(msg);
 		},
 
-		alertmsg : function(msg){ // Ex: ASTGUI.dialog.alertmsg('Some Alert Message');
+		alertmsg : function(msg){
+			// ASTGUI.dialog.alertmsg('Some Alert Message');
+			//	Display custom alert message with an 'Ok' button	
 			top.alertmsgtype = 1 ;
 			this.load_iframe(msg);
 		},
 
 		hide : function(){
+			// ASTGUI.dialog.hide();
+			// Hide the dialog message, use this when you want to hide the 'waitWhile' message
 			try{
 				top.document.getElementById( top.alertframename ).style.display = "none";
 			} catch (err){ }
@@ -807,6 +827,9 @@
 
 	domActions: {
 		alignBbelowA: function(a,b, offsetLeft, offsetTop ){
+			// ASTGUI.domActions.alignBbelowA( element1, element2 )
+			//	Moves/Aligns Element-B below Element-A
+			//	You can further control the position by sending additional offset parameters (optional)
 			try{
 			if ( typeof a == 'string'){ a = _$(a) ; }
 			if ( typeof b == 'string'){ b = _$(a) ; }
@@ -827,7 +850,9 @@
 			}
 		},
 
-		alignBontopofA: function(a,b){ // ASTGUI.domActions.alignBontopofA();
+		alignBontopofA: function(a,b){
+			// ASTGUI.domActions.alignBontopofA();
+			//	set Element-B's co-ordinates to those of Element-A
 			try{
 				if ( typeof a == 'string'){ a = _$(a) ; }
 				if ( typeof b == 'string'){ b = _$(b) ; }
@@ -1252,20 +1277,26 @@
 	},
 
 	isNull : function(a){
+		// ASTGUI.isNull(a) ;
 		return a===null
 	},
 
-	isArray: function(a){ //	ASTGUI.isArray(a) ;
+	isArray: function(a){
+		// ASTGUI.isArray(a) ;
 		return a instanceof Array || ( a!= null && typeof a=="object" && typeof a.push == "function" && typeof a.concat == "function" )
 	},
 
-	loadHTML: function(u){ // loads URL 'u' in synchronus mode. note that url 'u' is restricted by same origin policy
+	loadHTML: function(u){
+		// ASTGUI.loadHTML(url)
+		// loads URL 'url' in synchronus mode. note that 'url' is restricted by same origin policy
 		var r =  Math.round(10000*Math.random());
 		var s = $.ajax({ url: u + '?r=' + r , async: false });
 		return s.responseText;
 	},
 
 	listSystemFiles : function( dir , cb ){
+		// ASTGUI.listSystemFiles( dir , callBackFunction )
+		// list of files in 'dir' will be sent to callBackFunction as an array
 		try{
 		this.systemCmd( this.scripts.ListFiles + ' ' +  dir , function(){
 			var op = ASTGUI.loadHTML( ASTGUI.paths.output_SysInfo );
@@ -1286,7 +1317,8 @@
 	},
 
 	miscFunctions: {
-		getChunksFromManagerOutput : function( op , usf){ // ASTGUI.miscFunctions.getChunksFromManagerOutput( output_str ) ;
+		getChunksFromManagerOutput : function( op , usf){
+			// ASTGUI.miscFunctions.getChunksFromManagerOutput( output_str ) ;
 			try{
 			var tr_Array = [];
 			var tmp_chunk = (usf) ? {} : [] ;
@@ -1341,7 +1373,19 @@
 			return false;
 		},
 			
-		moveUpDown_In_context: function(context, line , updown , cbf ){ 	// ASTGUI.miscFunctions.moveUpDown_In_context( ct , line , bool , cbf ) // bool = 0 for Down , 1 for Up 
+		moveUpDown_In_context: function(context, line , updown , cbf ){
+			// ASTGUI.miscFunctions.moveUpDown_In_context( ct , line , bool , cbf ) ;  bool = true for Up, false for Down (default)
+			// Use this function when you want to move a line Up/Down with in a context
+			// Example:
+			//
+			// [somcontext]
+			// include=context2
+			// include=context1
+			//
+			// use:
+			// 	ASTGUI.miscFunctions.moveUpDown_In_context( 'somcontext' , 'include=context2' , false , someCallBackFunction ) ;
+			// to move the 'include=context2' below the 'include=context1'
+
 			try{
 			updown = Number(updown);
 			var t = context2json({ filename:'extensions.conf' , context : context , usf: 0 });
@@ -1354,7 +1398,7 @@
 				if( t[ti] == line ){
 					var tmp_a = (updown) ? t[ ti - 1 ] : t[ ti + 1 ] ;
 					t[ti] = tmp_a ;
-					if( updown == 1 ){ // move up
+					if( updown ){ // move up
 						t[ti-1] = line ;
 					}else{ // move down
 						t[ti+1] = line ;
@@ -1402,6 +1446,8 @@
 
 		delete_LinesLike: function( ct ){
 			// ASTGUI.miscFunctions.delete_LinesLike({ context_name : 'voicemailgroups' , beginsWithArr: ['exten=6050,'] , filename: 'extensions.conf', hasThisString:'somestring', cb:function(){} });
+			// deletes all line in the context 'voicemailgroups' that beings with 'exten=6050,' and contains the string hasThisString (optional)
+
 			try{
 			var sel_cxt = context2json({ filename: ct.filename, context : ct.context_name , usf:0 });
 			if ( typeof ct.beginsWithArr == 'string' ){
@@ -2028,6 +2074,7 @@
 		},
 
 		readAllValues: function(el){
+			// get an array of all option values in a select box
 			if ( typeof el == 'string'){ el = _$(el) ; }
 			var y = [] ;
 			for (var x=0; x < el.options.length; x++) {
@@ -2039,6 +2086,7 @@
 		},
 
 		populateOptions: function( el, n){
+			// Populate 'n' numbered options in a select box starting from 1
 			if ( typeof el == 'string'){ el = _$(el) ; }
 			n = Number(n);
 			ASTGUI.selectbox.clear(el);
@@ -2070,6 +2118,7 @@
 		},
 
 		append_option: function(el,opt){
+			// append new option to a select box element
 			if ( typeof el == 'string'){ el = _$(el) ; }
 			if($.browser.msie){
 				el.add(opt);
@@ -2079,11 +2128,13 @@
 		},
 
 		remove_i: function(el, i){
+			// removes i'th Option from the select box
 			if ( typeof el == 'string'){ el = _$(el) ; }
 			el.options[i] = null;
 		},
 	
 		clear: function(el){
+			// remove all options from the select box
 			if ( typeof el == 'string'){ el = _$(el) ; }
 			el.options.length = 0;
 		},
@@ -2113,7 +2164,9 @@
 		}
 	}, // { selectbox }
 
-	showbg: function(t){ // show/hide a transparent bg layer - ASTGUI.showbg(true);
+	showbg: function(t){ 
+		// ASTGUI.showbg(boolean)
+		// show/hide a transparent background layer while Showing/Hiding Edit Dialogs (to prevent the user from interacting with other elements on the page)
 		try{
 		if(t){
 			if( !document.getElementById('bg_transparent') ){ 
@@ -2276,7 +2329,9 @@
 		}
 	},
 
-	systemCmd: function(cmd, callbackfunction){ // ASTGUI.systemCmd(cmd, cbf);
+	systemCmd: function(cmd, callbackfunction){
+		// ASTGUI.systemCmd(cmd, cbf);
+		//	Execute a Unix system command
 		ASTGUI.Log.Debug("Executing System Command : '" + cmd + "'");
 		var delay_cb = function(){
 			if( parent.sessionData.PLATFORM.isAA50 ){
@@ -2382,7 +2437,8 @@
 	},
 
 	updateaValue: function(e){
-		// ASTGUI.updateaValue(  {file:'users.conf', context :'6000', variable :'hassip', value :'yes'}   )
+		// ASTGUI.updateaValue({ file:'users.conf', context :'6000', variable :'hassip', value :'yes' })
+		// Use this function when you have to update only one or two unique values in a config file
 		var u = new listOfSynActions(e.file) ;
 		u.new_action('update', e.context, e.variable , e.value );
 		var g = u.callActions();
@@ -2968,6 +3024,12 @@
 		if( !parent.sessionData.PLATFORM.isAST_1_4 && this.FILE_CONTENT != null ){
 			// the update/delete/delcat commands fail in Asterisk 1.6.X/trunk if the corresponding category/variables are not found
 			// In Asterisk 1.4 we do not have to do this check
+
+			var tmp_FILENAME = this.filename;
+			if( top.sessionData.FileCache[tmp_FILENAME].modified ){
+				this.FILE_CONTENT = config2json({ filename: tmp_FILENAME , usf:0 });
+			}
+
 			switch( action ){
 				case 'update':
 					if( !this.FILE_CONTENT.hasOwnProperty(cat) ) return s;
@@ -2987,13 +3049,6 @@
 					break;
 				default: break;
 			}
-			// TODO : handle the case where , a new category is added in 'batch 1' and is deleted in 'batch 2'
-			//		the 'delcat' in 'batch 2' would fail cause the switch does not know that the file has been changed after 'batch 1',
-			//		and even if we update the FILE_CONTENT after each start_sqreqs() it would still fail cause the batches are already generated by then
-			//	we could possibly generate the batches during callActions() and read the file before generating each batch and move this switch inside the batch
-
-			//	This should not be a problem for the time being, but I will fix this issue once i get everything else working with 'asterisk 1.4/1.6.0/trunk'
-			//	Note: this is not an issue with listOfSynActions() as clearActions() will take care of updating the file changes
 		}
 		var cnt = "" + count;
 		while(cnt.length < 6)

Modified: team/bkruse/dahdi_integration/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/index.js?view=diff&rev=4149&r1=4148&r2=4149
==============================================================================
--- team/bkruse/dahdi_integration/config/js/index.js (original)
+++ team/bkruse/dahdi_integration/config/js/index.js Wed Nov 19 14:23:57 2008
@@ -806,7 +806,7 @@
 			y.each(function(user){
 				var f = new destination;
 				f.optionText = 'User Extension -- ' + user ;
-				f.optionValue = (fortbr)? 'default|' + user + '|1' : 'Goto(default|' + user + '|1)' ;
+				f.optionValue = (fortbr)? 'default,' + user + ',1' : 'Goto(default,' + user + ',1)' ;
 				tmp.push(f);
 				if(!fortbr && sessionData.pbxinfo.users[user].getProperty('hasvoicemail').isAstTrue() ){
 					var p_Text = 'User VoiceMailBox ' + user ;
@@ -817,14 +817,14 @@
 			y.each(function(meetme){
 				var f = new destination;
 				f.optionText = 'Conference Room -- ' + meetme ;
-				f.optionValue = (fortbr)? ASTGUI.contexts.CONFERENCES + '|' + meetme + '|1' :  'Goto('+ ASTGUI.contexts.CONFERENCES +'|'+ meetme + '|1)';
+				f.optionValue = (fortbr)? ASTGUI.contexts.CONFERENCES + ',' + meetme + ',1' :  'Goto('+ ASTGUI.contexts.CONFERENCES +','+ meetme + ',1)';
 				tmp.push(f);
 			});
 		var y = sessionData.pbxinfo.queues.getOwnProperties();
 			y.each(function(q){
 				var f = new destination;
 				f.optionText = 'Queue -- ' + q ;
-				f.optionValue = (fortbr)? ASTGUI.contexts.QUEUES + '|' + q + '|1' : 'Goto('+ ASTGUI.contexts.QUEUES +'|'+ q + '|1)';
+				f.optionValue = (fortbr)? ASTGUI.contexts.QUEUES + ',' + q + ',1' : 'Goto('+ ASTGUI.contexts.QUEUES +','+ q + ',1)';
 				tmp.push(f);
 			});
 		var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
@@ -832,7 +832,7 @@
 				var vm_name = sessionData.pbxinfo.voicemenus[vmenu].comment || vmenu ;
 				var f = new destination;
 				f.optionText = 'VoiceMenu -- ' + vm_name ;
-				f.optionValue = (fortbr)? vmenu+ '|s|1' : 'Goto('+ vmenu +'|s|1)';
+				f.optionValue = (fortbr)? vmenu+ ',s,1' : 'Goto('+ vmenu +',s,1)';
 				tmp.push(f);
 			});
 		var y = sessionData.pbxinfo.timebasedRules.getOwnProperties();
@@ -840,7 +840,7 @@
 				var tbr_label = sessionData.pbxinfo.timebasedRules[tbr].label || tbr ;
 				var f = new destination;
 				f.optionText = 'Time Based Rule -- ' + tbr_label;
-				f.optionValue = (fortbr)? tbr + '|s|1' : 'Goto('+ tbr +'|s|1)';
+				f.optionValue = (fortbr)? tbr + ',s,1' : 'Goto('+ tbr +',s,1)';
 				tmp.push(f);
 			});
 		var y = sessionData.pbxinfo.ringgroups.getOwnProperties();
@@ -848,14 +848,14 @@
 				var rg_name = sessionData.pbxinfo.ringgroups[rg].NAME || rg ;
 				var f = new destination;
 				f.optionText = 'Ring Group -- ' + rg_name ;
-				f.optionValue = (fortbr)? rg + '|s|1' : 'Goto('+ rg +'|s|1)';
+				f.optionValue = (fortbr)? rg + ',s,1' : 'Goto('+ rg +',s,1)';
 				tmp.push(f);
 			});
 		var y = astgui_managePageGroups.getPGsList();
 			y.each(function(pge){
 				var f = new destination;
 				f.optionText = 'Page Group -- ' + pge ;
-				f.optionValue = 'Goto('+ ASTGUI.contexts.PageGroups +'|'+ pge +'|1)';
+				f.optionValue = 'Goto('+ ASTGUI.contexts.PageGroups +','+ pge +',1)';
 				tmp.push(f);
 			});
 
@@ -863,7 +863,7 @@
 			y.each(function( this_vmg_exten ){
 				var f = new destination;
 				f.optionText = 'VoiceMail Group -- ' + (sessionData.pbxinfo.vmgroups[this_vmg_exten].getProperty('label') || this_vmg_exten ) ;
-				f.optionValue = (fortbr) ? ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1' : 'Goto('+ ASTGUI.contexts.VoiceMailGroups +'|' + this_vmg_exten + '|1)' ;
+				f.optionValue = (fortbr) ? ASTGUI.contexts.VoiceMailGroups +',' + this_vmg_exten + ',1' : 'Goto('+ ASTGUI.contexts.VoiceMailGroups +',' + this_vmg_exten + ',1)' ;
 				tmp.push(f);
 			});
 
@@ -871,13 +871,13 @@
 			var nde = sessionData.pbxinfo['localextensions'].getProperty('defaultDirectory') ;
 			var f = new destination;
 			f.optionText = 'Names Directory -- ' + nde ;
-			f.optionValue = (fortbr) ? ASTGUI.contexts.Directory + '|' + nde + '|1' : 'Goto('+ ASTGUI.contexts.Directory + '|' + nde + '|1)'; ;
+			f.optionValue = (fortbr) ? ASTGUI.contexts.Directory + ',' + nde + ',1' : 'Goto('+ ASTGUI.contexts.Directory + ',' + nde + ',1)'; ;
 			tmp.push(f);
 		}
 
 			var f = new destination; // we always point to default|o instead of to where defautl|o points to, so that if when a different user is selected as operator, we do not have to update the menus
 			f.optionText = 'Operator';
-			f.optionValue = (fortbr)? 'default|o|1' : 'Goto(default|o|1)';
+			f.optionValue = (fortbr)? 'default,o,1' : 'Goto(default,o,1)';
 			tmp.push(f);
 
 		if(!fortbr){
@@ -890,6 +890,9 @@
 	ifExtensionAlreadyExists: function(a){ // miscFunctions.ifExtensionAlreadyExists() - returns true if an extension already exists, false Other wise
 		var tmp = [] ;
 		tmp = tmp.concat( astgui_manageusers.listOfUsers() );
+		if( sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain') ){
+			tmp.push( ASTGUI.parseContextLine.getExten(sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain')) ) ;
+		}
 		var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
 			y.each( function( item ){
 				var tmp_thisVMenu = ASTGUI.cloneObject(sessionData.pbxinfo.voicemenus[item]);

Modified: team/bkruse/dahdi_integration/config/js/pbx.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/pbx.js?view=diff&rev=4149&r1=4148&r2=4149
==============================================================================
--- team/bkruse/dahdi_integration/config/js/pbx.js (original)
+++ team/bkruse/dahdi_integration/config/js/pbx.js Wed Nov 19 14:23:57 2008
@@ -33,7 +33,7 @@
 					'default' : {},
 					'macro-stdexten' : [
 						'exten=s,1,Set(__DYNAMIC_FEATURES=${FEATURES})',
-						'exten=s,2,GotoIf($[${FOLLOWME_${ARG1}} = 1]?5:3)',
+						'exten=s,2,GotoIf($["${FOLLOWME_${ARG1}}" = "1"]?5:3)',
 						'exten=s,3,Dial(${ARG2},${RINGTIME},${DIALOPTIONS})',
 						'exten=s,4,Goto(s-${DIALSTATUS},1)',
 						'exten=s,5,Macro(stdexten-followme,${ARG1},${ARG2})',
@@ -154,6 +154,11 @@
 			}
 		}
 
+		if( EXN_CNF.hasOwnProperty('default') && EXN_CNF['default'].contains('include=demo') ){
+			UPDATES.new_action('delete', 'default', 'include', '', 'demo');
+			UPDATES.new_action('append', 'default', ';include', 'demo ; This line was commented by ASTERISK GUI');
+		}
+
 		if( UPDATES.current_batch == 1 && UPDATES.current_batch_actionnumber == 0 ){ // no updates to extensions.conf
 
 		}else{
@@ -406,7 +411,7 @@
 			df.each( function(line){
 				if( line.contains( ',1,Goto(ringroups-custom-' ) ){
 					var rg_ext = ASTGUI.parseContextLine.getExten(line) ;
-					var rg_name = line.betweenXY('(', '|') ; //ringroups-custom-1
+					var rg_name = ASTGUI.parseContextLine.getArgs(line)[0] ; //ringroups-custom-1
 					if( !sessionData.pbxinfo.ringgroups.hasOwnProperty(rg_name) ){
 						var tmp = {
 							NAME : rg_name,
@@ -921,14 +926,17 @@
 		x.callActions(cb); 
 	},
 
-	addIAXTrunk: function( tr , cbf ){  // 
-		// usage:: astgui_managetrunks.addIAXTrunk( {'host':'iaxtel.com' , username:'my_username', secret:'my_secret', ....}, cbf ) ;
+	addIAXTrunk: function( tr , cbf, cxb ){  //
+		// usage:: astgui_managetrunks.addIAXTrunk( {'host':'iaxtel.com' , username:'my_username', secret:'my_secret', ....}, cbf, "context-basis" ) ;
 		if( !tr.hasOwnProperty('host') ){ return false; } //check for required parameters
 
 		// add some default values for any IAXTrunk
-//		var trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
-		var tmp_trunksList = astgui_managetrunks.listofAllTrunks();
-		var trunk = ( !tr.username || tmp_trunksList.contains(tr.username) ) ? astgui_managetrunks.misc.nextAvailableTrunk_x() : tr.username ;
+
+		var trunk = tr.username ;
+		if (cxb == 'GUIAssigned') trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
+		else if (cxb == 'FromProvider') trunk = tr.trunkname;
+		else if (cxb == 'FromUser') trunk = tr.username;
+
 
 		sessionData.pbxinfo.trunks.iax[trunk] = new ASTGUI.customObject; // add new/reset iax trunk info in sessionData
 
@@ -979,8 +987,8 @@
 		x.callActions(cb); 
 	},
 
-	addSIPTrunk: function(tr,cbf){ // 
-		// usage:: astgui_managetrunks.addSIPTrunk( {'host':'sip_test.digium.com' , username:'my_username', secret:'my_secret',(required)fallback: '6001' ....}, cbf ) ;
+	addSIPTrunk: function(tr,cbf, cxb){ // 
+		// usage:: astgui_managetrunks.addSIPTrunk( {'host':'sip_test.digium.com' , username:'my_username', secret:'my_secret',(required)fallback: '6001' ....}, cbf, "context-basis") ;
 		if( !tr.hasOwnProperty('host') ){ return false; } //check for required parameters
 
 		// add some default values for any SIPTrunk
@@ -996,9 +1004,10 @@
 		tr.disallow ='all';
 		tr.allow = 'all';
 
-		//var trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
-		var tmp_trunksList = astgui_managetrunks.listofAllTrunks();
-		var trunk = ( !tr.username || tmp_trunksList.contains(tr.username) ) ? astgui_managetrunks.misc.nextAvailableTrunk_x() : tr.username ;
+		var trunk = tr.username ; /* default */
+		if (cxb == 'GUIAssigned') trunk = astgui_managetrunks.misc.nextAvailableTrunk_x();
+		else if (cxb == 'FromProvider') trunk = tr.trunkname;
+		else if (cxb == 'FromUser') trunk = tr.username;
 
 		var ct = ASTGUI.contexts.TrunkDIDPrefix + trunk;
 		var x = new listOfActions();
@@ -1418,7 +1427,7 @@
 		});
 		if( new_menu.alias_exten ){ // add 'exten = 7000,1,Goto(voicemenu-custom-1|s|1)' in  context 'voicemenus'
 			if( !new_menu.alias_exten.contains(',') || !new_menu.alias_exten.toLowerCase().contains('goto(') ){// if new_menu.alias_exten is '4444'
-				new_menu.alias_exten = new_menu.alias_exten.lChop('exten=') + ',1,Goto(' + new_name + '|s|1)' ;
+				new_menu.alias_exten = new_menu.alias_exten.lChop('exten=') + ',1,Goto(' + new_name + ',s,1)' ;
 			}
 			x.new_action( 'append', ASTGUI.contexts.VoiceMenuExtensions , 'exten', new_menu.alias_exten );
 		}
@@ -1501,7 +1510,7 @@
 			var configOptions = line.afterChar('=');
 			var params = configOptions.betweenXY('|',')');
 			if( params.contains('a') &&  params.contains('A') ) { // if is a meetMe Admin Login
-				b = configOptions.betweenXY('(','|');
+				b = ASTGUI.parseContextLine.getArgs(line)[0] ;
 			}
 			if( !sessionData.pbxinfo.conferences.hasOwnProperty(b) ){
 				sessionData.pbxinfo.conferences[b] = new ASTGUI.customObject ;
@@ -1658,7 +1667,7 @@
 		}
 
 		for(var u=0, v = rgextns.length; u < v ; u++ ){
-			if( rgextns[u].contains(cxtname + '|') ){
+			if( rgextns[u].contains(cxtname + '|') || rgextns[u].contains(cxtname + ',') ){
 				rg.extension = ASTGUI.parseContextLine.getExten(rgextns[u]);
 				break;
 			}
@@ -1713,7 +1722,7 @@
 		var after = function() {
 			if( rg.extension ){
 				var u = new listOfSynActions('extensions.conf') ;
-				u.new_action( 'append', ASTGUI.contexts.RingGroupExtensions , 'exten',  rg.extension + ',1,Goto(' + newrg + '|s|1)' );
+				u.new_action( 'append', ASTGUI.contexts.RingGroupExtensions , 'exten',  rg.extension + ',1,Goto(' + newrg + ',s,1)' );
 				u.callActions();
 			}
 			sessionData.pbxinfo.ringgroups[newrg] = rg ;
@@ -1728,13 +1737,8 @@
 		var u = new listOfSynActions('extensions.conf') ;
 		u.new_action('delcat', rgname , '', '');
 		if( sessionData.pbxinfo.ringgroups[rgname].extension ){
-
-
-
 			var f = sessionData.pbxinfo.ringgroups[rgname].extension ;
-
-
-			u.new_action( 'delete', ASTGUI.contexts.RingGroupExtensions , 'exten', '', f + ',1,Goto(' + rgname + '|s|1)' ) ;
+			u.new_action( 'delete', ASTGUI.contexts.RingGroupExtensions , 'exten', '', f + ',1,Goto(' + rgname + ',s,1)' ) ;
 			if( sessionData.pbxinfo.ringgroups[rgname].hasOwnProperty('isOLDRG') && sessionData.pbxinfo.ringgroups[rgname].isOLDRG == true ){
 				u.new_action( 'delete', 'default' , 'exten', '', f + ',1,Goto(' + rgname + '|s|1)' ) ;
 			}
@@ -1849,112 +1853,6 @@
 	// 	return sessionData.pbxinfo.vmgroups.getOwnProperties();
 	// }
 };
-
-
-
-// astgui_manageTimeBasedRules = {
-// 	
-// // 	// TimeBasedRule Type - by Day of Week
-// // 		[timebasedrule-custom-1] // 'timebasedrule-custom-' is time based rule prefix
-// // 		exten = s,1,NoOp(LabelForThisRule)
-// // 		exten = s,n,GotoIfTime(00:00-23:59|sun-sat|*|*?voicemenu-custom-1,s,1)
-// // 			OR
-// // 		exten = s,n,GotoIfTime(*|sun-sat|*|*?voicemenu-custom-1,s,1)
-// // 		exten = s,n,Goto(default,6000,1)
-// // 
-// // 	// TimeBasedRule Type - by a set of Dates
-// // 		[timebasedrule-custom-2] 
-// // 		exten = s,1,NoOp(LabelForThisRule)
-// // 		exten = s,n,GotoIfTime( 00:00-23:59|*|25|dec?voicemenu-custom-1,s,1 ) // christmas
-// // 		exten = s,n,GotoIfTime( 00:00-23:59|*|1|jan?voicemenu-custom-1,s,1 ) // Jan 1st
-// // 		exten = s,n,GotoIfTime( 00:00-23:59|*|4|jul?voicemenu-custom-1,s,1 ) // July 4rth
-// // 			OR
-// // 		exten = s,n,GotoIfTime( *|*|4|jul?voicemenu-custom-1,s,1 ) // July 4rth
-// // 		exten = s,n,Goto(default,6000,1)
-// // 
-// // 	
-// // 		// data structure //
-// // 		sessionData.pbxinfo['timebasedRules'][timebasedrule-custom-2] = {
-// // 			label : 'LabelForThisRule',
-// // 			matches : [ '00:00-23:59|*|25|dec', '00:00-23:59|*|1|jan', '00:00-23:59|*|4|jul' ], // by a set of Dates
-// // 				OR
-// // 			matches : [ '00:00-23:59|sun-sat|*|*'], // - by Day of Week, matches.length == 1
-// // 			ifMatched : 'voicemenu-custom-1,s,1',
-// // 			ifNotMatched : 'default,6000,1'
-// // 		}
-// // 	
-// 
-// 	parseContext : function(cxtname, cxt) { // parses a timebased rules context and returns a standard time based rules object 
-// 		// sessionData.pbxinfo['timebasedRules'][d]
-// 		var tbr = { label : '', matches : [] , ifMatched : '', ifNotMatched : '' } ;
-// 
-// 		if( cxt[0].contains('exten=s,1') &&  cxt[0].toLowerCase().contains('noop(')  ){
-// 			tbr.label = cxt[0].betweenXY( '(' , ')' );
-// 			cxt.splice(0,1);
-// 		}else{
-// 			tbr.label = 'TimeBased Rule ' + cxtname.withOut(ASTGUI.contexts.TimeBasedRulePrefix);
-// 		}
-// 
-// 		cxt.each( function(line) {
-// 			if( line.toLowerCase().contains('s,n,gotoiftime(') ){
-// 				tbr.matches.push( line.betweenXY('(','?') );
-// 				tbr.ifMatched = line.betweenXY('?',')') ;
-// 				return;
-// 			}
-// 			if( line.toLowerCase().contains('s,n,') ) {
-// 				tbr.ifNotMatched = line.afterStr( 's,n,' ) ;
-// 			}
-// 		});
-// 
-// 		return tbr ;
-// 	},
-// 
-// 	getTBRsList : function(){ // astgui_manageTimeBasedRules.getTBRsList
-// 		var tbrl = [] ;
-// 		var c = sessionData.pbxinfo['timebasedRules'];
-// 		for(var d in c){if(c.hasOwnProperty(d)){
-// 			tbrl.push(d);
-// 		}}
-// 		return tbrl;
-// 	},
-// 
-// 	nextAvailableTBR_x: function(){ // astgui_manageTimeBasedRules.nextAvailableTBR_x
-// 		var x = [], y = astgui_manageTimeBasedRules.getTBRsList() ;
-// 		y.each( function( item ){
-// 			if( item.beginsWith(ASTGUI.contexts.TimeBasedRulePrefix) ){ x.push( item.split(ASTGUI.contexts.TimeBasedRulePrefix)[1] ); }
-// 		} );
-// 		if( !x.length ){ return ASTGUI.contexts.TimeBasedRulePrefix + '1' ; }
-// 		return ASTGUI.contexts.TimeBasedRulePrefix + x.firstAvailable() ;
-// 	},
-// 	
-// 	createNewTBR: function( tbr , callback, newtb_ctname ){ // astgui_manageTimeBasedRules.createNewTBR(tbr, cb, name(optional) )
-// 		// tbr is new timebased rule object, callback is callback function, newtb_ctname(Optional) if you want to create with a specific name
-// 		// 
-// 		var newtb_cxt = newtb_ctname || this.nextAvailableTBR_x();
-// 		var x = new listOfActions();
-// 		x.filename('extensions.conf');
-// 		x.new_action('newcat', newtb_cxt , '', '');
-// 		x.new_action('append', newtb_cxt , 'exten', 's,1,NoOp(' + tbr.label  + ')' );
-// 		tbr.matches.each(function(match_time){
-// 			x.new_action('append', newtb_cxt , 'exten', 's,n,GotoIfTime(' + match_time + '?' + tbr.ifMatched +')' );
-// 		});
-// 		x.new_action('append', newtb_cxt , 'exten', 's,n,' +  tbr.ifNotMatched );
-// 		var after = function(){
-// 			sessionData.pbxinfo.timebasedRules[newtb_cxt] = tbr ;
-// 			callback();
-// 		};
-// 		x.callActions(after);
-// 	},
-// 	
-// 	deleteTBR : function(tbname){ // astgui_manageTimeBasedRules.deleteTBR(tbrname); 
-// 		var u = new listOfSynActions('extensions.conf') ;
-// 		u.new_action('delcat', tbname , '', '');
-// 		u.callActions();
-// 		delete sessionData.pbxinfo.timebasedRules[tbname] ;
-// 	}
-// 
-// };
-
 
 
 astgui_updateConfigFromOldGui = function(){
@@ -2055,13 +1953,12 @@
 			if(!this_line.beginsWith('exten=') ){ return ; }
 			var match_str = this_line.afterChar('=');
 	
-			if ( this_line.contains('MeetMe(${EXTEN}|') ){
+			if ( this_line.contains('MeetMe(${EXTEN}') ){
 			// Move any conferences into [conferences]
 				// old
 				// 	[default]
 				// 	exten => 6000,1,MeetMe(${EXTEN}|MI) // delete this line
-	
-					sa.new_action('delete', 'default' , 'exten', '', match_str );
+						sa.new_action('delete', 'default' , 'exten', '', match_str );
 				// new
 				//	[conferences]
 				// 	exten => 6000,1,MeetMe(${EXTEN}|MI)
@@ -2075,7 +1972,7 @@
 				//	[voicemenu-custom-?] 
 				//	exten = ????,?,Goto(conferences|6000|1)
 				var tmp_exten = ASTGUI.parseContextLine.getExten(match_str);
-				var tmp_oldMM_gotoStr = 'Goto(default|' + tmp_exten + '|1)' ;
+				var tmp_oldMM_gotoStr = 'Goto(default,' + tmp_exten + ',1)' ;
 	
 				for ( var catname in ext_conf ){
 					if( !ext_conf.hasOwnProperty(catname) ) continue;
@@ -2091,7 +1988,7 @@
 					this_menu.each( function( this_menu_line ){
 						if( this_menu_line.contains( tmp_oldMM_gotoStr ) ){
 							var tmp_toReplace = this_menu_line.afterChar('=');
-							var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldMM_gotoStr, 'Goto(' + ASTGUI.contexts.CONFERENCES +'|' + tmp_exten + '|1)' );
+							var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldMM_gotoStr, 'Goto(' + ASTGUI.contexts.CONFERENCES +',' + tmp_exten + ',1)' );
 							sa.new_action( 'update', catname , 'exten', tmp_ReplaceWith , tmp_toReplace );
 						}
 					});
@@ -2137,7 +2034,7 @@
 					this_menu.each( function( this_menu_line ){
 						if( this_menu_line.contains( tmp_oldRG_gotoStr ) ){
 							var tmp_toReplace = this_menu_line.afterChar('=');
-							var tmp_ReplaceWith = tmp_toReplace.replaceXY( tmp_oldRG_gotoStr, 'Goto(' + THIS_RGNAME +'|s|1)' );
+							var tmp_ReplaceWith = tmp_toReplace.replaceXY( tmp_oldRG_gotoStr, 'Goto(' + THIS_RGNAME +',s,1)' );
 							sa.new_action( 'update', catname , 'exten', tmp_ReplaceWith , tmp_toReplace );
 						}
 					});
@@ -2186,7 +2083,7 @@
 						this_menu.each( function( this_menu_line ){
 							if( this_menu_line.contains( tmp_oldQ_gotoStr ) ){
 								var tmp_toReplace = this_menu_line.afterChar('=');
-								var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldQ_gotoStr, 'Goto(' + ASTGUI.contexts.QUEUES +'|' + tmp_exten + '|1)' );
+								var tmp_ReplaceWith = tmp_toReplace.replaceXY(tmp_oldQ_gotoStr, 'Goto(' + ASTGUI.contexts.QUEUES +',' + tmp_exten + ',1)' );
 								sa.new_action( 'update', catname , 'exten', tmp_ReplaceWith , tmp_toReplace );
 							}
 						});

Modified: team/bkruse/dahdi_integration/config/js/tooltip.js
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/js/tooltip.js?view=diff&rev=4149&r1=4148&r2=4149
==============================================================================
--- team/bkruse/dahdi_integration/config/js/tooltip.js (original)
+++ team/bkruse/dahdi_integration/config/js/tooltip.js Wed Nov 19 14:23:57 2008
@@ -444,6 +444,9 @@
 		"</UL>\n";
 	tooltips['trunks'].en[37] = "<B>Provider Name:</B> A unique label to help you identify this trunk when listed in outbound rules, incoming rules etc.";
 	tooltips['trunks'].en[38] = "<B>Trunk Name:</B> A unique label to help you identify this trunk when listed in outbound rules, incoming rules etc. Ex: 'Port 5' ";
+	tooltips['trunks'].en[39] = "<B>Username:</B> Username that you authenticate with at VoIP provider. Must be unique if <B>Context Naming</B> is based on Username.";
+	tooltips['trunks'].en[40] = "<B>Context Naming:</B> How should Asterisk GUI determine the context name in Asterisk's .conf files.  Asterisk can assign a unique name itself, or you can base it upon the <B>Provider Name</B> or <B>Username</B> that you enter below.  Let Asterisk assign a name unles your VoIP provider requires otherwise.";
+	tooltips['trunks'].en[41] = "<B>Hostname:</B> IP address or URL for your VoIP providers server.";
 	// END   trunks_voip.html
 	
 

Modified: team/bkruse/dahdi_integration/config/trunks_voip.html
URL: http://svn.digium.com/view/asterisk-gui/team/bkruse/dahdi_integration/config/trunks_voip.html?view=diff&rev=4149&r1=4148&r2=4149
==============================================================================
--- team/bkruse/dahdi_integration/config/trunks_voip.html (original)
+++ team/bkruse/dahdi_integration/config/trunks_voip.html Wed Nov 19 14:23:57 2008
@@ -96,6 +96,7 @@
 	DOM_edit_VOIPTrunk_DIV = _$('edit_VOIPTrunk_DIV');
 	DOM_edit_VOIPTrunk_DIV_Title = _$('edit_VOIPTrunk_DIV_Title');
 	DOM_edit_VOIPTrunk_Type = _$('edit_VOIPTrunk_Type');
+	DOM_edit_VOIPTrunk_Context_Basis = _$('edit_VOIPTrunk_Context_Basis');
 	DOM_edit_VOIPTrunk_Hostname = _$('edit_VOIPTrunk_Hostname');
 	DOM_edit_VOIPTrunk_Username = _$('edit_VOIPTrunk_Username');
 	DOM_edit_VOIPTrunk_Password = _$('edit_VOIPTrunk_Password');
@@ -132,16 +133,20 @@
 
 	if( isNewTrunk == true ) {
 		DOM_edit_VOIPTrunk_DIV_Title.innerHTML = 'Create New SIP/IAX trunk';
-		ASTGUI.resetTheseFields([ DOM_edit_VOIPTrunk_Type, DOM_edit_VOIPTrunk_Hostname , DOM_edit_VOIPTrunk_Username ,  DOM_edit_VOIPTrunk_Password , 'trunk_obcid' , 'edit_VOIPTrunk_Providername','trunk_fromdomain', 'trunk_fromuser', 'trunk_insecure' ]);
+		ASTGUI.resetTheseFields([ DOM_edit_VOIPTrunk_Type, DOM_edit_VOIPTrunk_Hostname , DOM_edit_VOIPTrunk_Username ,  DOM_edit_VOIPTrunk_Password , 'trunk_obcid' , 'edit_VOIPTrunk_Providername','trunk_fromdomain', 'trunk_fromuser','trunk_authuser', 'trunk_insecure' ]);
 		DOM_edit_VOIPTrunk_Type.disabled = false;
+		DOM_edit_VOIPTrunk_Context_Basis.disabled = false;
 		ASTGUI.feedback( { msg: 'Create New Trunk', showfor:2 });
 		$('#TR_trunktype').show();
+		$('#TR_contextbasis').show();
 	} else {
 		$('#TR_trunktype').hide();
+		$('#TR_contextbasis').hide();
 		var ttype = parent.astgui_managetrunks.misc.getTrunkType(EDIT_TRUNK) ;
 		var tinfo = parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK];
 
 		DOM_edit_VOIPTrunk_Type.disabled = true;
+		DOM_edit_VOIPTrunk_Context_Basis.disabled = true;
 		DOM_edit_VOIPTrunk_DIV_Title.innerHTML = 'Edit ' + ttype.toUpperCase() + ' trunk ' + EDIT_TRUNK;
 		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Type, ttype.toUpperCase() );
 		ASTGUI.updateFieldToValue( DOM_edit_VOIPTrunk_Hostname , tinfo.getProperty('host') );
@@ -150,6 +155,7 @@
 		ASTGUI.updateFieldToValue( 'edit_VOIPTrunk_Providername' , tinfo.getProperty('trunkname') );
 		ASTGUI.updateFieldToValue( 'trunk_fromdomain' , tinfo.getProperty('fromdomain') );
 		ASTGUI.updateFieldToValue( 'trunk_fromuser' , tinfo.getProperty('fromuser') );
+		ASTGUI.updateFieldToValue( 'trunk_authuser' , tinfo.getProperty('authuser') );
 		ASTGUI.updateFieldToValue( 'trunk_insecure' , tinfo.getProperty('insecure') );
 
 		if( tinfo.getProperty('allow') == 'all'){
@@ -167,6 +173,12 @@
 			ASTGUI.updateFieldToValue( 'codec_fifth', (codecs_tmp[4] && codecs_tmp[4].trim()) || '' );
 		}
 
+		/* Don't allow editing field if the asterisk [context] is based on it. */
+		DOM_edit_VOIPTrunk_Username.disabled = false;
+		_$('edit_VOIPTrunk_Providername').disabled = false;
+		if (EDIT_TRUNK == tinfo.getProperty('username')) DOM_edit_VOIPTrunk_Username.disabled = true;
+		if (EDIT_TRUNK == tinfo.getProperty('trunkname')) _$('edit_VOIPTrunk_Providername').disabled = true;
+
 		var c = context2json({ filename:'extensions.conf', context: 'globals' , usf: 1 });
 		ASTGUI.updateFieldToValue( 'trunk_obcid', c.getProperty(ASTGUI.globals.obcidUsrPrefix + EDIT_TRUNK) );
 
@@ -209,13 +221,6 @@
 };
 
 
-
-
-
-
-
-
-
 var edit_VOIPTrunk_save_go = function(){
 	var topreload = false;
 	var tmp_username = ASTGUI.getFieldValue('edit_VOIPTrunk_Username');
@@ -224,35 +229,46 @@
 		if( !tmp_confirm ) return;
 	}
 
-	if ( !ASTGUI.checkRequiredFields(['edit_VOIPTrunk_Providername', 'edit_VOIPTrunk_Type' , 'edit_VOIPTrunk_Hostname']) ){
+	if ( !ASTGUI.checkRequiredFields(['edit_VOIPTrunk_Providername', 'edit_VOIPTrunk_Type', 'edit_VOIPTrunk_Context_Basis', 'edit_VOIPTrunk_Hostname']) ) {
 		return ;
 	}
 
 	if( isNewTrunk == true ) {
 	// New Trunk
-		var tmp_ttype = parent.astgui_managetrunks.misc.getTrunkType( DOM_edit_VOIPTrunk_Username.value );
-		//if( tmp_ttype ){
-		//	ASTGUI.highlightField( DOM_edit_VOIPTrunk_Username , "Another trunk exists with this name !!" );
-		//	return;
-		//}
+		var tcv = edit_VOIPTrunk_Context_Basis.value;  /* How do we assign context name ? */
+		if (tcv == 'FromUser') {
+			var tmp_ttype = parent.astgui_managetrunks.misc.getTrunkType( DOM_edit_VOIPTrunk_Username.value );
+			if( tmp_ttype ){
+				ASTGUI.highlightField( DOM_edit_VOIPTrunk_Username , "Another trunk exists with this name !!" );
+				return;
+			}
+		}
+		else if (tcv == 'FromProvider') {
+			var tmp_ttype = parent.astgui_managetrunks.misc.getTrunkType( ASTGUI.getFieldValue('edit_VOIPTrunk_Providername') );
+			if( tmp_ttype ){
+				ASTGUI.highlightField( 'edit_VOIPTrunk_Providername' , "Another trunk exists with this name !!" );
+				return;
+			}
+		}
 
 		var ttv = DOM_edit_VOIPTrunk_Type.value;
+
 		var trp = {
-			host: DOM_edit_VOIPTrunk_Hostname.value ,
+			host: 	  DOM_edit_VOIPTrunk_Hostname.value ,
+			username: DOM_edit_VOIPTrunk_Username.value ,
+			secret:   DOM_edit_VOIPTrunk_Password.value ,
 			trunkname: ASTGUI.getFieldValue('edit_VOIPTrunk_Providername')
 		};
-
-		if( DOM_edit_VOIPTrunk_Username.value ){
-			trp.username = ASTGUI.getFieldValue(DOM_edit_VOIPTrunk_Username) ;
-			trp.secret = ASTGUI.getFieldValue(DOM_edit_VOIPTrunk_Password) ;
-		}
 
 		var cbf = function(){
 			ASTGUI.feedback({msg:'Created New ' + ttv+ ' trunk !', showfor: 3 , color: 'green', bgcolor: '#FFFFFF'}) ;
 			window.location.reload();
 		};
-		if(ttv =='SIP'){ parent.astgui_managetrunks.addSIPTrunk( trp , cbf ) ; }
-		if(ttv =='IAX'){ parent.astgui_managetrunks.addIAXTrunk( trp , cbf ) ; }
+
+		if(ttv =='SIP'){ parent.astgui_managetrunks.addSIPTrunk( trp , cbf,
+						DOM_edit_VOIPTrunk_Context_Basis.value ) ; }
+		if(ttv =='IAX'){ parent.astgui_managetrunks.addIAXTrunk( trp , cbf,
+						DOM_edit_VOIPTrunk_Context_Basis.value ) ; }
 
 	}else if(isNewTrunk == false){
 	// Edit Existing Trunk
@@ -301,6 +317,17 @@
 				}
 			}
 
+			var tmp_authuser = ASTGUI.getFieldValue('trunk_authuser') ;
+			if( tmp_authuser ){
+				x.new_action('update', EDIT_TRUNK , 'authuser', tmp_authuser );
+				parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['authuser'] = tmp_authuser ;
+			}else{
+				if( parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK].hasOwnProperty('authuser') ){
+					delete parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['authuser'] ;
+				}
+			}
+
+
 			var tmp_insecure = ASTGUI.getFieldValue('trunk_insecure') ;
 			x.new_action('update', EDIT_TRUNK , 'insecure', tmp_insecure );
 			parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['insecure'] = tmp_insecure ;
@@ -353,43 +380,6 @@
 
 			}
 		// End of remote MWI
-
-		var NEW_TRUNKNAME = ASTGUI.getFieldValue(DOM_edit_VOIPTrunk_Username) ;
-		if( old_trunkUsername != NEW_TRUNKNAME ){
-			var topreload = true;
-			// if username is changed, change the trunk name, incoming context name and all timeinterval incoming context names
-			v.new_action('delete', 'globals', EDIT_TRUNK, '','' );
-			if( parent.sessionData.pbxinfo.trunks[ttype][EDIT_TRUNK]['hasiax'] == 'yes' ){

[... 103 lines stripped ...]



More information about the asterisk-gui-commits mailing list