DTMF мучения и развлечения
Добавлено: 06 дек 2013, 15:17
Может кому-то пригодится: http://wapo-spb.livejournal.com/24902.html
Код: Выделить всё
[calc]
exten => s,1,Answer
exten => s,n,Wait(1)
exten => s,n,Background(please-enter-your)
exten => s,n,Read(Num1,vm-press,0,i,2,5)
exten => s,n,Background(vm-received)
exten => s,n,Read(Znak,vm-press,1,i,2,5)
exten => s,n,GotoIf($["${Znak}" = "1"]?:continue1)
exten => s,n,Set(ZNAK=+)
exten => s,n,Goto(s,continue4)
exten => s,n(continue1),GotoIf($["${Znak}" = "2"]?:continue2)
exten => s,n,Set(ZNAK=-)
exten => s,n,Goto(s,continue4)
exten => s,n(continue2),GotoIf($["${Znak}" = "3"]?:continue3)
exten => s,n,Set(ZNAK=*)
exten => s,n,Goto(s,continue4)
exten => s,n(continue3),GotoIf($["${Znak}" = "4"]?:end)
exten => s,n,Set(ZNAK=/)
exten => s,n,Goto(s,continue4)
exten => s,n(continue4),Background(vm-received)
exten => s,n,Read(Num2,vm-press,0,i,2,5)
exten => s,n,Background(vm-received)
exten => s,n,Set(Otvet=$[${Num1}${ZNAK}${Num2}])
exten => s,n,NoOp(${Otvet})
exten => s,n,NoOp(${Num1}${ZNAK}${Num2}=${Otvet})
exten => s,n,SayNumber(${Otvet})
exten => s,n,System(echo "${Num1}${ZNAK}${Num2}=${Otvet}" | mail -s "Calc" nickel@xxxxx.ru)
exten => s,n,Wait(3)
exten => s,n(end),Playback(tt-monkeys)
exten => s,n,Hangup
Код: Выделить всё
[Ded-Moroz]
exten => s,1,Answer ; поздравление от Деда Мороза
exten => s,n,Wait(1)
exten => s,n,Set(Fail=${RAND(1,3)})
exten => s,n,NoOp(${Fail})
exten => s,n,System(echo "${Fail}" | mail -s "Новый год" nickel@xxxxx.ru)
exten => s,n,Playback(/nickel/wav/ng/${Fail})
exten => s,n,Hangup