rbrindley: branch rbrindley/welcome_revamp r4287 - /team/rbrindley/welcome_re...

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


Author: rbrindley
Date: Thu Dec  4 21:34:23 2008
New Revision: 4287

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

- implemented 'join' and 'leave' cases in parseOutput's event switchcase
- added and implemented addQueueCall and removeQueueCall functions


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

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=4287&r1=4286&r2=4287
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Thu Dec  4 21:34:23 2008
@@ -399,6 +399,7 @@
 				$('<td></td>').html(waittime).appendTo(call);
 
 				call.addClass(call_class);
+				call.attr('id',''+q_name.toString()+'_call_'+cid.toString());
 				calls.append(call);
 				line_index++;
 			}
@@ -552,6 +553,19 @@
 			var status = 'hangup';
 			this.updateExtension(exten.trim(),context,status);
 			break;
+		case 'event: join':
+			/* event[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = event[2].split(' ')[1].split('/')[1].split('-')[0];
+			var queue = event[5].split(' ')[1];		//Queue: 6501
+			var position = event[6].split(' ')[1];		//Position: 1
+			this.addQueueCall(queue, exten, position);
+			break;
+		case 'event: leave':
+			/* event[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = event[2].split(' ')[1].split('/')[1].split('-')[0];
+			var queue = event[3].split(' ')[1];		//Queue: 6501
+			this.removeQueueCall(queue, exten);
+			break;
 		case 'event: newchannel':
 			/* event[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
 			var exten = event[2].split(' ')[1].split('/')[1].split('-')[0];
@@ -581,8 +595,6 @@
 		case 'event: queuememberpaused':
 		case 'event: dial':
 		case 'event: musiconhold':
-		case 'event: join':
-		case 'event: leave':
 		case 'event: link':
 		case 'event: meetmejoin':
 		case 'event: meetmeleave':
@@ -657,6 +669,35 @@
 	}
 };
 
+manager_events.addQueueCall = function (queue, exten, position) {
+	var calls_tbody = $('#queue_'+queue.toString()+' .calls > .list > tbody');
+	var new_row = $('<tr></tr>').attr('id',''+queue.toString()+'_call_'+exten.toString()).addClass('call').addClass('new');
+
+	if (position == 1) {
+		calls_tbody.empty();
+	}
+
+	$("<td></td>").html(position).appendTo(new_row);
+	$("<td></td>").html(exten).appendTo(new_row);
+	$("<td></td>").html('0:00').appendTo(new_row);
+
+	calls_tbody.append(new_row);
+};
+
+manager_events.removeQueueCall = function (queue, exten) {
+	var calls_tbody = $('#queue_'+queue.toString()+' .calls > .list > tbody');
+
+	$('#'+queue.toString()+'_call_'+exten.toString()).remove();
+
+	if (calls_tbody.children('tr').length == 0) {
+		calls_tbody.append(
+			$('<tr></tr>').append(
+				$('<td></td>').attr('colspan','3').html('No Calls')
+			)
+		);
+	}
+};
+
 manager_events.updateExtension = function(exten, context, status) {
 	var exten_status_img = $('#exten_status_'+exten.toString()+' img');
 	switch(status.toString()) {




More information about the asterisk-gui-commits mailing list