rbrindley: branch rbrindley/astman_revamp r4597 - /team/rbrindley/astman_reva...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Mar 10 15:32:19 CDT 2009
Author: rbrindley
Date: Tue Mar 10 15:32:15 2009
New Revision: 4597
URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4597
Log:
- copied astgui_managetrunks.misc.nextAvailableTrunk_x to pbx.trunks.nextAvailTrunk
- copied astgui_managetrunks.misc.nextAvailableGroup to pbx.trunks.nextAvailGroup
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=4597&r1=4596&r2=4597
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Tue Mar 10 15:32:15 2009
@@ -399,6 +399,45 @@
};
/**
+ * Get next available group.
+ * @return first available group, or null on error.
+ */
+pbx.trunks.nextAvailGroup = function() {
+ var nums = [];
+ var trunks = this.list({analog: true, pri: true});
+ var type = 'analog';
+
+ if (!trunks.length) {
+ top.log.warn('pbx.trunks.nextAvailGroup: no trunks');
+ return null;
+ }
+
+ trunks.each(function(trunk) {
+ type = (sessionData.pbxinfo.trunks['analog'].hasOwnProperty(trunk)) ? 'analog' : 'pri';
+ nums.push(sessionData.pbxinfo.trunks[type][trunk]['group']);
+ });
+
+ return nums.firstAvailable();
+};
+
+/**
+ * Get next available trunk number.
+ * @return first available trunk number.
+ */
+pbx.trunks.nextAvailTrunk = function() {
+ var numbers = [];
+ var trunks = this.list();
+
+ trunks.each(function(trunk) {
+ if (trunk.beginsWith('trunk_')) {
+ numbers.push(trunk.split('trunk_')[1]);
+ }
+ });
+
+ return (!x.length) ? 'trunk_1' : 'trunk_' + numbers.firstAvailable();
+};
+
+/**
* Delete a trunk
* @param trunk The trunk name
*/
More information about the asterisk-gui-commits
mailing list