rbrindley: branch 2.0 r5030 - /branches/2.0/config/js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Aug 5 09:19:11 CDT 2010


Author: rbrindley
Date: Thu Aug  5 09:19:06 2010
New Revision: 5030

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

- merged the addqueuemember change


Modified:
    branches/2.0/config/js/astman.js
    branches/2.0/config/js/pbx.js
    branches/2.0/config/js/pbx2.js
    branches/2.0/config/js/queues.js

Modified: branches/2.0/config/js/astman.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=5030&r1=5029&r2=5030
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Thu Aug  5 09:19:06 2010
@@ -348,6 +348,7 @@
 	contexts: {
 		guitools : 'asterisk_guitools', // gui tools context
 		dialtrunks : 'trunkdial-failover-0.3', // trunkdial macro with failback trunk and setcid, ASTGUI.contexts.dialtrunks
+		subscribe : 'device-hints',	//subscribecontext for sip.conf (aka devicestate fun)
 		CONFERENCES : 'conferences', // ASTGUI.contexts.CONFERENCES
 		QUEUES : 'queues', //ASTGUI.contexts.QUEUES
 		TrunkDIDPrefix : 'DID_', // context for trunks -  - ASTGUI.contexts.TrunkDIDPrefix 

Modified: branches/2.0/config/js/pbx.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/pbx.js?view=diff&rev=5030&r1=5029&r2=5030
==============================================================================
--- branches/2.0/config/js/pbx.js (original)
+++ branches/2.0/config/js/pbx.js Thu Aug  5 09:19:06 2010
@@ -311,6 +311,7 @@
 	}, // end of readcfg.guiPreferencesConf();
 
 	ExtensionsConf: function(){ //readcfg.ExtensionsConf();
+		pbx.queues.agents.setup();
 		var c = config2json({filename:'extensions.conf', usf:0});
 		//	look for numberplans, voicemenus, DID_trunk_x (incoming rules), timebasedrules, ringgroups, 
 		//	and store the information in the following objects
@@ -573,9 +574,15 @@
 				if (c[d].hasOwnProperty('zapchan') && sessionData.PLATFORM.isABE) {
 					users_conf.new_action('delete', d, 'zapchan', '');
 					users_conf.new_action('append', d, 'dahdichan', c[d]['zapchan']);
+					c[d]['dahdichan'] = c[d]['zapchan'];
 				}
 				if (!c[d].hasOwnProperty('type')) {
 					users_conf.new_action('append', d, 'type', 'peer');
+					c[d]['type'] = 'peer';
+				}
+				if (!c[d].hasOwnProperty('callcounter')) {
+					users_conf.new_action('append', d, 'callcounter', 'yes');
+					c[d]['callcounter'] = 'yes';
 				}
 				sessionData.pbxinfo['users'][d] = c[d];
 				continue;

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=5030&r1=5029&r2=5030
==============================================================================
--- branches/2.0/config/js/pbx2.js (original)
+++ branches/2.0/config/js/pbx2.js Thu Aug  5 09:19:06 2010
@@ -673,6 +673,8 @@
 		return true;
 	}
 
+	sessionData.pbxinfo.queues = new ASTGUI.customObject;
+	
 	cxt.each(function(line) {
 		if (!line.beginsWith('exten=')) {
 			return;
@@ -688,7 +690,95 @@
 		sessionData.pbxinfo.queues[exten]['configLine'] = config;
 	});
 
-	return true;
+	var exten_globals = context2json({filename: 'extensions.conf', context: 'globals', usf:0});
+	sessionData.pbxinfo.queues_list = exten_globals[exten_globals.indexOfLike('QUEUES')].afterChar('=');
+
+	return true;
+};
+
+pbx.queues.agents = {};
+
+pbx.queues.agents.setup = function() {
+	//set up extensions.conf
+	var extensions_changes = {
+		'queue-member-manager' : [
+			'handle_member,1,Verbose(2, Looping through queues to log in or out queue members)',
+			'handle_member,n,Set(thisActiveMember=${CHANNEL(channeltype)}/${CHANNEL(peername)})',
+			'handle_member,n,Set(queue_field=1)',
+			'handle_member,n,Set(thisQueueXtn=${CUT(QUEUES,\\,,${queue_field})})',
+			'handle_member,n,While($[${EXISTS(${thisQueueXtn})}])',
+			'handle_member,n,Macro(member-loginlogout)',
+			'handle_member,n,Set(queue_field=$[${queue_field} + 1])',
+			'handle_member,n,Set(thisQueueXtn=${CUT(QUEUES,\\,,${queue_field})})',
+			'handle_member,n,EndWhile()'
+		],
+		'macro-member-loginlogout' : [
+			's,1,Verbose(2, Logging queue member in or out of the request queue)',
+			's,n,Set(thisQueue=${thisQueueXtn})',
+			's,n,Set(queueMembers=${QUEUE_MEMBER_LIST(${thisQueue})})',
+			's,n,MacroIf("${queueMembers}" = ""]?q_login)',
+			's,n,Set(field=1)',
+			's,n,Set(logged_in=0)',
+			's,n,Set(thisQueueMember=${CUT(queueMembers,\\,,${field})})',
+			's,n,While($[${EXISTS(${thisQueueMember})}])',
+			's,n,GotoIf($["${thisQueueMember}" != "${thisActiveMember}"]?check_next)',
+			's,n,Set(logged_in=1)',
+			's,n,ExitWhile()',
+			's,n(check_next),Set(field=$[${field} + 1])',
+			's,n,Set(thisQueueMember=${CUT(queueMembers,\\,,${field})})',
+			's,n,EndWhile()',
+			's,n,MacroIf($[${logged_in} = 0]?q_login:q_logout)'
+		],
+		'macro-q_login' : [
+			's,1,Verbose(2, Logging ${thisActiveMember} into the ${thisQueue} queue)',
+			's,n,AddQueueMember(${thisQueue},${thisActiveMember})',
+			's,n,Playback(silence/1)',
+			's,n,ExecIf($["${AQMSTATUS}" = "ADDED"]?Playback(agent-loginok):Playback(an-error-has-occurred))'
+		],
+		'macro-q_logout' : [
+			's,1,Verbose(2, Logged ${thisActiveMember} out of ${thisQueue} queue)',
+			's,n,RemoveQueueMember(${thisQueue},${thisActiveMember})',
+			's,n,Playback(silence/1)',
+			's,n,ExecIf($["${AQMSTATUS}" = "REMOVED"]?Playback(agent-loggedoff):Playback(an-error-has-occurred))'
+		]
+	};
+	var sip_changes = {
+		'general' : {
+			'subscribecontext' : ASTGUI.contexts.subscribe
+		}
+	};
+
+	var extensions_conf = listOfSynActions('extensions.conf');
+	var extensconfig = config2json({filename: 'extensions.conf', usf:0});
+	for (var cxt_name in extensions_changes) {
+		if (!extensions_changes.hasOwnProperty(cxt_name) || extensconfig.hasOwnProperty(cxt_name)) {
+			continue;
+		}
+
+		extensions_conf.new_action('newcat', cxt_name, '', '');
+		extensconfig[cxt_name] = extensions_changes[cxt_name];
+
+		var cxt = extensions_changes[cxt_name];
+		for (var i=0; i<cxt.length; i++) {
+			var prop = cxt[i];
+			extensions_conf.new_action('append', cxt_name, 'exten', prop);
+		}
+
+		extensions_conf.callActions();
+		extensions_conf.clearActions();
+	}
+	if (!extensconfig['globals'].indexOfLike('QUEUES')) {
+		extensions_conf.new_action('append', 'globals', 'QUEUES', '');
+		extensions_conf.callActions();
+		extensions_conf.clearActions();
+	}
+
+	var sip_conf = listOfSynActions('sip.conf');
+	var sipconfig = config2json({filename: 'sip.conf', usf:0});
+	if (!sipconfig['general'].hasOwnProperty('subscribecontext')) {
+		sip_conf.new_action('append', 'general', 'subscribecontext', sip_changes['general']['subscribecontext']);
+	}
+	sip_conf.callActions();
 };
 /*---------------------------------------------------------------------------*/
 

Modified: branches/2.0/config/js/queues.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/queues.js?view=diff&rev=5030&r1=5029&r2=5030
==============================================================================
--- branches/2.0/config/js/queues.js (original)
+++ branches/2.0/config/js/queues.js Thu Aug  5 09:19:06 2010
@@ -72,14 +72,14 @@
 		addCell( newRow , { html:''} );
 	})();
 	(function(){
-		var m = parent.sessionData.pbxinfo.queues ;
+		var m = parent.sessionData.pbxinfo.queues;
 		for( l in m ){ if( m.hasOwnProperty(l) ){
 			if( m[l]['configLine'].contains(',1,agentlogin()') ){
 				loginsettings.agentLogin_line = m[l]['configLine'];
 				_$('login_exten').value = ASTGUI.parseContextLine.getExten(m[l]['configLine']) ;
 				continue;
 			}
-			if( m[l]['configLine'].contains(',1,agentcallbacklogin()') ){
+			if( m[l]['configLine'].contains(',1,Goto(queue-member-manager, handle_member, 1)') ){
 				loginsettings.agentCallbackLogin_line = m[l]['configLine'];
 				_$('login_callback_exten').value = ASTGUI.parseContextLine.getExten(m[l]['configLine']);
 				continue;
@@ -115,6 +115,8 @@
 		u.new_action( 'delete', 'default', 'exten', '' , parent.sessionData.pbxinfo.queues[q]['configLine'] );
 	}
 	u.new_action( 'delete', ASTGUI.contexts.QUEUES, 'exten', '' , parent.sessionData.pbxinfo.queues[q]['configLine'] );
+	u.new_action( 'update', 'globals', 'QUEUES', parent.sessionData.pbxinfo.queues_list.split(',').withOut(q).join(','))
+	parent.sessionData.pbxinfo.queues_list = parent.sessionData.pbxinfo.queues_list.split(',').withOut(q).join(',');
 	u.callActions();
 	var w = new listOfSynActions('queues.conf') ;
 	w.new_action('delcat', q, '', '');
@@ -209,6 +211,8 @@
 
 		var u = new listOfSynActions('extensions.conf') ;
 		u.new_action('append', ASTGUI.contexts.QUEUES, 'exten', configLine );
+		u.new_action('update', 'globals', 'QUEUES', parent.sessionData.pbxinfo.queues_list + "," + cat);
+		parent.sessionData.pbxinfo.queues_list += "," + cat;
 		u.callActions();
 
 		var x = new listOfActions('queues.conf');
@@ -253,6 +257,9 @@
 		else x.new_action('delete', cat, 'context');
 	}
 
+	$('.'+ag_chkbxClass).each(function(a) {
+		x.new_action('delete', cat, 'member', $(this).val() );
+	});
 	var ags = ASTGUI.domActions.get_checked(ag_chkbxClass) ;
 	ags.each( function(ag){
 		x.new_action('append', cat, 'member', ag );
@@ -286,8 +293,14 @@
 	var agent_count = 0 ;
 	ul.each(function(user){
 		if( parent.sessionData.pbxinfo.users[user]['hasagent'] && parent.sessionData.pbxinfo.users[user]['hasagent'].isAstTrue() ){
-			agent_count++;
-			ul_agents['Agent/' + user] = parent.sessionData.pbxinfo.users[user]['fullname'] + ' (' + user  + ')';
+			if (parent.sessionData.pbxinfo.users[user]['hassip'] && parent.sessionData.pbxinfo.users[user]['hassip'].isAstTrue()) {
+				agent_count++;
+				ul_agents['SIP/' + user] = parent.sessionData.pbxinfo.users[user]['fullname'] + ' - SIP (' + user  + ')';
+			}
+			if (parent.sessionData.pbxinfo.users[user]['hasiax'] && parent.sessionData.pbxinfo.users[user]['hasiax'].isAstTrue()) {
+				agent_count++;
+				ul_agents['IAX2/' + user] = parent.sessionData.pbxinfo.users[user]['fullname'] + ' - IAX (' + user  + ')';
+			}
 		}
 	});
 
@@ -392,9 +405,9 @@
  		delete parent.sessionData.pbxinfo.queues[OLD_EXT] ;
 	}
 	if(lce){
-		u.new_action('append', ASTGUI.contexts.QUEUES , 'exten', lce + ',1,agentcallbacklogin()');
+		u.new_action('append', ASTGUI.contexts.QUEUES , 'exten', lce + ',1,Goto(queue-member-manager, handle_member, 1)');
 		parent.sessionData.pbxinfo.queues[lce] = new ASTGUI.customObject;
-		parent.sessionData.pbxinfo.queues[lce]['configLine'] = lce + ',1,agentcallbacklogin()' ;
+		parent.sessionData.pbxinfo.queues[lce]['configLine'] = lce + ',1,Goto(queue-member-manager, handle_member, 1)' ;
 	}
 
 	u.callActions();




More information about the asterisk-gui-commits mailing list