rbrindley: branch rbrindley/astman_revamp r4647 - /team/rbrindley/astman_reva...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Mar 24 08:05:54 CDT 2009


Author: rbrindley
Date: Tue Mar 24 08:05:50 2009
New Revision: 4647

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

- copied ASTGUI.getUser_DeviceStatus to pbx.users.state


Modified:
    team/rbrindley/astman_revamp/config/js/pbx2.js

Modified: team/rbrindley/astman_revamp/config/js/pbx2.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/pbx2.js?view=diff&rev=4647&r1=4646&r2=4647
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Tue Mar 24 08:05:50 2009
@@ -1613,6 +1613,34 @@
 		}
 	});
 };
+
+/**
+ * Get a User's Status.
+ * copied from ASTGUI.getUser_DeviceStatus.
+ * @param user The User's Extension.
+ * @return [FBUR] depending on the status
+ */
+pbx.users.state = function(user) {
+	user = (typeof user === 'number') ? String(user) : user;
+	if (typeof user !== 'string') {
+		top.log.warn('pbx.users.state: Expecting user to be a String.');
+		return 'U';
+	}
+
+	var req = makeSyncRequest({action: 'ExtensionState', Exten: user});
+	switch(true) {
+		case t.contains('Status: 0'): /* No Device is Busy/InUse */
+			return 'F';
+		case t.contains('Status: 1'): /* 1+ Devices Busy/InUse */
+		case t.contains('Status: 2'): /* all Devices Busy/InUse */
+			return 'B';
+		case t.contains('Status: 8'): /* all Devices Ringing */
+			return 'R';
+		case t.contains('Status: 4'): /* All devices unavailable/unregistered */
+		default:
+			return 'U';
+	}
+};
 /*---------------------------------------------------------------------------*/
 
 /*---------------------------------------------------------------------------*/




More information about the asterisk-gui-commits mailing list