The option ‘y’ allows to interrupt the recording if any DTMF digit is pressed. How can I know which digit was pressed?
I believe “RECORD_STATUS” just says “DTMF” without specifying the actual digit.
I’m trying to set up an IVR with voice recognition. It’s a bit like this:
playback(For foo, press 1 or say foo after the beep.)
playback(For bar, press 2 or say bar after the beep.)
playback(For operator, press 0 or say operator after the beep or please hold.)
Record(tempfile.wav,2,10,y)
agi(menu1.agi,${CHANNEL(language)},"wav","${RECORDED_FILE}","${RECORD_STATUS}")
[etc]
The AGI script then uses Vosk to convert the audio file into a string. From there I can match keywords and send instructions back to the dialplan.
First of all, any suggestions on how to improve this (maybe with a completely different approach)? I would really like to remove the “after the beep” message, but I don’t know if there’s a way to transcribe the channel’s audio to text “at all time” even while a message is being played back – as with playback or background (ie. record whenever there’s “noise” then pause when silence detected so the recording can be processed, then resume recording until next pause/silence, etc. – oh, and if there are any digits pressed then send them too so they can be processed). All this sounds like it should be in its own process - a bit like a ChanSpy app, processing audio on-the-go but within the same dialplan channel logic so as to control the call’s behavior.
Second, if Record cannot reliably give me the dialed digit then I will obviously not be able to do the “or press WHATEVER” options above.