📄 trunks.html.svn-base
字号:
}else{ var tmp = _$('disallow').value.split(","); for(var x=0; x < tmp.length; x++){ selectbox_add("disallowed", tmp[x]); } } if(_$('allow').value =="all"){ selectbox_add("allowed", "ulaw"); selectbox_add("allowed", "alaw"); selectbox_add("allowed", "gsm"); selectbox_add("allowed", "g726");// selectbox_add("allowed", "ilbc");// selectbox_add("allowed", "speex");// selectbox_add("allowed", "adpcm");// selectbox_add("allowed", "lpc10");// selectbox_add("allowed", "g729"); }else{ var tmp = _$('allow').value.split(","); for(var x=0; x < tmp.length; x++){ selectbox_add("allowed", tmp[x]); selectbox_remove("disallowed",tmp[x]); } }}function disallow_all_refresh(){ if( _$('disallow_all').checked ){ _$('disallowed').innerHTML=""; _$('allowed').innerHTML=""; _$('disallow').value = "all"; _$('allow').value = ""; update_div_setordercodecs(); _$('save').disabled = false; _$('cancel').disabled = false; }}function saveSPdetails(){ hideSPdetails(); loadServiceProvidersintotable();}function hideSPdetails(){ _$('userscontent').style.display = "none"; _$('bg_transparent').style.display ='none';}function showSPdetails(){ _$('cancel').disabled = false; _$('userscontent').style.display = ""; _$('bg_transparent').style.display =''; if ( isnewtrunk == 0){ _$('trunkstyleanalog').disabled = true; _$('trunkstylevoip').disabled = true; _$('trunkstylecustomvoip').disabled = true; _$('provider').disabled = true; } else { _$('voip').style.display = ""; //_$('voip').style.height =350; _$('trunkstylevoip').click(); //_$('provider').options[0].selected = true; _$('provider').selectedIndex = -1 ; setTimeout( function(){ try{$('provider').selectitem(0); showhidefields(); }catch(err){} }, 500 ); showhidefields(); }}function deleteSP(trunk){ var _devices = _$('devices'); for(var i=0; i< _devices.length; i++){ if(_devices.options[i].value == trunk){ _devices.selectitem(i) ; _$('delete').disabled = 0; used_fxos.oldvalue = _devices.stored_config.catbyname[_devices.value].fieldbyname['zapchan'] ; if( !_$('delete').click() ){ return; } break; } }}function deletesp_fromui(trunk){ var delete_id = "row" + trunk; var _sp_t = _$('serviceproviderstable'); for( var i=0; i < _sp_t. rows.length; i++){ if ( _sp_t.rows[i].id == delete_id ){ _sp_t.deleteRow(i); loadServiceProvidersintotable(); break; } }}function flip_register(){ _$('cancel').disabled= false; _$('save').disabled= false; if( _$('customvoip_register').checked && _$('customvoip_protocol').value == "iax"){ _$('registeriax').value = 'yes'; _$('registersip').value = 'no'; } if( _$('customvoip_register').checked && _$('customvoip_protocol').value == "sip"){ _$('registeriax').value = 'no'; _$('registersip').value = 'yes'; } if( !_$('customvoip_register').checked ){ _$('registeriax').value = 'no'; _$('registersip').value = 'no'; }}function free_mem( ){ if( navigator.userAgent.indexOf("MSIE") == -1 ){ return true; } try{ widgets['save'].hostselectbox = null ; widgets['cancel'].hostselectbox = null ; widgets['new'].hostselectbox = null ; widgets['delete'].hostselectbox = null ; purge( document.body ); }catch(e){ }}function advanced_save(){ _$('save').disabled = false; _$('save').click(); _$('bg_transparent').style.display = "none"; _$('advanced_content').style.display = "none";}function advanced_cancel(){ _$('cancel').click(); _$('bg_transparent').style.display = "none"; _$('advanced_content').style.display = "none";}function calibrate_ports(){ // PORTS_toCALIBRATE -- button_CalibratePorts, button_resetCalibration, button_skipCalibration var output = "/var/lib/asterisk/static-http/config/fxotune_out"; var msg1 = "starting FXO tuning".toLowerCase() ; var msg2 = "FXO tuning is complete".toLowerCase() ; var keepchecking; var starthere= function(){ _$('bg_transparent').style.display = ""; _$('msg_div').style.display = ""; _$('button_calPorts').disabled = true; _$('button_resCalib').disabled = true; _$('button_skipCalib').disabled = true; var getoutput = function(){ var opt = { method: 'get', asynchronous: true, onComplete: function(originalRequest){ var op = originalRequest.responseText.toLowerCase(); if( op.indexOf(msg1) != -1 ){ _$('msg_div_span').innerHTML = " Performing Calibration .... "; }else if( op.indexOf(msg2) != -1 ){ //_$('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" + "<BR><input type=button onclick='skip_Calibration();' value='Close'>"; window.clearInterval ( keepPinging ); updateUsers_fromFxotune(); _$('msg_div').onclick = function(){ skip_Calibration(); }; } }, onFailure: function(t) { alert("Config Error: " + t.status + ": " + t.statusText); } }; opt.parameters=""; var tmp = new Ajax.Request('./fxotune_out', opt); } var f1 =function(){ keepPinging = window.setInterval ( getoutput , 10000); }; var f2= function(){}; _$('msg_div_span').innerHTML = "Starting Calibration script .."; f1(); 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(){ // 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 " ); }) ;}function skip_Calibration(){ _$('bg_transparent').style.display = "none"; _$('msg_div').style.display = "none"; _$('div_calibrate').style.display = "none";}function editVolumeLevels( spName ){ var portsArray = _$('devices').stored_config.catbyname[ spName ].fieldbyname['zapchan'].split( ',' ); var efgh = function(){ var y = _$('al_ports'); var z = ""; ASTGUI.selectbox.clear(y); for( var u =0; u < portsArray.length ; u++ ){ z = 'Analog Port #' + portsArray[u] ; ASTGUI.selectbox.append( y, z , portsArray[u] ) ; } y.selectedIndex = -1; }; efgh(); 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; _$('volLevel2').checked = false; _$('volLevel1').checked = false; _$('button_saveAudioLevels').disabled = true ; _$('bg_transparent').style.display = ''; _$('div_audioLevels').style.display = '' ; }; getPreviousVolume_fromFxotune( spName , portsArray, abcd ); }function audioLevels_Cancel(){ AUDIO_LEVELS = []; AUDIO_LEVELS.trunkname =""; _$('bg_transparent').style.display = 'none'; _$('div_audioLevels').style.display = 'none';}function audioLevels_showPort(){ var getVolumeforPort = function(x){ for( var w=0; w< AUDIO_LEVELS.length; w++){ if(AUDIO_LEVELS[w].port == x ){ return AUDIO_LEVELS[w].portVolumeLevel } } }; //console.log( AUDIO_LEVELS.length ); //console.log( AUDIO_LEVELS.trunkname ); var v = Number( getVolumeforPort(_$('al_ports').value ) ) ; switch(v){ case 1: _$('volLevel1').checked = true; break ; case 2: _$('volLevel2').checked = true; break ; case 3: _$('volLevel3').checked = true; break ; case 4: _$('volLevel4').checked = true; break ; 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; _$('volLevel2').checked = false; _$('volLevel1').checked = false; }}function audioLevels_Change(z){ if( _$('al_ports').selectedIndex == -1 ) return; _$('button_saveAudioLevels').disabled = false ; var setVolumeforPort = function(x, y){ // set volume for port x to y for( var w=0; w< AUDIO_LEVELS.length; w++){ if(AUDIO_LEVELS[w].port == x ){ AUDIO_LEVELS[w].portVolumeLevel = y; } } }; setVolumeforPort( Number(_$('al_ports').value) , z);}function save_audioLevels(){ var getVolumeforPort = function(x){ for( var w=0; w< AUDIO_LEVELS.length; w++){ if(AUDIO_LEVELS[w].port == x ){ return AUDIO_LEVELS[w].portVolumeLevel } } }; // read the list of ports and then get their corresponding volume levels from AUDIO_LEVELS // 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', '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){ for( var d in c ){ if ( c.hasOwnProperty(d) && c[d]['fxorxgain']) { ports[d].fxogain = Number(c[d]['fxorxgain']) ; } } }; update_fxogains(c); 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 = Number( ports[j].fxogain ) ; // gain from fxotune for this channel (y) u_new = k ; v_new = -1 * fx ;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -