Hi everyone,
I am running a Stasis application for a voicebot using Asterisk ARI and Node.js. Everything is working well—the bot answers calls, processes speech, and responds in real-time.
Now, I want to add background ambient sound (e.g., office noise) while the conversation is ongoing to make it sound more natural.
Issue:
I tried playing the sound using Playback()
on the same channel, but it blocks further execution until the sound completes. This causes the bot to get stuck until the background sound finishes, which is not the intended behavior.
What I Tried:
- Playing sound in the same channel
- Used
channel.play({ media: "sound:office-background" })
→ This blocks the conversation.
- Used
- Playing sound in a bridge
- Added the main caller and played audio inside the bridge.
- Still, the bot’s speech processing was delayed.
- Using a Local channel to play the sound
- Created a
Local/5001
extension that plays the sound and added it to the bridge. - It works but causes high voice queue warnings (
Exceptionally long voice queue length (97 voice / 100 total)
).
- Created a
Question:
Is there a better way to continuously play background sound without interfering with the ongoing conversation?
Any suggestions or best practices for handling this in ARI?
Thanks in advance!