rbrindley: branch rbrindley/astman_revamp r4603 - /team/rbrindley/astman_reva...
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Wed Mar 11 08:37:43 CDT 2009
Author: rbrindley
Date: Wed Mar 11 08:37:39 2009
New Revision: 4603
URL: http://svn.digium.com/svn-view/asterisk-gui?view=rev&rev=4603
Log:
- implemented pbx.calling_rules.remove, replacing astgui_manageCallingRules.deleteCallingRule()
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=4603&r1=4602&r2=4603
==============================================================================
--- team/rbrindley/astman_revamp/config/js/pbx2.js (original)
+++ team/rbrindley/astman_revamp/config/js/pbx2.js Wed Mar 11 08:37:39 2009
@@ -75,6 +75,54 @@
sessionData.pbxinfo.callingRules[name].push('exten=' + dp);
return true;
};
+
+/**
+ * Delete a Calling Rule.
+ * Copied from astgui_manageCallingRules.deleteCallingRule().
+ * @param name The Calling Rule name.
+ * @param dp The Calling Rule string.
+ * @return boolean of success.
+ */
+pbx.calling_rules.remove = function(name, dp) {
+ if (!name) {
+ top.log.warn('pbx.calling_rules.remove: name is not defined');
+ return false;
+ } else if (!sessionData.pbxinfo.callingRules.hasOwnProperty(name)) {
+ top.log.warn('pbx.calling_rules.remove: ' + name + 'is not a calling rule in cached extensions.conf, likely not in real file as well. Proceeding with caution.');
+ }
+
+ if (dp.beginsWith('exten=')) {
+ dp = dp.lChop('exten=');
+ }
+
+ var ext_conf = new listOfSynActions('extensions.conf');
+
+ if (sessionData.pbxinfo.callingRules[name].length === 1 && sessionData.pbxinfo.callingRules[name][0] === 'exten=' + dp) {
+ ext_conf.new_action('delcat', name, '', '');
+ var resp = ext_conf.callActions();
+
+ if (!resp.contains('Response: Success')) {
+ top.log.error('pbx.calling_rules.remove: error removing from extensions.conf');
+ return false;
+ }
+
+ delete sessionData.pbxinfo.callingRules[name];
+ } else if (sessionData.pbxinfo.callingRules[name].length !== 1) {
+ ext_conf.new_action('delete', name, 'exten', '', dp);
+ var resp = ext_conf.callActions();
+
+ if (!resp.contains('Response: Success')) {
+ top.log.error('pbx.calling_rules.remove: error removing from extensions.conf');
+ return false;
+ }
+
+ sessionData.pbxinfo.callingRules[name] = ASTGUI.cloneObject(sessionData.pbxinfo.callingRules[name]).withOut('exten=' + dp);
+ } else {
+ top.log.warn('pbx.calling_rules.remove: ' + name + ' exists, but does not contain ' + dp + '.');
+ }
+
+ return true;
+};
/*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
More information about the asterisk-gui-commits
mailing list