bkruse: branch asterisknow r1462 - in /branches/asterisknow: ./ config/ confi...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Aug 27 14:04:14 CDT 2007


Author: bkruse
Date: Mon Aug 27 14:04:14 2007
New Revision: 1462

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1462
Log:
[1] Changed todo list to effect this commit.
[2] Added support for our providers:
Bandwidth.com
VoilaIP
SimpleSignal
NGT
VoicePulse
[3] Added the Digital card detection along in with
the change to trunks.html.
[4] Added all provider images and a beta warning
to the providers select box.
[5] Added a new sub-catagory on bugs.digium.com
specifically for this (that could be a bad sign)
[6] Merged Support for AUDIO levels and fxotune
(To calibrate and adjust levels) (by pari)
However, this IS commented out for now.
[7] Pretty much a revamp of the trunks.html 
page for asteriskNOW all together. Numerous
bug fixes and changes.

Added:
    branches/asterisknow/config/images/bandwidth.gif   (with props)
    branches/asterisknow/config/images/ngt.jpg   (with props)
    branches/asterisknow/config/images/simplesignal.jpg   (with props)
    branches/asterisknow/config/images/voilaip.gif   (with props)
Modified:
    branches/asterisknow/config/images/voicepulse.gif
    branches/asterisknow/config/scripts/tooltip.js
    branches/asterisknow/config/trunks.html
    branches/asterisknow/configs/providers.conf.sample
    branches/asterisknow/todo.txt

Added: branches/asterisknow/config/images/bandwidth.gif
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/images/bandwidth.gif?view=auto&rev=1462
==============================================================================
Binary file - no diff available.

Propchange: branches/asterisknow/config/images/bandwidth.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: branches/asterisknow/config/images/ngt.jpg
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/images/ngt.jpg?view=auto&rev=1462
==============================================================================
Binary file - no diff available.

Propchange: branches/asterisknow/config/images/ngt.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: branches/asterisknow/config/images/simplesignal.jpg
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/images/simplesignal.jpg?view=auto&rev=1462
==============================================================================
Binary file - no diff available.

Propchange: branches/asterisknow/config/images/simplesignal.jpg
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: branches/asterisknow/config/images/voicepulse.gif
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/images/voicepulse.gif?view=diff&rev=1462&r1=1461&r2=1462
==============================================================================
Binary files - no diff available.

Added: branches/asterisknow/config/images/voilaip.gif
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/images/voilaip.gif?view=auto&rev=1462
==============================================================================
Binary file - no diff available.

Propchange: branches/asterisknow/config/images/voilaip.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: branches/asterisknow/config/scripts/tooltip.js
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/scripts/tooltip.js?view=diff&rev=1462&r1=1461&r2=1462
==============================================================================
--- branches/asterisknow/config/scripts/tooltip.js (original)
+++ branches/asterisknow/config/scripts/tooltip.js Mon Aug 27 14:04:14 2007
@@ -256,6 +256,7 @@
 	tooltips['trunks'].en[3] = "<B>Username:</B> The username for your account with the provider - please contact your provider if you do not know it.";
 	tooltips['trunks'].en[4] = "<B>Password:</B> The password for your account with the provider - please contact your provider if you do not know it.";
 	tooltips['trunks'].en[5] = "<B>Digital Cards:</B> Digital Card trunking setup includes TExxxx based cards. Anything that is based from zaptel.conf and zapata.conf is readily availible to be configured as a trunk.";
+	tooltips['trunks'].en[6] = "<B>Provider:</B> These VOIP service providers are currently in state beta. report bugs to http://bugs.digium.com";
 	 
 	// Tooltips for Voicemenus (menus)
 	tooltips['menus']= new Object;

Modified: branches/asterisknow/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/trunks.html?view=diff&rev=1462&r1=1461&r2=1462
==============================================================================
--- branches/asterisknow/config/trunks.html (original)
+++ branches/asterisknow/config/trunks.html Mon Aug 27 14:04:14 2007
@@ -1,23 +1,17 @@
 <!--
- * Asterisk-GUI	-	an Asterisk configuration interface
+ * Configuration for "Service Providers (trunks)"
  *
- * Create/Manage Service Providers (trunks)
- *
- * Copyright (C) 2006-2007, Digium, Inc.
+ * Copyright (C) 2006 - 2007, Digium, Inc.
  *
  * Mark Spencer <markster at digium.com>
  * Pari Nannapaneni <pari at digium.com>
  * Brandon Kruse <bkruse at digium.com>
  *
- * See http://www.asterisk.org for more information about
- * the Asterisk project. Please do not directly contact
- * any of the maintainers of this project for assistance;
- * the project provides a web site, mailing lists and IRC
- * channels for your use.
+ * All Rights Reserved.
  *
- * This program is free software, distributed under the terms of
- * the GNU General Public License Version 2. See the LICENSE file
- * at the top of the source tree.
+ * Distribution of this file is subject to the license
+ * agreement you accepted when obtained and/or activated
+ * the Digium product containing this file.
  *
 -->
 <script src="scripts/prototype.js"></script>
@@ -28,15 +22,16 @@
 var origwidth;
 var widgets = {};
 var provwidgets = {};
-var spanwidgets = {};
 var callbacks = new Object;
 var phonecallbacks = new Object;
 var providercallbacks = new Object;
 var globalvars = new Object;
-var fieldnames =[ 'disallow','allow','callerid','cancel','contact','context','delete','dialformat','fromdomain','fromuser','group','hasexten','hasiax','hassip','host','insecure',
+var fieldnames =[ 'disallow','allow','signalling','callerid','cancel','contact','context','delete','dialformat','fromdomain','fromuser','group','hasexten','hasiax','hassip','host','insecure',
 		'name','new','port','provider','registeriax','registersip','save','secret','trunkname','trunkstyleanalog','trunkstylecustomvoip', 'trunkstyledigital',
 		'trunkstylevoip','username','zapchan'];
 var provfieldnames = ['providerdesc', 'providerlogo'];
+var opt_userandpass = ['voip_user', 'voip_pass', 'username', 'secret'];
+var opt_userandip = ['voip_user', 'voip_ip', 'username', 'ip'];
 var isnewtrunk;
 var dids_array = [];
 var old_trunkname;
@@ -45,6 +40,10 @@
 var used_fxos = {};
 used_fxos.oldvalue = "";
 used_fxos.newvalue = "";
+
+/* I am leaving this in here for when pari merges the audio level stuff with asterisknow... */
+var PORTS_toCALIBRATE = {} ;
+var AUDIO_LEVELS = [];
 
 function add_didcontext(trunk){
 	var didcontext = asterisk_guiTDPrefix + trunk ;
@@ -94,6 +93,7 @@
 globalvars.loaded = function() {
 	parent.astmanEngine.config2list("users.conf", _$('devices'), widgets, callbacks);
 }
+			
 
 providercallbacks.loaded = function() {
 	var p = _$('provider');
@@ -131,7 +131,6 @@
 	ASTGUI.events.add( _$('new') , "click", showSPdetails ) ;
 	loadServiceProvidersintotable();
 	preparemenus();
-	//parent.astmanEngine.config2list("ztscan.conf", _$('spans'), new Array(), digitalcallbacks);
 	/* If ztscan is not installed, the config file will not be generated. */
 	if(!config2json("ztscan.conf", 1, digitalparse)) {
 			has_digital = 0; /* ztscan.conf was NOT found */
@@ -193,8 +192,39 @@
 	var _msg2 = "No analog line hardware installed on the system";
 	var _msg3 = "When using Analog, at least one port must be selected.";
 	var _msg4 = "Please enter a Comment for this Service Provider";
-
-	if ( _tsv.checked && !_$('username').value.length ) { gui_alert(_msg1); return false; }
+	var _msg5 = "Please enter an IP for your NGT Sip Server!";
+
+	var provider_rl;
+	var _provider_rl = _$('provider');
+	provider_rl = _provider_rl.stored_config.catbyname[_provider_rl.value];
+
+	/* ngt and bandwidth do not require passwords, its ip based. */
+	if ( _tsv.checked && !_$('username').value.length && _$('provider').value != "bandwidth" && _$('provider').value != "ngt") { gui_alert(_msg1); return false; }
+
+	if ( _tsv.checked && !_$('ip').value.length && _$('provider').value == "ngt") { gui_alert(_msg5); return false; }
+	 /* If they chose ngt, and did not provide an IP address, error out. */
+	
+	 if(_tsv.checked && _$('provider').value == "ngt") {
+		 _$('fromuser').value = (_$('username').value) ? _$('username').value : 'NO USERNAME SPECIFIED!';
+		widgets['fromuser'] = _$('username');
+		/* Our makerequest uses this widget as its call for fromuser */
+		/* If provider is NGT, we need to change the host and IP right before we save, to our two input boxes, username and IP. */
+		 _$('host').value = (_$('ip').value.length) ? _$('ip').value : 'NO IP SPECIFIED!' ;
+	 } 
+
+	if(_$('provider').value == "simplesignal" && _tsv.checked) {	
+		if(_tsv.checked) {
+			_$('fromuser').value = _$('username').value;
+			widgets['fromuser'] = _$('username');
+			/* Our makerequest uses this widget as its call for fromuser */
+			_$('fromdomain').value = (provider_rl.fieldbyname['host']) ? provider_rl.fieldbyname['host'] : 'type make samples in the gui source directory' ;
+		}
+	} else {
+		if(_tsv.checked) {
+			_$('fromuser').value = (provider_rl.fieldbyname['fromuser']) ? provider_rl.fieldbyname['fromuser'] : '' ;
+			_$('fromdomain').value = (provider_rl.fieldbyname['fromdomain']) ? provider_rl.fieldbyname['fromdomain'] : '' ;
+		}
+	}
 
 	if ( _tsa.checked ) {
 		var _zapchan = _$('zapchan');
@@ -248,6 +278,7 @@
 					count++ ;
 				}
 			}
+			PORTS_toCALIBRATE.ports_string = _$('trunkname').value;
 			used_fxos.newvalue = _$('trunkname').value;
 			_$('trunkname').value = ((count > 1) ? "Ports ":"Port ") + _$('trunkname').value ;
 		}
@@ -260,7 +291,9 @@
 }
 
 callbacks.savechanges = function() {
+	isAnalog = false;
 	update_used_fxos();
+	if ( !( _$('trunkstylevoip').checked && _$('trunkstylecustomvoip').checked )  ) { isAnalog = true; }
 	if(isnewtrunk == 1){ //New Trunk created , add [DID_trunk_x] in extensions.conf
 		add_didcontext(_$('name').value);
 		if (_$('trunkstylevoip').checked) {
@@ -268,16 +301,30 @@
 			_$('callerid').value = '';
 			_$('insecure').value = (provider.fieldbyname['insecure']) ? provider.fieldbyname['insecure'] : '' ;
 			_$('port').value = (provider.fieldbyname['port']) ? provider.fieldbyname['port'] : '' ;
-			_$('fromuser').value = (provider.fieldbyname['fromuser']) ? provider.fieldbyname['fromuser'] : '' ;
-			if (_$('fromuser').value == '<DID>') { _$('fromuser').value = _$('username').value; }
+			if(_$('provider').value == "ngt" ) {
+				_$('fromuser').value = _$('username').value;
+			} else { 
+				_$('fromuser').value = (provider.fieldbyname['fromuser']) ? provider.fieldbyname['fromuser'] : '' ;
+			}
 			_$('fromdomain').value = (provider.fieldbyname['fromdomain']) ? provider.fieldbyname['fromdomain'] : '' ;
 		}
 		callbacks_savechanges_step2();
+		
 	}else{
 		if(old_trunkname != _$('name').value ){ update_didcontext(old_trunkname, _$('name').value); } // rename DID if needed
 		hideSPdetails();
 		loadServiceProvidersintotable();
 	}
+
+       if ( isAnalog ){
+		PORTS_toCALIBRATE.ports_array  = PORTS_toCALIBRATE.ports_string.split(",") ;
+		$('span_Ports_toCalibratie').innerHTML = "" ;
+		for( var p =0; p < PORTS_toCALIBRATE.ports_array.length ; p++) {
+			$('span_Ports_toCalibratie').innerHTML += "Analog Port #" + PORTS_toCALIBRATE.ports_array[p] + "<BR>" ;
+		}
+		_$('bg_transparent').style.display = '' ;
+		_$('div_calibrate').style.display = '' ;
+       }
 
 	return true;
 }
@@ -330,8 +377,6 @@
 	}
 }
 
