All pastes #493509 Raw Edit

Something

public text v1 · immutable
·published 2007-05-17 20:27 UTC
rendered paste body
function add_extension(a){
	// add extension 'a' in extensions.conf 
	// add 'exten => a,1,Queue' to default
	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', qa+',1,Goto(Queues,q${EXTEN})');
	uri0[1] = build_action('append', 0, queues ,'exten',b+ n,Playback(sales&for-quality-purposes&this-call-may-be-monitored-or-recorded)', qa+, n,Playback(sales&for-quality-purposes&this-call-may-be-monitored-or-recorded)' );
	uri0[2] = build_action('append', 0, queues ,'exten',qb+,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)', qa+,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)' );
	uri0[3] = build_action('append', 0, queues ,'exten',qb+,n(USERCID),Macro(user-callerid,)', qa+,n(USERCID),Macro(user-callerid,)' );
	uri0[4] = build_action('append', 0, queues ,'exten',qb+,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})', qa+,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})' );
	uri0[5] = build_action('append', 0, queues ,'exten',qb+,n(ID),Playback(pls-enter-account)', qa+,n(ID),Playback(pls-enter-account)' );
	uri0[6] = build_action('append', 0, queues ,'exten',qb+,n,Read(acct,then-press-pound)', qa+,n,Read(acct,then-press-pound)' );
	uri0[7] = build_action('append', 0, queues ,'exten',qb+,n,SayDigits(${acct})', qa+,n,SayDigits(${acct})' );
	uri0[8] = build_action('append', 0, queues ,'exten',qb+,n,Background(if-this-is-correct-press)', qa+,n,Background(if-this-is-correct-press)' );
	uri0[9] = build_action('append', 0, queues ,'exten',qb+,n,SayDigits(1)', qa+,n,SayDigits(1)' );
	uri0[10] = build_action('append', 0, queues ,'exten',qb+,n,Background(if-this-is-incorrect-press)', qa+,n,Background(if-this-is-incorrect-press)', );
	uri0[11] = build_action('append', 0, queues ,'exten',qb+,n,SayDigits(2)', qa+,n,SayDigits(2)' );
	uri0[12] = build_action('append', 0, queues ,'exten',qb+,n,Read(res,then-press-pound,)', qa+,n,Read(res,then-press-pound,)' );
	uri0[13] = build_action('append', 0, queues ,'exten',qb+,n,GotoIf($["${res}"="1"]?ACCT:ID)', qa+,n,GotoIf($["${res}"="1"]?ACCT:ID)' );
	uri0[14] = build_action('append', 0, queues ,'exten',qb+,n(ACCT),Set(CALLERID(number)=${acct})', qa+,n(ACCT),Set(CALLERID(number)=${acct})' );
	uri0[15] = build_action('append', 0, queues ,'exten',qb+,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID})', qa+,n,Set(MONITOR_FILENAME=/var/spool/asterisk/monitor/q${EXTEN}-${TIMESTAMP}-${UNIQUEID})' );
	uri0[16] = build_action('append', 0, queues ,'exten',qb+,n,Queue(${EXTEN}|t|||300)', qa+,n,Queue(${EXTEN}|t|||300)' );
	uri0[17] = build_action('append', 0, queues ,'exten',qb+,n,Voicemail(u${EXTEN})', qa+,n,Voicemail(u${EXTEN})' );
	opt0.parameters="action=updateconfig&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri0;
	tmp0 = new Ajax.Request(asterisk_rawmanPath, opt0);
}