[ivr-menu]
exten => 400100,1,Noop(----IVR-MENU-----)
same => n,Answer
same => n,Set(playFile=/var/lib/asterisk/sounds/ivr)
same => n,Read(varCase,${playFile},1,,3) ;; 1 - ждем ввода одной цифры 3 - ждем 3сек, varCase - переменная в которую попадает цифра IVR
same => n,Goto(${EXTEN},ivr-${varCase})
same => n(ivr-),Queue(managers)
same => n,Hangup()
same => n(ivr-8),Dial(SIP/casa)
same => n,Hangup()
same => n(ivr-9),Dial(SIP/buh)
same => n,Hangup()
context ivr-menu {
400100 => {
Noop(----IVR-MENU-----);
Answer;
Set(playFile=/var/lib/asterisk/sounds/ivr);
Read(ivrCase,${playFile},1,,3);
switch (${ivrCase}) {
case 8:
Dial(SIP/casa);
break;
case 9:
Dial(SIP/buh);
break;
default:
Queue(managers);
break;
}
}
}
// вот простой пример на AEL))
_XXX. => {
Noop(---------CALL-OUT-AEL--------);
Set(lineList=213135;213136)
while (${LEN(${lineList})} > 0) {
Set(OUT_LINE=${CUT(lineList,;,1)});
Set(__lineList=${CUT(lineList,;,2-)});
if("${DEVICE_STATE(SIP/${OUT_LINE})}"="NOT_INUSE") {
Dial(SIP/${EXTEN}@${OUT_LINE},45,T);
if("${DIALSTATUS}"="ANSWER") {HangUp;}
if("${DIALSTATUS}"="BUSY") {HangUp;}
}
}
HangUp;
}
};
[out-call-wait]
exten => _X.,1,Verbose(----Wait-before-Forward-to-mobile---)
same => n,NoCDR()
same => n,Wait(30)
same => n,Dial(SIP/trunk/${EXTEN},120,tT)
same => n,HangUp()
[out-call]
exten => _XXX,1,Noop(----------------Internal-call----------------)
same => n,Set(EXTEN_MOBILE=380674444444)
same => n,Dial(SIP/${EXTEN}&Local/${EXTEN_MOBILE}@out-call-wait/n,120,rTt)
same => n,HangUp()
exten => _XXXX,1,NoOp(-------AGENT-DIALPLAN----------)
same => n,Dial(${EXTEN},60,rU(sub-agi,${CALLERID(num)},${EXTEN},${UNIQUEID}))
[sub-agi]
exten => s,1,Noop(------------Start-Sub-AGI---------------)
same => n,NoCDR()
same => n,Noop(${ARG1}
same => n,Noop(${ARG2}
same => n,Noop(${ARG3}
same => n,AGI(myscript.php,${ARG1},${ARG2},${ARG3})
same => n,return
[test]
exten => _XXXX,n,Verbose(0,-----Call-Start-----)
same => n,Set(CHANNEL(hangup_handler_push)=hdlr-call-end,s,1)
same => n,Dial(SIP/${EXTEN},10,U(sub-answ-call-start))
same => n,HangUp()
[sub-answ-call-start]
exten => s,1,Set(__ANSWER_CALL_START=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
same => n,return
[hdlr-call-end]
exten => s,1,Verbose(0,-----hdlr-call-stats-----)
same => n,Set(ANSWER_CALL_END=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} )
same => n,Set(CALL_TIME=${MATH(${ANSWER_CALL_END}-${ANSWER_CALL_START},int)})
same => n,return