-
-
 function ifnewtrunk(){
 	var needcomma = 0;
 	var provider;
@@ -339,17 +384,22 @@
 	var _provider = _$('provider');
 	var _zapchan = _$('zapchan');
 	var _trunkname = _$('trunkname');
+	var _username2 = (_$('username').value) ? ' - ' + _$('username').value : ' - (No Username Needed)'; 
 	_$('hasexten').value = 'no';
 	_$('context').value =  asterisk_guiTDPrefix + _$('name').value  ;
 
 	if (_$('trunkstylevoip').checked) {
 		provider = _provider.stored_config.catbyname[_provider.value];
-		_trunkname.value = _provider.options[_provider.selectedIndex].innerHTML + " - " + _$('username').value;
+		_trunkname.value = _provider.options[_provider.selectedIndex].innerHTML + _username2;
+		_$('signalling').value = '';
 		_$('hassip').value = provider.fieldbyname['hassip'];
 		_$('hasiax').value = provider.fieldbyname['hasiax'];
 		_$('registeriax').value = provider.fieldbyname['registeriax'];
 		_$('registersip').value = provider.fieldbyname['registersip'];
-		_$('host').value = provider.fieldbyname['host'];
+		if(_provider.value != "ngt") {
+			_$('host').value = provider.fieldbyname['host'];
+			_$('fromuser').value = _$('username').value;
+		}
 		for (var x=0;x<_zapchan.options.length;x++){  _zapchan.options[x].selected = false; }
 		_zapchan.value = '';
 		_$('group').value = '';
@@ -369,8 +419,11 @@
 				count++;
 			}
 		}
+
+ 		 PORTS_toCALIBRATE.ports_string = _trunkname.value;	
 		used_fxos.newvalue = _trunkname.value; 
 		_trunkname.value = ((count > 1) ? "Ports ":"Port ") + _trunkname.value;
+		_$('signalling').value = 'fxs_ks';
 		_$('callerid').value = 'asreceived';
 		_$('hassip').value = 'no';
 		_$('hasiax').value = 'no';
@@ -381,6 +434,7 @@
 		_trunkname.value = "Custom - " + _$('customvoip_name').value;
 		provider = _$('customvoip_name').value;
 		_provider.selectedIndex  = -1;
+		_$('signalling').value = '';
 		_$('username').value = _$('customvoip_username').value;
 		_$('secret').value = _$('customvoip_secret').value;
 		var _cv_p = $('customvoip_protocol').value ;
@@ -442,7 +496,7 @@
 	ASTGUI.events.add( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
 	ASTGUI.events.add( _$('trunkstylevoip') , 'click' , activateanalogvoip );
 	ASTGUI.events.add( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
-	ASTGUI.events.add( _$('trunkstyledigital'), 'click', activateanalogvoip );
+	ASTGUI.events.add( _$('trunkstyledigital') , 'click' , activateanalogvoip );
 
 	return tmp;
 }
@@ -472,9 +526,12 @@
 			if(n[l]['continue'] == "yes") {
 				has_digital = 1;
 				has_spans = n[l]['totalspans'];
-				_$('spans').style.display = "none";
+				_$('spans3').style.display = "none";
+				_$('spans3').style.visibility = "none";
+				_$('spans2').style.display = "none";
+				_$('spans2').style.visibility = "none";
 				_$('digital_click_txt').style.display="";
-				_$('digital_click_txt').innerHTML="<br><br>We Detected " + has_spans + " Spans in your computer!<br><br> Click Here to go to the Digital Card setup Wizard";		
+				_$('digital_click_txt').innerHTML="<br><br>We Detected " + has_spans + " Spans in your computer!<br><br> Click Here to go to the Digital Card Setup Wizard";		
 				ASTGUI.events.add(_$('digital_click_txt'), 'click', function() { window.location.href = "digital.html" } );
 				/* Set digital detection as true, and our total spans to the has_spans variable (setting it from the previous 0 value) */
 				
@@ -517,7 +574,7 @@
 	var disablestring;
 
 	if (_$('trunkstyleanalog').checked) {
-		_$('analog').style.display = "block";
+		_$('analog').style.display = "";
 		_zcal.style.display = "";
 		if(_zapchan.options.length ==0){
 			_zcal.innerHTML = "No analog line hardware installed on the system";
@@ -540,34 +597,39 @@
 		}
 	}else if (_$('trunkstylevoip').checked) {
 		_$('voip').style.display = "";
-		_$('voip').style.height =350;
+		//_$('voip').style.height =350;
+		for(var x=0; x < opt_userandpass.length; x++) { /* 2 */
+		_$(opt_userandpass[x]).style.display = "none";
+		}
 	}else if (_$('trunkstylecustomvoip').checked) {
 		_$('customvoip').style.display = "" ;
 	}else if (_$('trunkstyledigital').checked) {
 		_$('digital').style.display = "" ;
 		_$('digital').style.height = 350;
-	}
-
+ 	}
 }
 
 function localajaxinit() {
-	parent.astmanEngine.run_tool(asterisk_guiZtscan, onSuccess = function() { return true; }); 
 	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 
 	ASTGUI.events.add( _$('customvoip_name') , 'change' , function(){ _$('trunkname').value = _$('customvoip_name').value; } );
 	ASTGUI.events.add( _$('customvoip_protocol') , 'change' , function(){ 
-		if(_$('customvoip_protocol').value == "sip"){ _$('hassip').value = 'yes'; _$('hasiax').value = 'no'; }
+		if(_$('customvoip_protocol').value == "sip"){ _$('hassip').value = 'yes'; _$('hasiax').value = 'no';  }
 		if(_$('customvoip_protocol').value == "iax"){ _$('hassip').value = 'no' ; _$('hasiax').value = 'yes'; }
 	});
 	ASTGUI.events.add( _$('customvoip_register') , 'change' , function(){ 
 		if(_$('customvoip_register').checked){ 
 			if(_$('customvoip_protocol').value == "sip"){ _$('registersip').value = 'yes'; _$('registeriax').value = 'no';  }
 			if(_$('customvoip_protocol').value == "iax"){ _$('registersip').value = 'no' ; _$('registeriax').value = 'yes'; }
-		}else{ _$('registersip').value = 'no'; _$('registeriax').value = 'no'; }
+		}else{
+			_$('registersip').value = 'no'; _$('registeriax').value = 'no';
+		}
 	});
 	ASTGUI.events.add( _$('customvoip_host') , 'change' , function(){ _$('host').value = _$('customvoip_host').value; } );
 	ASTGUI.events.add( _$('customvoip_username') , 'change' , function(){ _$('username').value = _$('customvoip_username').value; } );
 	ASTGUI.events.add( _$('customvoip_secret') , 'change' , function(){ _$('secret').value = _$('customvoip_secret').value; } );
