espiceland: branch 2.0 r5092 - in /branches/2.0/config: ./ js/

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Oct 14 12:54:14 CDT 2010


Author: espiceland
Date: Thu Oct 14 12:54:11 2010
New Revision: 5092

URL: http://svnview.digium.com/svn/asterisk-gui?view=rev&rev=5092
Log:
IAX2 security settings added in September 2009 now configurable in IAX Settings.

Modified:
    branches/2.0/config/iax.html
    branches/2.0/config/js/astman.js
    branches/2.0/config/js/iax.js
    branches/2.0/config/js/tooltip.js
    branches/2.0/config/js/users.js
    branches/2.0/config/users.html

Modified: branches/2.0/config/iax.html
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/iax.html?view=diff&rev=5092&r1=5091&r2=5092
==============================================================================
--- branches/2.0/config/iax.html (original)
+++ branches/2.0/config/iax.html Thu Oct 14 12:54:11 2010
@@ -24,7 +24,61 @@
 	<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
 
 	<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
-	<style type="text/css"></style>
+	<style type="text/css">
+ 	#callNumberLimits div span.callnumber_delete {
+ 		float: right;
+ 		width: 20px;
+ 		background: transparent url("./images/delete_circle.png") no-repeat;
+ 	}
+ 	#callNumberLimits{
+ 		height:120px ;
+ 		background-color:#FFFFFF;
+ 		padding: 5px;
+ 		border-width: 1px;
+ 		border-color: #7E5538;
+ 		border-style: solid;
+ 		cursor: default;
+ 		font: 83%/1.4 arial, helvetica, sans-serif;
+ 		overflow :auto;
+ 	}
+ 	
+ 	#callNumberLimits div {
+ 		clear :both;
+ 		padding : 3px 5px 0px 5px;
+ 		min-height: 20px;
+ 	}
+ 	#callNumberLimits div:hover {
+ 		background-color:#DEDEDE;
+ 	}
+ 	
+ 	#callNumberLimits div span.step_desc {
+ 		float: left;
+ 		/* max-width: 300px; */
+ 		background: transparent;
+ 	}
+ 	#callNumberLimits div span.step_desc:hover{
+ 		background-color:#DEDEDE;
+ 	}
+ 	
+ 	#callNumberLimits div span.step_up {
+ 		float: right;
+ 		width: 20px;
+ 		background: transparent url("./images/asterisk-arrow-up.png") no-repeat;
+ 	}
+ 	
+ 	#callNumberLimits div span.step_down {
+ 		float: right;
+ 		width: 20px;
+ 		background: transparent url("./images/asterisk-arrow-down.png") no-repeat;
+ 	}
+ 	
+ 	#callNumberLimits div span.step_delete {
+ 		float: right;
+ 		width: 20px;
+ 		background: transparent url("./images/delete_circle.png") no-repeat;
+ 	}
+	
+	</style>
 </head>
 <body bgcolor="EFEFEF">
 	<div class="iframeTitleBar">
@@ -222,6 +276,49 @@
 				</table>
 			</div>
 		
+ 		<div id='iaxoptions_security' style='display: none;'>
+ 			<table class="field_text" align="center" width="100%" cellpadding=3 cellspacing=0 border=0>
+ 			<tr>
+ 				<td align=right width="50%">Call Token Optional: <img src='images/tooltip_info.gif' alt='' class='tooltipinfo' tip='en,iax_general,40'></td>
+ 				<td>&nbsp;<input type='text' size=20 id='calltokenoptional' dfalt='' class="input8" validation='iporrange'></td>
+ 			</tr>
+ 			<tr>
+ 				<td align=right  tip="en,iax_general,41"  width="50%">Max Call Numbers:</td>
+ 				<td>&nbsp;<input type='text' size=4 id='maxcallnumbers' dfalt='' validation='numeric' class="input8"></td>
+ 			</tr>
+ 			<tr>
+ 				<td align=right  tooltip="en,iax_general,42"  width="50%">Max Nonvalidated Call Numbers:</td>
+ 				<td>&nbsp;<input type='text' size=4 id='maxcallnumbers_nonvalidated' dfalt='' validation='numeric' class="input8"></td>
+ 			</tr>
+ 			<tr>
+ 				<td align=right valign=top>Call Number Limits: <img src="images/tooltip_info.gif" tip="en,iax_general,43" class='tooltipinfo'></td>
+ 				<td><div id='callNumberLimits'></div></td>
+ 			</tr>
+ 			<tr class='form_newCallNumberLimit' >
+ 				<td align=right width="50%"></td>
+ 				<td>
+ 					<span class='guiButton' onclick=" showCallNumberLimitsForm(); "><B>Add Call Number Limit</B></span>
+ 				</td>
+ 			</tr>
+ 			<tr class='form_newCallNumberLimit'>
+ 				<td align=right valign=top></td>
+ 				<td align=left width="50%">IP or IP Range: <img src='images/tooltip_info.gif' alt='' class='tooltipinfo' tip='en,iax_general,40'>
+ 				&nbsp;<input type='text' size=20 id='form_newCallNumberLimit_ip' class="input8" validation='iporrange'></td>
+ 			</tr>
+ 			<tr class='form_newCallNumberLimit'>
+ 				<td align=right valign=top></td>
+ 				<td align=left width="50%">Max Call Numbers:
+ 				&nbsp;<input type='text' size=4 id='form_newCallNumberLimit_maxcallnumbers' dfalt='512' validation='numeric' class="input8"></td>
+ 			</tr>
+ 			<tr class='form_newCallNumberLimit'>
+ 				<td align=right width="50%"></td>
+ 				<td>
+ 					<span class='guiButtonCancel' onclick='hideCallNumberLimitsForm();'>Cancel</span>
+ 					<span class='guiButton' onclick='pushNewCallNumberLimit();'> &uarr; Add</span>
+ 				</td>
+ 			</tr>
+ 			</table>
+ 		</div>
 			
 			<div style='margin-top:15px; width:100%; text-align:center;'>
 				<span class='guiButtonCancel' onclick='window.location.reload();' style='margin-left:10px'>Cancel</span>
@@ -232,7 +329,9 @@
 
 	</center>
 	<script src="js/jquery.js"></script>
+ 	<script src="js/jquery.tooltip.js"></script>
 	<script src="js/astman.js"></script>
 	<script src="js/iax.js"></script>
+ 	<script type='text/javascript'>hideCallNumberLimitsForm();</script>
 </body>
 </html>

Modified: branches/2.0/config/js/astman.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=5092&r1=5091&r2=5092
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Thu Oct 14 12:54:11 2010
@@ -58,6 +58,9 @@
 		return this.indexOfLike(str) != -1;
 	};
 	
+	/* This cannot be used if you need to return from the calling
+	function early. The return statement will return from this 
+	anonymous function instead. */
 	Array.prototype.each = function(iterator) {
 		for(var i=0 , j = this.length; i < j ; i++ ){
 			iterator(this[i] , i);
@@ -2065,6 +2068,7 @@
 			}
 		};
 		var el;
+		top.log.debug("flds is " + flds);
 		for (var i=0; i < flds.length ; i++ ) {
 			el = flds[i] ;
 			if ( typeof el == 'string'){ el = _$(el) ; }
@@ -2658,6 +2662,16 @@
 						return false;
 					}
 					break;
+				case 'iporrange':
+					var fb_msg = (this_field_name) ? this_field_name + ' does not contain a valid IP address or IP range.' : 'The IP address field does not contain a valid IP address or IP range.' ;
+					var pieces = x.split("/");
+					for (var j = 0; j < pieces.length; j++){
+						if ( !(/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/.test(pieces[j])) ){
+							ASTGUI.highlightField( field, fb_msg );
+							return false;
+						}
+					}
+					break;
 				default:
 					break;
 			}

Modified: branches/2.0/config/js/iax.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/iax.js?view=diff&rev=5092&r1=5091&r2=5092
==============================================================================
--- branches/2.0/config/js/iax.js (original)
+++ branches/2.0/config/js/iax.js Thu Oct 14 12:54:11 2010
@@ -21,7 +21,8 @@
 //Realtime :  'rtcachefriends', 'rtignoreexpire', 'rtupdate', 'rtautoclear' 
 // CDR: amaflags, accountcode
 
