Woodsy
Woodsy

Reputation: 3377

Asterisk increase timeout between dtmf tones

I'm working on a dial plan where a user is prompted for a 4 digit number the below dialplan works fine for what I need under normal conditions. The problem occurs when a user takes longer than 5 seconds to hit the next dtmf tone.

Example user presses 111(waits > 5 seconds) I am prompted to the invalid audio track and repeat the process. Is there a way to increase the timeout to say 10 seconds?

[Example_IVR_Start]
exten => s,1,Verbose(1, Starting the IVR example)
        same => n,Set(CORRECTNUM=1111)    
        same => n(menu),Background(example_start)
        same => n,WaitExten(5)
        same => n,Background(long_silence)
        same => n,Goto(Timeout_hangup,s,1)
exten => _XXXX,1,GotoIf($[${EXTEN}=${CORRECTNUM}]?Example_IVR_TWO,s,1:i,invalid)
exten => *,1,Goto(s,menu)
exten => i,1(invalid),Playback(invalid)
exten => i,n,Goto(s,menu)
exten => t,1,Goto(Timeout_hangup,s,1)

Upvotes: 0

Views: 1643

Answers (2)

arheops
arheops

Reputation: 15257

Yes, you have function timeout

TIMEOUT(digit) - set timeout between keypress
TIMEOUT(absolute) - set overal timeout before hangup(not forget reset after input done).

https://wiki.asterisk.org/wiki/display/AST/Function_TIMEOUT

Upvotes: 1

Woodsy
Woodsy

Reputation: 3377

Fixed, calling TIMEOUT(digit) before Background fixes allows you to adjust the TIMEOUT period.

[Example_IVR_Start]
exten => s,1,Verbose(1, Starting the IVR example)
    same => n,Set(CORRECTNUM=1111)    
    same => n,Set(TIMEOUT(digit)=10) ;needs to come before Background
    same => n(menu),Background(example_start)
    same => n,WaitExten(5)
    same => n,Background(long_silence)
    same => n,Goto(Timeout_hangup,s,1)
exten => _XXXX,1,GotoIf($[${EXTEN}=${CORRECTNUM}]?Example_IVR_TWO,s,1:i,invalid)
exten => *,1,Goto(s,menu)
exten => i,1(invalid),Playback(invalid)
exten => i,n,Goto(s,menu)
exten => t,1,Goto(Timeout_hangup,s,1)

Upvotes: 0

Related Questions