ARI and AudioSocket

Hello Everyone,

I have researched this question for a long time and haven’t come up with anything so I am hoping a guru here will be able to shed some light on this.

I have written a Stassis application that uses ExternalMedia + AudioSocket to do to speech recognition. Everything is working very well. I’ve written a simple echo application that uses speech-to-text to capture and then uses text-to-speech to repeat it back. It works nicely

However the problem that I am running into is that while my recording is playing back on the channel. Asterisk stops sending audio to the audiosocket. Only while the audio is playing. It resumes once the recording is done. I confirmed that it really is not sending any audio by doing a packet trace on the audiosocket port.

The result is that anything the caller says while the recording is playing is not captured.

I am playing the recording on the caller’s channel, not the bridge. If I play the recording on the bridge the recording audio is echo’d back to the AudioSocket and the speechdetection hears itself which is not good.

How can I play a recording on the channel without it blocking the audiostream to my AudioSocket?

I hope someone has come across this before
Thanks

I think I’ve answered this two or three times already. The short answer is (and you can search for the other forum threads) is that if you play back something to a channel it leaves the bridge temporarily, so no more audio. If you want to inject audio to the channel while it is in a bridge you would use a Snoop channel that you then play back to.

Thank you so much for answering, I searched for hours and didn’t find anything. Now of course searching with keyword ‘snoop’ I am finding all the relevant posts. Thanks very much for your help

Thank you again for the advice and it definitely got me pointed in the right direction but I am still not getting this to line up right.

The flow in my application is

  • Call enters stassis
  • Create an ExternalMedia channel
  • Create a bridge
  • Put Caller Channel and ExternalMedia channel in bridge
  • Play a welcome message on the Bridge
  • Create snoop channel on Caller Channel
  • Whisper to Caller Channel

Is this the correct flow? In the last step, when I try to whisper, the caller does not hear anything. But if I play audio to the bridge or the caller channel they hear it.

At a high level yes, though that’s not that deep to verify if you’re doing everything right.