-var fieldnames = [ 'adsi', 'authdebug', 'autokill', 'bandwidth', 'bindaddr', 'bindport', 'codecpriority', 'delayreject', 'dropcount', 'forcejitterbuffer', 'iaxcompat', 'iaxmaxthreadcount', 'iaxthreadcount', 'jitterbuffer', 'jittershrinkrate', 'language', 'maxexcessbuffer', 'maxjitterbuffer', 'maxjitterinterps', 'maxregexpire', 'minexcessbuffer', 'minregexpire', 'mohinterpret', 'mohsuggest', 'nochecksums','resyncthreshold', 'tos', 'trunkfreq', 'trunktimestamps' ];
+var fieldnames = [ 'adsi', 'authdebug', 'autokill', 'bandwidth', 'bindaddr', 'bindport', 'codecpriority', 'delayreject', 'dropcount', 'forcejitterbuffer', 'iaxcompat', 'iaxmaxthreadcount', 'iaxthreadcount', 'jitterbuffer', 'jittershrinkrate', 'language', 'maxexcessbuffer', 'maxjitterbuffer', 'maxjitterinterps', 'maxregexpire', 'minexcessbuffer', 'minregexpire', 'mohinterpret', 'mohsuggest', 'nochecksums','resyncthreshold', 'tos', 'trunkfreq', 'trunktimestamps', 'calltokenoptional', 'maxcallnumbers', 'maxcallnumbers_nonvalidated'];
+var callNumberLimitsList = [];
 
 var localajaxinit = function(){
 	top.document.title = 'global IAX settings' ;
@@ -33,6 +34,7 @@
 			$('#iaxoptions_trunkregistration').hide() ;
 			//$('#iaxoptions_realtime').hide() ;
 			$('#iaxoptions_Codecs').hide() ;
+			$('#iaxoptions_security').hide() ;
 		};
 
 		var t = [
@@ -41,12 +43,12 @@
 			{url:'#', desc:'Jitter Buffer', click_function: function(){ hideall(); $('#iaxoptions_jitterBuffer').show();} },
 			{url:'#', desc:'Registration', click_function: function(){ hideall(); $('#iaxoptions_trunkregistration').show(); } },
 			//{url:'#', desc:'Realtime', click_function: function(){ hideall(); $('#iaxoptions_realtime').show(); } },
-			{url:'#', desc:'Codecs', click_function: function(){ hideall(); $('#iaxoptions_Codecs').show(); } }
+			{url:'#', desc:'Codecs', click_function: function(){ hideall(); $('#iaxoptions_Codecs').show(); } },
+			{url:'#', desc:'Security', click_function: function(){ hideall(); $('#iaxoptions_security').show(); } }
 		];
 		ASTGUI.tabbedOptions( _$('tabbedMenu') , t );
 		$('#tabbedMenu').find('A:eq(0)').click();
 	})();
-
 
 	var c = context2json({ filename:'iax.conf' , context : 'general' , usf:1 });
 	var AU = ASTGUI.updateFieldToValue ; // temporarily cache function
@@ -54,6 +56,14 @@
 		var val = ( c[fld] ) ? c[fld] : '';
 		AU(fld,val) ;
 	});
+
+	var d = context2json({ filename:'iax.conf' , context : 'callnumberlimits' , usf:0 });
+	if(d){
+		d.each( function(fld){
+			pushNewCallNumberLimit(fld);
+		});
+	}
+
 	var disallowed = false;
 	var real_codecs;
 	ASTGUI.CODECSLIST.populateCodecsList(_$('allow'));
@@ -77,18 +87,33 @@
 	};
 	var skip_ifempty = ['register', 'localnet', 'externhost', 'externip'];
 	var x = new listOfActions('iax.conf');
-	var AG = ASTGUI.getFieldValue;
-	fieldnames.each( function(fld){
-		var val = AG(fld).trim();
+ 	/* Can't use fieldnames.each here because the return statement
+ 	would return from the anonymous function passed to the iterator, 
+ 	not saveChanges(). */
+ 	for(var i = 0; i < fieldnames.length ; i++){
+ 		var fld = fieldnames[i];
+ 		var val = ASTGUI.getFieldValue(fld).trim();
 		if (val == "") {
 			if (skip_ifempty.contains(fld)) {
 				return;
 			}
 			x.new_action('delete', cat , fld , '') ;
-		}else{
+		} else {
+ 			if (!ASTGUI.validateFields([fld])) { return; }
 			x.new_action('update', cat , fld , val) ;
 		}
-	});
+ 	}
+ 
+ 	x.new_action('delcat', 'callnumberlimits', '', '');
+ 	if (callNumberLimitsList.length >= 0){
+ 		x.new_action('newcat', 'callnumberlimits', '', '')
+ 	}
+ 
+ 	callNumberLimitsList.each( function(eachOne){
+ 		var pieces = eachOne.split('=');
+ 		x.new_action('append', 'callnumberlimits' , pieces[0], pieces[1]) ;
+ 	});
+
 	x.new_action('delete', cat , 'disallow', '' ) ;
 	x.new_action('delete', cat , 'allow', '' ) ;
 	x.new_action('append', cat , 'disallow', 'all' ) ;
@@ -96,4 +121,71 @@
 
 	parent.ASTGUI.dialog.waitWhile(' Saving ...');
 	setTimeout( function(){ x.callActions(after) ; } , 300 );
+	hideCallNumberLimitsForm();
 }
+
+var showCallNumberLimitsForm = function(){ 
+	ASTGUI.updateFieldToValue('form_newCallNumberLimit_ip', '');
+	ASTGUI.updateFieldToValue('form_newCallNumberLimit_maxcallnumbers', '');
+	$('.form_newCallNumberLimit').show();
+	$($('.form_newCallNumberLimit')[0]).hide();
+}
+
+var hideCallNumberLimitsForm = function(){
+	$('.form_newCallNumberLimit').hide();
+	$($('.form_newCallNumberLimit')[0]).show();
+}
+
+var pushNewCallNumberLimit = function(limit_str){
+	if(limit_str){
+		var p = limit_str.split("=");
+		var new_ip = p[0];
+		var new_maxcallnumbers = p[1];
+	}else{
+		var new_ip = ASTGUI.getFieldValue( 'form_newCallNumberLimit_ip' );
+		var new_maxcallnumbers = ASTGUI.getFieldValue( 'form_newCallNumberLimit_maxcallnumbers' );
+	}
+	var tmp_pieces = new_ip.split("/");
+	if (!limit_str && !ASTGUI.validateFields(['form_newCallNumberLimit_ip'])){
+		return;
+	} else if (!callNumberLimitsList.contains(new_ip + "=" + new_maxcallnumbers)){
+		callNumberLimitsList.push(new_ip + "=" + new_maxcallnumbers);
+		clearCallNumberLimitsForm();
+		refreshCallNumberLimitsList();
+	}
+}
+
+var deleteCallNumber = function(indexno){
+	callNumberLimitsList.splice(indexno, 1);
+	refreshCallNumberLimitsList();
+}
+
+var clearCallNumberLimitsForm = function(){
+		ASTGUI.updateFieldToValue('form_newCallNumberLimit_ip', '');
+		ASTGUI.updateFieldToValue('form_newCallNumberLimit_maxcallnumbers', '');
+}
+
+var refreshCallNumberLimitsList = function(){
+	ASTGUI.domActions.removeAllChilds( 'callNumberLimits');
+
+	for (var i = 0; i < callNumberLimitsList.length; i++){
+		var pieces = callNumberLimitsList[i].split("=");
+
+		var row_div = document.createElement('div');
+		row_div.id = callNumberLimitsList[i];
+		row_div.innerHTML = pieces[0] + " = " + pieces[1];
+
+		var sp_delete = document.createElement('span');
+		sp_delete.className = 'callnumber_delete';
+		sp_delete.innerHTML = '&nbsp;';
+		sp_delete.id = "callNumberLimit" + i;
+		row_div.appendChild(sp_delete);
+
+		_$('callNumberLimits').appendChild(row_div);
+		$('#callNumberLimit' + i).click(function(e){
+			deleteCallNumber($(this).attr('id').substr(15));
+		});
+	}
+
+}
+

Modified: branches/2.0/config/js/tooltip.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/tooltip.js?view=diff&rev=5092&r1=5091&r2=5092
==============================================================================
--- branches/2.0/config/js/tooltip.js (original)
+++ branches/2.0/config/js/tooltip.js Thu Oct 14 12:54:11 2010
@@ -66,6 +66,7 @@
 	tooltips['users'] .en[30] = "<B>Flash</B> sets the amount of time, in milliseconds, that must have passed since the last hook-flash event received by asterisk before it will recognize a second event.  If a second event occurs in less time than defined for Flash, then asterisk will ignore the event.  The default value of Flash is 750 ms, and it can be configured in 1ms increments." ;
 
 	tooltips['users'] .en[31] = "<B>RXFlash</B> sets the amount of time, in milliseconds, that the hook-flash must remain depressed in order for asterisk to consider such an event a valid flash event.  The default value of RXFlash is 1250ms and it can be configured in 1ms increments." ;
+	tooltips['users'] .en[32] = "<B>Require Call Token:</B> Enable or disable requiring call token.  Default is 'yes'. Using 'auto' may lock out users who depend on backward compatibility when peer authentication credentials are shared between physical endpoints.";
 
 	tooltips['users'] .en[94] = "Line Keys is the number of lines that are tied to this SIP registration.";
 
@@ -275,6 +276,9 @@
 	tooltips['iax_general'].en[36] = "<B>Ignore Expired Peers:</B> if the peers ip registration is expired use the ip information  if available.";
 	tooltips['iax_general'].en[37] = "<B>Disallowed Codecs:</B> set default disallow codecs to the following";
 	tooltips['iax_general'].en[38] = "<B>Allowed Codecs:</B> set allowed codecs to the following.";
+	tooltips['iax_general'].en[40] = "A single IP address or a range of IP addresses for which call token validation is not required in the form \"11.11.11.11\" or \"11.11.11.11/22.22.22.22\".";
+	tooltips['iax_general'].en[41] = "<B>Max Call Numbers:</B> Limits the amount of call numbers allowed for a single IP address.";
+	tooltips['iax_general'].en[42] = "<B>Max Nonvalidated Call Numbers:</B> Limits the amount of nonvalidated call numbers for all IP addresses combined.";
 
 
 	// Tooltips for Options (options)

Modified: branches/2.0/config/js/users.js
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/js/users.js?view=diff&rev=5092&r1=5091&r2=5092
==============================================================================
--- branches/2.0/config/js/users.js (original)
+++ branches/2.0/config/js/users.js Thu Oct 14 12:54:11 2010
@@ -21,7 +21,7 @@
 var isNewUSER;
 var EXTENSION_EDIT;
 var zapchan_Before = '';
