rbrindley: branch 2.0 r4954 - /branches/2.0/config/js/pbx2.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Jun 29 20:57:51 CDT 2009


Author: rbrindley
Date: Mon Jun 29 20:57:47 2009
New Revision: 4954

URL: http://svn.asterisk.org/svn-view/asterisk-gui?view=rev&rev=4954
Log:

- trunks and users now check to see if a context with their name already exists

(closes issue #15108)
Reported by: timeshell


Modified:
    branches/2.0/config/js/pbx2.js

Modified: branches/2.0/config/js/pbx2.js
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/js/pbx2.js?view=diff&rev=4954&r1=4953&r2=4954
==============================================================================
--- branches/2.0/config/js/pbx2.js (original)
+++ branches/2.0/config/js/pbx2.js Mon Jun 29 20:57:47 2009
@@ -1279,6 +1279,11 @@
 			return false;
 		}
 
+		if (!checkForNames(exten)) {
+			top.log.error('pbx.trunks.add: There is already a context with this exten. Maybe a user?');
+			return false;
+		}
+
 		if (basis === 'GUIAssigned') {
 			name = this.nextAvailTrunk();
 		} else if (basis === 'FromProvider') {
@@ -1827,6 +1832,12 @@
 		top.log.error('pbx.users.add: info was undefined.');
 		return false;
 	}
+
+	if (!checkForNames(exten)) {
+		top.log.error('pbx.users.add: There is already a context with this exten. Maybe a trunk?');
+		return false;
+	}
+
 	info = ASTGUI.toCustomObject(info);
 
 	var disallow = info.getProperty('disallow') || 'all';
@@ -2276,3 +2287,8 @@
 	return ASTGUI.contexts.VoiceMenuPrefix + vm.firstAvailable();
 };
 /*---------------------------------------------------------------------------*/
+
+var checkForNames = function(name, users_conf) {
+	var users_conf = users_conf || config2json({ filename: 'user.conf', usf: 0});
+	return users_conf.hasOwnProperty(name) ? false : true;
+};




More information about the asterisk-gui-commits mailing list