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

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Mar 12 22:45:41 CDT 2009


Author: rbrindley
Date: Thu Mar 12 22:45:38 2009
New Revision: 4638

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

- copied astgui_manageRingGroups.createNewRg = pbx.ring_groups.add


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=4638&r1=4637&r2=4638
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Thu Mar 12 22:45:38 2009
@@ -329,6 +329,52 @@
  * Ring Groups object.
  */
 pbx.ring_groups = {};
+
+/**
+ * Add a new Ring Group.
+ * @param name Ring Group name.
+ * @param rg Ring Group object.
+ * @param callback Callback function.
+ * @return boolean on success.
+ */
+pbx.ring_groups.add = function(name, rg, callback) {
+	name = name || this.next();
+	rg.fallback = rg.fallback || 'Hangup';
+	var ignore = (rg.ignore) ? '${DIALOPTIONS}i' : '${DIALOPTIONS}';
+
+	var actions = new listOfSynActions('extensions.conf');
+	actions.new_action('newcat', name, '', '');
+	actions.new_action('append', name, 'exten', 's,1,NoOp(' + rg.NAME + ')');
+
+	if (rg.strategy === 'ringinorder') {
+		rg.members.each(function(member) {
+			actions.new_action('append', name, 'exten', 's,n,Dial(' + member + ',' + rg.ringtime + ',' + ignore + ')');
+		});
+	} else {
+		if (rg.members.length) {
+			actions.new_action('append', name, 'exten', 's,n,Dial(' + rg.members.join('&') + ',' + rg.ringtime + ',' + ignore + ')');
+		}
+	}
+
+	actions.new_action('append', name, 'exten', 's,n,' + rg.fallback);
+
+	var resp = actions.callActions();
+
+	if (!rest.contains('Response: Success')) {
+		top.log.error('pbx.ring_groups.add: error updating extensions.conf');
+		return false;
+	}
+
+	if (rg.extension) {
+		actions.clearActions();
+		actions.new_action('append', ASTGUI.contexts.RingGroupExtensions, 'exten', rg.extension + ',1,Goto(' + name + ',s,1)');
+		actions.callActions();
+	}
+	
+	sessionData.pbxinfo.ringgroups[name] = rg;
+	callback();
+	return true;
+};
 
 /**
  * List Ring Groups.




More information about the asterisk-gui-commits mailing list