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

📄 1.html

📁 asterisk 的图形管理界面
💻 HTML
字号:
<!--
 * Asterisk-GUI	-	an Asterisk configuration interface
 *
 * Setup WIzard/ Login page & Hardware detection
 *
 * Copyright (C) 2006-2007, Digium, Inc.
 *
 * Mark Spencer <markster@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.
 *
-->
<HTML>
<HEAD>
	<TITLE> Asterisk GUI Setup Wizard</TITLE>
	<link href="setup.css" media="all" rel="Stylesheet" type="text/css" />
</HEAD>
<script src="../scripts/prototype.js"></script>
<script src="../scripts/astman.js"></script>
<SCRIPT>

var rawman_url;
var zapcallbacks = new Object;
var asterisk_guitools = "asterisk_guitools";
var cats = new Array();

function localinit(){
	var un = _$('username') ; var pwd = _$('secret') ; 
	un.onfocus = function(){this.className = 'input9_hilight';}
	un.onblur = function(){this.className = 'input9';}
	pwd.onfocus = function(){this.className = 'input9_hilight';}
	pwd.onblur = function(){this.className = 'input9';}

	parent.fxoports = [];
	parent.fxsports = [];
	parent.$('next').disabled = true;
	parent.$('back').disabled = true;
	rawman_url = parent.rawman_url ;
	parent.astmanEngine.setURL(rawman_url);
	ping();
}

function ping(){
	var opt = {
		method: 'get',
		asynchronous: true,
		onComplete: isloggedin
	};
	opt.parameters="action=ping" ;
	var tmp = new Ajax.Request(rawman_url , opt);
}

function isloggedin(originalRequest){
	if ( originalRequest.responseText.match("Error") ) {
		// User is not logged in , show him the login screen
		_$('loginform').style.display = "";
		_$('username').focus();
		return true;
	}
	if ( originalRequest.responseText.match("Pong") ) {
		// install [asterisk_guitools] if not installed
		getextconf();
	}
}

function getextconf(){
	parent.loggedon = 1;
	parent.astmanEngine.pollEvents();

	var opt = {
		method: 'get',
		asynchronous: true,
		onComplete: checkExtconfig
	};
	opt.parameters="action=getconfig&filename=extensions.conf" ;
	var tmp = new Ajax.Request(rawman_url, opt);
}

function checkExtconfig(originalRequest){
	// now parse the output and search for [gui-tools]
	var lines = originalRequest.responseText.split("\n");
	for( var i=0 ; i < lines.length ; i++){
		if ( lines[i].substr(0,9) == "Category-"  ){
			var tmp = lines[i].split(": ");
			if( tmp[1].match(asterisk_guitools) ){
				scan_zapteldevices();
				return false;
			}
			cats.push(tmp[1]);
		}
	}
	// Install the [asterisk_guitools] section in extensions.conf
	installguitools();
}


function installguitools(){
	var opt = {
		method: 'get',
		asynchronous: true,
		onComplete: scan_zapteldevices
	};
	opt.parameters="action=updateconfig&reload=yes&srcfilename=extensions.conf&dstfilename=extensions.conf&"  +

	"Action-000000=newcat&Cat-000000=" + asterisk_guitools + "&Var-000000=&Value-000000=" + "&" + 
	
	"Action-000001=append&Cat-000001=" + asterisk_guitools + "&Var-000001=exten&Value-000001=" +
	encodeURI(		'executecommand,1,System(${command})' 	) + "&" + 

	"Action-000002=append&Cat-000002=" + asterisk_guitools + "&Var-000002=exten&Value-000002=" +
	encodeURI(		'executecommand,n,Hangup()' 	) + "&" + 

	"Action-000003=append&Cat-000003=" + asterisk_guitools + "&Var-000003=exten&Value-000003=" +
	encodeURI(		'record_vmenu,1,Answer' 	) + "&" + 

	"Action-000004=append&Cat-000004=" + asterisk_guitools + "&Var-000004=exten&Value-000004=" +
	encodeURI(		'record_vmenu,n,Playback(vm-intro)' 	) + "&" + 

	"Action-000005=append&Cat-000005=" + asterisk_guitools + "&Var-000005=exten&Value-000005=" +
	encodeURI(		'record_vmenu,n,Record(${var1})' 	) + "&" + 

	"Action-000006=append&Cat-000006=" + asterisk_guitools + "&Var-000006=exten&Value-000006=" +
	encodeURI(		'record_vmenu,n,Playback(vm-saved)' 	) + "&" + 

	"Action-000007=append&Cat-000007=" + asterisk_guitools + "&Var-000007=exten&Value-000007=" +
	encodeURI(		'record_vmenu,n,Playback(vm-goodbye)' 	) + "&" + 

	"Action-000008=append&Cat-000008=" + asterisk_guitools + "&Var-000008=exten&Value-000008=" +
	encodeURI(		'record_vmenu,n,Hangup' 	) + "&" + 

	"Action-000009=append&Cat-000009=" + asterisk_guitools + "&Var-000009=exten&Value-000009=" +
	encodeURI(		'play_file,1,Answer' 	) + "&" + 

	"Action-000010=append&Cat-000010=" + asterisk_guitools + "&Var-000010=exten&Value-000010=" +
	encodeURI(		'play_file,n,Playback(${var1})' 	) + "&" + 

	"Action-000011=append&Cat-000011=" + asterisk_guitools + "&Var-000011=exten&Value-000011=" +
	encodeURI(		'play_file,n,Hangup' 	) + "&" + 

	"Action-000012=append&Cat-000012=" + asterisk_guitools + "&Var-000012=hasbeensetup&Value-000012=" + 'N';

	var tmp = new Ajax.Request(rawman_url, opt);
}

function scan_zapteldevices(){
	parent.astmanEngine.run_tool(asterisk_guiZapscan, onSuccess = function() { 
		parent.astmanEngine.config2list("zapscan.conf", _$('zapchan'), new Array(), zapcallbacks);
		}
	);
	return;
}

zapcallbacks.format = function(t) {
	if (t.fieldbyname['port'] == 'fxo'){
		parent.fxoports.push(t.name);
		return "Analog(FXS) Port #" + t.name;
	}
	if (t.fieldbyname['port'] == 'fxs'){
		parent.fxsports.push(t.name);
		return "Analog(FXO) Port #" + t.name;
	}
	return null;
}

zapcallbacks.loaded = function(){
	for(var x=0; x< _$('zapchan').length ; x++){
		_$('zapscan_info').innerHTML+= _$('zapchan').options[x].text + "<BR>";
	}
	if( _$('zapchan').length ==0 ){
		_$('detected_info').style.display = "none";
		_$('zapscan_info').innerHTML = " <B>No Analog ports have been detected on your system</B> <BR><BR>"
		+" If you do not have any analog hardware please click Next to proceed";
	}

	_$('loginform').style.display = "none";
	_$('zapinfo').style.display = "";
	parent.$('next').disabled = false;
	parent.$('next').onclick = function(){	 window.location.href="3.html"; };
	_$('menu').style.display = "";
}

function showResponse(originalRequest){
	_$('status_message').style.display="none";
	if ( originalRequest.responseText.match("Success") || originalRequest.responseText.match("Invalid/unknown command")  ) {
		getextconf();
	}else{
		alert("Invalid Password");
		_$('secret').focus();
	}

}

function login(){
	_$('message_text').innerHTML =" Logging in ...";
	_$('status_message').style.display="";
	var opt = {
		method: 'get',
		asynchronous: true,
		onComplete: showResponse
	};
	opt.parameters="action=login&username="+ _$('username').value + "&secret=" + _$('secret').value ;
	var tmp = new Ajax.Request(rawman_url , opt);
}

function submitOnEnter(e){ 
	if(e.keyCode == 13){ 
		login();
		return false;
	}
}

</SCRIPT>
<BODY bgcolor="#FFFFFF" onload="localinit()" topmargin=0 leftmargin=0>
<table width="100%" height="100%" border=0 cellpadding=0 cellspacing=0>
	<tr>
	<td width="170" valign=top align=left>
		<div id="menu" style="display:none">
		<table cellpadding=3 cellspacing=2 border=0 id="sidelist">
			<tr><td width=3></td><td>Start</td></tr>
			<tr><td></td><td class="slselected">Verify Analog Ports</td></tr>
			<!-- <tr><td></td><td>Date & Time</td></tr> -->
			<tr><td></td><td>Local Extension Settings</td></tr>
			<tr><td></td><td>Service Providers</td></tr>
			<tr><td></td><td>Calling Rules</td></tr>
			<tr><td></td><td>VoiceMail Settings</td></tr>
			<tr><td></td><td>User Extensions</td></tr>
			<tr><td></td><td>Incoming Calls</td></tr>
			<!-- <tr><td></td><td>VoiceMenus</td></tr> -->
			<tr><td></td><td>Finish</td></tr>
		</table>
		</div>
	</td>
	<td valign=top align=center>
	<!--  this page -->
		<select id='zapchan' style="display:none"></select>
		<div id="loginform" style="display:none">
		<div class="heading">Pleae enter your admin Username and Password </div>
		<table align="center">
			<tr>	<td>Username:</td>
				<td><input id="username"  size=12 class="input9"></td>
			</tr>
			<tr>	<td>Password:</td>
				<td><input type="password" id="secret" size=12 onKeyPress="submitOnEnter(event)" class="input9"></td>
			</tr>
			<tr>	<td align='center' colspan='2' height=40 valign=bottom>
					<input type="button" id="login" value="Login" onClick="login()" >
				</td>
			</tr>
		</table>
		</div>
		<div id="zapinfo" style="display:none">
			<div class="heading">Step 1 of <script>document.write(parent.numberofsteps);</script>&nbsp;&nbsp;- Verify Analog Ports</div>
			<div id="detected_info" class="subheading">The following analog ports have been detected on your system</div>
			<div id="zapscan_info" class="subheading"></div>
		</div>
	<!--  this page -->
	</td>
	</tr>
</table>
<div ID="status_message"  STYLE="display:none; position: absolute; left: 170; top: 100; width:350; height:115;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid;">
	<BR><BR>
	<TABLE border=0 cellpadding=0 cellspacing=3 align="center">
		<TR>
		<TD><img src="../images/loading.gif"></TD>
		<TD valign="middle" align="center">&nbsp;&nbsp;<div id="message_text"></div></TD>
		</TR>
	</TABLE>
</div>
</BODY>
</HTML>

⌨️ 快捷键说明

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