⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 digital.html.svn-base

📁 asterisk-gui asterisk网关接口编程 控制asterisk的接口
💻 SVN-BASE
📖 第 1 页 / 共 3 页
字号:
<!-- * Asterisk-GUI	-	an Asterisk configuration interface * * Digital Card Setup / Detection  * * Copyright (C) 2006-2007, Digium, Inc. * * Brandon Kruse <bkruse@digium.com> * & Pari Nannapaneni <pari@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. * * 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. * ** this page is designed to work with the following sample ztscan output  ** - - - - - - begin ztscan output - - - - - - - -  **   [3] **   active=yes **   alarms=UNCONFIGURED **   description=T4XXP (PCI) Card 2 Span 1 **   name=TE4/2/1 **   manufacturer=Digium **   devicetype=Wildcard TE410P/TE405P (1st Gen) **   location=PCI Bus 02 Slot 04 **   basechan=1 **   totchans=24 **   irq=21 **   type=digital-T1 **   syncsrc=0 **   lbo=0 db (CSU)/0-133 feet (DSX-1) **   coding_opts=B8ZS,AMI **   framing_opts=ESF,D4 **   coding= **   framing= ** - - - - - - End of ztscan output - - - - - - - -  ** in the above output, [3] is the span number and the description says 'Card 2 Span 1' which is  ** still valid because 'span 3' is the 'span 1' on 'card 2' ** if your ztscan outputs in some other wiered format, this page will go crazy and might not work as expected. **  **  *** in this page, SPANS[l]['syncsrc'] is NOT the syncsrc from ztscan - but it is read from zaptel.conf --><script src="scripts/prototype.js"></script><script src="scripts/astman.js"></script><script src="scripts/tooltip.js"></script><link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" /><style>	.taglist {		border: 1px solid #666666;		margin-top:10px;		margin-bottom:10px;		max-width: 745;	}	.taglist tr.frow {		background-color: #6b79a5;		color: #CED7EF;	}	.taglist tr.even {		background-color: #DFDFDF;	}	.taglist tr.odd{		background-color: #FFFFFF;	}	.taglist tr.even:hover, .taglist tr.odd:hover {		background-color: #a8b6e5;	}	#errmsg{		border: 1px solid #666666;		margin-left:50px;		margin-right:50px;		padding : 20px 10px 20px 10px;		font-size: 125%;		text-align: center;		background-color:#FFFFFF;	}	.pageheading{		padding : 10px 10px 4px 10px;		font-size: 135%;		text-align: center;		font-weight: bold;	}		span.downbutton {		font-size:12px;		background:#FFFFFF; 		border:1px solid #8A8A8A; 		padding:2px 7px 2px 7px;		text-decoration:none;	}	span.downbutton:hover {		background:#F3640D;		color:#FFFFFF;		text-decoration:none;	}</style><script>var SPANS = {};var oldSpanCount = 0; // we get this from previuos applyzap.confvar oldLoadZone;var GROUPS = [];var NEWGROUPNUMBER;var CURRENT_SPAN; // span being editedvar CONFIGUREDHARDWARE = {}; // configuration read from an existing hwcfgfile (if exists)var DETECTEDHARDWARE = {};var hwcfgfile = parent.hwcfgfile ;var spans_todelete = []; // we delete all the span_x entries in users.conf (and their extensions.conf counter parts) before writing back any new information.var hwchanged = true ; // -1 for no previous configuration found (first time), true for detected hardware changes, false for no hardware changesvar HAS_ANALOGHARDWARE = true; var HAS_DIGITALHARDWARE = true; // if the user does not have any hardware - always set parent.REQUIRE_RESTART to falsevar SPANCOUNT_LOCATION = {}; // this object is used to store the number of spans found in each location Ex: SPANCOUNT_LOCATION['PCI Bus 02 Slot 04'] = 4;function detectHwChanges(){ // compare DETECTEDHARDWARE vs CONFIGUREDHARDWARE // returns true if a hardware change is detected and false if there are no hardware changes// we can actually check a lot of things here like	// [A] check if - any cards are missing 	//	if yes - delete all existing configuration and ask the user to reconfigure from scratch	// [B] check if - any cards are added  - if something is added 	//	- check if the basechan of configured hardware matches with basechan of detected hardware	//	- if (matches) { 	//		no need to delete existing configuration - just present the current card information as detected/configured and new card as unconfigured 	//	}else{ 	//		delete all existing configuration and ask the user to reconfigure from scratch 	//	}	// [C] if all the cards match - check if basechan of detected hardware matches with basechan of configured hardware	//	- if does not match - delete all existing configuration and ask the user to reconfigure from scratch// BUT to avoid all the complexity and to keep things simple (atleast for now) - we will just do [c]	// check if the devices match 	// check if the basechan match for all the devices	var configured_devices = [];	var detected_devices = [];	for( var l in CONFIGUREDHARDWARE ){ if(CONFIGUREDHARDWARE.hasOwnProperty(l)){ 		configured_devices.push( CONFIGUREDHARDWARE[l]['device'] + '::' + CONFIGUREDHARDWARE[l]['basechan'] + '::' + CONFIGUREDHARDWARE[l]['type'] ); 		// this way we can check for whether 'device' and 'basechan' and 'type' all matched in one go	}}	for( var l in DETECTEDHARDWARE ){ if(DETECTEDHARDWARE.hasOwnProperty(l)){ 		detected_devices.push( DETECTEDHARDWARE[l]['device'] + '::' + DETECTEDHARDWARE[l]['basechan'] + '::' + DETECTEDHARDWARE[l]['type']  ); 	}}	configured_devices.sort(); detected_devices.sort();	if( !configured_devices.length && !detected_devices.length){ return false; }	if(configured_devices.length == detected_devices.length){		for(var l=0; l < configured_devices.length; l++){			if(configured_devices[l] != detected_devices[l]){ // devices does not match - but the number of devices match				//console.log("DEVICES or basechans does not MATCHED"); //				return true;			}		}		//console.log("DEVICES and basechans MATCH"); 		return false;	}else{			//console.log("DEVICES or basechans does not MATCHED"); 		return true;	}}function verify_priChLimit(){	var l = String(CURRENT_SPAN);	if( !_$('editspan_signalling').value.beginsWith('pri')){ return true;}	var y = Number(_$('edit_DefinedChans').value);	if( Number(SPANS[l]['totchans'] ) <= 24 && y ==24){return false;}//alert("You should leave atleast 1 channel for PRI signalling");	if( Number(SPANS[l]['totchans'] ) > 24 && y ==31){return false;}//alert("You should leave atleast 1 channel for PRI signalling");	return true;};function calc_bchan_fxx(l){ // calculates the bchan,and fxx strings for a given span	var y = Number(SPANS[l]['min_ch']);	var z = Number(SPANS[l]['definedchans']);	if(z==1){return String(y);}	if( SPANS[l]['signalling'] && !SPANS[l]['signalling'].beginsWith('pri') ){ // if is an fxo/fxs or e&m		return y + "-" + String(y+z);	}else{		if(SPANS[l]['totchans'] <= 24){ // if T1			return y + "-" + String(y+z-1);		}else{ // if E1 - take first 15 as b-channels, then a d channel and then take the next 15 as bchannels			if(z==16){ return y+"-"+String(y+14)+","+String(y+16); }			if(z<= 15){				return y+"-"+String(y+z-1);			}else{				return y+"-"+String(y+14)+","+String(y+16) +"-"+ String(y+z);			}		}	}}function canelSpanInfo(){	_$('edit_span').style.display = "none";	_$('bg_transparent').style.display = "none";	CURRENT_SPAN = null;}var editSPAN = function(l){ // show values for SPAN l in the edit_span dialog box	CURRENT_SPAN = l;	_$('editspan_SPAN').innerHTML = SPANS[l]['description'];	_$('editspan_ALARMS').innerHTML = SPANS[l]['alarms'];	// console.log( SPANS[l]['min_ch'] );	// console.log( SPANS[l]['max_ch'] );	// console.log( SPANS[l]['definedchans']  );	ASTGUI.selectbox.clear( _$('editspan_fac') );	var w = _$('edit_DefinedChans') ;	var ijkl = function(){		ASTGUI.selectbox.clear(w);		var f = Number( SPANS[l]['totchans'] ), g=0;		if(f == 31){ f = 30;} // always make sure that only a max of 30 ports are available on E1 		for(g=1; g <=f; g++){ ASTGUI.selectbox.append(w,g,g); }		ASTGUI.selectbox.selectOption(w,SPANS[l]['definedchans']);		_$('edit_labelReserved').innerHTML = SPANS[l]['reserved_ch'];		_$('edit_labelZapchan').innerHTML = calc_bchan_fxx(l);	}();	if ( Number(SPANS[l]['totchans']) <= 24 ){		ASTGUI.selectbox.append(_$('editspan_fac'),'ESF/B8ZS', 'ESF/B8ZS');		ASTGUI.selectbox.append(_$('editspan_fac'),'D4/AMI', 'D4/AMI');	}else{		ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/HDB3', 'CCS/HDB3');		ASTGUI.selectbox.append(_$('editspan_fac'),'CCS/HDB3/CRC4', 'CCS/HDB3/CRC4');	}	if(SPANS[l]['framing'] && SPANS[l]['coding']) {		if( SPANS[l]['framing'] == 'CCS/CRC4' ){			ASTGUI.selectbox.selectOption( _$('editspan_fac') , 'CCS/HDB3/CRC4' );		}else{			ASTGUI.selectbox.selectOption( _$('editspan_fac') , SPANS[l]['framing'] + '/' + SPANS[l]['coding'] );		}	}	_$('editspan_channels').innerHTML = String(SPANS[l]['definedchans']) + "/" + String(SPANS[l]['totchans']) + " ("+SPANS[l]['spantype']+")";	if( SPANS[l]['signalling'] ){		ASTGUI.selectbox.selectOption( _$('editspan_signalling') , SPANS[l]['signalling'] );	}else{		_$('editspan_signalling').selectedIndex = -1 ; 	}	disablEnable_sc();	if(SPANS[l]['switchtype']){		ASTGUI.selectbox.selectOption( _$('editspan_switchtype') , SPANS[l]['switchtype'] );	}else{		_$('editspan_switchtype').selectedIndex = -1 ;	}	(function (){		ASTGUI.selectbox.clear( _$('editspan_syncsrc'));		var y = SPANCOUNT_LOCATION[ SPANS[l]['location'] ];		var u =0; 		while(u<=y){ ASTGUI.selectbox.append( _$('editspan_syncsrc'),u,u ); u++ }		if( !SPANS[l].hasOwnProperty('syncsrc') ){ SPANS[l]['syncsrc'] = '1' } // default		ASTGUI.selectbox.selectOption( _$('editspan_syncsrc') , SPANS[l]['syncsrc'] );	})();	ASTGUI.selectbox.selectOption( _$('editspan_lbo') , SPANS[l]['lbo'] );	_$('edit_span').style.display = "";	_$('bg_transparent').style.display = "";};function showtable(){ // navigates through the SPANS object and presents as a table to the user	try{	var tbl = _$('digitalcardstable') ;	var add_fRow = function(){		var newRow = tbl.insertRow(-1);		newRow.className = "frow";		var newCell0 = newRow.insertCell(0);		newCell0.innerHTML = "SPAN";		var newCell1 = newRow.insertCell(1);		newCell1.innerHTML = "ALARMS";		var newCell2 = newRow.insertCell(2);		newCell2.innerHTML =  "Framing/Coding";		var newCell3 = newRow.insertCell(3);		newCell3.innerHTML = "channels<BR>Used/Total" ;		newCell3.align = "center";		var newCell4 = newRow.insertCell(4);		newCell4.innerHTML = "Signalling" ;		newCell4.align = "center";		var newCell5 = newRow.insertCell(5);		newCell5.innerHTML = "" ;	};	var addrow_totable = function(span){		if( LAST_LOCATION != SPANS[span]['location'] ){			var newRow = tbl.insertRow(-1);			var ntd = document.createElement('TD');			ntd.setAttribute('colspan',6);			ntd.style.backgroundColor='#B0B9D0';			ntd.align = 'center';			ntd.innerHTML = '<B>' + SPANS[span]['location'] + ' --> ' + SPANS[span]['devicetype'] + '</B>';			newRow.appendChild(ntd);		}		var singalling_defs = {pri_net: 'PRI - Net', pri_cpe: 'PRI - CPE', em: 'E & M',em_w: 'E & M -- Wink', featd:'E & M -- featd(DTMF)', fxo_ks:'FXOKS', fxo_ls:'FXOLS'  };		var sno = tbl.rows.length + 1;		var newRow = tbl.insertRow(-1);		newRow.className = ((tbl.rows.length)%2==1)?"odd":"even";		newRow.id ="row" + span ;		newRow["span_value"] = span;		var newCell0 = newRow.insertCell(0);		(function(){			var u = SPANS[span]['name'].split('/'); // Ex: name=TE4/2/1 where 2 is card number and 1 is the span number on that card			var w = SPANS[span]['devicetype'] ; // Ex: 'Wildcard TE410P/TE405P (1st Gen)'			var v = w + ', Card ' + String(Number(u[1]) + 1) + ' - Port ' + u[2] + "&nbsp;(span_" + span + ")&nbsp;&nbsp;" ;			newCell0.innerHTML = v ; // Ex: 'Wildcard TE410P/TE405P (1st Gen), Card 3 - Port 1, (span_3)'			newCell0.align = "center";		})();		var newCell1 = newRow.insertCell(1);		newCell1.innerHTML = SPANS[span]['alarms'];		newCell1.align = "center";		var newCell2 = newRow.insertCell(2);		newCell2.innerHTML =  (SPANS[span]['framing'] && SPANS[span]['coding']) ? SPANS[span]['framing'] + '/' + SPANS[span]['coding'] : '';		var newCell3 = newRow.insertCell(3);		//newCell3.innerHTML = String(SPANS[span]['usedchans'])+"/"+String(SPANS[span]['totchans'])+" ("+SPANS[k]['spantype']+")";		newCell3.innerHTML = String(SPANS[span]['definedchans']) + '/' + String(SPANS[span]['totchans']); //for the time being		newCell3.align = "center";		var newCell4 = newRow.insertCell(4);		newCell4.innerHTML = (SPANS[span]['signalling'])? singalling_defs[ SPANS[span]['signalling'] ] : "<font color=red>NOT DEFINED</font>" ;		newCell4.align = "center";		var newCell5 = newRow.insertCell(5);		newCell5.innerHTML = "<span class=\"downbutton\" id='" + "span_" + span + "'  onclick=\"editSPAN( '"+ span + "');\">Edit</span>" ;		//newCell5.innerHTML = "<span class=\"downmenubutton\" id='" + "span_" + span + "'  onclick=\"show_downmenu( '"+ span + "');\">Options&nbsp;&nbsp;<img src=images/1.gif></span>" ;		newCell5.style.width = 90;		newCell5.align = "center";		LAST_LOCATION = SPANS[span]['location'] ;	};	ASTGUI.domActions.clear_table(tbl);	add_fRow();	var foo_spans =0;	var LAST_LOCATION = '';	for( var k in SPANS ){ if( SPANS.hasOwnProperty(k) ){ foo_spans++; addrow_totable(k); }}	if(!foo_spans){		ASTGUI.domActions.clear_table(tbl);		var newRow = tbl.insertRow(-1);		newRow.className = "even";		var newCell0 = newRow.insertCell(0);		newCell0.innerHTML = "No Digital Hardware detected !!";		HAS_DIGITALHARDWARE = false;	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -