All pastes #495620 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-18 21:18 UTC
rendered paste body
<!--
 * Asterisk-GUI	-	an Asterisk configuration interface
 *
 * Manage Queues
 *
 * 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/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 mohcallbacks = new Object;
var queuecallbacks = new Object;
var usercallbacks = new Object;
var extencallbacks = new Object;
var callbacks = new Object;
var widgets = {};
var queueagents = new  Array;
var queuenames = new Array;
var fieldnames = ['agents', 'autofill', 'autopause', 'cancel', 'delete', 'fullname', 'joinempty', 'leavewhenempty', 'maxlen', 'musicclass', 'name', 'new', 'reportholdtime', 'save', 'strategy', 'timeout', 'wrapuptime'];

var k =0;
var j = -1; 
var extensions_conf_qs = new Array;
var localextenlength ;
var userbase;

function rename_extension(a,b){
	// rename extension 'a' in extensions.conf to 'b'
	// change 'exten => a,1,Queue' in default to 'exten => b,1,Queue'
        var uri = new Array();
	var x=0;

	var opt0 = {
		method: 'get',
		asynchronous: true,
		onSuccess: function() { 
			return true;	
		},
		onFailure: function(t) {
			gui_alert("Config Error: " + t.status + ": " + t.statusText);
			return false;
		}
	};
	uri[0] = build_action('update', 0, specialcontext ,'exten', b+',1,Goto(queues,${EXTEN},1)', a+',1,Goto(queues,${EXTEN},1)' );
	uri[1] = build_action('update', 0, queues ,'exten', b+',1,Answer()', a+',1,Answer()' ) ;
	uri[2] = build_action('update', 0, queues ,'exten', b+',n,Playback(for-quality-purposes&this-call-may-be-monitored-or-recorded)', a+', n,Playback(ales&for-quality-purposes&this-call-may-be-monitored-or-recorded)' );
	uri[3] = build_action('update', 0, queues ,'exten', b+',n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)', a+',n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)' );
	uri[4] = build_action('update', 0, queues ,'exten', b+',n(USERCID),Macro(user-callerid,)', a+',n(USERCID),Macro(user-callerid,)' );
	uri[5] = build_action('update', 0, queues ,'exten', b+',n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})', a+',n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})' );
	uri[6] = build_action('update', 0, queues ,'exten', b+',n(ID),Playback(pls-enter-account)', a+',n(ID),Playback(pls-enter-account)' );
	uri[7] = build_action('update', 0, queues ,'exten', b+',n,Read(acct,then-press-pound)', a+',n,Read(acct,then-press-pound)' );
	uri[8] = build_action('update', 0, queues ,'exten', b+',n,SayDigits(${acct})', a+',n,SayDigits(${acct})' );
	uri[9] = build_action('update', 0, queues ,'exten', b+',n,Background(if-this-is-correct-press)', a+',n,Background(if-this-is-correct-press)' );
	uri[10] = build_action('update', 0, queues ,'exten', b+',n,SayDigits(1)', a+',n,SayDigits(1)' );
	uri[11] = build_action('update', 0, queues ,'exten', b+',n,Background(if-this-is-incorrect-press)', a+',n,Background(if-this-is-incorrect-press)' );
	uri[12] = build_action('update', 0, queues ,'exten', b+',n,SayDigits(2)', a+',n,SayDigits(2)' );
	uri[13] = build_action('update', 0, queues ,'exten', b+',n,Read(res,then-press-pound,)', a+',n,Read(res,then-press-pound,)' );
	uri[14] = build_action('update', 0, queues ,'exten', b+',n,GotoIf($["${res}"="1"]?ACCT:ID)', a+',n,GotoIf($["${res}"="1"]?ACCT:ID)' );
	uri[15] = build_action('update', 0, queues ,'exten', b+',n(ACCT),Set(CALLERID(number)=${acct})', a+',n(ACCT),Set(CALLERID(number)=${acct})' );
	uri[16] = build_action('update', 0, queues ,'exten', b+',n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID})', a+',n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID})' );
	uri[17] = build_action('update', 0, queues ,'exten', b+',n,Queue(${EXTEN}|t|||300)', a+',n,Queue(${EXTEN}|t|||300)' );
	uri[18] = build_action('update', 0, queues ,'exten', b+',n,Voicemail(u${EXTEN})', a+',n,Voicemail(u${EXTEN})' );
	for(x;x<uri.length;x++) {
	opt0.parameters="action=updateconfig&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri[x];
	tmp0 = new Ajax.Request(asterisk_rawmanPath, opt0);
	}
        
}

function add_extension(a){
	// add extension 'a' in extensions.conf 
	// add 'exten => a,1,Queue' to default
	var x=0;
		for(x;x<uri0.length;x++) {
		this[x] = uri0[x];
		}
		this.length = uri0.length;
	}
	var opt0 = {
		method: 'get',
		asynchronous: true,
		onSuccess: function() { 
			return true;	
		},
		onFailure: function(t) {
			gui_alert("Config Error: " + t.status + ": " + t.statusText);
			return false;
		}
	};
	uri0[0] = build_action('append', 0, specialcontext ,'exten', a+',1,Goto(Queues,${EXTEN})' );
	uri0[1] = build_action('append', 0, queues ,'exten', a+',1,Answer()' ) ;
	uri0[2] = build_action('append', 0, queues ,'exten', a+',n,Playback(sales&for-quality-purposes&this-call-may-be-monitored-or-recorded)' );
	uri0[3] = build_action('append', 0, queues ,'exten', a+',n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)' );
	uri0[4] = build_action('append', 0, queues ,'exten', a+',n(USERCID),Macro(user-callerid,)'  );
	uri0[5] = build_action('append', 0, queues ,'exten', a+',n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})' );
	uri0[6] = build_action('append', 0, queues ,'exten', a+',n(ID),Playback(pls-enter-account)' );
	uri0[7] = build_action('append', 0, queues ,'exten', a+',n,Read(acct,then-press-pound)' );
	uri0[8] = build_action('append', 0, queues ,'exten', a+',n,SayDigits(${acct})' );
	uri0[9] = build_action('append', 0, queues ,'exten', a+',n,Background(if-this-is-correct-press)' );
	uri0[10] = build_action('append', 0, queues ,'exten', a+',n,SayDigits(1)' );
	uri0[11] = build_action('append', 0, queues ,'exten', a+',n,Background(if-this-is-incorrect-press)' );
	uri0[12] = build_action('append', 0, queues ,'exten', a+',n,SayDigits(2)' );
	uri0[13] = build_action('append', 0, queues ,'exten', a+',n,Read(res,then-press-pound,)' );
	uri0[14] = build_action('append', 0, queues ,'exten', a+',n,GotoIf($["${res}"="1"]?ACCT:ID)' );
	uri0[15] = build_action('append', 0, queues ,'exten', a+',n(ACCT),Set(CALLERID(number)=${acct})' );
	uri0[16] = build_action('append', 0, queues ,'exten', a+',n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID})' );
	uri0[17] = build_action('append', 0, queues ,'exten', a+',n,Queue(${EXTEN}|t|||300)' );
	uri0[18] = build_action('append', 0, queues ,'exten', a+',n,Voicemail(u${EXTEN})' );
	opt0.parameters="action=updateconfig&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri0[x];
	tmp0 = new Ajax.Request(asterisk_rawmanPath, opt0);
        }
}

function delete_extension(a){
	// delete extension 'a' in extensions.conf 
	var x=0;
		for(x;x<uri0.length;x++) {
		this[x] = uri0[x];
		}
		this.length = uri0.length;
	}
	var opt0 = {
		method: 'get',
		asynchronous: true,
		onSuccess: function() { 
			return true;	
		},
		onFailure: function(t) {
			gui_alert("Config Error: " + t.status + ": " + t.statusText);
			return false;
		}
	};
	uri0[0] = build_action('delete', 0, specialcontext ,'exten', '', a+',1,Goto(queues,${EXTEN})' );
	uri0[1] = build_action('append', 0, queues ,'exten', '', a+',1,Answer()' ) ;
	uri0[2] = build_action('delete', 0, queues ,'exten', '', a+',n,Playback(sales&for-quality-purposes&this-call-may-be-monitored-or-recorded)' );
	uri0[3] = build_action('delete', 0, queues ,'exten', '', a+',n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)' );
	uri0[4] = build_action('delete', 0, queues ,'exten', '', a+',n(USERCID),Macro(user-callerid,)' );
	uri0[5] = build_action('delete', 0, queues ,'exten', '', a+',n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})' );
	uri0[6] = build_action('delete', 0, queues ,'exten', '', a+',n(ID),Playback(pls-enter-account)' );
	uri0[7] = build_action('delete', 0, queues ,'exten', '', a+',n,Read(acct,then-press-pound)' );
	uri0[8] = build_action('delete', 0, queues ,'exten', '', a+',n,SayDigits(${acct})' );
	uri0[9] = build_action('delete', 0, queues ,'exten', '', a+',n,Background(if-this-is-correct-press)' );
	uri0[10] = build_action('delete', 0, queues ,'exten', '', a+',n,SayDigits(1)' );
	uri0[11] = build_action('delete', 0, queues ,'exten', '', a+',n,Background(if-this-is-incorrect-press)' );
	uri0[12] = build_action('delete', 0, queues ,'exten', '', a+',n,SayDigits(2)' );
	uri0[13] = build_action('delete', 0, queues ,'exten', '', a+',n,Read(res,then-press-pound,)' );
	uri0[14] = build_action('delete', 0, queues ,'exten', '', a+',n,GotoIf($["${res}"="1"]?ACCT:ID)' );
	uri0[15] = build_action('delete', 0, queues ,'exten', '', a+',n(ACCT),Set(CALLERID(number)=${acct})' );
	uri0[16] = build_action('delete', 0, queues ,'exten', '', a+',n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID})' );
	uri0[17] = build_action('delete', 0, queues ,'exten', '', a+',n,Queue(${EXTEN}|t|||300)' );
	uri0[18] = build_action('delete', 0, queues ,'exten', '', a+',n,Voicemail(u${EXTEN})' );
	opt0.parameters="action=updateconfig&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri0[x];
	tmp0 = new Ajax.Request(asterisk_rawmanPath, opt0);
		  }
}

function save_queue(){
	var p = 0;
	var q = 0;
	var r = 0;
	var fields = new Array('fullname', 'strategy', 'timeout', 'wrapuptime','autofill','autopause','maxlen', 'joinempty',  'leavewhenempty', 'reportholdtime','musicclass');
	var otherfields_action, tmp;
	var opt = {
		method: 'get',
 		asynchronous: true,
		onSuccess: function() { 
			$('status_message').style.display='none';
			gui_feedback('Updated','blue');
			$('new').disabled = false;
			$('save_q').disabled = true;
			$('save').disabled = true;
			$('cancel').disabled = true;
			var cattmp = new Object;
			cattmp.catname = $('queues').value;

			$('queues').engine.fields2changes($('queues').widgets, $('queues').stored_config, cattmp);
			$('queues').options[$('queues').selectedIndex].innerHTML = $('name').value + " -- Queue '" + $('fullname').value +"'";
			$('queues').options[$('queues').selectedIndex].value =$('name').value;
			$('queues').options[$('queues').selectedIndex].core_name = cattmp.catname;

			for (var y = 0; y < $('queues').options.length + 1; y++) {
				if (!$('queues').options[y] || 
					do_compare($('queues'), $('queues').options[$('queues').selectedIndex], $('queues').options[y])) {
						$('queues').options.add($('queues').options[$('queues').selectedIndex], y);
						break;
				}
			}
		},
		onFailure: function(t) {
			$('status_message').style.display='none';
			gui_alert("Config Error: " + t.status + ": " + t.statusText);
		}
	};

	// before going any further check whether there is another entry with this name
	if( $('name').value != $('queues').value ){
		if ($('queues').stored_config.catbyname[$('name').value]) {
			gui_alert("Sorry, an entry named " + $('name').value + " already exists!");
			return;
		}

		for(var k=0; k<$('queues').length; k++ ){
			var tmp = $('queues').options[k].innerHTML.split(' -- '); 
			if( tmp[0] ==  $('name').value   ){
				gui_alert("Sorry, an entry named " + $('name').value + " already exists!");
				return;
			}
		}

	}

	if(!$('name').value.length){
		gui_alert("Sorry, an Extension must be specified for this Queue!");
		$('name').focus();
		return;
	}
	if(!$('fullname').value.length){
		gui_alert("Sorry, a Full Name must be specified !");
		$('fullname').focus();
		return;
	}
	if( localextenlength !=0 && (localextenlength != $('name').value.length) ) {
		gui_alert("Sorry, An Extension must be "+ localextenlength  + " digits !");
		$('name').focus();
		return ;
	}
	
	if (!check_patternonfields( [ 'name', 'fullname','timeout','wrapuptime','maxlen' ] ) ){
		return false;
	}

	$('status_message').style.display="block";
	p = 0;
	uri = "";
	if( $('queues').options[$('queues').selectedIndex].innerHTML=='New Entry' ){
		uri += build_action('newcat', p, $('name').value,"", ""); p = p+1;
		otherfields_action = 'append'; 			// add other fields
		add_extension( $('name').value ); // add in extensions.conf
		//add to stored names & fields 
		r = queuenames.length;
		queueagents[r] = new Array;
		queuenames[r] = $('name').value ;
		q =0;
		for (k=0;k< $('agents').length ;k++ ){
				if( $('agents').options[k].selected ){
					queueagents [r][q] = $('agents').options[k].innerHTML.split(' -- ')[0] ;
					q = q+1;
				}
		}
	}else{
		if( $('name').value != $('queues').value ){
			uri += build_action('renamecat', p, $('queues').value ,"", $('name').value ); p = p+1;
			rename_extension($('queues').value,$('name').value ); // rename in extensions.conf
		}
		// delete existing agents
		uri += build_action('delete', p, $('name').value,"member", ""); p = p+1;
		otherfields_action = 'update'; 			// update other fields
		
		//update the stored names & fields 
		for( k=0; k<queuenames.length; k++ ){
				if( queuenames[k] == $('queues').value ){
					j = k;
					break;
				}
		}
		// reset the array queueagents [j] to selected elements of $('agents')
		queueagents [j] = [];
		q =0;
		
		for (k=0;k< $('agents').length ;k++ ){
				selectedagent = "selectedagent" + k;
				if( $(selectedagent).checked  ){
					queueagents [j][q] = $('agents').options[k].innerHTML.split(' -- ')[0] ;
					$('agents').options[k].selected = true;
					q = q+1;
				}else{
					$('agents').options[k].selected = false;
				}
		}
		// also reset queuenames[j] to $('name').value
		queuenames[j] = $('name').value;
	}

	for(k=0; k<fields.length; k++ ){
		if ( $(fields[k]).type =='checkbox'){
			tmp=( $(fields[k]).checked)? 'yes': 'no';
		}else{
			tmp = $(fields[k]).value;
		}
		uri += build_action(otherfields_action, p, $('name').value , fields[k] , tmp);
		p = p + 1;
	}

	//add agents
	for(k=0; k<$('agents').length; k++){
		selectedagent = "selectedagent" + k;
		if( $(selectedagent).checked ){
			uri += build_action('append', p, $('name').value,"member", "Agent/"+$(selectedagent).value);
			p = p+1;
		}
	}

	opt.parameters="action=updateconfig&srcfilename=" + encodeURIComponent("queues.conf") + "&dstfilename=" + encodeURIComponent("queues.conf") + uri;
	tmp = new Ajax.Request(asterisk_rawmanPath, opt);
}


// User call backs
usercallbacks.loaded = function (){
	merge_extensions($('queues'), $('extensions'));
	merge_extensions($('queues'), $('devices'));
	parent.loadscreen(this);
}
usercallbacks.identifier = "extension";
usercallbacks.postselect = function (){	 }
usercallbacks.format = function (t,x){
	if ((t.name == 'general'))
		return null;
	if ( t.fieldbyname['hasagent']=='yes' ) 
		return t.name + " -- " + t.fieldbyname['fullname'];
	else
		return null;
}

// Call Backs
callbacks.loaded = function (){	parent.astmanEngine.config2list("users.conf", $('agents'), new Array(), usercallbacks);	}
callbacks.identifier = "extension";
callbacks.postselect = function (){	 }
callbacks.format = function (t,x){
	if ((t.name == 'general')){
		if ( t.fieldbyname['localextenlength'] && t.fieldbyname['localextenlength'].length){ localextenlength =  parseInt(t.fieldbyname['localextenlength']) ; }
		if ( t.fieldbyname['userbase'] && t.fieldbyname['userbase'].length){ userbase =  t.fieldbyname['userbase'] ; }
		return null;
	}
	//if (t.name.substring(0,6) == 'trunk_')
	//	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;
}


// Queue Call Backs
queuecallbacks.oncategorydelete = function(value){
	$('testmulti').innerHTML = "";
	delete_extension(value);
}


queuecallbacks.postselect = function(box, val ) {
	if($('queues').selectedIndex	==-1){ 	$('save_q').disabled=true; 	return true; 	} 
	// 
	if(val == "reserved" ){
		$('testmulti').innerHTML = "";
		$('save_q').disabled=true;
		$('cancel').disabled = true;
		if( box.options[box.selectedIndex].text.toLowerCase().match("-- conference bridge")     ){
			//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Conferencing\' panel to edit a Conference Bridge</font>";
			box.selectedIndex = -1;
			gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Conferencing\' panel to edit the selected entry");
			return true;
		}
		if( box.options[box.selectedIndex].text.toLowerCase().match("-- check voicemail")     ){
			//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Voicemail\' panel to edit Voicemail Preferences</font>";
			box.selectedIndex = -1;
			gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Voicemail\' panel to edit the selected entry");
			return true;
		}
		if( box.options[box.selectedIndex].text.toLowerCase().match("-- voice menu")     ){
			box.selectedIndex = -1;
			//parent.$('tooltip').innerHTML = " <font size=\"-2\" color=\"#FF0000\">Click on \'Voicemail\' panel to edit Voicemail Preferences</font>";
			gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Voice Menus\' panel to edit the selected entry");
			return true;
		}
		box.selectedIndex = -1;
		gui_alert(" You can not edit the selected entry from here.\n Please click on the \'Users\' panel to edit the selected entry");
		return true;
	}

	// show all member entires listed under the queue member - $('queues').value
	for( k=0; k<queuenames.length; k++ ){
			if( queuenames[k] == $('queues').value ){		j = k;	break;		}
	}
	$('testmulti').innerHTML ="";		
	for (k=0;k< $('agents').length ;k++ ){
		selectedagent = "selectedagent" + k;
		var str_checked = "";
		$('agents').options[k].selected = false;
		if( InArray( queueagents [j], $('agents').options[k].innerHTML.split(' -- ')[0] ) ){
			$('agents').options[k].selected = true;	
			str_checked = " checked ";
		}
		$('testmulti').innerHTML += '<LABEL FOR=' + selectedagent + '><INPUT id="' + selectedagent + '" TYPE="CHECKBOX" VALUE="'+ $('agents').options[k].innerHTML.split(' -- ')[0] + '"'+ str_checked + ' onclick="$(\'save_q\').disabled=false; $(\'cancel\').disabled=false;">&nbsp;' + $('agents').options[k].innerHTML.split(' -- ')[1] +' (' + $('agents').options[k].innerHTML.split(' -- ')[0]+ ')' + '</LABEL><BR>';
	}
	$('save_q').disabled = false;
}

queuecallbacks.loaded = function() { 	parent.astmanEngine.config2list("users.conf", $('devices'), new Array(), callbacks); }
queuecallbacks.newcategory = function(t) {
	var tmp = null;
	$('save_q').disabled=false;
	if ($('queues').stored_config.catbyname['general']){ 
		tmp = objcopy($('queues').stored_config.catbyname['general']);	
		x = userbase ; 
		for( var f=0; f < $('queues').options.length ; f++ ){
			if( x < $('queues').options[f].innerHTML.split(' -- ')[0] )
				break;
			x++;
		}				
		tmp.name = x;
	}else{
		tmp.name = 6000 ;	// a default value if one is not defined in users.conf's general context
	}

	$('testmulti').innerHTML ="";
	for (k=0;k< $('agents').length ;k++ ){
		selectedagent = "selectedagent" + k;
		$('agents').options[k].selected = false;
		$('testmulti').innerHTML += '<LABEL FOR=' + selectedagent + '><INPUT id="' + selectedagent + '" TYPE="CHECKBOX" VALUE="'+ $('agents').options[k].innerHTML.split(' -- ')[0] + '" onclick="$(\'save_q\').disabled=false; $(\'cancel\').disabled=false;">&nbsp;' + $('agents').options[k].innerHTML.split(' -- ')[1] +' (' + $('agents').options[k].innerHTML.split(' -- ')[0] + ')' +  '</LABEL><BR>';
	}
return tmp;
}
queuecallbacks.checkparams = function(box) { }
queuecallbacks.eachline = true;
queuecallbacks.includecats = true;

queuecallbacks.format = function(t,x) {
	var tmp = t.name.split('general');
	if(tmp.length>1)
			return false;
	else if ( t.name && x==undefined && InArray(extensions_conf_qs, t.name) ){	 				// if is a category
		k=0;
		j = j +1;
		queueagents[j] = new Array;
		queuenames[j] = t.name;
			return t.name + " -- Queue '" + t.fieldbyname['fullname'] + "'";
	}else if(InArray(extensions_conf_qs, t.name)) {  // if is a subcategory 
		tmp = t.fields[x].split ('Agent/');
		if(t.names[x] == 'member' && tmp.length > 1){
			queueagents [j] [k] = tmp[1];
			k = k+1;
		}
		return false;
	}
}

//extencallbacks
extencallbacks.loaded = function() {	parent.astmanEngine.config2list("queues.conf", $('queues'), widgets, queuecallbacks);	}
extencallbacks.eachline = true;
extencallbacks.format = function(t, x) {
	var res;
	var qname;
	if ((t.name != specialcontext)){	return null; }
	res = format_extension($('extensions'), t, x);
	if (t.subfields[x]['app'] == 'Queue') {	extensions_conf_qs.push(t.subfields[x]['name']); return null;	 }
	return res;
}
////////

function localajaxinit() {
	showdiv_statusmessage();
	setWindowTitle("Call Queues");
	$('queues').style.height = "415px";
	for (var x=0; x < fieldnames.length ; x++) {
		widgets[fieldnames[x]] = $(fieldnames[x]);
		widgets[fieldnames[x]].disabled = true;
	}

	parent.astmanEngine.config2list("musiconhold.conf", $('musicclass'), new Array(), mohcallbacks);
	$('save_q').disabled = true;
	$('message_text').innerHTML = " Saving Changes ... ";
	return;
}

mohcallbacks.format = function(t) {
	return t.name;
}

mohcallbacks.loaded = function() {
	parent.astmanEngine.config2list("extensions.conf", $('extensions'), new Array(), extencallbacks);
}

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){ }
}
</script>
<body id="foo" onload="localajaxinit()"  bgcolor="EFEFEF"  onunload="free_mem()">
<div class="mainscreenTitleBar">
	<span style="margin-left: 4px;font-weight:bold;">Queue Extension Configuration</span>
	<span style="cursor: pointer; cursor: hand;" onclick="window.location.href=window.location.href;" >&nbsp;<img src="images/refresh.png" title=" Refresh " border=0 >&nbsp;</span>
</div>
<div class="mainscreenContentBox" id="mailboxcontent">
<table class="mainscreenTable" align="center">
	<tr valign="top">
		<td colspan='2'>Queues:</td>
	</tr>
	<tr valign="top">
	<td>
		<select size="25" id="queues"  style="width:220px;" class="input10"><option>Loading...</option></select>
	</td>
	<td style="width:311px; height: 415px">
		<div id='adjustments' style='width:310'>
			<select id='extensions' style='display:none;width:0px;height:0px'></select>
			<select id='devices' style='display:none;width:0px;height:0px'></select>
			<select id='finalextensions'  style='display:none;width:0px;height:0px'></select>

			<table cellspacing='0' cellpadding='0'>
			<tr valign="top">
			<td>
				<table>
					<tr onmouseover="show_tooltip('en', 'queues', 0);" >
						<td class="field_text">Queue:</td>
						<td>&nbsp;<input size='5' id='name' pattern='^\d*$' class="input8"></td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 1);" >
						<td class="field_text">Full Name:</td>
						<td>&nbsp;<input size='24' id='fullname' pattern='^[a-zA-Z_0-9 ]*$' class="input8"></td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 2);" >
						<td class="field_text">Strategy :</td><td>&nbsp;<select id='strategy' class="input8"> 
							<option value="ringall">ringall</option> 
							<option value="roundrobin">roundrobin</option> 
							<option value="leastrecent">leastrecent</option> 
							<option value="fewestcalls">fewestcalls</option> 
							<option value="random">random</option> 
							<option value="rrmemory">rrmemory</option> 
							</select>
						</td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 3);" >
						<td valign='top' class="field_text">Agents:</td>
						<td><select multiple='true' id='agents' style='display:none;'></select>
							<div id="testmulti" style='border:1px solid; font-size: 8pt; height:75px; width: 200px;overflow :auto;'></div>
						</td>
					</tr>
				</table>
			</td>
			</tr>
			<tr><td height=5></td></tr>
			<tr>	<td align=center>
				<fieldset style="width: 225px; ">
					<legend>&nbsp;Queue Options:&nbsp;</legend>
					<table>
					<tr onmouseover="show_tooltip('en', 'queues', 5);" >
						<td class="field_text">TimeOut:</td>
						<td>&nbsp;<input size='2' id='timeout'  pattern='^\d*$' class="input8"></td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 6);" >
						<td class="field_text">Wrapup Time:</td>
						<td>&nbsp;<input size='2' id='wrapuptime' pattern='^\d*$' class="input8"></td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 9);" >
						<td class="field_text">Max Len:</td>
						<td>&nbsp;<input size='2' id='maxlen' pattern='^\d*$' class="input8"></td>
					</tr>
					<tr  onmouseover="show_tooltip('en', 'queues', 13);" >
						<td class="field_text">Music On Hold: </td>
						<td><select id="musicclass" class="input8"></select></td>
					</tr>
					</table>
					<table>
					<tr onmouseover="show_tooltip('en', 'queues', 7);" >
						<td><input type=checkbox id='autofill'></td>
						<td class="field_text">Auto Fill:</td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 8);" >
						<td><input type=checkbox id='autopause'></td>
						<td class="field_text">Auto Pause:</td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 10);" >
						<td><input type=checkbox id='joinempty'></td>
						<td class="field_text">JoinEmpty:</td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 11);" >
						<td><input type=checkbox id='leavewhenempty'></td>
						<td class="field_text">LeaveWhenEmpty:</td>
					</tr>
					<tr onmouseover="show_tooltip('en', 'queues', 12);" >
						<td><input type=checkbox id='reportholdtime'></td>
						<td class="field_text">Report Hold Time:</td>
					</tr>
					</table>
				</fieldset>
				</td>
			</tr>
			</table>
		</div>
	</td>
	</tr>
	<tr>	<td align='center'>
			<input type='button' id='new' value='New' class="buttonbold">&nbsp;
			<input type='button' id='delete' value='Delete' class="buttonbold">
		</td>
		<td align='center' colspan='2'>
			<input type=hidden id='save' value="Save">
			<input type='button' id='save_q' onclick="save_queue()" value='Save' class="buttonbold">&nbsp;
			<input type='button' id='cancel' value='Cancel'  class="buttonbold">
		</td>
	</tr>
</table>
</div>
</body>


Error: syntax error
Source File: http://orionvoip.homeip.net:8088/asterisk/static/config/queues.html
Line: 85, Column: 8
Source Code:
        }