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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Mar 9 23:16:48 CDT 2009


Author: rbrindley
Date: Mon Mar  9 23:16:45 2009
New Revision: 4595

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

- added trunk_types array to pbx.trunks
- implemented pbx.trunks.get to replace astgui_managetrunks.getTrunkDetails


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=4595&r1=4594&r2=4595
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Mon Mar  9 23:16:45 2009
@@ -177,12 +177,52 @@
 /**
  * Trunks object.
  */
-pbx.trunks = {};
+pbx.trunks = {
+	trunk_types = ['analog', 'bri', 'iax', 'pri', 'provider', 'sip']
+};
+
+/**
+ * Get Trunk Details.
+ * @param trunk
+ * @return an object with the trunk details, or null.
+ */
+pbx.trunks.get = function(trunk) {
+	try {
+		var x = null;
+		var tr = new ASTGUI.customObject;
+
+		for (var i=0; i<this.trunk_types.length; i++) {
+			var type = this.trunk_types[i];
+
+			if (sessionData.pbxinfo.trunks[type].hasOwnProperty(trunk)) {
+				x = sessionData.pbxinfo.trunks[type];
+			}
+		}
+
+		if (x === null) {
+			return x;
+		}
+
+		for (var d in x) {
+			if (!x.hasOwnProperty(d)) {
+				continue;	
+			}
+
+			tr[d] = x[d];
+		}
+
+		return tr;
+	} catch(err) {
+		top.log.error('pbx.trunks.get: ' + err);
+		return null;
+	}
+};
 
 /**
  * List trunks.
  * This function takes an object as an argument and cycles through 
  * @param types This is the object holding all the types to be listed.
+ * @return an array of all the trunks.
  */
 pbx.trunks.list = function(types) {
 	var trunks = [];




More information about the asterisk-gui-commits mailing list