rbrindley: branch rbrindley/astman_revamp r4545 - in /team/rbrindley/astman_r...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Mar 2 18:29:39 CST 2009


Author: rbrindley
Date: Mon Mar  2 18:29:36 2009
New Revision: 4545

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

- merged 4524:HEAD from branches/2.0


Modified:
    team/rbrindley/astman_revamp/Makefile
    team/rbrindley/astman_revamp/config/js/welcome.js

Modified: team/rbrindley/astman_revamp/Makefile
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/Makefile?view=diff&rev=4545&r1=4544&r2=4545
==============================================================================
--- team/rbrindley/astman_revamp/Makefile (original)
+++ team/rbrindley/astman_revamp/Makefile Mon Mar  2 18:29:36 2009
@@ -95,8 +95,8 @@
 ifeq ($(HTTPPREFIXBASE),)
   HTTPPREFIX:=asterisk
 endif
-HTTPURL:=http://$(HTTPHOST):$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/cfgbasic.html
-HTTPLOCALURL:=http://localhost:$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/cfgbasic.html
+HTTPURL:=http://$(HTTPHOST):$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/index.html
+HTTPLOCALURL:=http://localhost:$(HTTPBINDPORT)/$(HTTPPREFIX)/static/config/index.html
 	
 #SUBDIRS:=tools
 SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean)

Modified: team/rbrindley/astman_revamp/config/js/welcome.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/welcome.js?view=diff&rev=4545&r1=4544&r2=4545
==============================================================================
--- team/rbrindley/astman_revamp/config/js/welcome.js (original)
+++ team/rbrindley/astman_revamp/config/js/welcome.js Mon Mar  2 18:29:36 2009
@@ -64,7 +64,7 @@
 		addCell( newRow , { html: parent.sessionData.pbxinfo['trunks']['analog'][item]['trunkname'] } );
 		addCell( newRow , { html:'Analog'} );
 		addCell( newRow , { html:''} );
-		addCell( newRow , { html:'Ports ' + parent.sessionData.pbxinfo['trunks']['analog'][item]['zapchan'] } );
+		addCell( newRow , { html:'Ports ' + parent.sessionData.pbxinfo['trunks']['analog'][item][top.sessionData.DahdiChannelString] } );
 	});
 /* End Analog Trunks */
 
@@ -132,8 +132,8 @@
 		} else if ( ud.getProperty('hassip').isAstTrue() ) {
 			tmp_usertype_a.push( ' SIP User' );
 			new_row.addClass('sip');
-		} else if( ud.getProperty('zapchan') ) {
-			tmp_usertype_a.push( 'Analog User (Port ' + ud['zapchan'] + ')' ) ;
+		} else if( ud.getProperty(top.sessionData.DahdiChannelString) ) {
+			tmp_usertype_a.push( 'Analog User (Port ' + ud[top.sessionData.DahdiChannelString] + ')' ) ;
 			new_row.addClass('analog');
 		}
 
@@ -276,7 +276,7 @@
 
 	$('.queue:not(.template)').remove();
 
-	var queue_status = ASTGUI.cliCommand('show queues');
+	var queue_status = ASTGUI.cliCommand('queue show');
 	queue_status = parent.ASTGUI.parseCLIResponse(queue_status);
 	//ast-gui*CLI> show queues
 	//6501         has 1 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:4, SL:0.0% within 0s
@@ -581,105 +581,89 @@
 		} else if (event.length == 0) {
 			continue;
 		}
-		event = event.split('\r\n');
-
-		switch (event[0].trim()) {
+		/* this is used for manager_events.parseEvent() which was
+		 * decided to only be called in the cases that needed to
+		 * have the event parsed. This is for efficiency reasons.
+		 */
+		var event_lines = event.split('\r\n');
+
+		switch (event_lines[0].trim()) {
 		case 'event: agentcallbacklogin':
-			var agent = event[1].split(' ')[1];	
-			var loginchan = event[2].split(' ')[1];	
-			this.updateAgent("callbacklogin", agent, loginchan);
+			var eventObj = this.parseEvent(event_lines);
+			this.updateAgent("callbacklogin", eventObj.agent, eventObj.loginchan);
 			break;
 		case 'event: agentcallbacklogoff':
-			var agent = event[1].split(' ')[1];	
-			var loginchan = event[2].split(' ')[1];	
-			this.updateAgent("callbacklogoff", agent, loginchan);
+			var eventObj = this.parseEvent(event_lines);
+			this.updateAgent("callbacklogoff", eventObj.agent, eventObj.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);
+			var eventObj = this.parseEvent(event_lines);
+			this.updateExtension(eventObj.exten.trim(), eventObj.context, eventObj.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);
+			var eventObj = this.parseEvent(event_lines);
+			/* exten = 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = eventObj.channel.split('/')[1].split('-')[0];
+			this.updateExtension(exten.trim(),'','hangup');
 			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 cid = event[3].split(' ')[1];
-			var queue = event[5].split(' ')[1];		//Queue: 6501
-			var position = event[6].split(' ')[1];		//Position: 1
-			this.addQueueCall(queue, exten, cid, position);
+			var eventObj = this.parseEvent(event_lines);
+			/* exten = 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = eventObj.channel.split('/')[1].split('-')[0];
+			this.addQueueCall(eventObj.queue, exten, eventObj.callerid, eventObj.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);
+			var eventObj = this.parseEvent(event_lines);
+			/* event_lines[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = eventObj.channel.split('/')[1].split('-')[0];
+			this.removeQueueCall(eventObj.queue, exten);
 			break;
 		case 'event: meetmejoin':
-			var chan = event[2].split(' ')[1];
-			var meetme = event[4].split(' ')[1];
-			var usernum = event[5].split(' ')[1];
-			chan = chan.split('/')[1].split('-')[0];	/* SIP/6000-123 */
-
-			this.meetmeJoin(meetme, usernum, chan, 0);
+			var eventObj = this.parseEvent(event_lines);
+			/* event_lines[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var chan = eventObj.channel.split('/')[1].split('-')[0];
+			var usernum = event_lines[5].split(' ')[1];
+			this.meetmeJoin(eventObj.meetme, eventObj.usernum, chan, 0);
 			break;
 		case 'event: meetmeleave':
-			var chan = event[2].split(' ')[1];
-			var meetme = event[4].split(' ')[1];
-			var usernum = event[5].split(' ')[1];
-			chan = chan.split('/')[1].split('-')[0];	/* SIP/6000-123 */
-
-			this.meetmeLeave(meetme, usernum, chan);
+			var eventObj = this.parseEvent(event_lines);
+			/* event_lines[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var chan = eventObj.channel.split('/')[1].split('-')[0];
+			this.meetmeLeave(eventObj.meetme, eventObj.usernum, chan);
 			break;
 		case 'event: meetmetalking':
-			var chan = event[2].split(' ')[1];
-			var meetme = event[4].split(' ')[1];
-			var usernum = event[5].split(' ')[1];
-			var status = event[6].split(' ')[1];
-			chan = chan.split('/')[1].split('-')[0];	/* SIP/6000-123 */
-			status = status.toString() == 'on' ? 1: 0;
-
-			this.meetmeTalking(meetme, chan, status);
+			var eventObj = this.parseEvent(event_lines);
+			/* event_lines[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var chan = eventObj.channel.split('/')[1].split('-')[0];
+			status = eventObj.status.toString() == 'on' ? 1: 0;
+			this.meetmeTalking(eventObj.meetme, chan, 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);
+			var eventObj = this.parseEvent(event_lines);
+			/* event_lines[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = eventObj.channel.split('/')[1].split('-')[0];
+			this.updateExtension(exten.trim(), '', eventObj.state);
 			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);
+			var eventObj = this.parseEvent(event_lines);
+			/* event_lines[2]= 'Channel: Zap/2-1' or 'Channel: SIP/101-3f3f' */
+			var exten = eventObj.channel.split('/')[1].split('-')[0];
+			this.updateExtension(exten.trim(), '', eventObj.state);
 			break;
 		case 'event: parkedcall':
-			var exten = event[2].split(' ')[1];	/* Exten: <parkexten> */
-			var chan = event[3].split(' ')[1];	/* Channel: <channel> */
-			var from = event[4].split(' ')[1];	/* From: <from> */
-			var timeout = event[5].split(' ')[1];	/* Timeout: <timeout> */
-			var cid = event[6].split(' ')[1];	/* CallerID: <cid> */
-			this.parkedCall(exten, chan, from, timeout, cid);
+			var eventObj = this.parseEvent(event_lines);
+			this.parkedCall(eventObj.exten, eventObj.channel, eventObj.from, eventObj,timeout, eventObj.callerid);
 			break;
 		case 'event: parkedcallgiveup':
 		case 'event: parkedcalltimeout':
 		case 'event: unparkedcall':
-			var exten = event[2].split(' ')[1];	/* Exten: <parkexten> */
-			this.unparkedCall(exten);
+			var eventObj = this.parseEvent(event_lines);
+			this.unparkedCall(eventObj.exten);
 			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);
+			var eventObj = this.parseEvent(event_lines);
+			var agent = eventObj.membername.split('/')[1];	//MemberName: 6000
+			this.updateAgent('status_'+eventObj.status.toString(), agent, eventObj.queue);
 			break;
 		case 'event: agentcalled':
 		case 'event: agentcomplete':
@@ -872,11 +856,14 @@
 		break;
 	default:
 		var state = 'Unknown';
-		alert('updateExtension:\r\n'
-			+'status: '+status.toString()+'\r\n'
-			+'exten: '+exten.toString()+'\r\n'
-			+'context: '+context.toString()+'\r\n'
-		);
+		ASTGUI.Log.Debug("updateExtension :: We have encountered an unknown extension state of " + status.toString());
+		if ( top.sessionData.DEBUG_MODE ) {
+			alert('updateExtension:\r\n'
+				+'status: '+status.toString()+'\r\n'
+				+'exten: '+exten.toString()+'\r\n'
+				+'context: '+context.toString()+'\r\n'
+			);
+		}
 		break;
 	}
 
@@ -959,6 +946,18 @@
 	}
 };
 
+manager_events.parseEvent = function(event_lines) {
+	var eventObj = new Object();
+	
+	for (var i=0; i<event_lines.length; i++) {
+		var line = event_lines[i];
+		line = line.split(': ');
+		eventObj[line[0]] = line[1];
+	}
+
+	return eventObj;
+};
+
 //abstracted out because its called in manager_events.meetmeJoin & loadConferences
 var addMeetmeMember = function(meetme, user_num, duration) {
 	//set duration's default value




More information about the asterisk-gui-commits mailing list