user-inputasteriskivragi

Asterisk hangs up if caller inputs number early


We have an Asterisk IVR system setup that prompts the user for input

In our extensions file, we have the following:

[englishprocess]
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,Set(TIMEOUT(digit)=2)
exten => s,n,agi(mstts.agi,"Please enter your ID number followed by pound.",en-US)
exten => s,n,Read(APCODE,,666)
exten => s,n,agi(mstts.agi,"Your ID Number is",en)
exten => s,n,SayDigits(${APCODE})
exten => s,n,agi(mstts.agi,"If this is correct press, 1, otherwise, press, 3",en-US)
exten => s,n,Read(CHECK,,1)
exten => s,n,GotoIf($["${CHECK}" = "3"]?englishprocess,s,1)
exten => s,n,Set(MYADDR=${CURL(webserviceaddress.php?idnum=${APCODE})})
exten => s,n,agi(mstts.agi,${MYADDR},en-US)
exten => s,n,Hangup()

The problem is that if the user inputs their ID before the text to speech prompt finishes, or if they hit 1 before it finishes saying

"If this is correct press, 1, otherwise, press, 3"

The service hangs up.

How can we keep the process the same and accept early user input?

If accepting user input early is not possible is there a way to prevent hangup and prompt again?


Solution

  • We switched to Amazon's Polly service to generate the sound files and used the asterisk method Playback(filename) instead of agi() inside of extensions_custom.conf in order to stop the call from hanging up if the user inputs text prematurely.

    Granted the service ignores the inputs that are put in early, but at least it does not hang up. A better solution would accept early input. I'll update this if I find an alternative.

    Edit: Found an alternative Read() which lets us play soundbites that can be interrupted, so we now have a mix of Read() and playback() calls and can control which sound files can be skipped by the user in this way. The service no longer hangs up on users and we no longer use agi() calls.