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

📄 iaxyprov.html.svn-base

📁 asterisk-gui asterisk网关接口编程 控制asterisk的接口
💻 SVN-BASE
字号:
<!-- * Asterisk-GUI	-	an Asterisk configuration interface * * IAXys - provisioning and setup from the gui * * Copyright (C) 2006-2008, Digium, Inc. * * 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. * --><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>	#iaxytable {		border: 1px solid #666666;		margin-top:40px;		margin-bottom:10px;	}	#iaxytable tr.frow {		background-color: #6b79a5;		color: #CED7EF;	}	#iaxytable tr.even {		background-color: #DFDFDF;	}	#iaxytable tr.odd{		background-color: #FFFFFF;	}	#iaxytable tr.even:hover, #iaxytable tr.odd:hover {		background-color: #a8b6e5;	}</style><script>var IAXYS = {};var USERS = {};var CURRENT_IAXY ; // store the iaxy sno being editedvar addnew_iaxy_dialog = function(){	_$('iaxsrl').style.display = '';	CURRENT_IAXY = 'new';	_$('editiaxy_sno').innerHTML = ' Add IAXy ';	_$('editiaxy_server').value = '' ;	_$('editiaxy_serial').value = '' ;	_$('editiaxy_username').selectedIndex = -1 ;	_$('editiaxy_password').innerHTML = '' ;	_$('editiaxy_port').value = '4569' ;	_$('editiaxy_codec').selectedIndex = 0 ;	_$('edit_iaxy').style.display = '';	_$('bg_transparent').style.display = '';}var parseIaxProv = function(iprv){	(function(){		/*		// iaxprov.conf is parsed into IAXYS object as below.			IAXYS = {				si-000364000126:{					server: '192.168.69.3',					altserver: '192.168.69.4',					user: 'username',					pass: 'password',					port: '4569',					codec: 'ulaw', // adpcm					flags: 'register,heartbeat'				}			}		*/		for(var d in iprv){if(iprv.hasOwnProperty(d)){			if( !d.beginsWith('si-') ){ continue; }			if( !IAXYS.hasOwnProperty(d) ){ IAXYS[d] = {} ; }			var f = iprv[d];			for(var e in  f){ if(f.hasOwnProperty(e)){				IAXYS[d][e] = f[e] ;			}}		}}	})();	config2json('users.conf', 1 , parseUsers );}var parseUsers = function(users){	// store all local usernames and passwords in USERS object	// ex: USERS = { '6000':'password_600', 'user2':'password_user2' };	(function(){		for(var d in users ){ if( users.hasOwnProperty(d) ) {			if(d == 'general' || d.beginsWith('trunk_') || d.beginsWith('span_') ) { continue; }			if( !users[d].hasOwnProperty('hasiax') ||  users[d]['hasiax'] != 'yes' ) { continue; }			USERS[d] = ( users[d].hasOwnProperty('secret') ) ? users[d]['secret'] : '';			ASTGUI.selectbox.append(_$('editiaxy_username'),d, d);		}}	})();	showtable() ;	parent.loadscreen(this);}var updateIaxyInfo = function(){	var after = function(){		setTimeout( function(){window.location.reload();}, 500 );	};	if( CURRENT_IAXY == 'new' ){		var new_iaxy = 'si-' + _$('editiaxy_serial').value;		var uname = _$('editiaxy_username').value ;		var chs = new listOfActions();		chs.filename('iaxprov.conf');		chs.build_action('newcat', 0 ,  new_iaxy , '' , '' );		chs.build_action('update', 0 , new_iaxy , 'server' ,  _$('editiaxy_server').value );		chs.build_action('update', 0 , new_iaxy , 'user' ,  uname);		chs.build_action('update', 0 , new_iaxy , 'pass' ,  USERS[uname] );		chs.build_action('update', 0 , new_iaxy , 'port' ,  _$('editiaxy_port').value );		chs.build_action('update', 0 , new_iaxy , 'codec' ,  _$('editiaxy_codec').value );		chs.build_action('update', 0 , new_iaxy , 'flags' ,  'register,heartbeat' );		chs.callActions(after);		return;	}	var uname = _$('editiaxy_username').value ;	var chs = new listOfActions(); 	chs.filename('iaxprov.conf');	chs.build_action('update', 0 , CURRENT_IAXY , 'server' ,  _$('editiaxy_server').value );	chs.build_action('update', 0 , CURRENT_IAXY , 'user' ,  uname);	chs.build_action('update', 0 , CURRENT_IAXY , 'pass' ,  USERS[uname] );	chs.build_action('update', 0 , CURRENT_IAXY , 'port' ,  _$('editiaxy_port').value );	chs.build_action('update', 0 , CURRENT_IAXY , 'codec' ,  _$('editiaxy_codec').value );	chs.callActions(after);}var canelIaxyInfo = function(){	_$('edit_iaxy').style.display = 'none';	_$('bg_transparent').style.display = 'none';}var editIAXY = function(a){	_$('iaxsrl').style.display = 'none';	var ix = 'si-' + a ;	CURRENT_IAXY = ix;	_$('editiaxy_sno').innerHTML = ' IAXy : ' + a ;	_$('editiaxy_server').value = IAXYS[ix]['server'] ;	ASTGUI.selectbox.selectOption( _$('editiaxy_username') , IAXYS[ix]['user'] ); 	if ( !USERS.hasOwnProperty( IAXYS[ix]['user'] ) ) {		_$('editiaxy_password').innerHTML = '' ;	}else{		_$('editiaxy_password').innerHTML = ( IAXYS[ix]['pass'] == USERS[IAXYS[ix]['user']] ) ? IAXYS[ix]['pass'] : '<font color=red><strike><B>' + IAXYS[ix]['pass'] + '</B></strike></font> <BR> Click \'Update\' button below to update password' ;	}	_$('editiaxy_port').value = IAXYS[ix]['port'] ;	ASTGUI.selectbox.selectOption( _$('editiaxy_codec') , IAXYS[ix]['codec'] );	_$('bg_transparent').style.display = '';	_$('edit_iaxy').style.display = '';}var deleteIAXY = function(a){	if(!confirm("Delete IAXy '" + a + "' ?")){ return true; }	var uri = build_action('delcat', 0, 'si-' + a , '' , '');	makerequest('u', 'iaxprov.conf' , uri , function(t) {		gui_feedback("Iaxy \"" + a + "\" deleted !",'blue');		setTimeout( function(){window.location.reload();}, 500 );	});}function showtable(){ // navigates through the IAXYS object and presents as a table	var tbl = _$('iaxytable') ;	var add_fRow = function(){		var newRow = tbl.insertRow(-1);		newRow.className = "frow";		var newCell0 = newRow.insertCell(0);		newCell0.innerHTML = "IAXy Serial";		var newCell1 = newRow.insertCell(1);		newCell1.innerHTML = "User";		var newCell2 = newRow.insertCell(2);		newCell2.innerHTML =  "password";		var newCell3 = newRow.insertCell(3);		newCell3.innerHTML = "Codec" ;		newCell3.align = "center";		var newCell4 = newRow.insertCell(4);		newCell4.innerHTML = "Server" ;		newCell4.align = "center";		var newCell5 = newRow.insertCell(5);		newCell5.innerHTML = "" ;	};	var addrow_totable = function(iaxy_sno, iaxy_data){		var newRow = tbl.insertRow(-1);		newRow.className = ((tbl.rows.length)%2==1)?"odd":"even";		var newCell0 = newRow.insertCell(0);		newCell0.innerHTML = '<B>' + iaxy_sno + '</B>' ;		newCell0.align = "center";			var newCell1 = newRow.insertCell(1);		newCell1.innerHTML = (USERS.hasOwnProperty( iaxy_data['user'] ))? iaxy_data['user']: '<font color=red>' + iaxy_data['user'] + '?</font>' ;		newCell1.align = "center";		var newCell2 = newRow.insertCell(2);		newCell2.innerHTML = ( iaxy_data['pass'] == USERS[iaxy_data['user']] ) ? iaxy_data['pass'] : '<font color=red><strike><B>' + iaxy_data['pass'] + '</B></strike></font>';		var newCell3 = newRow.insertCell(3);		newCell3.innerHTML = iaxy_data['codec'] ;		newCell3.align = "center";		var newCell4 = newRow.insertCell(4);		newCell4.innerHTML = iaxy_data['server'] ;		newCell4.align = "center";		var newCell5 = newRow.insertCell(5);		newCell5.innerHTML = "<span class=\"downbutton\" onclick=\"editIAXY( '"+ iaxy_sno + "');\">Edit</span>" 					+ "&nbsp;&nbsp;|&nbsp;&nbsp;<span class=\"downbutton\" onclick=\"deleteIAXY( '"+ iaxy_sno + "');\">Delete</span>";		newCell5.style.width = 90;		newCell5.align = "center";	};	ASTGUI.domActions.clear_table(tbl);	add_fRow();	for(var d in IAXYS){if(IAXYS.hasOwnProperty(d)){		addrow_totable(d.substr(3),IAXYS[d]);	}}	if( tbl.rows.length == 1 ){		tbl.innerHTML = "<tr><td align=center height=50 valign=middle>No IAXys configured !! </td></tr>";	}}window.onload = function(){   //  parse iaxprov.conf and show all contexts in the format 'si-xxx' format   //  load list of users/passwords from users.conf   //	ASTGUI.events.add( _$('editiaxy_username'), "change", function(){		try{ _$('editiaxy_password').innerHTML = USERS[_$('editiaxy_username').value] ; }catch(err){ }	});	top._$('mainscreen').width= 798 ;	config2json('iaxprov.conf', 1, parseIaxProv );}window.onunload = function(){	top._$('mainscreen').width= 540 ;}</script><body  bgcolor="#EFEFEF"><div style="font-size : 12px; padding : 4px 6px 4px 6px; border-style : solid none solid none; border-top-color : #BDC7E7; border-bottom-color : #182052; border-width : 1px 0px 1px 0px; background-color : #ef8700; color : #ffffff;">	<span style="margin-left: 4px;font-weight:bold;">IAXy Configuration (beta)</span>	<span style="cursor: pointer; cursor: hand;" onclick="window.location.reload();" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span></div><table id="iaxytable" cellpadding=5 cellspacing=1 border=0 align=center width=480></table><table align=center border=0><tr><td>	<BR>	<input type=button onclick='addnew_iaxy_dialog();' value='Add IAXy'></td></tr></table><div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 0; width:100%; height:100%;  background-color:#FFFFFF; filter:alpha(opacity=50); -moz-opacity:.50;opacity:.50; border-width: 0px; z-index:4"></div><div id="edit_iaxy" STYLE=" display:none; position: absolute; left: 30; top: 40; width:500; height:250;  background-color:#F4EFE5;   border-width: 1px; border-color: #7E5538; border-style: solid; z-index:5">	<table width="100%" cellpadding=0 cellspacing=0  onmousedown="ASTGUI.startDrag(event , 'edit_iaxy');">	<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;">			&nbsp;&nbsp;<span id="editiaxy_sno"></span>			</font>		</TD>		<TD Height="20" align="right" style="cursor: move" width=20>			<A href="#" onclick="$('cancel_a').click();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>		</TD>		<TD width=4></TD>	</TR>	</table>	<TABLE	align=center cellpadding=2 cellspacing=2 border=0>	<TR>	<TD height=10 colspan=2></TD>	</TR>	<TR id='iaxsrl'>		<TD align="right">Serial :</TD>		<TD><input id="editiaxy_serial" size=14></TD>	</TR>	<TR>	<TD align="right">Server :</TD>		<TD><input id="editiaxy_server" size=14></TD>	</TR>	<TR>	<TD align="right">Username:</TD>		<TD> <select id="editiaxy_username"></select> </TD>	</TR>	<TR>	<TD align="right" valign=top>Password:</TD>		<TD> <span id="editiaxy_password"></span></TD>	</TR>	<TR>	<TD align="right">Port:</TD>		<TD> <input id="editiaxy_port" size=14> </TD>	</TR>	<TR>	<TD align="right">Codec:</TD>		<TD>	<select id="editiaxy_codec">			<option value='ulaw'>ulaw</option>			<option value='adpcm'>adpcm</option>			</select>		</TD>	</TR>	<TR>	<TD colspan=2 align=center height=50 valign=middle>  			<input type="button" id="save_a" value="Update" onclick="updateIaxyInfo();">&nbsp;&nbsp;			<input type="button" id="cancel_a" value="Cancel" onclick="canelIaxyInfo();">		</TD>	</TR>	</TABLE></div></body>

⌨️ 快捷键说明

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