+
+	ASTGUI.events.add(_$('provider'), 'click', showhidefields);
 	setWindowTitle("Service Providers");
 	_$('devices').contentEditable = 'false';
 	_$('zapchan').splitchar=',';
@@ -587,17 +649,46 @@
 	) ;
 
 	for (var x =0; x< fieldnames.length; x++) {
+		if(!_$(fieldnames[x])) {
+			alert(fieldnames[x] + " does not exists.");
+		}
 		widgets[fieldnames[x]] = _$(fieldnames[x]);
 		widgets[fieldnames[x]].disabled = true;
 	}
-	for (var x =0; x < provfieldnames.length ; x++) {
+	for (var x =0; x < provfieldnames.length ; x++) { 
 		provwidgets[provfieldnames[x]] = _$(provfieldnames[x]);
 		provwidgets[provfieldnames[x]].disabled = true;
 	}
-
+	
 	parent.astmanEngine.config2list("zapscan.conf", _$('zapchan'), new Array(), phonecallbacks);
 }
 
+function showhidefields() {
+	var provname = _$('provider').value;
+	if(provname == "bandwidth") {
+		for(var x=0; x < opt_userandpass.length; x++) { /* 3 */
+			_$(opt_userandpass[x]).style.display="none";	
+		}
+	return true;
+	/* we dont want to go to the next statement, if we know its bandwidth */
+	} 
+	if(provname == "ngt") {
+		for(var x=0; x < opt_userandpass.length; x++) {
+			_$(opt_userandpass[x]).style.display="none";
+		}
+
+		for(var x=0; x < opt_userandip.length; x++) {
+			_$(opt_userandip[x]).style.display="";
+		}
+	} else {
+		for(var x=0; x < opt_userandpass.length; x++) {
+			_$(opt_userandpass[x]).style.display="";
+			_$('ip').style.display="none";
+			_$('voip_ip').style.display="none";
+		}
+	}
+	
+}
 
 function loadServiceProvidersintotable(){
 	var _spt = _$('serviceproviderstable');
@@ -689,7 +780,7 @@
 
 function preparemenus(){
 	var menu_div = document.getElementById('mymenu') ;
-	menu_div.style.width="80";
+	menu_div.style.width="100";
 	menu_div.style.borderColor = "#eee #bbb #bbb #ddd";
 	ASTGUI.events.add( document.body , "click", function(){ _$('mymenu').style.display="none"; } );
 
@@ -775,6 +866,37 @@
 		this.style.backgroundColor='#FFFFFF'; 
 	};
 	menu_div.appendChild(menuitem3);
+
+/* This can be uncommented to include paris work with audio calibration, which will be added later. */
+/*
+	var menuitem5 = document.createElement('div');
+	menuitem5.innerHTML = "Calibrate" ;
+	//menuitem5.onclick =  function(){  hide_mymenu( );  deleteSP( this.parentNode.sp_value );  };
+	menuitem5.onclick =  function(){ hide_mymenu( ); calibrate_ports( ); };
+	menuitem5.onmouseover= function(){ 
+		document.getElementById('row'+this.parentNode.sp_value ).style.backgroundColor='#F6E7B6';
+		this.style.backgroundColor = '#EFEFEF' ;
+	};
+	menuitem5.onmouseout=function(){ 
+		document.getElementById('row'+this.parentNode.sp_value ).style.backgroundColor='#FFFFFF';
+		this.style.backgroundColor = '#FFFFFF' ;
+	};
+	menu_div.appendChild( menuitem5 );
+
+
+	var menuitem6 = document.createElement('div');
+	menuitem6.innerHTML = "Audio Levels" ;
+	menuitem6.onclick =  function(){ hide_mymenu( ); editVolumeLevels( this.parentNode.sp_value  ); };
+	menuitem6.onmouseover= function(){ 
+		document.getElementById('row'+this.parentNode.sp_value ).style.backgroundColor='#F6E7B6';
+		this.style.backgroundColor = '#EFEFEF' ;
+	};
+	menuitem6.onmouseout=function(){ 
+		document.getElementById('row'+this.parentNode.sp_value ).style.backgroundColor='#FFFFFF';
+		this.style.backgroundColor = '#FFFFFF' ;
+	};
+	menu_div.appendChild( menuitem6 );
+*/
 
 }
 
