rbrindley: branch rbrindley/welcome_revamp r4285 - /team/rbrindley/welcome_re...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Thu Dec 4 19:22:15 CST 2008
Author: rbrindley
Date: Thu Dec 4 19:22:14 2008
New Revision: 4285
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4285
Log:
- added class 'exten_status' to extensions 'Status' column
- added a try...catch around parseOutput's event for loop
- implemented hangup, newchannel and newstate in parseOutput's event switchcase
- changed agent 'unknown' status image to agent_loggedoff.png as its not busy, but unavailable
- changed agent 'In Use/Busy' status image to status_red.png as its busy, not ringing
- removed exten.split('/') in updateExtension as it wasn't necessary
- separated each case out and added state values to change an extension's 'Status' column
- added and implemented 'dialing', 'down', 'hangup', 'ring', 'rsvd', and 'up' to switchcase in updateExtension
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=4285&r1=4284&r2=4285
==============================================================================
--- team/rbrindley/welcome_revamp/config/js/welcome2.js (original)
+++ team/rbrindley/welcome_revamp/config/js/welcome2.js Thu Dec 4 19:22:14 2008
@@ -145,7 +145,7 @@
$("<td></td>").html(ASTGUI.getUser_DeviceStatus_Image(user)).attr("id","exten_status_"+user),
$("<td></td>").html(tmp_userstring),
$("<td></td>").html(ud.getProperty('fullname')),
- $("<td></td>").html(tmp_mails_str),
+ $("<td></td>").html(tmp_mails_str).addClass('exten_status'),
$("<td></td>").html(tmp_usertype_a.join(', '))
]);
//addCell( newRow ,
@@ -516,6 +516,7 @@
var events = op.toLowerCase();
events = events.split('\r\n\r\n');
+ try {
for (var i=0; i<events.length; i++) {
var event = events[i];
if (event.contains('response: success')) {
@@ -538,17 +539,38 @@
var loginchan = event[2].split(' ')[1];
this.updateAgent("callbacklogoff", agent, loginchan);
break;
+ case 'event: extensionstatus':
+ var exten = event[2].split(' ')[1]; //Exten: SIP/6000
+ var context = event[3].split(' ')[1]; //Context: default
+ var status = event[4].split(' ')[1]; //Status: 1
+ this.updateExtension(exten.trim(), context, status);
+ break;
+ case 'event: hangup':
+ /* event[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+ var exten = event[2].split(' ')[1].split('/')[1].split('-')[0];
+ var context = '';
+ var status = 'hangup';
+ this.updateExtension(exten.trim(),context,status);
+ 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];
+ var context = '';
+ var status = event[3].split(' ')[1]; /* State: Ring */
+ this.updateExtension(exten.trim(),context,status);
+ break;
+ case 'event: newstate':
+ /* event[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+ var exten = event[2].split(' ')[1].split('/')[1].split('-')[0];
+ var context = '';
+ var status = event[3].split(' ')[1]; /* State: Dialing */
+ this.updateExtension(exten.trim(),context,status);
+ break;
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: extensionstatus':
- var exten = event[2].split(' ')[1]; //Exten: SIP/6000
- var context = event[3].split(' ')[1]; //Context: default
- var status = event[4].split(' ')[1]; //Status: 1
- this.updateExtension(exten, context, status);
break;
case 'event: agentcalled':
case 'event: agentcomplete':
@@ -558,7 +580,6 @@
case 'event: agentlogoff':
case 'event: queuememberpaused':
case 'event: dial':
- case 'event: hangup':
case 'event: musiconhold':
case 'event: join':
case 'event: leave':
@@ -569,7 +590,6 @@
case 'event: meetmetalking':
case 'event: messagewaiting':
case 'event: newcallerid':
- case 'event: newchannel':
case 'event: newexten':
case 'event: parkedcall':
case 'event: rename':
@@ -585,12 +605,12 @@
case 'event: reload':
case 'event: shutdown':
case 'event: userevent':
- case 'event: newstate':
default:
//console.log(event[3]);
break;
}
}
+ } catch (err) { alert(err);}
this.watch();
};
@@ -607,14 +627,14 @@
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');
+ agent_locs.children('.status_icon').attr('src','images/agent_loggedout.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');
+ agent_locs.children('.status_icon').attr('src','images/status_red.png');
break;
case 'status_4': /* Invalid */
agent_locs.children('.status_icon').attr('src','images/agent_loggedout.png');
@@ -638,28 +658,67 @@
};
manager_events.updateExtension = function(exten, context, status) {
- if ( exten.contains('/')) {
- exten = exten.split('/')[1]; // SIP/6000
- }
var exten_status_img = $('#exten_status_'+exten.toString()+' img');
switch(status.toString()) {
+ case '-1': /* Invalid */
+ var state = 'Invalid';
+ exten_status_img.attr('src','images/status_gray.png');
+ break;
case '0': /* Not In Use */
+ var state = 'Not In Use';
exten_status_img.attr('src','images/status_green.png');
break;
case '1': /* In Use */
+ var state = 'In Use';
+ exten_status_img.attr('src','images/status_red.png');
+ break;
case '2': /* Busy */
+ var state = 'Busy';
+ exten_status_img.attr('src','images/status_red.png');
+ break;
+ case '4': /* Unavailable */
+ var state = 'Unavailable';
+ exten_status_img.attr('src','images/status_gray.png');
+ break;
+ case '8': /* Ringing */
+ case 'ringing': /* Ringing */
+ var state = 'Ringing';
+ exten_status_img.attr('src','images/status_orange.png');
+ break;
+ case '9': /* Ringing In Use */
+ var state = 'Ringing In Use';
+ exten_status_img.attr('src','images/status_orange.png');
+ break;
case '16': /* On Hold */
+ var state = 'On Hold';
exten_status_img.attr('src','images/status_red.png');
break;
- case '-1': /* Invalid */
- case '4': /* Unavailable */
- exten_status_img.attr('src','images/status_gray.png');
- break;
- case '8': /* Ringing */
- case '9': /* Ringing In Use */
- exten_status_img.attr('src','images/status_orange.png');
+ case 'dialing': /* Dialing */
+ //var state = 'Dialing';
+ //exten_status_img.attr('src','images/status_red.png');
+ break;
+ case 'down': /* Down */
+ var state = 'Available';
+ exten_status_img.attr('src','images/status_green.png');
+ break;
+ case 'hangup':
+ var state = 'Hangup';
+ exten_status_img.attr('src','images/status_green.png');
+ break;
+ case 'ring': /* Line is ringing */
+ var state = 'Ring';
+ exten_status_img.attr('src','images/status_red.png');
+ break;
+ case 'rsvd': /* Reserved */
+ //var state = 'Reserved';
+ //exten_status_img.attr('src','images/status_red.png');
+ break;
+ case 'up': /* Up */
+ //var state = 'Up';
+ //exten_status_img.attr('src','images/status_green.png');
break;
default:
+ var state = 'Unknown';
alert('updateExtension:\r\n'
+'status: '+status.toString()
+'exten: '+exten.toString()
@@ -667,6 +726,8 @@
);
break;
}
+
+ exten_status_img.parent().siblings('.exten_status').html(state);
};
var pushRow = function(tbody, cells) {
More information about the asterisk-gui-commits
mailing list