I’m working on an IVR system and wondering how to play multiple audio files in sequence, based on a provided list—while also allowing termination on specific digit input.
For example, I want to play the following menu:
{for} {sales} {press} {1}
{for} {account} {press} {2}
{for} {tech support} {press} {3}
Ideally, I’d like to call a single API that accepts:
A list of media files to be played in order, and
A set of acceptable DTMF digits (e.g., 1, 2, 3).
While the audio is playing, if a valid digit is pressed, playback should stop immediately, and I should be able to detect which digit was pressed.
Currently, I have to:
Call the API separately for each menu chunk,
Monitor for digit input after each call, and
Manually stop the playback when a digit is detected.
This approach works, but it feels inefficient. I’m looking for a better way to handle this flow using a single API call, if possible.