📄 record.html
字号:
<!--
* Asterisk-GUI - an Asterisk configuration interface
*
* Records a voicemenu from a user selected device
*
* 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.
*
-->
<script src="scripts/prototype.js"></script>
<script src="scripts/rico.js"></script>
<script src="scripts/astman.js"></script>
<script src="scripts/tooltip.js"></script>
<link href="stylesheets/rico.css" media="all" rel="Stylesheet" type="text/css" />
<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
<script>
var callbacks = {};
function localajaxinit(){
showdiv_statusmessage();
setWindowTitle("Record a Menu");
_$('message_text').innerHTML = "Please wait while the system <BR> Calls the specified Extension ... ";
parent.astmanEngine.config2list("users.conf", _$('newvmenu_ext'), new Array, callbacks);
}
function showlist_of_files(){
var k = _$('list_files').innerHTML ;
var recfiles = k.split("\n") ;
clear_table();
for( var i =0 ; i < recfiles.length ; i++){
if( typeof recfiles[i] == "undefined" || recfiles[i] == "" ){
continue;
}
recfiles[i] = recfiles[i].replace(/^\s*|\s*$/g,'') ;
if( recfiles[i] == "" ){ continue; }
addrow_totable( recfiles[i].stripTags(), i );
}
var _rft = _$('recfilesTable') ;
if( _rft.rows.length == 0 ){
_$('table_one').style.display="none";
var newRow = _rft.insertRow(-1);
var newCell0 = newRow.insertCell(0);
newCell0.align = "center";
newCell0.innerHTML = "<BR><I> No Recorded menus found !!</I> <BR><BR>" +
"Please click on 'Record a new Voice Menu' button to record one.<BR><BR>" ;
}
parent.loadscreen(this);
}
function clear_table(){
var _rft = _$('recfilesTable') ;
for( var i=0; i < _rft.rows.length; ){
_rft.deleteRow(i);
}
}
function addrow_totable(filename, i){
var newRow = _$('recfilesTable').insertRow(-1);
newRow.style.backgroundColor='#FFFFFF';
newRow.onmouseover= function(){ this.style.backgroundColor='#F9F0D1'; };
newRow.onmouseout=function(){ this.style.backgroundColor='#FFFFFF'; };
var newCell0 = newRow.insertCell(0);
newCell0.innerHTML =_$('recfilesTable').rows.length ;
newCell0.width = 35;
newCell0.align = "center";
var newCell1 = newRow.insertCell(1);
newCell1.innerHTML = filename ;
newCell1.width = 180;
var newCell2 = newRow.insertCell(2);
newCell2.innerHTML = "<input type='button' value='Record Again' onclick='record_existing(\"" + filename + "\")' class='splbutton'> <input type=button value='Play' onclick='play_existing(\"" + filename.substr(0,(filename.length - 4) )+ "\")' class='splbutton'> <input type='button' onclick='delete_sounds(\""+ filename + "\")' value='Delete' class='splbutton'>" ;
newCell2.align = "center";
}
function show_record(){
_$('bg_transparent').style.display = "";
_$('recordnew_content').style.display = "";
_$('newvmenu_name').focus();
}
function hide_record(){
_$('bg_transparent').style.display = "none";
_$('recordnew_content').style.display = "none";
}
callbacks.format = function(t) {
if ((t.name == 'general'))
return null;
if ( t.fieldbyname['context'] == asterisk_guiTDPrefix + t.name ) {
return null;
}
if (t.fieldbyname['fullname'] && t.fieldbyname['fullname'].length) {
return t.name + " -- " + t.fieldbyname['fullname'];
} else
return t.name;
}
callbacks.loaded = function(){
parent.astmanEngine.run_tool(asterisk_guiListFiles + " " + asterisk_menusRecord_path, callback = function() {
var opt = { method: 'get', asynchronous: true,
onComplete: function(originalRequest){
_$('sysinfohtml').innerHTML = originalRequest.responseText;
showlist_of_files();
parent.loadscreen(this);
},
onFailure: function(t) { alert("Config Error: " + t.status + ": " + t.statusText); }
};
opt.parameters="";
var tmp = new Ajax.Request(asterisk_guiSysInfo_output, opt);
});
}
function play_existing(filename){
var extension = prompt("Please enter an Extension on which you want to listen to the file","");
var opt = {
method: 'get',
asynchronous: true,
onSuccess: function(t) { gui_feedback('Play Request Successfull !','blue'); },
onFailure: function(t) { gui_alert("Config Error: " + t.status + ": " + t.statusText); }
};
opt.parameters ="action=originate&channel=Local/"+extension + "&context="+asterisk_guitools+"&exten=play_file&priority=1&Variable=var1%3d"+ encodeURIComponent( filename );
var tmp = new Ajax.Request(asterisk_rawmanPath, opt);
}
function record_existing(filename){
if(!confirm("Are you sure you want to Record over an existing Voicemenu?")){ return true; }
var extension = prompt("Please enter an Extension to call ","");
if(!extension){ return false; }
originate_recordrequest(extension, filename);
}
function record_new(){
var _nm_n = _$('newvmenu_name');
var _nm_e = _$('newvmenu_ext');
if( _nm_n.value == "" ){
gui_alert("Please Enter a name for the new Voice Menu");
_nm_n.focus();
return true;
}
if ( _nm_e.value == ""){
gui_alert("Please Select an extension to record the VoiceMenu");
_nm_e.focus();
return true;
}
var filename_torecord = _nm_n.value + "." + _$('format').value;
originate_recordrequest(_nm_e.value, filename_torecord);
hide_record();
}
function originate_recordrequest(newvmenu_ext, filename_torecord){
_$('status_message').style.display="";
var opt = {
method: 'get',
asynchronous: true,
onSuccess: function(t) {
setTimeout( function(){ _$('status_message').style.display='none'; },sc_displaytime);
},
onFailure: function(t) {
_$('status_message').style.display='none';
gui_alert("Config Error: " + t.status + ": " + t.statusText);
}
};
opt.parameters ="action=originate&channel=Local/"+newvmenu_ext + "&context="+asterisk_guitools+"&exten=record_vmenu&priority=1&Variable=var1%3d"+ encodeURIComponent( asterisk_menusRecord_path + filename_torecord );
var tmp = new Ajax.Request(asterisk_rawmanPath, opt);
}
function delete_sounds(filename){
if(!confirm("Delete selected file ?")){ return ; }
parent.astmanEngine.run_tool("/bin/rm -f "+ asterisk_menusRecord_path + filename , callback=function(){
gui_feedback('Delete Request Successfull !','default');
window.location.href = window.location.href ;
});
}
</script>
<body id="foo" onload="localajaxinit()" bgcolor="EFEFEF">
<div class="mainscreenTitleBar">
<span style="margin-left: 4px;font-weight:bold;">Record a Custom VoiceMenu</span>
<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" > <img src="images/refresh.png" title=" Refresh " border=0 > </span>
</div>
<div class="mainscreenContentBox" id="userscontent">
<table class="mainscreenTable" align="center">
<tr>
<td valign="top" align="center">
<BR>
<fieldset style="height: 390px; " id="fieldset2">
<legend> List of Recorded VoiceMenus </legend>
<table class="table_blacksm" cellpadding=2 cellspacing=2 border=0 align=center width=500 id="table_one">
<tr> <td width=35>S.No</td>
<td width="180">Name</td>
<td align="center">Options</td>
</tr>
</table>
<div id="recfilesTable_div" style="height:260px;width=100%; overflow :auto; padding : 0px 0px 0px 0px;">
<table id="recfilesTable" cellpadding=2 cellspacing=1 border=0 align=center width=500></table>
</div>
<div STYLE="position: absolute; left:186; top: 460;">
<input type="button" id="vvv" value="Record a new Voice Menu" onclick="show_record();" onmouseover="show_tooltip('en', 'record', 0);">
</div>
</fieldset>
</td>
</tr>
</table>
</div>
<div id="recordnew_content" STYLE="display:none; position: absolute; left: 20; top: 125; width:475; height:150; background-color:#F4EFE5; border-width: 1px; border-color: #7E5538; border-style: solid;z-index:5">
<table width="100%" cellpadding=0 cellspacing=0 onmousedown="startDrag(event , 'recordnew_content');">
<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;">Record a new Voicemenu</font>
</TD>
<TD Height="20" align="right" style="cursor: move">
<A href="#" onclick="hide_record();"><font style="color:#FFFFFF; font-size: 12px; font-weight:bold;">X</font></A>
</TD>
<TD width=4></TD>
</TR>
</table>
<table cellpadding=2 cellspacing=2 border=0>
<tr> <td colspan=2 height=15 valign=middle align=center class="field_text"></td></tr>
<tr onmouseover="show_tooltip('en', 'record', 1);">
<td class="field_text">File Name:</td>
<td><input id='newvmenu_name' size=24 class="input9">
<input type="hidden" id="format" value="gsm">
</td>
</tr>
<!-- <tr><td>Format:</td>
<td><select id='format'>
<option value="gsm">gsm</option>
<option value="g723">g723</option>
<option value="g729">g729</option>
<option value="h623">h623</option>
<option value="ulaw">ulaw</option>
<option value="alaw">alaw</option>
<option value="vox">vox</option>
<option value="wav">wav</option>
<option value="WAV">WAV</option>
</select>
</td>
</tr> -->
<tr onmouseover="show_tooltip('en', 'record', 2);">
<td class="field_text">Extension used for recording:</td>
<td><select id='newvmenu_ext' class="input9"></select></td>
</tr>
<tr> <td colspan=2 align=center height=10></td></tr>
<tr> <td colspan=2 align=center>
<input type="button" id='record' Value="Record" onclick="record_new()" class="buttonbold">
<input type="button" Value="Cancel" onclick="hide_record();" class="buttonbold">
</td>
</tr>
<tr> <td colspan=2 align=center height=10></td></tr>
</table>
</div>
<div id="sysinfohtml" style="display:none"></div>
<div id="bg_transparent" STYLE="display:none; position: absolute; left: 0; top: 24; width:100%; height:100%; background-color:#EFEFEF; -moz-opacity:.50;opacity:.50; border-width: 1px; border-color: #EFEFEF; border-style: solid; z-index:4">
</div>
</body>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -