bkruse: branch asterisknow r1688 - /branches/asterisknow/config/trunks.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Oct 15 12:13:47 CDT 2007


Author: bkruse
Date: Mon Oct 15 12:13:46 2007
New Revision: 1688

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1688
Log:
Now trunks.html has all the service provider fixes
from the sx00i branch. It also has SOME of the analog
port code, but its just, is not accessible via
the menus, or when you add a new analog (commented
out or deleted). It will be easy to add in the future.

Modified:
    branches/asterisknow/config/trunks.html

Modified: branches/asterisknow/config/trunks.html
URL: http://svn.digium.com/view/asterisk-gui/branches/asterisknow/config/trunks.html?view=diff&rev=1688&r1=1687&r2=1688
==============================================================================
--- branches/asterisknow/config/trunks.html (original)
+++ branches/asterisknow/config/trunks.html Mon Oct 15 12:13:46 2007
@@ -27,7 +27,7 @@
 var providercallbacks = new Object;
 var globalvars = new Object;
 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',
+		'name','new','port','provider','registeriax','registersip','save','secret','trunkname','trunkstyleanalog','trunkstylecustomvoip',
 		'trunkstylevoip','username','zapchan'];
 var provfieldnames = ['providerdesc', 'providerlogo'];
 var opt_userandpass = ['voip_user', 'voip_pass', 'username', 'secret'];
@@ -35,13 +35,10 @@
 var isnewtrunk;
 var dids_array = [];
 var old_trunkname;
-var has_spans = 0;
-var has_digital = 0;
 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 = [];
 
@@ -56,6 +53,14 @@
 	var old_didcontext = asterisk_guiTDPrefix + old_trunk  ;
 	var new_didcontext = asterisk_guiTDPrefix + new_trunk  ;
 	var uri = build_action('renamecat', 0, old_didcontext ,"", new_didcontext );
+	makerequest('u','extensions.conf', uri, function(t){ callbacks_savechanges_step2(); }  );
+}
+
+function update_didcontext_andcid(old_trunk, new_trunk){
+	var old_didcontext = asterisk_guiTDPrefix + old_trunk  ;
+	var new_didcontext = asterisk_guiTDPrefix + new_trunk  ;
+	var uri = build_action('renamecat', 0, old_didcontext ,"", new_didcontext );
+	uri += build_action('renamecat', 1, old_didcontext + "_cid", "", new_didcontext + "_cid" );
 	makerequest('u','extensions.conf', uri, function(t){ callbacks_savechanges_step2(); }  );
 }
 
@@ -116,7 +121,6 @@
 	ASTGUI.events.remove( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
 	ASTGUI.events.remove( _$('trunkstylevoip') , 'click' , activateanalogvoip );
 	ASTGUI.events.remove( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
-	ASTGUI.events.remove( _$('trunkstyledigital') , 'click' , activateanalogvoip );
 	hideSPdetails();
 }
 
@@ -131,16 +135,7 @@
 	ASTGUI.events.add( _$('new') , "click", showSPdetails ) ;
 	loadServiceProvidersintotable();
 	preparemenus();
-	/* 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 */
-			has_spans = 0; /* no ztscan.conf, we cannot have spans. */
-			_$('digital_click_txt').style.display="";
-			_$('digital_click_txt').innerHTML="<br><br>No Config File Found, either ztscan is not installed/built properly<br>or it has not been run";		
-			ASTGUI.events.add(_$('digital_click_txt'), 'click', function() { window.location.href = "digital.html" } );
-	}
 	parent.loadscreen(this);
-	/* our callbacks are finished, providers are loaded into table, display the screen. */
 }
 
 callbacks.postselect = function(){
@@ -183,7 +178,6 @@
 	var _tsv = _$('trunkstylevoip');
 	var _tsa = _$('trunkstyleanalog');
 	var _tscv = _$('trunkstylecustomvoip');
-	var _dig = _$('trunkstyledigital');
 	var _cv_un = _$('customvoip_username');
 	var _name = _$('name')  ;
 	var _dvcs_v = _$('devices').value ;
@@ -202,23 +196,24 @@
 	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!' ;
-		_$('insecure').value = "very";
-	 } 
-
-	if(_$('provider').value == "simplesignal" && _tsv.checked) {	
+	/* 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!' ;
+	_$('insecure').value = 'very';
+	}
+
+	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' ;
+			_$('insecure').value = 'invite';
 		}
 	} else {
 		if(_tsv.checked) {
@@ -226,6 +221,7 @@
 			_$('fromdomain').value = (provider_rl.fieldbyname['fromdomain']) ? provider_rl.fieldbyname['fromdomain'] : '' ;
 		}
 	}
+
 
 	if(_$('provider').value == "VoicePulse-sip" && _tsv.checked) {
 		/* save our fromuser field has the username field. */
@@ -259,6 +255,15 @@
 	if( !_tsv.checked && !_tsa.checked && !_tscv.checked ){ gui_alert("A trunk must be Analog or VoIP or Custom VOIP"); return false; }
 
 	if(_dvcs_v.length ==0 ){
+		try{
+			var _pvdr = _$('provider');
+			provider = _pvdr.stored_config.catbyname[_pvdr.value];		
+			if( typeof provider.fieldbyname['trunk_username'] != "undefined" && _tsv.checked ){
+				_name.value = provider.fieldbyname['trunk_username'];
+			}
+		}catch(e){ 
+
+		}
 		ifnewtrunk();
 	}else{
 		if( _$('custom_trunkname').value !=  _dvcs_v && _$('advanced_content').style.display == '' ){
@@ -269,15 +274,6 @@
 	}
 
 	if(isnewtrunk ==1){
-		try{
-			var _pvdr = _$('provider');
-			provider = _pvdr.stored_config.catbyname[_pvdr.value];		
-			if( typeof provider.fieldbyname['trunk_username'] != "undefined" && _tsv.checked ){
-				_name.value = provider.fieldbyname['trunk_username'];
-			}
-		}catch(e){
-
-		}
 		dids_array.push( _name.value );
 	}else{
 
@@ -311,7 +307,10 @@
 callbacks.savechanges = function() {
 	isAnalog = false;
 	update_used_fxos();
-	if ( !( _$('trunkstylevoip').checked && _$('trunkstylecustomvoip').checked )  ) { isAnalog = true; }
+	var _hiddenglobals = _$('hiddenglobals') ;
+	//if ( !( _$('trunkstylevoip').checked && _$('trunkstylecustomvoip').checked )  ) { isAnalog = true; }
+	if ( _$('trunkstyleanalog').checked ) { isAnalog = true; }
+
 	if(isnewtrunk == 1){ //New Trunk created , add [DID_trunk_x] in extensions.conf
 		add_didcontext(_$('name').value);
 		if (_$('trunkstylevoip').checked) {
@@ -319,21 +318,39 @@
 			_$('callerid').value = '';
 			_$('insecure').value = (provider.fieldbyname['insecure']) ? provider.fieldbyname['insecure'] : '' ;
 			_$('port').value = (provider.fieldbyname['port']) ? provider.fieldbyname['port'] : '' ;
-			if(_$('provider').value == "ngt" ) {
+			_$('fromuser').value = (provider.fieldbyname['fromuser']) ? provider.fieldbyname['fromuser'] : '' ;
+
+			if(_$('provider').value == "ngt") {
 				_$('fromuser').value = _$('username').value;
-			} else { 
+			} 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
+		/* Rename DID if needed */
+		if(old_trunkname != _$('name').value )	{
+			if(_$('callerid').value != "") {
+				update_didcontext_andcid(old_trunkname, _$('name').value); 
+			} else {
+				update_didcontext(old_trunkname, _$('name').value); 
+			}
+		}
+		/* build callerid */
+		var u = 0;
+		var newvalue = (_$('callerid').value.length > 0) ? _$('callerid').value : "unknown";
+		var uri = build_action('delete', u, 'globals', old_trunkname + "_cid", "","" ); u++;
+		uri += build_action('update', u, 'globals', old_trunkname + "_cid", newvalue);
+		apply_uri(_hiddenglobals, uri);
+		_hiddenglobals.stored_config.catbyname['globals'].fieldbyname[old_trunkname + "_cid"] = newvalue;
+		makerequest('u', 'extensions.conf',uri, function(t){ });
 		hideSPdetails();
 		loadServiceProvidersintotable();
 	}
-
+	/* do not need this yet...
        if ( isAnalog ){
 		PORTS_toCALIBRATE.ports_array  = PORTS_toCALIBRATE.ports_string.split(",") ;
 		$('span_Ports_toCalibratie').innerHTML = "" ;
@@ -342,15 +359,21 @@
 		}
 		_$('bg_transparent').style.display = '' ;
 		_$('div_calibrate').style.display = '' ;
+		_$('img_loading').setAttribute('src', './images/loading.gif' );
+		_$('bottom_msg').innerHTML = "<BR>This might take upto 8 minutes to complete. Please do not reboot or poweroff the unit until the calibration is complete." ;
+		_$('button_calPorts').disabled = false;
+		_$('button_resCalib').disabled = false;
+		_$('button_skipCalib').disabled = false;
        }
-
+	*/
 	return true;
 }
 
+
 function update_used_fxos(){
-	var r; 
-	var ovs = used_fxos.oldvalue.split(",");
-	var nvs = used_fxos.newvalue.split(",");
+	var r;
+	try {	var ovs = used_fxos.oldvalue.split(",");	}catch(err){	var ovs = [];	}
+	try {	var nvs = used_fxos.newvalue.split(",");	}catch(err){	var nvs = [];	}
 	for(r=0; r < ovs.length; r++){ delete used_fxos[ovs[r]]; }
 	for(r=0; r < nvs.length; r++){ used_fxos[nvs[r]] = true; }
 }
@@ -414,10 +437,13 @@
 		_$('hasiax').value = provider.fieldbyname['hasiax'];
 		_$('registeriax').value = provider.fieldbyname['registeriax'];
 		_$('registersip').value = provider.fieldbyname['registersip'];
+
+		/* if its not ngt, go ahead and set the host field, or else do NOT and get it from _$('ip'); */
 		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 = '';
@@ -508,59 +534,17 @@
 	_$('analog').style.display="none";
 	_$('voip').style.display="none";
 	_$('customvoip').style.display="none";
-	_$('digital').style.display="none";
 	_$('userscontent_title').innerHTML = "Add Service Provider";
 	isnewtrunk = 1;
 
 	ASTGUI.events.add( _$('trunkstyleanalog') , 'click' , activateanalogvoip );
 	ASTGUI.events.add( _$('trunkstylevoip') , 'click' , activateanalogvoip );
 	ASTGUI.events.add( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip );
-	ASTGUI.events.add( _$('trunkstyledigital') , 'click' , activateanalogvoip );
 
 	return tmp;
 }
 
 callbacks.identifier = "extension";
-
-function isInt(x) {
-	var y=parseInt(x);
-	if (isNaN(y)) return false;
-		return x==y && x.toString()==y.toString();
-} 
-
-function digitalparse(n) { 
-
-	var l, h;
-	for( l in n ){	if(n.hasOwnProperty(l)){
-		if( l =='general') { 
-			if(n[l]['continue'] == "no") {
-				has_digital = 0; /* ztscan.conf was NOT found */
-				has_spans = 0; /* no ztscan.conf, we cannot have spans. */
-				_$('spans').style.display = "none";
-				_$('digital_click_txt').style.display="";
-				_$('digital_click_txt').innerHTML="<br><br>Problem Detecting: <br>Reason: No Cards/Spans Found!<br><br>  Error: " + n[l]['error'];		
-				ASTGUI.events.add(_$('digital_click_txt'), 'click', function() { window.location.href = "digital.html" } );
-				return false;
-			}
-			if(n[l]['continue'] == "yes") {
-				has_digital = 1;
-				has_spans = n[l]['totalspans'];
-				_$('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";		
-				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) */
-				
-			}
-		} 
-
-	}}
-	return true;
-
-}
 
 phonecallbacks.format = function(t) {
 	if (t.fieldbyname['port'] == 'fxs')
@@ -590,7 +574,6 @@
 	_zcal.innerHTML ="";
 	_$('customvoip').style.display = "none" ;
 	_$('voip').style.display= "none";
-	_$('digital').style.display="none";
 	var disablestring;
 
 	if (_$('trunkstyleanalog').checked) {
@@ -621,20 +604,18 @@
 		showhidefields();
 	}else if (_$('trunkstylecustomvoip').checked) {
 		_$('customvoip').style.display = "" ;
-	}else if (_$('trunkstyledigital').checked) {
-		_$('digital').style.display = "" ;
-		_$('digital').style.height = 350;
- 	}
+	}
 }
 
 function localajaxinit() {
 	ASTGUI.events.add(document, 'mouseover', show_tooltip);
 
 	for(var x=0; x < opt_userandpass; x++) {
-		ASTGUI.events.add( _$(opt_userandpass[x]) , "focus", function() { _$('save').disabled = false; _$('cancel').disabled = false;});
-	}
-	ASTGUI.events.add( _$('ip') , "focus", function() { _$('save').disabled = false; _$('cancel').disabled = false;});
-	ASTGUI.events.add( _$('voip_ip') , "focus", function() { _$('save').disabled = false; _$('cancel').disabled = false;});
+	  ASTGUI.events.add( _$(opt_userandpass[x]) , "change", function() { _$('save').disabled = false; _$('cancel').disabled = false; });
+	}
+	ASTGUI.events.add( _$('ip') , "change", function() { _$('save').disabled = false; _$('cancel').disabled = false; });
+	ASTGUI.events.add( _$('voip_ip') , "change", function() { _$('save').disabled = false; _$('cancel').disabled = false; });
+
 	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';  }
@@ -664,9 +645,6 @@
 
 	var _trunkstylecustomvoip = _$('trunkstylecustomvoip');
 	_trunkstylecustomvoip.onclick = null;
-	
-	var _trunkstyledigital = _$('trunkstyledigital');
-	_trunkstyledigital.onclick = null;
 
 	ASTGUI.events.add( _$('custom_trunkname') , 'change' , function(){ 
 		_$('name').value = _$('custom_trunkname').value;
@@ -699,21 +677,13 @@
 	/* 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="";
-		}
+		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";
-		}
-	}
-	
+		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(){
@@ -741,7 +711,6 @@
 }
 
 function addrow_totable(sp_text, sp_value){
-	if(sp_value.beginsWith('span_')){return true;} 
 	var _spt = _$('serviceproviderstable') ;
 	var sno = _spt.rows.length + 1;
 	var newRow = _spt.insertRow(-1);
@@ -766,9 +735,6 @@
 		break;
 	case "voip":
 		newCell2.innerHTML =  "Voip";
-		break;
-	case "digital":
-		newCell2.innerHTML = "Digital";
 		break;
 	default : 
 		newCell2.innerHTML =  "?";
@@ -894,37 +860,6 @@
 	};
 	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 );
-*/
-
 }
 
 function codecs_save(){
@@ -1101,7 +1036,7 @@
 	_$('bg_transparent').style.display ='none';
 }
 
-function showSPdetails(edit_flag){
+function showSPdetails(){
 	_$('cancel').disabled = false;
 	_$('userscontent').style.display = "";
 	_$('bg_transparent').style.display ='';
@@ -1109,12 +1044,11 @@
 		_$('trunkstyleanalog').disabled = true;
 		_$('trunkstylevoip').disabled = true;
 		_$('trunkstylecustomvoip').disabled = true;
-		_$('trunkstyledigital').disabled = true;
 		_$('provider').disabled = true;
 	} else {
-		/* Make our default option VOIP (service providers) */
 		_$('voip').style.display = "";
 		//_$('voip').style.height =350;
+
 		_$('trunkstylevoip').click();
 		_$('provider').options[0].selected = true;
 		showhidefields();
@@ -1212,7 +1146,9 @@
 							//_$('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";
+							_$('bottom_msg').innerHTML = "<BR>Click the 'Save Configuration' button in the 'Home' panel to save these parameter settings"
+													+ "<BR><input type=button onclick='skip_Calibration();' value='Close'>";
+
 							window.clearInterval ( keepPinging );
 							updateUsers_fromFxotune();
 							_$('msg_div').onclick = function(){ skip_Calibration(); };
@@ -1232,15 +1168,27 @@
 	
 		_$('msg_div_span').innerHTML = "Starting Calibration script ..";
 		f1();
-		parent.astmanEngine.run_tool("/bin/fxotune_from_gui &", onSuccess = f2 );
+		var pstc = "";
+		for( var p =0; p < PORTS_toCALIBRATE.ports_array.length ; p++) { pstc += " "+ PORTS_toCALIBRATE.ports_array[p]; }
+		parent.astmanEngine.run_tool( "/bin/fxotune_from_gui" + pstc, onSuccess = f2 );
 	};
 
 	starthere();
 }
 
 
-function reset_calibration(){
-
+function reset_calibration(){		// Reset Calibration
+	var t , uri = "" , u =0 ;
+
+	for( var p =0; p < PORTS_toCALIBRATE.ports_array.length ; p++) { 
+		t = PORTS_toCALIBRATE.ports_array[p] ;
+		uri += build_action( 'delcat' , u , t , "" ,  "" ) ; u++ ;
+	}
+
+	makerequest ( 'u','fxotune.conf', uri , function(t) {
+		updateUsers_fromFxotune();
+		gui_alert ( " Finished Resetting Channels " );
+	}) ;
 
 }
 
@@ -1270,6 +1218,7 @@
 	var abcd = function(al_channels){
 		AUDIO_LEVELS = al_channels;
 		AUDIO_LEVELS.trunkname = spName;
+		_$('volLevel6').checked = false;
 		_$('volLevel5').checked = false;
 		_$('volLevel4').checked = false;
 		_$('volLevel3').checked = false;
@@ -1317,11 +1266,15 @@
 		case 4:
 			_$('volLevel4').checked = true;
 			break ;
-		case 4:
+		case 5:
 			_$('volLevel5').checked = true;
 			break ;
+		case 6:
+			_$('volLevel6').checked = true;
+			break ;
 
 		default:
+		_$('volLevel6').checked = false;
 		_$('volLevel5').checked = false;
 		_$('volLevel4').checked = false;
 		_$('volLevel3').checked = false;
@@ -1359,16 +1312,15 @@
 	// 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 get_guiVolValue = { '1':'-2', '2':'0', '3':'2', '4':'5', '5':'9', '6':'12' };
+	var ports = { 1:{'fxogain':'0' }, 2:{'fxogain':'0'}, 3:{'fxogain':'0'}, 4:{'fxogain':'0'}, 5:{'fxogain':'0'}, 6:{'fxogain':'0'}, 7:{'fxogain':'0'}, 8:{'fxogain':'0'} };
 	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 ,'txgain', '', '' ); h++ ;
 	deleteUrl  += build_action( 'delete', h, g ,'channel', '', '' ); h++ ;
-
 	
 	var fxotune_conf_loaded = function(c){
 		var update_fxogains = function(c){
@@ -1383,7 +1335,7 @@
 		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)
+			fx = Number( ports[j].fxogain ) ; // gain from fxotune for this channel (y)
 
 			u_new = k ;
 			v_new = -1 * fx ;
@@ -1392,6 +1344,7 @@
 			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 , "txgain", '0.0'); h++;
 			updaterequest += build_action('append', h, g , "channel", j ); h++;
 		}
 
@@ -1445,7 +1398,6 @@
 		<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>
-		<div style="display:none"><LABEL FOR="trunkstyledigital"><input name='trunkstyle' type='radio' id='trunkstyledigital' tip="en,trunks,5" value='digital'>(BETA!) Digital Cards(T1/E1/J1)</LABEL></div>
 	</fieldset>
 	<!-- Provider type -->
 	</td>
@@ -1463,21 +1415,13 @@
 		</table>
 	</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>
+				Provider:<BR>
+				<select size='6' id='provider' style='width:200px' class="input8"></select>
 			</td>
 			<td>
 				<A href="#" id="providerlink"><img id='providerlogo' style='visibility:hidden;' border=0></A>
@@ -1497,10 +1441,11 @@
 					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,7">
-					 NGT Host:</td>
-				<td><input style="display:none" size='20' id='ip' class="input8"></td>
+
+				<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>
@@ -1645,7 +1590,7 @@
 	<table width="100%" cellpadding=0 cellspacing=0 onmousedown="ASTGUI.startDrag(event , 'div_calibrate');">
 	<TR bgcolor="#7E5538"  style="background-image:url('images/title_gradient.gif');">
 		<TD Height="20" align="center" style="cursor: move"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">
-			Port Calibration
+			Easy Calibrate
 		</font></TD>
 		<TD Height="20" align="right" style="cursor: move"><A href="#" onclick="skip_Calibration();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A></TD>
 		<TD width=4></TD>
@@ -1657,14 +1602,14 @@
 					Please ensure that your analog lines are plugged in and proceed with calibration.
 				</td>
 		</tr>
-		<tr>	<td height=15></td>	</tr>
+		<tr>	<td height=20></td>	</tr>
 		<tr>	<td align="right" valign=top>Lines:&nbsp;</td>
-				<td valign="top" height=170>
+				<td valign="top">
 					<span id="span_Ports_toCalibratie"></span>
 				</td>
 		</tr>
 		<tr><td colspan=2 align=Center>
-			<input id="button_calPorts" type="button" class="buttonbold" value="Calibrate Ports" onclick="calibrate_ports( )">&nbsp;&nbsp;
+			<input id="button_calPorts" type="button" class="buttonbold" value="Easy Calibrate" onclick="calibrate_ports( )">&nbsp;&nbsp;
 			<input id="button_resCalib" type="button" class="buttonbold" value="Reset Calibration" onclick="reset_calibration( )">&nbsp;&nbsp;
 			<input id="button_skipCalib" type="button" class="buttonbold" value="Skip" onclick="skip_Calibration( )">
 			</td>
@@ -1710,11 +1655,15 @@
 
 					<table cellpadding=2 cellspacing=2 border=0 align="center">
 						<tr><td>
-							<LABEL FOR="volLevel5"><input name='al_volLevel' type='radio' id='volLevel5' value='5' onchange="audioLevels_Change(this.value)">Loudest</LABEL>
+							<LABEL FOR="volLevel6"><input name='al_volLevel' type='radio' id='volLevel6' value='6'  onchange="audioLevels_Change(this.value)">Loudest</LABEL>
 							</td>
 						</tr>
 						<tr><td>
-							<LABEL FOR="volLevel4"><input name='al_volLevel' type='radio' id='volLevel4' value='4' onchange="audioLevels_Change(this.value)">Louder</LABEL>
+							<LABEL FOR="volLevel5"><input name='al_volLevel' type='radio' id='volLevel5' value='5' onchange="audioLevels_Change(this.value)">Louder</LABEL>
+							</td>
+						</tr>
+						<tr><td>
+							<LABEL FOR="volLevel4"><input name='al_volLevel' type='radio' id='volLevel4' value='4' onchange="audioLevels_Change(this.value)">Loud</LABEL>
 							</td>
 						</tr>
 						<tr><td>
@@ -1722,7 +1671,7 @@
 							</td>
 						</tr>
 						<tr><td>
-							<LABEL FOR="volLevel2"><input name='al_volLevel' type='radio' id='volLevel2' value='2'  onchange="audioLevels_Change(this.value)">Softer</LABEL>
+							<LABEL FOR="volLevel2"><input name='al_volLevel' type='radio' id='volLevel2' value='2'  onchange="audioLevels_Change(this.value)">Soft</LABEL>
 							</td>
 						</tr>
 						<tr><td>




More information about the asterisk-gui-commits mailing list