rendered paste bodyfunction 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 = build_action('append', 0, specialcontext ,'exten', qa+',1,Goto(Queues,q${EXTEN})');
uri0 = 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 = build_action('append', 0, queues ,'exten',qb+,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)', qa+,n,GotoIf($["${CONTEXT}"="from-internal"]?USERCID:SETCID)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n(USERCID),Macro(user-callerid,)', qa+,n(USERCID),Macro(user-callerid,)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})', qa+,n(SETCID),Set(CALLERID(name)=${CALLERIDNAME})' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n(ID),Playback(pls-enter-account)', qa+,n(ID),Playback(pls-enter-account)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,Read(acct,then-press-pound)', qa+,n,Read(acct,then-press-pound)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,SayDigits(${acct})', qa+,n,SayDigits(${acct})' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,Background(if-this-is-correct-press)', qa+,n,Background(if-this-is-correct-press)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,SayDigits(1)', qa+,n,SayDigits(1)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,Background(if-this-is-incorrect-press)', qa+,n,Background(if-this-is-incorrect-press)', );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,SayDigits(2)', qa+,n,SayDigits(2)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,Read(res,then-press-pound,)', qa+,n,Read(res,then-press-pound,)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,GotoIf($["${res}"="1"]?ACCT:ID)', qa+,n,GotoIf($["${res}"="1"]?ACCT:ID)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n(ACCT),Set(CALLERID(number)=${acct})', qa+,n(ACCT),Set(CALLERID(number)=${acct})' );
uri0 = 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 = build_action('append', 0, queues ,'exten',qb+,n,Queue(${EXTEN}|t|||300)', qa+,n,Queue(${EXTEN}|t|||300)' );
uri0 = build_action('append', 0, queues ,'exten',qb+,n,Voicemail(u${EXTEN})', qa+,n,Voicemail(u100)' );
opt0.parameters="action=updateconfig&srcfilename=" + encodeURIComponent("extensions.conf") + "&dstfilename=" + encodeURIComponent("extensions.conf") + uri0;
tmp0 = new Ajax.Request(asterisk_rawmanPath, opt0);
}