exten => s,1, GotoIfTime(8:00-20:00,mon-fri,*,*?ivr-main,s,1)
exten => s,n, GotoIfTime(8:00-17:00,sat,*,*?ivr-main,s,1)
exten => s,n, GotoIfTime(10:00-15:00,sun,*,*?ivr-main,s,1)
exten => s,n, Playback(nonworkinghours)
exten => s,n,Goto(autoanswer,s,1)
exten => s,n, HangUp()
TOTALSOUNDS = 20
CURRENTSOUND = 1
[context]
exten => _X.,1,GotoIf($[${CURRENTSOUND} <= ${TOTALSOUNDS}]?sound-plus)
exten => _X.,n,Set(GLOBAL(CURRENTSOUND)=1)
exten => _X.,n(sound-plus),Set(GLOBAL(CURRENTSOUND)=$[${CURRENTSOUND}+1])
exten => _X.,n,Playback(${CURRENTSOUND})
exten => _X.,n,Hangup()
$sound = 'enter_digits_and_press_#'; //файл со звуковым сообщением
$timeout = 20000; //таймаут для ввода DTMF - 20 секунд (в миллисекундах)
$max_dtmf_input = 10; //разрешить максимум 10 символов DTMF
$dtmf = $agi->get_data($sound, $timeout, $max_dtmf_input);
$code = $dtmf['result']; //строка с введенными цифрами
dtlsenable=yes