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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Mar 10 16:03:55 CDT 2009


Author: rbrindley
Date: Tue Mar 10 16:03:52 2009
New Revision: 4598

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

- implemented pbx.trunks.getType, replacing astgui_managetrunks.getTrunkType
- implemented pbx.trunks.getProviderType, replacing astgui_managetrunks.getProviderTrunkType
- implemented pbx.trunks.getName, replacing astgui_managetrunks.getTrunkName


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=4598&r1=4597&r2=4598
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Tue Mar 10 16:03:52 2009
@@ -351,6 +351,70 @@
 };
 
 /**
+ * Get Trunk Name.
+ * @param name.
+ * @return trunk name.
+ */
+pbx.trunks.getName = function(trunk) {
+	if (trunk === 'Skype') {
+		return trunk;
+	}
+
+	for (var i=0; i < this.trunk_types.length; i++) {
+		if (sessionData.pbxinfo.trunks[this.trunk_types[i]][trunk]) {
+			if (this.trunk_types[i] === 'bri' && sessionData.pbxinfo.trunks[this.trunk_types[i]][trunk].trunkname) {
+				return 'BRI - ' + sessionData.pbxinfo.trunks[this.trunk_types[i]][trunk].trunkname;
+			}
+			return sessionData.pbxinfo.trunks[this.trunk_types[i]][trunk].trunkname || trunk;
+		}
+	}
+
+	top.log.warn('pbx.trunks.getType: No trunk name found.');
+	top.log.warn('pbx.trunks.getType: Trunk, ' + trunk + ', most like doesn\'t exist');
+	return null;
+};
+
+/**
+ * Get Provider Trunk Type.
+ * @param trunk.
+ * @return provider type.
+ */
+pbx.trunks.getProviderType = function(trunk) [
+	if (!sessionData.pbxinfo.trunks.providers.hasOwnProperty(trunk)) {
+		top.log.error('pbx.trunks.getProviderType: ' + trunk + ' is not a provider.');
+		return '';
+	}
+
+	var provider = sessionData.pbxinfo.trunks.providers[trunk];
+	if (provider.hasOwnProperty('hassip') && provider.hassip.isAstTrue()) {
+		return 'sip';
+	} else if (provider.hasOwnProperty('hasiax') && provider.hasiax.isAstTrue()) {
+		return 'iax';
+	} else {
+		top.log.warn('pbx.trunks.getProviderType: Unexpected - ' + trunk + ' is not type iax or sip');
+		return '';
+	}
+
+};
+
+/**
+ * Get Trunk Type.
+ * @param trunk.
+ * @return type of trunk.
+ */
+pbx.trunks.getType = function(trunk) {
+	for (var i=0; i < this.trunk_types.length; i++) {
+		if (sessionData.pbxinfo.trunks[this.trunk_types[i]][trunk]) {
+			return this.trunk_types[i];
+		}
+	}
+
+	top.log.warn('pbx.trunks.getType: No trunk type found.');
+	top.log.warn('pbx.trunks.getType: Trunk, ' + trunk + ', most like doesn\'t exist');
+	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.




More information about the asterisk-gui-commits mailing list