@@ -831,12 +953,13 @@
 		case 'ulaw': addtosel("u-law","ulaw",selectbox_id) ; break;
 		case 'alaw': addtosel("a-law","alaw",selectbox_id) ; break;
 		case 'gsm': addtosel("GSM","gsm",selectbox_id) ; break ;
-		case 'ilbc': addtosel("ILBC","ilbc",selectbox_id) ; break ;
-		case 'speex': addtosel("SPEEX","speex",selectbox_id) ; break ;
 		case 'g726':  addtosel("G.726","g726",selectbox_id) ; break ;
-		case 'adpcm': addtosel("ADPCM","adpcm",selectbox_id) ; break ;
-		case 'lpc10': addtosel("LPC10","lpc10",selectbox_id) ; break ;
-		case 'g729': addtosel("G.729","g729",selectbox_id) ; break ;
+
+//		case 'ilbc': addtosel("ILBC","ilbc",selectbox_id) ; break ;
+//		case 'speex': addtosel("SPEEX","speex",selectbox_id) ; break ;
+//		case 'adpcm': addtosel("ADPCM","adpcm",selectbox_id) ; break ;
+//		case 'lpc10': addtosel("LPC10","lpc10",selectbox_id) ; break ;
+//		case 'g729': addtosel("G.729","g729",selectbox_id) ; break ;
 		default: break
 	}
 
@@ -896,12 +1019,13 @@
 		selectbox_add("disallowed", "ulaw");
 		selectbox_add("disallowed", "alaw");
 		selectbox_add("disallowed", "gsm");
-		selectbox_add("disallowed", "ilbc");
-		selectbox_add("disallowed", "speex");
 		selectbox_add("disallowed", "g726");
-		selectbox_add("disallowed", "adpcm");
-		selectbox_add("disallowed", "lpc10");
-		selectbox_add("disallowed", "g729");
+
+//		selectbox_add("disallowed", "ilbc");
+//		selectbox_add("disallowed", "speex");
+//		selectbox_add("disallowed", "adpcm");
+//		selectbox_add("disallowed", "lpc10");
+//		selectbox_add("disallowed", "g729");
 	}else{
 		var tmp = _$('disallow').value.split(",");
 		for(var x=0; x < tmp.length; x++){
@@ -912,12 +1036,13 @@
 		selectbox_add("allowed", "ulaw");
 		selectbox_add("allowed", "alaw");
 		selectbox_add("allowed", "gsm");
-		selectbox_add("allowed", "ilbc");
-		selectbox_add("allowed", "speex");
 		selectbox_add("allowed", "g726");
-		selectbox_add("allowed", "adpcm");
-		selectbox_add("allowed", "lpc10");
-		selectbox_add("allowed", "g729");
+
+//		selectbox_add("allowed", "ilbc");
+//		selectbox_add("allowed", "speex");
+//		selectbox_add("allowed", "adpcm");
+//		selectbox_add("allowed", "lpc10");
+//		selectbox_add("allowed", "g729");
 	}else{
 		var tmp = _$('allow').value.split(",");
 		for(var x=0; x < tmp.length; x++){
@@ -951,7 +1076,7 @@
 
 function showSPdetails(){
 	_$('cancel').disabled = false;
-	_$('userscontent').style.display = "block";
+	_$('userscontent').style.display = "";
 	_$('bg_transparent').style.display ='';
 	/* Make our default option VOIP (service providers) */
 	_$('trunkstylevoip').click();
@@ -961,6 +1086,12 @@
 		_$('trunkstylevoip').disabled = true;
 		_$('trunkstylecustomvoip').disabled = true;
 		_$('provider').disabled = true;
+	} else {
+		_$('voip').style.display = "";
+		//_$('voip').style.height =350;
+		for(var x=0; x < opt_userandpass.length; x++) { /* 1 */
+			_$(opt_userandpass[x]).style.display = "none";
+		}
 	}
 }
 
@@ -1029,6 +1160,222 @@
 	_$('bg_transparent').style.display = "none";
 	_$('advanced_content').style.display = "none";
 }
+
+function calibrate_ports(){
+	// PORTS_toCALIBRATE  -- button_CalibratePorts, button_resetCalibration, button_skipCalibration
+	var output = "/var/lib/asterisk/static-http/config/fxotune_out";
+	var msg1 = "starting FXO tuning".toLowerCase() ;
+	var msg2 =  "FXO tuning is complete".toLowerCase() ;
+	var keepchecking;
+
+	var starthere=  function(){
+		_$('bg_transparent').style.display = "";
+		_$('msg_div').style.display = "";
+
+		_$('button_calPorts').disabled = true;
+		_$('button_resCalib').disabled = true;
+		_$('button_skipCalib').disabled = true;
+
+		var getoutput = function(){
+			var opt = { method: 'get', asynchronous: true,
+				onComplete: function(originalRequest){
+						var op = originalRequest.responseText.toLowerCase();
+						if( op.indexOf(msg1) != -1 ){
+							_$('msg_div_span').innerHTML = " Performing Calibration .... ";
+						}else if( op.indexOf(msg2) != -1 ){
+							//_$('img_loading').style.display = "none";
+							_$('img_loading').setAttribute('src', './images/tick.gif' );
+							_$('msg_div_span').innerHTML = "Finished Calibrating !!";
+							_$('bottom_msg').innerHTML = "<BR>Click the 'Save Configuration' button in the 'Home' panel to save these parameter settings";
+							window.clearInterval ( keepPinging );
+							updateUsers_fromFxotune();
+							_$('msg_div').onclick = function(){ skip_Calibration(); };
+						}
+				},
+				onFailure: function(t) { alert("Config Error: " + t.status + ": " + t.statusText); }
+			};
+			opt.parameters="";
+			var tmp = new Ajax.Request('./fxotune_out', opt);
+		}
+
+		var f1 =function(){
+			keepPinging =  window.setInterval ( getoutput , 10000);
+		};
+
+		var f2= function(){};
+	
+		_$('msg_div_span').innerHTML = "Starting Calibration script ..";
+		f1();
+		parent.astmanEngine.run_tool("/bin/fxotune_from_gui &", onSuccess = f2 );
+	};
+
+	starthere();
+}
+
+
+function reset_calibration(){
+
+
+}
+
+
+function skip_Calibration(){
+	_$('bg_transparent').style.display = "none";
+	_$('msg_div').style.display = "none";
+	_$('div_calibrate').style.display = "none";
+}
+
+function editVolumeLevels( spName ){
+
+	var portsArray = _$('devices').stored_config.catbyname[ spName ].fieldbyname['zapchan'].split( ',' );
+	var efgh = function(){
+		var y = _$('al_ports');
+		var z = "";
+	
+		ASTGUI.selectbox.clear(y);
+		for( var u =0; u < portsArray.length ; u++ ){
+			z = 'Analog Port #' + portsArray[u] ;
+			ASTGUI.selectbox.append( y, z , portsArray[u] ) ;
+		}
+		y.selectedIndex = -1;
+	};
+	efgh();
+	
+	var abcd = function(al_channels){
+		AUDIO_LEVELS = al_channels;
+		AUDIO_LEVELS.trunkname = spName;
+		_$('volLevel5').checked = false;
+		_$('volLevel4').checked = false;
+		_$('volLevel3').checked = false;
+		_$('volLevel2').checked = false;
+		_$('volLevel1').checked = false;
+		_$('button_saveAudioLevels').disabled = true ;
+		_$('bg_transparent').style.display = '';
+		_$('div_audioLevels').style.display = '' ;
+	};
+
+	getPreviousVolume_fromFxotune( spName , portsArray,  abcd );
+	
+	
+}
+
+
+function audioLevels_Cancel(){
+	AUDIO_LEVELS = [];
+	AUDIO_LEVELS.trunkname ="";
+
+	_$('bg_transparent').style.display = 'none';
+	_$('div_audioLevels').style.display = 'none';
+}
+
+function audioLevels_showPort(){
+	var getVolumeforPort = function(x){
+		for( var w=0; w< AUDIO_LEVELS.length; w++){
+			if(AUDIO_LEVELS[w].port == x ){ return AUDIO_LEVELS[w].portVolumeLevel }
+		}
+	};
+	//console.log( AUDIO_LEVELS.length );
+	//console.log( AUDIO_LEVELS.trunkname );
+
+	var v = Number( getVolumeforPort(_$('al_ports').value ) ) ;
+	switch(v){
+		case 1:
+			_$('volLevel1').checked = true;
+			break ;
+		case 2:
+			_$('volLevel2').checked = true;
+			break ;
+		case 3:
+			_$('volLevel3').checked = true;
+			break ;
+		case 4:
+			_$('volLevel4').checked = true;
+			break ;
+		case 4:
+			_$('volLevel5').checked = true;
+			break ;
+
+		default:
+		_$('volLevel5').checked = false;
+		_$('volLevel4').checked = false;
+		_$('volLevel3').checked = false;
+		_$('volLevel2').checked = false;
+		_$('volLevel1').checked = false;
+	}
+}
+
+
+
+function audioLevels_Change(z){
+	if( _$('al_ports').selectedIndex == -1 ) return;
+	_$('button_saveAudioLevels').disabled = false ;
+	
+	var setVolumeforPort = function(x, y){ // set volume for port x to y
+		for( var w=0; w< AUDIO_LEVELS.length; w++){
+			if(AUDIO_LEVELS[w].port == x ){ AUDIO_LEVELS[w].portVolumeLevel = y; }
+		}
+	};
+
+	setVolumeforPort( Number(_$('al_ports').value) ,  z);
+}
+
+function save_audioLevels(){
+
+
+	var getVolumeforPort = function(x){
+		for( var w=0; w< AUDIO_LEVELS.length; w++){
+			if(AUDIO_LEVELS[w].port == x ){ return AUDIO_LEVELS[w].portVolumeLevel }
+		}
+	};
+
+
+	// read the list of ports and then get their corresponding volume levels from AUDIO_LEVELS
+	// calculate new values and update the context in users.conf
+	var i,j,k, fx;
+	var deleteUrl ='' , updaterequest ='' , h = 0, g = AUDIO_LEVELS.trunkname;
+	var get_guiVolValue = { '1':'-2', '2':'0', '3':'2', '4':'5', '5':'9' };
+	var ports = { 1:{}, 2:{}, 3:{}, 4:{}, 5:{}, 6:{}, 7:{}, 8:{} };
+
+	var u_new, v_new, w_new ;
+
+	deleteUrl    = build_action( 'delete', h, g,'gui_volume', '', '' ); h++ ;
+	deleteUrl  += build_action( 'delete', h, g ,'gui_fxooffset', '', '' ); h++ ;
+	deleteUrl  += build_action( 'delete', h, g ,'rxgain', '', '' ); h++ ;
+	deleteUrl  += build_action( 'delete', h, g ,'channel', '', '' ); h++ ;
+
+	
+	var fxotune_conf_loaded = function(c){
+		var update_fxogains = function(c){
+			for( var d in c ){	
+				if ( c.hasOwnProperty(d) && c[d]['fxorxgain']) {
+					ports[d].fxogain = Number(c[d]['fxorxgain']) ;
+				}
+			}
+		};
+		update_fxogains(c);
+
+		for( i=0 ; i < _$('al_ports').options.length ;   i++ ){
+			j = _$('al_ports').options[i].value ; // j is port
+			k = getVolumeforPort(j); // k is volume for this port
+			fx = ports[j].fxogain; // gain from fxotune for this channel (y)
+
+			u_new = k ;
+			v_new = -1 * fx ;
+			w_new = v_new + Number(get_guiVolValue[ String(k) ]) ;
+
+			updaterequest += build_action('append', h, g , "gui_volume", u_new); h++;
+			updaterequest += build_action('append', h, g , "gui_fxooffset", v_new); h++;
+			updaterequest += build_action('append', h, g , "rxgain", w_new); h++;
+			updaterequest += build_action('append', h, g , "channel", j ); h++;
+		}
+
+		var m = deleteUrl + updaterequest ;
+		makerequest( 'u','users.conf', m, function(t){ audioLevels_Cancel(); } );
+	};
+
+	config2json( 'fxotune.conf', 1 , fxotune_conf_loaded );
+}
+
 
 </script>
 <body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF"   onunload="free_mem()">
@@ -1061,104 +1408,132 @@
 		<TD Height="20" width=15 align="center"  style="color:#FFFFFF; font-size: 12px; font-weight:bold;" onclick="$('cancel').click();">X</TD>
 		</TR>
 	</table>
-<table align="center" width=450>
-<tr>
-<td class="field_text" width=130 valign="top" align="left" tip="en,trunks,0">
-<!-- Provider type -->
-	<div id='cabinet' style='width:0;overflow:hidden'><select id='hiddenglobals'></select></div>
-	<fieldset  tip="en,trunks,0">
+<table align="center" width=470>
+<tr>	<td class="field_text">
+	<!-- Provider type -->
+	<fieldset  tip="en,trunks,0" style="width:460px">
+		<select id='hiddenglobals' style="display:none"></select>
+		<input id="name" size=10  style="display:none">
+
 		<legend><B>&nbsp;Provider Type:&nbsp;</B></legend>
-		<LABEL FOR="trunkstyleanalog"><input name='trunkstyle' type='radio' id='trunkstyleanalog' value='analog'>Analog</LABEL><BR>
-		<LABEL FOR="trunkstylevoip"><input name='trunkstyle' type='radio' id='trunkstylevoip' value='voip'>VoIP</LABEL><BR>
+		<LABEL FOR="trunkstyleanalog"><input name='trunkstyle' type='radio' id='trunkstyleanalog' value='analog'>Analog</LABEL>
+		<LABEL FOR="trunkstylevoip"><input name='trunkstyle' type='radio' id='trunkstylevoip' value='voip'>VoIP</LABEL>
 		<LABEL FOR="trunkstylecustomvoip"><input name='trunkstyle' type='radio' id='trunkstylecustomvoip' value='customvoip'>Custom VoIP</LABEL>
 		<LABEL FOR="trunkstyledigital"><input name='trunkstyle' type='radio' id='trunkstyledigital' tip="en,trunks,5" value='digital'>(BETA!) Digital Cards(T1/E1/J1)</LABEL>
 	</fieldset>
-	<div id="div_providername" style="display:none">
-		<BR><BR><B>Provider Name:</B><BR><input id="name" size=10 class='input8'>
-	</div>
-<!-- Provider type -->
-</td>
-<td>
-<!-- Provider options -->
-<div id='analogvoipcontainer' style='height:350;overflow:hidden' align="center">
-<div id='analog' style='overflow:hidden' align="center">
-	<table align="center">
-	<tr><td style='width:80px' valign='top' class="field_text"  tip="en,trunks,2">Lines:</td>
-		<td>	<select size="12" multiple='true' id='zapchan' style='width:200px' class="input8"></select>
-			<div id="zapchan_analoglines" style='height:110px; width: 200px; overflow :auto; display:none'></div>
-		</td>
-	</tr>
-	<tr><td colspan='2' style='width:80px' valign='top' align='center'></td></tr>
-	</table>
-</div>
-<div id='digital' style='height:0;overflow:hidden' align="center">
-	<table align="center">
-		<td style='width:20px' valign='top' class='field_text' tip="en,trunks,5">Spans:</td>
-		<td><select size='12' style="display:none" id='spans' style='width:240px' class='input8'><option name="blah" value="blah"></option></select></td>
-		<td style='display:none;color:#0000FF' valign='bottom' id='digital_click_txt' class='field_text' tip="en,trunks,5"></td>
-	</tr>
-	</table>
-</div>
-<div id='voip' style='height:0;overflow:hidden' align="center">
-	<table align="center">
-	<tr>	<td style='width:80px' valign='top' class="field_text" tip="en,trunks,1">Provider:</td>
-		<td><select size='6' id='provider' style='width:200px' class="input8"></select></td>
-	</tr>
-	<tr><td colspan='2' align='center'><A href="#" id="providerlink"><img id='providerlogo' style='visibility:hidden;' border=0></A></td></tr>
-	<tr><td colspan='2' align='center'><div id='providerdesc' align='left' style='width:230px;height:100px; font-size:10px'></div></td></tr>
-	<tr>	<td class="field_text" tip="en,trunks,3">Username:</td>
-		<td><input size='20' id='username' class="input8"></td>
-	</tr>
-	<tr>	<td class="field_text" tip="en,trunks,4">Password:</td>
-		<td><input type="password" size='20' id='secret' class="input8"></td>
-	</tr>
-	</table>
-</div>
-<div id='customvoip' align="center" style='display:none' align="center">
-	<table align="center" cellpadding=2 cellspacing=1>
-		<input id="trunkname" type="hidden">
-		<input id="hasiax" type="hidden">
-		<input id="hassip" type="hidden">
-		<input id="hasexten" type="hidden">
-		<input id="registeriax" type="hidden">
-		<input id="registersip" type="hidden">
-		<input id="host" type="hidden">
-		<input id="dialformat" type="hidden">
-		<input id="context" type="hidden">
-		<input id="group" type="hidden">
-		<tr>	<td height=10></td>
-			<td></td>
-		</tr>
-		<tr>	<td class="field_text">Comment:</td>
-			<td><input type="text" id="customvoip_name" size=14 onkeyup=" $('cancel').disabled= false;$('save').disabled= false;"  class="input8"></td>
-		</tr>
-		<tr>	<td class="field_text">Protocol:</td>
-			<td><select id="customvoip_protocol" onchange=" $('cancel').disabled= false;$('save').disabled= false;"  class="input8">
-				<option value="iax">IAX</option>
-				<option value="sip">SIP</option>
-				</select>
+	<!-- Provider type -->
+	</td>
+</tr>
+<tr id='analog' style='display:none; height:280px'>
+	<td align="center">
+		<table align="center">
+		<tr>	<td style='width:80px' valign='top' class="field_text"  tip="en,trunks,2">
+				Lines:
 			</td>
-		</tr>
-		<tr>	<td class="field_text">Register:</td>
-			<td><input type="checkbox" id="customvoip_register" onchange="flip_register();"  class="input8"></td>
-		</tr>
-		<tr>	<td class="field_text">Host:</td>
-			<td><input type="text" id="customvoip_host" size=14 onkeyup=" $('cancel').disabled= false;$('save').disabled= false;"  class="input8"></td>
-		</tr>
-		<tr>	<td class="field_text">Username:</td>
-			<td><input type="text" id="customvoip_username" size=14 onkeyup=" $('cancel').disabled= false;$('save').disabled= false;"  class="input8"></td>
-		</tr>
-		<tr>	<td class="field_text">Password:</td>
-			<td><input type="password" id="customvoip_secret" size=14 onkeyup=" $('cancel').disabled= false;$('save').disabled= false;"  class="input8"></td>
-		</tr>
-	</table>
-</div>
-</div>
-<!-- Provider options -->
-</td>
+			<td>	<select multiple='true' id='zapchan' style='display:none'></select>
+				<div id="zapchan_analoglines" style='height:110px; width: 200px; overflow :auto; display:none'></div>
+			</td>
+		</tr>
+		</table>
+	</td>
 </tr>
-<tr><td></td><td align="center"><input type='button' id='save' value='Save' class="buttonbold">&nbsp;<input type='button' id='cancel' value='Cancel' class="buttonbold"></td></tr>
+<tr id='digital' style='display:none;height:0;overflow:hidden' align="center">
+	<td align="center">
+		<table align="center">
+			<td style='width:20px' id='spans2' valign='top' class='field_text' tip="en,trunks,5">Spans:</td>
+			<td><select size='12' style="display:none;visilbility:none" id='spans3' style='width:240px' class='input8'><option name="blah" value="blah"></option></select></td>
+			<td style='display:none;color:#0000FF' valign='bottom' id='digital_click_txt' class='field_text' tip="en,trunks,5"></td>
+		</table>
+	</td>
+</tr>
+<tr id='voip' style='display:none; height:280px'>
+	<td align="center" valign="top">
+		<table align="center" width="96%">
+		<tr>	<td valign='top' class="field_text" tip="en,trunks,1">
+				Providers: (beta)<BR>
+				<select size='8' tip="en,trunks,6" id='provider' style='width:200px' class="input8"></select>
+			</td>
+			<td>
+				<A href="#" id="providerlink"><img id='providerlogo' style='visibility:hidden;' border=0></A>
+			</td>
+		</tr>
+		<tr>
+			<td colspan=2 align="center">
+				<div id='providerdesc' style='margin-left: 5px; margin-bottom: 5px; margin-top: 10px; font-size:10px'></div>
+
+				<div>
+				<table align="center">
+				<tr>	<td id='voip_user' class="field_text" tip="en,trunks,3">
+					Username:</td>
+					<td><input size='20' id='username' class="input8"></td>
+				</tr>
+				<tr>	<td id='voip_pass' class="field_text" tip="en,trunks,4">
+					Password:</td>
+					<td><input type="password" size='20' id='secret' class="input8"></td>
+				</tr>
+				<tr> <td style='display:none' id='voip_ip' class="field_text" tip="en,trunks,5">
+					 NGT Host:</td>
+				<td><input style="display:none" size='20' id='ip' class="input8"></td>
+				</tr>
+				</table>
+				</div>
+			</td>
+		</tr>
+		</table>
+	</td>
+</tr>
+
+<tr id='customvoip' style='display:none; height:280px'>
+	<td align="center">
+		<table align="center" cellpadding=2 cellspacing=1>
+			<input id="trunkname" type="hidden">
+			<input id="hasiax" type="hidden">
+			<input id="hassip" type="hidden">
+			<input id="hasexten" type="hidden">
+			<input id="registeriax" type="hidden">
+			<input id="registersip" type="hidden">
+			<input id="host" type="hidden">
+			<input id="dialformat" type="hidden">
+			<input id="context" type="hidden">
+			<input id="group" type="hidden">
+			<input id="signalling" type="hidden">
+			<tr>	<td height=10></td>
+				<td></td>
+			</tr>
+			<tr>	<td class="field_text">Comment:</td>
+				<td><input type="text" id="customvoip_name" size=14 onkeyup=" $('cancel').disabled= false;$('save').disabled= false;"  class="input8"></td>
+			</tr>

[... 316 lines stripped ...]



More information about the asterisk-gui-commits mailing list