How to interrupt a stream with XAPI

Thorn

Platinum Distributor
Advanced Certified
Joined
Mar 25, 2019
Messages
15
Reaction score
2
We are developing a Voice Agent application running on 3CX using XAPI, and we’ve encountered an issue that is not addressed in the documentation.

Specifically, we are using the endpoint /callcontrol/{dnnumber}/participants/{id}/stream to stream audio to a participant. The audio playback works as expected; however, once audio streaming has started, we are unable to interrupt or stop the playback when an interruption occurs.

For example, if the AI Agent generates a 5-second audio response and we stream this to the participant, but the participant asks a new question at the 3-second mark, we need to immediately stop the currently playing audio. Unfortunately, there is no API endpoint that allows us to cancel or interrupt an ongoing audio stream.

We attempted a workaround by sending a 2–3-second silent audio chunk while the original audio was still playing, but this does not stop the existing audio. Instead, it is simply appended to the end of the current playback queue.

We would appreciate your guidance on whether there is a recommended solution or an undocumented method to interrupt or cancel an audio stream in this scenario.

Thank you in advance for your support.
 
Have you investigated whether the build in AI agents in the upcoming update 8 might serve your requirements better, with their tighter integration to the PBX? It does pause when speaking if the caller talks.
 
  • Like
Reactions: Evolute IT
Unfortunately, the AI Agents feature does not meet our needs, as we are developing our own fully custom AI solution that integrates multiple systems. For this reason, we need to resolve the issue using XAPI or an alternative method that can address the problem we are facing.
 

Latest Posts

Forum statistics

Threads
111,953
Messages
589,916
Members
164,851
Latest member
DrunkeMeister