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

📄 ringgroups.html.svn-base

📁 asterisk-gui asterisk网关接口编程 控制asterisk的接口
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
<!-- * Asterisk-GUI	-	an Asterisk configuration interface * * Ring Groups * * Copyright (C) 2006-2007, 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><link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" /><script>var isNewRG, ie;var UserExtensions = [];var LISTOFCHANNELS = {};var ringgroups = {};var RG_COMMENT = 'gui_ring_groupname';var RG_FORMAT = 'ringroups-custom-';var RG_EDITING;function clear_table(){	var t = _$('rgsTable') ;	_$('table_one').style.display = '';	for( var i=0; i < t.rows.length; ){ t.deleteRow(i); }}function showlist_of_rules(){	var t;	for( t in ringgroups ){		if(ringgroups.hasOwnProperty(t)){ addrow_totable( ringgroups[t],t ); }	}	var u = _$('rgsTable');	if( u.rows.length == 0 ){		_$('table_one').style.display="none";		var newRow = u.insertRow(-1);		var newCell0 = newRow.insertCell(0);		newCell0.align = "center";		newCell0.innerHTML = "<BR><I> No Previous Ring Groups found !!</I> <BR><BR>" +			"To create a ring group click on the 'New Ring Group' button <BR><BR>" ;	}}function addrow_totable(k,l){	// sno, ringgroup, options	var newRow = _$('rgsTable').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 =_$('rgsTable').rows.length  ;	newCell0 .width = 35;	newCell0.align = "center";		var newCell1 = newRow.insertCell(1);	newCell1 .innerHTML = k.rgname;	newCell1.align = "left";		var newCell2 = newRow.insertCell(2);	newCell2 .innerHTML = "<input type=\"button\" onclick='edit_form(\""+ l+ "\")'  value=\"Edit\" class=\"splbutton\">&nbsp;" + "<input type=\"button\" onclick='delete_rg(\""+ l+ "\")'  value=\"Delete\"  class=\"splbutton\">" ;	newCell2.align = "center";	newCell2.width = 115;}function edit_form(g){	_$('form_caption').innerHTML = "<B>Edit Ring Group</B>";	isNewRG = 0;	RG_EDITING = g;	var this_ringgroup = ringgroups[g];	_$('text_rgname').value = this_ringgroup.rgname ;	if( this_ringgroup.ringstyle == 'ringall' ){ _$('select_strategy').selectedIndex = 0 ; }	if( this_ringgroup.ringstyle == 'ringinorder' ){ _$('select_strategy').selectedIndex = 1 ; }	var r = _$('select_ringthesechannels');	var s = _$('select_listofchannels');	var cn ;	ASTGUI.selectbox.clear(s);	ASTGUI.selectbox.clear(r);	for (var y=0; y < this_ringgroup.rgchannels.length ; y++ ){ 		if(LISTOFCHANNELS[this_ringgroup.rgchannels[y]]){			cn = LISTOFCHANNELS[this_ringgroup.rgchannels[y]]['ChannelName'];		}else{			cn = this_ringgroup.rgchannels[y];		}		ASTGUI.selectbox.append(r,cn,this_ringgroup.rgchannels[y]);	}	for( var u in LISTOFCHANNELS ){ if(LISTOFCHANNELS.hasOwnProperty(u)) {		if( !InArray(this_ringgroup.rgchannels, u) ){			//ASTGUI.selectbox.append(s,u,u);			ASTGUI.selectbox.append( s, LISTOFCHANNELS[u]['ChannelName'] , u);		}	}}	var find_index = function(el,val){		for(var t=0; t< el.options.length; t++){			if( el.options[t].value == val){ el.selectedIndex = t; return; }		}	}	if( this_ringgroup.laststep.match('Voicemail') ){		_$('select_voicemails').style.display = "";		_$('select_vmenus').style.display = "none";		_$('select_voicemails').selectedIndex = -1;		find_index(_$('select_voicemails'), this_ringgroup.laststep );		_$('radio_fbvm').checked = true;	}	if( this_ringgroup.laststep.match('voicemenu-custom-') ){		_$('select_voicemails').style.display = "none";		_$('select_vmenus').style.display = "";		_$('select_vmenus').selectedIndex = -1;		find_index(_$('select_vmenus'), this_ringgroup.laststep );		_$('radio_fbivr').checked = true;	}	if( this_ringgroup.laststep == 'Hangup' ){		_$('select_voicemails').style.display = "none";		_$('select_vmenus').style.display = "none";		_$('radio_fbhgp').checked = true;	}	_$('text_rgExten').value = (this_ringgroup.rgExten)?this_ringgroup.rgExten:"" ;	_$('text_ringTime').value = this_ringgroup.ringTime ;	_$('ringgroup_editdiv').style.display = '';}function delete_rg(g){	if(!confirm("Are you sure ?")){ return true; }	var uri = build_action('delcat', 0, RG_FORMAT+g, "", "");	/* If we made a goto extension in default, delete the reference. */	if(ringgroups[g].rgExten){		var rlex = ringgroups[g].rgExten + ',1,Goto(' + RG_FORMAT+g+ '|s|1)' ;		uri += build_action('delete', 1, specialcontext, "exten", "", rlex); 	}	makerequest('u','extensions.conf', uri, function(t){		delete ringgroups[g];		clear_table();		showlist_of_rules();	});}function save_rg(){	if(_$('select_ringthesechannels').options.length ==0){		gui_alert("You can not create a ring group with no members"); return false;	}	if( !_$('text_rgname').value.strip()){		gui_alert("Please enter a name for the ring group"); return false;	}	if( isNaN(_$('text_ringTime').value) || Number(_$('text_ringTime').value) <= 0 ){		gui_alert("Please enter the number of seconds"); _$('text_ringTime').focus(); return false;	}	if(isNewRG){ 		var check4duplicatename = function(){ //Check for duplicate names 			var rgn = _$('text_rgname').value ;			for( var t in ringgroups ){ if(ringgroups.hasOwnProperty(t)){ 				if(  rgn == ringgroups[t].rgname )return false;			}}			return true;		};		if(!check4duplicatename()){			gui_alert("A Ring Group with this name already Exists. Please choose a different name.");			return false;		}		var getnewringgroupcontext = function(){			var t=1;			while(ringgroups[t]){ t++; }			return t;		}		var s = getnewringgroupcontext();		create_newRG(s); 	}else{		var uri = build_action('delcat', 0, RG_FORMAT+RG_EDITING, "", "");		if(ringgroups[RG_EDITING].rgExten){			var y = ringgroups[RG_EDITING].rgExten + ',1,Goto(' + RG_FORMAT+RG_EDITING + '|s|1)' ;			uri += build_action('delete', 1, specialcontext ,"exten", "", y); 		}		makerequest('u','extensions.conf', uri, function(t){			delete ringgroups[RG_EDITING];			create_newRG(RG_EDITING);		});	}}function create_newRG(v){	var uri="", p=0, context = 'ringroups-custom-' + v ;	var rcs = _$('select_ringthesechannels') ;	var ringtime = _$('text_ringTime').value;	var s,t,u;	ringgroups[v] = {};	var this_ringgroup = ringgroups[v];	this_ringgroup.rgname = _$('text_rgname').value;	this_ringgroup.ringstyle = _$('select_strategy').value;	this_ringgroup.rgchannels = [];	this_ringgroup.laststep = '';	this_ringgroup.ringTime = ringtime;	uri += build_action('newcat', p, context ,"", ""); p = p+1;	uri += build_action('append', p, context ,RG_COMMENT, _$('text_rgname').value); p = p+1;	uri += build_action('append', p, context ,"exten", "s,1,NoOp(RINGGROUP)"); p = p+1;	if( _$('text_rgExten').value.length ){		var y = _$('text_rgExten').value + ',1,Goto(' + context + '|s|1)' ;		uri += build_action('append', p, specialcontext ,"exten", y); p++;		this_ringgroup.rgExten = _$('text_rgExten').value ;	}	if( _$('select_strategy').value =='ringinorder'){		for( s=0; s< rcs.options.length; s++  ){			t = 's,n,Dial(' + rcs.options[s].value + ',' + ringtime + ')' ;			this_ringgroup.rgchannels.push(rcs.options[s].value);			uri += build_action('append', p, context ,"exten", t); p = p+1;		}	}		if( _$('select_strategy').value =='ringall'){		for( s=0; s< rcs.options.length; s++  ){ 			this_ringgroup.rgchannels.push(rcs.options[s].value);		}		t = 's,n,Dial(' + this_ringgroup.rgchannels.join("&") + ',' + ringtime + ')' ;		uri += build_action('append', p, context ,"exten", t); p = p+1;	}			if( _$('radio_fbvm').checked ){ // FailBack to voicemail group		t = 's,n,' + _$('select_voicemails').value ;		uri += build_action('append', p, context ,"exten", t); p = p+1;		this_ringgroup.laststep = _$('select_voicemails').value;	}	if( _$('radio_fbivr').checked ){  // FailBack to IVR		t = 's,n,' + _$('select_vmenus').value ;		uri += build_action('append', p, context ,"exten", t); p = p+1;		this_ringgroup.laststep = _$('select_vmenus').value ;	}	if( _$('radio_fbhgp').checked){  // Failback to Hangup		uri += build_action('append', p, context ,"exten", 's,n,Hangup'); p = p+1;		this_ringgroup.laststep = 'Hangup' ;	}	makerequest('u','extensions.conf', uri, function(t){		_$('ringgroup_editdiv').style.display = 'none';		clear_table();		showlist_of_rules();	});}function switch_fb_selects(){	if( _$('radio_fbvm').checked ){		_$('select_voicemails').style.display = "";		_$('select_vmenus').style.display = "none";	}	if( _$('radio_fbivr').checked ){		_$('select_voicemails').style.display = "none";		_$('select_vmenus').style.display = "";	}		if( _$('radio_fbhgp').checked ){		_$('select_voicemails').style.display = "none";		_$('select_vmenus').style.display = "none";	}}function a2b(a,b){	if(a.selectedIndex < 0){return false;}	ASTGUI.selectbox.append(b,a.options[a.selectedIndex].text, a.options[a.selectedIndex].value);	a.remove(a.selectedIndex);

⌨️ 快捷键说明

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