-var MULTI_FIELDS = ['edit_check_multiple_obcid','edit_multiple_obcid','edit_check_multiple_dialplan','edit_multiple_dialplan','edit_check_multiple_hasvoicemail','edit_multiple_hasvoicemail','edit_check_multiple_vmsecret', 'edit_multiple_vmCHoice1', 'edit_multiple_vmCHoice2', 'edit_multiple_vmsecret', 'edit_check_multiple_hassip', 'edit_multiple_hassip', 'edit_check_multiple_hasiax', 'edit_multiple_hasiax', 'edit_check_multiple_allow',  'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three', 'edit_multiple_codec_fourth', 'edit_multiple_codec_fifth', 'edit_check_multiple_flashrxflash',  'edit_multiple_flash', 'edit_multiple_rxflash', 'edit_check_multiple_secret', 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret', 'edit_check_multiple_nat',  'edit_multiple_nat', 'edit_check_multiple_canreinvite', 'edit_multiple_canreinvite', 'edit_check_multiple_dtmfmode',  'edit_multiple_dtmfmode', 'edit_check_multiple_insecure',  'edit_multiple_insecure', 'edit_check_multiple_3waycalling',  'edit_multiple_3waycalling', 'edit_check_multiple_indirectory',  'edit_multiple_indirectory', 'edit_check_multiple_callwaiting',  'edit_multiple_callwaiting', 'edit_check_multiple_cti',  'edit_multiple_cti', 'edit_check_multiple_isagent',  'edit_multiple_isagent', 'edit_check_multiple_pickupgroup',  'edit_multiple_pickupgroup'];
+var MULTI_FIELDS = ['edit_check_multiple_obcid','edit_multiple_obcid','edit_check_multiple_dialplan','edit_multiple_dialplan','edit_check_multiple_hasvoicemail','edit_multiple_hasvoicemail','edit_check_multiple_vmsecret', 'edit_multiple_vmCHoice1', 'edit_multiple_vmCHoice2', 'edit_multiple_vmsecret', 'edit_check_multiple_hassip', 'edit_multiple_hassip', 'edit_check_multiple_hasiax', 'edit_multiple_hasiax', 'edit_check_multiple_allow',  'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three', 'edit_multiple_codec_fourth', 'edit_multiple_codec_fifth', 'edit_check_multiple_flashrxflash',  'edit_multiple_flash', 'edit_multiple_rxflash', 'edit_check_multiple_secret', 'edit_check_multiple_iax', 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret', 'edit_check_multiple_nat',  'edit_multiple_nat', 'edit_check_multiple_canreinvite', 'edit_multiple_canreinvite', 'edit_check_multiple_dtmfmode',  'edit_multiple_dtmfmode', 'edit_check_multiple_insecure',  'edit_multiple_insecure', 'edit_check_multiple_3waycalling',  'edit_multiple_3waycalling', 'edit_check_multiple_indirectory',  'edit_multiple_indirectory', 'edit_check_multiple_callwaiting',  'edit_multiple_callwaiting', 'edit_check_multiple_cti',  'edit_multiple_cti', 'edit_check_multiple_isagent',  'edit_multiple_isagent', 'edit_check_multiple_pickupgroup',  'edit_multiple_pickupgroup', 'edit_multiple_requirecalltoken', 'edit_multiple_maxcallnumbers'];
 
 var show_UserEdit_normal = function(){ // show_UserEdit_normal();
 	$('#edit_User_Advanced_DIV').hideWithBg();
@@ -111,7 +111,8 @@
 	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_hasiax' , [ 'edit_multiple_hasiax' ] );
 	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_allow' , [ 'edit_multiple_codec_one', 'edit_multiple_codec_two', 'edit_multiple_codec_three' , 'edit_multiple_codec_fourth' , 'edit_multiple_codec_fifth'  ] );
 	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_flashrxflash' , [ 'edit_multiple_flash', 'edit_multiple_rxflash'  ] );
-	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_secret' , [ 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret'  ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_secret' , [ 'edit_multiple_seCHoice1', 'edit_multiple_seCHoice2', 'edit_multiple_secret' ] );
+	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_iax' , [ 'edit_multiple_requirecalltoken' ,'edit_multiple_maxcallnumbers' ] );
 	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_nat' , [ 'edit_multiple_nat' ] );
 	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_canreinvite' , [ 'edit_multiple_canreinvite' ] );
 	ASTGUI.domActions.enableDisableByCheckBox( 'edit_check_multiple_dtmfmode' , [ 'edit_multiple_dtmfmode' ] );
@@ -193,7 +194,7 @@
 };
 
 var RESET_USER_FORM_FIELDS = function(){ // RESET_USER_FORM_FIELDS();
-	ASTGUI.resetTheseFields( ['new_ext','edit_fullname','edit_user_dialplan','edit_OutBoundCallerid','edit_hasvoicemail','edit_vmsecret','edit_email','edit_hasSip','edit_hasIax','edit_fxs','edit_flash','edit_rxflash','codec_one','codec_two','codec_three','codec_fourth','codec_fifth','macaddress','linenumber','edit_secret','edit_nat','edit_canreinvite','edit_dtmfmode','edit_insecure', 'edit_mwifrom', 'edit_3wayCalling','edit_inDirectory','edit_callWaiting','edit_cti','edit_isagent','edit_pickupgroup','edit_linekeys'] );
+	ASTGUI.resetTheseFields( ['new_ext','edit_fullname','edit_user_dialplan','edit_OutBoundCallerid','edit_hasvoicemail','edit_vmsecret','edit_email','edit_hasSip','edit_hasIax','edit_fxs','edit_flash','edit_rxflash','codec_one','codec_two','codec_three','codec_fourth','codec_fifth','macaddress','linenumber','edit_secret','edit_nat','edit_canreinvite','edit_dtmfmode','edit_insecure', 'edit_mwifrom', 'edit_3wayCalling','edit_inDirectory','edit_callWaiting','edit_cti','edit_isagent','edit_pickupgroup','edit_linekeys','edit_maxcallnumbers' ,'edit_requirecalltoken'] );
 	_$('edit_fxs').selectedIndex = 0; _$('codec_one').selectedIndex = 0; _$('codec_two').selectedIndex = 0; _$('codec_three').selectedIndex = 0; _$('codec_fourth').selectedIndex = 0; 
 	_$('codec_fifth').selectedIndex = 0; _$('linenumber').selectedIndex = 0; _$('edit_pickupgroup').selectedIndex = 0;
 
@@ -257,6 +258,8 @@
 		ASTGUI.updateFieldToValue( 'edit_cti', uinfo.getProperty('hasmanager') );
 		ASTGUI.updateFieldToValue( 'edit_isagent', uinfo.getProperty('hasagent') );
 		ASTGUI.updateFieldToValue( 'edit_pickupgroup', uinfo.getProperty('pickupgroup') );
+		ASTGUI.updateFieldToValue( 'edit_maxcallnumbers', uinfo.getProperty('maxcallnumbers') );
+		ASTGUI.updateFieldToValue( 'edit_requirecalltoken', uinfo.getProperty('requirecalltoken') );
 		zapchan_Before = uinfo.getProperty(top.sessionData.DahdiChannelString);
 	}else{
 			_$('new_ext').disabled = false;
@@ -400,6 +403,9 @@
 var SAVE_USER_FORM = function(){ // SAVE_USER_FORM();
 	if ( !ASTGUI.checkRequiredFields(['new_ext']) ) return ;
 	if ( !ASTGUI.validateFields(['new_ext'] ) ) return ;
+	if ( $('edit_maxcallnumbers').attr('value') && !ASTGUI.validateFields(['edit_maxcallnumbers'] ) ){
+		return;
+	}
 
 	if ( !ASTGUI.getFieldValue('edit_hasSip').isAstTrue() && ASTGUI.getFieldValue('edit_fxs') && !ASTGUI.getFieldValue('macaddress') ){
 		ASTGUI.updateFieldToValue( 'macaddress',  ASTGUI.getFieldValue('new_ext') );
@@ -494,6 +500,16 @@
 		x.new_action('update', u, 'mwi_from', 		ASTGUI.getFieldValue('edit_mwifrom') );	tmp_obj['mwi_from'] = ASTGUI.getFieldValue('edit_mwifrom') ;
 	}
 		x.new_action('update', u, 'pickupgroup', 	ASTGUI.getFieldValue('edit_pickupgroup') );	tmp_obj['pickupgroup'] = ASTGUI.getFieldValue('edit_pickupgroup') ;
+		if (ASTGUI.getFieldValue('edit_requirecalltoken') == ''){
+			x.new_action('delete', u, 'requirecalltoken','');	tmp_obj['requirecalltoken'] = '';
+		} else {
+			x.new_action('update', u, 'requirecalltoken',	ASTGUI.getFieldValue('edit_requirecalltoken') );	tmp_obj['requirecalltoken'] = ASTGUI.getFieldValue('edit_requirecalltoken') ;
+		}
+		if(ASTGUI.getFieldValue('edit_maxcallnumbers') ){
+			x.new_action('update', u, 'maxcallnumbers', 	ASTGUI.getFieldValue('edit_maxcallnumbers') );	tmp_obj['maxcallnumbers'] = ASTGUI.getFieldValue('edit_maxcallnumbers') ;
+		}else{
+			x.new_action('delete', u, 'maxcallnumbers', '');	tmp_obj['maxcallnumbers'] = '';
+		}
 
 		var tmp_cl = parent.sessionData.pbxinfo.users[u].getProperty('call-limit') ;
 		if( !tmp_cl ){
@@ -629,8 +645,30 @@
 			tmp_obj['rxflash'] = ASTGUI.getFieldValue('edit_multiple_rxflash') ;
 		}
 		if( _$('edit_check_multiple_secret').checked ){
-			x.new_action('update', u, 'secret',  ASTGUI.getFieldValue('edit_multiple_secret') );
-			tmp_obj['secret'] = ASTGUI.getFieldValue('edit_multiple_secret') ;
+			if(ASTGUI.getFieldValue('edit_multiple_seCHoice1') == 'on'){
+				x.new_action('update', u, 'secret',  ASTGUI.getFieldValue('edit_multiple_secret') );
+				tmp_obj['secret'] = ASTGUI.getFieldValue('edit_multiple_secret') ;
+			}else if(ASTGUI.getFieldValue('edit_multiple_seCHoice2') == 'on'){
+				x.new_action('update', u, 'secret',  '' );
+				tmp_obj['secret'] = '' ;
+			}
+		}
+		if( _$('edit_check_multiple_iax').checked ){
+			if ( ASTGUI.getFieldValue('edit_multiple_maxcallnumbers') ){
+				if ( !ASTGUI.validateFields(['edit_multiple_maxcallnumbers'] ) ){
+					return;
+				}else{
+					x.new_action('update', u, 'maxcallnumbers',  ASTGUI.getFieldValue('edit_multiple_maxcallnumbers') );
+					tmp_obj['maxcallnumbers'] = ASTGUI.getFieldValue('edit_multiple_maxcallnumbers') ;
+				}
+			}else{
+					x.new_action('delete', u, 'maxcallnumbers', '' );
+					tmp_obj['maxcallnumbers'] = '';
+			}
+			if( ASTGUI.getFieldValue('edit_multiple_requirecalltoken') != ''){
+				x.new_action('update', u, 'requirecalltoken',  ASTGUI.getFieldValue('edit_multiple_requirecalltoken') );
+				tmp_obj['requirecalltoken'] = ASTGUI.getFieldValue('edit_multiple_requirecalltoken') ;
+			}
 		}
 		if( _$('edit_check_multiple_nat').checked ){
 			x.new_action('update', u, 'nat',  ASTGUI.getFieldValue('edit_multiple_nat') );

Modified: branches/2.0/config/users.html
URL: http://svnview.digium.com/svn/asterisk-gui/branches/2.0/config/users.html?view=diff&rev=5092&r1=5091&r2=5092
==============================================================================
--- branches/2.0/config/users.html (original)
+++ branches/2.0/config/users.html Thu Oct 14 12:54:11 2010
@@ -223,12 +223,34 @@
 									<option value='6'>6</option>
 								</select>
 								<img src="images/tooltip_info.gif" tip="en,users,94" class='tooltipinfo'>
+							</TD>
+						</TR>
+						<TR>
+							<TD>
 								
 								SIP/IAX Password: <input id="edit_secret" size=6>
 								<img src="images/tooltip_info.gif" tip="en,users,2" class='tooltipinfo'>
-							</TD>
-						</TR>
-						<TR>	<TD>
+ 							
+ 							IAX: Require Call Token: <img src="images/tooltip_info.gif" tip="en,users,32" class='tooltipinfo'>
+ 							<select id="edit_requirecalltoken" dfalt=""> 
+ 								<option value=''></option>
+ 								<option value='yes'>yes</option>
+ 								<option value='no'>no</option>
+ 								<option value='auto'>auto</option>
+ 							</select>
+							</TD>
+						</TR>
+						<TR>
+							<TD>
+ 					<TR>
+ 						<TD>
+ 
+ 							IAX: Max Call Numbers: <img src="images/tooltip_info.gif" tip="en,iax_general,42" class='tooltipinfo'>
+ 							<input type='text' size=4 id='edit_maxcallnumbers' dfalt='' validation='numeric' class="input8">
+ 						</TD>
+ 					</TR>
+ 					<TR>
+ 						<TD>
 								NAT: <input type='checkbox' id='edit_nat' dfalt='yes'> <img src="images/tooltip_info.gif" tip="en,users,22" class='tooltipinfo'>
 								Can Reinvite: <input type='checkbox' id='edit_canreinvite'> <img src="images/tooltip_info.gif" tip="en,users,21" class='tooltipinfo'>
 
@@ -380,8 +402,27 @@
 				<TD><input type=checkbox id='edit_check_multiple_secret'></TD>
 				<TD>
 					SIP/IAX Password: <img src="images/tooltip_info.gif" tip="en,users,2" class='tooltipinfo'>
-					<BR>	<input type=radio id='edit_multiple_seCHoice1' name='edit_multiple_seCHoice'> Use <input id="edit_multiple_secret" size=4> for all users<BR>
-							<input type=radio id='edit_multiple_seCHoice2' name='edit_multiple_seCHoice'> Use Extension as Password
+ 				<BR>	<input type=radio id='edit_multiple_seCHoice1' name='edit_multiple_seCHoice'> Use <input id="edit_multiple_secret" size=4> for all users 
+ 						<input type=radio id='edit_multiple_seCHoice2' name='edit_multiple_seCHoice'> Use Extension as Password
+ 						</TD>
+ 					</TR>
+				<TR>
+					<TD></TD>
+					<TD><strong>IAX Security Settings:</strong></TD>
+				</TR>
+ 					<TR>
+					<TD><input type=checkbox id='edit_check_multiple_iax'></TD>
+ 						<TD>
+ 							IAX: Require Call Token: <img src="images/tooltip_info.gif" tip="en,users,32" class='tooltipinfo'>
+ 							<select id="edit_multiple_requirecalltoken" dfalt=''> 
+ 								<option value=''></option>
+ 								<option value='yes'>yes</option>
+ 								<option value='no'>no</option>
+ 								<option value='auto'>auto</option>
+ 							</select>
+							<br> 
+ 							IAX: Max Call Numbers: <img src="images/tooltip_info.gif" tip="en,iax_general,42" class='tooltipinfo'>
+ 							<input type='text' size=4 id='edit_multiple_maxcallnumbers' dfalt='' validation='numeric' class="input8">
 				</TD>
 			</TR>
 




More information about the asterisk-gui-commits mailing list