📄 trunks.html.svn-base
字号:
_$('dialformat').value = (provider.fieldbyname['dialformat']) ? provider.fieldbyname['dialformat'] : '${EXTEN:1}'; _$('callerid').value = ''; _$('insecure').value = (provider.fieldbyname['insecure']) ? provider.fieldbyname['insecure'] : '' ; _$('port').value = (provider.fieldbyname['port']) ? provider.fieldbyname['port'] : '' ; _$('fromuser').value = (provider.fieldbyname['fromuser']) ? provider.fieldbyname['fromuser'] : '' ; if(_$('provider').value == "ngt") { _$('fromuser').value = _$('username').value; } else { _$('fromuser').value = (provider.fieldbyname['fromuser']) ? provider.fieldbyname['fromuser'] : '' ; } _$('fromdomain').value = (provider.fieldbyname['fromdomain']) ? provider.fieldbyname['fromdomain'] : '' ; } callbacks_savechanges_step2(); }else{ /* Rename DID if needed */ if(old_trunkname != _$('name').value ) { if(_$('callerid').value != "") { update_didcontext_andcid(old_trunkname, _$('name').value); } else { update_didcontext(old_trunkname, _$('name').value); } } /* build callerid */ var u = 0; var newvalue = (_$('callerid').value.length > 0) ? _$('callerid').value : "unknown"; var uri = build_action('delete', u, 'globals', old_trunkname + "_cid", "","" ); u++; uri += build_action('update', u, 'globals', old_trunkname + "_cid", newvalue); apply_uri(_hiddenglobals, uri); _hiddenglobals.stored_config.catbyname['globals'].fieldbyname[old_trunkname + "_cid"] = newvalue; makerequest('u', 'extensions.conf',uri, function(t){ }); hideSPdetails(); loadServiceProvidersintotable(); } /* do not need this yet... if ( isAnalog ){ PORTS_toCALIBRATE.ports_array = PORTS_toCALIBRATE.ports_string.split(",") ; $('span_Ports_toCalibratie').innerHTML = "" ; for( var p =0; p < PORTS_toCALIBRATE.ports_array.length ; p++) { $('span_Ports_toCalibratie').innerHTML += "Analog Port #" + PORTS_toCALIBRATE.ports_array[p] + "<BR>" ; } _$('bg_transparent').style.display = '' ; _$('div_calibrate').style.display = '' ; _$('img_loading').setAttribute('src', './images/loading.gif' ); _$('bottom_msg').innerHTML = "<BR>This might take upto 8 minutes to complete. Please do not reboot or poweroff the unit until the calibration is complete." ; _$('button_calPorts').disabled = false; _$('button_resCalib').disabled = false; _$('button_skipCalib').disabled = false; } */ return true;}function update_used_fxos(){ var r; try { var ovs = used_fxos.oldvalue.split(","); }catch(err){ var ovs = []; } try { var nvs = used_fxos.newvalue.split(","); }catch(err){ var nvs = []; } for(r=0; r < ovs.length; r++){ delete used_fxos[ovs[r]]; } for(r=0; r < nvs.length; r++){ used_fxos[nvs[r]] = true; }}function callbacks_savechanges_step2(){ hideSPdetails(); loadServiceProvidersintotable(); var uri; var newvalue; var _devices = _$('devices') ; var tmp = _devices.value.split('_'); var _hiddenglobals = _$('hiddenglobals') ; var oldvalue = _hiddenglobals.stored_config.catbyname['globals'].fieldbyname[_devices.value]; if (_$('trunkstylevoip').checked || _$('trunkstylecustomvoip').checked) { if (_devices.stored_config.catbyname[_devices.value].fieldbyname['hasiax'] == 'yes') newvalue = "IAX2/" + _devices.value; else newvalue = "SIP/" + _devices.value; } else { newvalue = "Zap/g" + NEWGROUPNUMBER; GROUPS.push(NEWGROUPNUMBER); } if (newvalue != oldvalue) { var _name = _$('name') ; if(old_trunkname == _name.value ){ uri = build_action('update', 0, 'globals', _devices.value, newvalue); apply_uri(_hiddenglobals, uri); _hiddenglobals.stored_config.catbyname['globals'].fieldbyname[_devices.value] = newvalue; return true; }else{ uri = ""; var u =0; if(old_trunkname){ uri = build_action('delete', u, 'globals', old_trunkname, "","" ); u++; } uri += build_action('update', u , 'globals', _name.value, newvalue); u++; apply_uri(_hiddenglobals, uri); _hiddenglobals.stored_config.catbyname['globals'].fieldbyname[ _name.value ] = newvalue; return true; } }}function ifnewtrunk(){ var needcomma = 0; var provider; var count = 0; var _provider = _$('provider'); var _zapchan = _$('zapchan'); var _trunkname = _$('trunkname'); var _username2 = (_$('username').value) ? ' - ' + _$('username').value : ' - (No Username Needed)'; _$('hasexten').value = 'no'; _$('context').value = asterisk_guiTDPrefix + _$('name').value ; if (_$('trunkstylevoip').checked) { provider = _provider.stored_config.catbyname[_provider.value]; _trunkname.value = _provider.options[_provider.selectedIndex].innerHTML + _username2; _$('signalling').value = ''; _$('hassip').value = provider.fieldbyname['hassip']; _$('hasiax').value = provider.fieldbyname['hasiax']; _$('registeriax').value = provider.fieldbyname['registeriax']; _$('registersip').value = provider.fieldbyname['registersip']; /* if its not ngt, go ahead and set the host field, or else do NOT and get it from _$('ip'); */ if(_provider.value != "ngt") { _$('host').value = provider.fieldbyname['host']; _$('fromuser').value = _$('username').value; } for (var x=0;x<_zapchan.options.length;x++){ _zapchan.options[x].selected = false; } _zapchan.value = ''; _$('group').value = ''; _$('disallow').value= ""; _$('allow').value = "all"; } else if (_$('trunkstyleanalog').checked) { // Analog _provider.selectedIndex = -1; count = 0; _trunkname.value = ""; used_fxos.oldvalue = ""; for (var x=0;x<_zapchan.options.length;x++) { if (_zapchan.options[x].selected) { if (needcomma){ _trunkname.value += "," } needcomma = 1 ; _trunkname.value += _zapchan.options[x].value; count++; } } PORTS_toCALIBRATE.ports_string = _trunkname.value; used_fxos.newvalue = _trunkname.value; _trunkname.value = ((count > 1) ? "Ports ":"Port ") + _trunkname.value; _$('signalling').value = 'fxs_ks'; _$('callerid').value = 'asreceived'; _$('hassip').value = 'no'; _$('hasiax').value = 'no'; _$('callerid').value = 'asreceived'; NEWGROUPNUMBER = GROUPS.firstAvailable() ; _$('group').value = NEWGROUPNUMBER ; } else if( _$('trunkstylecustomvoip').checked ){ // Custom VOIP Provider _trunkname.value = "Custom - " + _$('customvoip_name').value; provider = _$('customvoip_name').value; _provider.selectedIndex = -1; _$('signalling').value = ''; _$('username').value = _$('customvoip_username').value; _$('secret').value = _$('customvoip_secret').value; var _cv_p = $('customvoip_protocol').value ; _$('hassip').value = ( _cv_p == "iax" ) ? "no" : "yes" ; _$('hasiax').value = ( _cv_p == "iax" ) ? "yes" : "no"; var _cv_r = _$('customvoip_register') ; var _registeriax = _$('registeriax') ; var _registersip = _$('registersip'); if( !_cv_r.checked ){ _registeriax.value = 'no'; _registersip.value = 'no'; }else{ _registeriax.value = ( _cv_p == "iax") ?'yes' : 'no'; _registersip.value = ( _cv_p == "sip") ?'yes' : 'no'; } _$('host').value = _$('customvoip_host').value ; _$('dialformat').value = '${EXTEN:1}'; _$('callerid').value = ''; _$('insecure').value = ''; _$('port').value = ( _cv_p == "iax" ) ? "4569" : "5060"; //$('context').value = 'default'; _$('fromuser').value = ''; _$('fromdomain').value = ''; for (var x=0;x<_zapchan.options.length;x++) _zapchan.options[x].selected = false; _zapchan.value = ''; _$('group').value = ''; _$('disallow').value= ""; _$('allow').value = "all"; }}callbacks.newcategory = function() { var tmp = {}; tmp.fieldbyname = {}; var x; var _devices = _$('devices'); // if ( _devices.stored_config.catbyname['general'])// tmp = objcopy( _devices.stored_config.catbyname['general']); if (tmp) { x = 1; while( _devices.stored_config.catbyname['trunk_' + x]) x++; tmp.name = 'trunk_' + x; } tmp.fieldbyname['hasexten'] = 'no'; tmp.fieldbyname['context'] = asterisk_guiTDPrefix + tmp.name; _$('customvoip_name').value = ""; _$('customvoip_username').value = ""; _$('customvoip_secret').value = ""; _$('customvoip_protocol').selectedIndex = 0; _$('customvoip_host').value =""; _$('analog').style.display="none"; _$('voip').style.display="none"; _$('customvoip').style.display="none"; _$('userscontent_title').innerHTML = "Add Service Provider"; isnewtrunk = 1; ASTGUI.events.add( _$('trunkstyleanalog') , 'click' , activateanalogvoip ); ASTGUI.events.add( _$('trunkstylevoip') , 'click' , activateanalogvoip ); ASTGUI.events.add( _$('trunkstylecustomvoip') , 'click' , activateanalogvoip ); return tmp;}callbacks.identifier = "extension";function update_zapchan(){ _$('save').disabled = false; _$('cancel').disabled = false; var _zapchan = _$('zapchan'); for (k=0;k< _zapchan.length ;k++ ){ _zapchan.options[k].selected = ( _$("selectedline" + k).checked ) ?true:false; }}function activateanalogvoip() { _$('analog').style.display = "none"; var _zapchan = _$('zapchan'); _zapchan.style.display = "none"; var _zcal = _$('zapchan_analoglines'); _zcal.style.display = "none"; _zcal.innerHTML =""; _$('customvoip').style.display = "none" ; _$('voip').style.display= "none"; var disablestring; if (_$('trunkstyleanalog').checked) { _$('analog').style.display = ""; _zcal.style.display = ""; if(_zapchan.options.length ==0){ _zcal.innerHTML = "No analog line hardware installed on the system"; }else{ for (k=0;k< _zapchan.length ;k++ ){ var selectedline = "selectedline" + k; if( used_fxos[_zapchan.options[k].value] && !_zapchan.options[k].selected){ disablestring = " disabled"; }else{ disablestring = ""; } if(_zapchan.options[k].selected){ _zcal.innerHTML += '<LABEL FOR="' + selectedline + '"><INPUT id="' + selectedline + '" TYPE="CHECKBOX" VALUE="'+ _zapchan.options[k].value+ '" checked onclick="update_zapchan()"' + disablestring +'>' + _zapchan.options[k].text + '</LABEL><BR>'; }else{ _zcal.innerHTML += '<LABEL FOR="'+ selectedline+'"><INPUT id="' + selectedline + '" TYPE="CHECKBOX" VALUE="'+ _zapchan.options[k].value+ '" onclick="update_zapchan()"' + disablestring +'>' + _zapchan.options[k].text + '</LABEL><BR>'; } } } }else if (_$('trunkstylevoip').checked) { _$('voip').style.display = ""; //_$('voip').style.height =350; showhidefields(); }else if (_$('trunkstylecustomvoip').checked) { _$('customvoip').style.display = "" ; }}function localajaxinit() { ASTGUI.events.add(document, 'mouseover', show_tooltip); for(var x=0; x < opt_userandpass; x++) { ASTGUI.events.add( _$(opt_userandpass[x]) , "change", function() { _$('save').disabled = false; _$('cancel').disabled = false; }); } ASTGUI.events.add( _$('ip') , "change", function() { _$('save').disabled = false; _$('cancel').disabled = false; }); ASTGUI.events.add( _$('voip_ip') , "change", function() { _$('save').disabled = false; _$('cancel').disabled = false; }); ASTGUI.events.add( _$('customvoip_name') , 'change' , function(){ _$('trunkname').value = _$('customvoip_name').value; } ); ASTGUI.events.add( _$('customvoip_protocol') , 'change' , function(){ if(_$('customvoip_protocol').value == "sip"){ _$('hassip').value = 'yes'; _$('hasiax').value = 'no'; } if(_$('customvoip_protocol').value == "iax"){ _$('hassip').value = 'no' ; _$('hasiax').value = 'yes'; } }); ASTGUI.events.add( _$('customvoip_register') , 'change' , function(){ if(_$('customvoip_register').checked){ if(_$('customvoip_protocol').value == "sip"){ _$('registersip').value = 'yes'; _$('registeriax').value = 'no'; } if(_$('customvoip_protocol').value == "iax"){ _$('registersip').value = 'no' ; _$('registeriax').value = 'yes'; } }else{ _$('registersip').value = 'no'; _$('registeriax').value = 'no'; } }); ASTGUI.events.add( _$('customvoip_host') , 'change' , function(){ _$('host').value = _$('customvoip_host').value; } ); ASTGUI.events.add( _$('customvoip_username') , 'change' , function(){ _$('username').value = _$('customvoip_username').value; } ); ASTGUI.events.add( _$('customvoip_secret') , 'change' , function(){ _$('secret').value = _$('customvoip_secret').value; } ); ASTGUI.events.add(_$('provider'), 'click', showhidefields); setWindowTitle("Service Providers"); _$('devices').disabled = true; _$('zapchan').splitchar=','; var _trunkstyleanalog = _$('trunkstyleanalog') ; _trunkstyleanalog.onclick = null; var _trunkstylevoip = _$('trunkstylevoip'); _trunkstylevoip.onclick = null; var _trunkstylecustomvoip = _$('trunkstylecustomvoip'); _trunkstylecustomvoip.onclick = null; ASTGUI.events.add( _$('custom_trunkname') , 'change' , function(){ _$('name').value = _$('custom_trunkname').value; _$('save').disabled = false; } ) ; for (var x =0; x< fieldnames.length; x++) { if(!_$(fieldnames[x])) { alert(fieldnames[x] + " does not exists."); } widgets[fieldnames[x]] = _$(fieldnames[x]); widgets[fieldnames[x]].disabled = true; } for (var x =0; x < provfieldnames.length ; x++) { provwidgets[provfieldnames[x]] = _$(provfieldnames[x]); provwidgets[provfieldnames[x]].disabled = true; } parent.FXO_PORTS_DETECTED.each( function(y) { ASTGUI.selectbox.append( _$('zapchan'),"Analog Port #" + y , y ); }); parent.astmanEngine.config2list("providers.conf", _$('provider'), provwidgets, providercallbacks);}function showhidefields() { var provname = _$('provider').value; if(provname == "bandwidth") { for(var x=0; x < opt_userandpass.length; x++) { /* 3 */ _$(opt_userandpass[x]).style.display="none"; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -