rbrindley: branch rbrindley/welcome_revamp r4282 - in /team/rbrindley/welcome...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Dec 4 13:13:31 CST 2008


Author: rbrindley
Date: Thu Dec  4 13:13:31 2008
New Revision: 4282

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

- restructured how to handle events in parseOutput by:
	- separating by '\r\n\r\n' to get separate events
	- handle each event in a for loop
- implemented queuememberstatus case in parseOutput
- added status_X cases for queuememberstatus events in updateAgent


Modified:
    team/rbrindley/welcome_revamp/config/js/welcome2.js
    team/rbrindley/welcome_revamp/config/welcome2.html

Modified: team/rbrindley/welcome_revamp/config/js/welcome2.js
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/js/welcome2.js?view=diff&rev=4282&r1=4281&r2=4282
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Thu Dec  4 13:13:31 2008
@@ -414,6 +414,7 @@
 		queue.contents().find('.calls_complete').html(calls_completed);
 		queue.contents().find('.calls_abandoned').html(calls_abandoned);
 		queue.removeClass('template');
+		queue.attr('id','queue_'+q_name);
 		queue_conts[cont_index].append(queue);
 		cont_index = cont_index == 1 ? 0 : 1;
 	});
@@ -512,65 +513,82 @@
 };
 
 manager_events.parseOutput = function(op) {
-	var event = op.toLowerCase();
-	event = event.split('\n');
-
-	switch (event[3].trim()) {
-	case 'event: agentcallbacklogin':
-		var agent = event[5].split(' ')[1];	
-		var loginchan = event[6].split(' ')[1];	
-		this.updateAgent("callbacklogin", agent, loginchan);
-		break;
-	case 'event: agentcallbacklogoff':
-		var agent = event[5].split(' ')[1];	
-		var loginchan = event[6].split(' ')[1];	
-		this.updateAgent("callbacklogoff", agent, loginchan);
-		break;
-	case 'event: agentcalled':
-	case 'event: agentcomplete':
-	case 'event: agentconnect':
-	case 'event: agentdump':
-	case 'event: agentlogin':
-	case 'event: agentlogoff':
-	case 'event: queuememberpaused':
-	case 'event: queuememberstatus':
-	case 'event: dial':
-	case 'event: extensionstatus':
-	case 'event: hangup':
-	case 'event: musiconhold':
-	case 'event: join':
-	case 'event: leave':
-	case 'event: link':
-	case 'event: meetmejoin':
-	case 'event: meetmeleave':
-	case 'event: meetmestoptalking':
-	case 'event: meetmetalking':
-	case 'event: messagewaiting':
-	case 'event: newcallerid':
-	case 'event: newchannel':
-	case 'event: newexten':
-	case 'event: parkedcall':
-	case 'event: rename':
-	case 'event: setcdruserfield':
-	case 'event: unlink':
-	case 'event: unparkedcall':
-	case 'event: alarm':
-	case 'event: alarmclear':
-	case 'event: dndstate':
-	case 'event: logchannel':
-	case 'event: peerstatus':
-	case 'event: registry':
-	case 'event: reload':
-	case 'event: shutdown':
-	case 'event: userevent':
-	case 'event: newstate':
-		break;
-	default:
-		//console.log(event[3]);
-		break;
+	var events = op.toLowerCase();
+	events = events.split('\r\n\r\n');
+
+	for (var i=0; i<events.length; i++) {
+		var event = events[i];
+		if (event.contains('response: success')) {
+			continue;
+		} else if (event.contains('event: waiteventcomplete')) {
+			continue;
+		} else if (event.length == 0) {
+			continue;
+		}
+		event = event.split('\r\n');
+
+		switch (event[0].trim()) {
+		case 'event: agentcallbacklogin':
+			var agent = event[1].split(' ')[1];	
+			var loginchan = event[2].split(' ')[1];	
+			this.updateAgent("callbacklogin", agent, loginchan);
+			break;
+		case 'event: agentcallbacklogoff':
+			var agent = event[1].split(' ')[1];	
+			var loginchan = event[2].split(' ')[1];	
+			this.updateAgent("callbacklogoff", agent, loginchan);
+			break;
+		case 'event: agentcalled':
+		case 'event: agentcomplete':
+		case 'event: agentconnect':
+		case 'event: agentdump':
+		case 'event: agentlogin':
+		case 'event: agentlogoff':
+		case 'event: queuememberpaused':
+		case 'event: queuememberstatus':
+			var agent = event[4].split(' ')[1].split('/')[1];	//MemberName: 6000
+			var queue = event[2].split(' ')[1];			//Queue: 6501
+			var status = event[9].split(' ')[1];			//Status: 1
+			this.updateAgent('status_'+status.toString(), agent, queue);
+			break;
+		case 'event: dial':
+		case 'event: extensionstatus':
+		case 'event: hangup':
+		case 'event: musiconhold':
+		case 'event: join':
+		case 'event: leave':
+		case 'event: link':
+		case 'event: meetmejoin':
+		case 'event: meetmeleave':
+		case 'event: meetmestoptalking':
+		case 'event: meetmetalking':
+		case 'event: messagewaiting':
+		case 'event: newcallerid':
+		case 'event: newchannel':
+		case 'event: newexten':
+		case 'event: parkedcall':
+		case 'event: rename':
+		case 'event: setcdruserfield':
+		case 'event: unlink':
+		case 'event: unparkedcall':
+		case 'event: alarm':
+		case 'event: alarmclear':
+		case 'event: dndstate':
+		case 'event: logchannel':
+		case 'event: peerstatus':
+		case 'event: registry':
+		case 'event: reload':
+		case 'event: shutdown':
+		case 'event: userevent':
+		case 'event: newstate':
+			break;
+		default:
+			//console.log(event[3]);
+			break;
+		}
 	}
 
-	this.watch();	
+	this.watch();
 };
 
 manager_events.updateAgent = function(event, agent, loginchan) {
@@ -584,7 +602,34 @@
 	case 'callbacklogoff':
 		agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
 		break;
+	case 'status_0': /* Unknown */
+		agent_locs.children('.status_icon').attr('src','images/status_red.png');
+		break;
+	case 'status_1': /* Not In Use */
+		agent_locs.children('.status_icon').attr('src','images/agent_loggedin.png');
+		break;
+	case 'status_2': /* In Use */
+	case 'status_3': /* Busy */
+		agent_locs.children('.status_icon').attr('src','images/status_orange.png');
+		break;
+	case 'status_4': /* Invalid */
+		agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
+		alert(event);
+		break;
+	case 'status_5': /* Not Available (Disconnected) */
+		agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
+		break;
+	case 'status_6': /* Ringing */
+		agent_locs.children('.status_icon').attr('src','images/status_orange.png');
+		break;
+	case 'status_7': /* Ring In Use */
+		agent_locs.children('.status_icon').attr('src','images/status_orange.png');
+		break;
+	case 'status_8': /* On Hold */
+		agent_locs.children('.status_icon').attr('src','images/status_red.png');
+		break;
 	default:
+		alert(event);
 		break;
 	}
 };

Modified: team/rbrindley/welcome_revamp/config/welcome2.html
URL: http://svn.digium.com/view/asterisk-gui/team/rbrindley/welcome_revamp/config/welcome2.html?view=diff&rev=4282&r1=4281&r2=4282
==============================================================================
--- team/rbrindley/welcome_revamp/config/welcome2.html (original)
+++ team/rbrindley/welcome_revamp/config/welcome2.html Thu Dec  4 13:13:31 2008
@@ -220,13 +220,19 @@
 div.queue div.body div.agents div.template {
 	display: none;
 }
+
 div.queue div.body div.stats {
 	-moz-border-radius-bottomleft: 4px;
 	-moz-border-radius-bottomright: 4px;
 	-webkit-border-radius-bottomleft: 4px;
 	-webkit-border-radius-bottomright: 4px;
 	background-color: #efefef;
+	font-weight: bold;
 	padding: 2px;
+}
+
+div.queue div.body div.stats span {
+	font-weight: normal;
 }
 
 div.conf_room div.actions {




More information about the asterisk-gui-commits mailing list