-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.conf
26 lines (22 loc) · 1.21 KB
/
main.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
[talk-bot-manned]
exten => lenny,1,Gosub(talk-bot-core,init,manned(lenny,16,7))
[talk-bot-unmanned]
exten => lenny,1,Gosub(talk-bot-core,init,unmanned(lenny,16,7))
[talk-bot-core]
exten => init,1(manned),Set(MANNED=1)
same => n,Answer()
same => n,While($["${STARTNUM}"!="0"&${LEN(${STARTNUM})}<2])
same => n, WaitDigit(${IF($[${LEN(${STARTNUM})}>0]?0.5:1.5)},0123456789)
same => n, ExecIf($["${WAITDIGITSTATUS}"=="DTMF"]?Set(STARTNUM=${STARTNUM}${WAITDIGITRESULT}):ExitWhile())
same => n,EndWhile()
same => n(unmanned),MixMonitor(${UNIQUEID}.wav)
same => n,Set(STARTPRI=${IF($["${STARTNUM}"=="0"]?listen:1)})
same => n,Set(STARTNUM=${IF($["${STARTNUM}"==""|"${STARTNUM}"=="0"]?1:${STARTNUM})})
same => n,Set(STARTNUM=${IF($[${STARTNUM}>${ARG2}]?${ARG2}:${STARTNUM})})
same => n,Gosub(talk,${STARTPRI}(${ARG1},${ARG2},${ARG3},${STARTNUM}))
exten => talk,1,Set(i=${IF($[0${i}==0${ARG2}]?${ARG3}:$[0${i}+${IF($["${i}"==""]?${ARG4}:1)}])})
same => n,Playback(talk-bot/${ARG1}/${i})
same => n(listen),BackgroundDetect(talk-bot/silence,1500)
exten => #,1,GotoIf($[${MANNED}==1]?talk,1:talk,listen)
exten => *,1,ExecIf($[${MANNED}==1]?WaitDigit(1500,#):Goto(talk,listen))
same => n,GotoIf($["${WAITDIGITRESULT}"=="#"]?#,1)