Hi everyone,
I’m experiencing an issue with ARI playback control when the system is under moderate to heavy load (30-150 concurrent calls). I’m hoping someone can help me understand if this is expected behavior or if there’s a better approach.
Setup
- Asterisk Version: 22.6.0
- Using ARI via WebSocket for event handling
- Python client with connection pooling (requests.Session)
- Calls originate via AMI, then enter Stasis application
The Problem
When a channel is playing audio via /channels/{channel}/play and I try to stop it with DELETE /playbacks/{playback_id}, the DELETE request returns success (204) almost immediately (1-3ms), but the audio continues playing until it finishes naturally - sometimes 10+ seconds later.
This only happens under load. With 1-5 concurrent calls, stopping playback works instantly. With 30+ concurrent calls, it’s completely unreliable.
What I’ve Tried
-
Different stop methods:
-
DELETE /playbacks/{id}- doesn’t work under load -
DELETE /channels/{channel}/play- also doesn’t work under load -
Both return success but Asterisk seems to queue the command
-
-
Optimizations:
-
HTTP connection pooling with requests.Session
-
Async/threaded API calls to avoid blocking
-
Ultra-short timeouts (0.5-1s)
-
Immediate state transitions before calling API
-
Questions
-
Is this expected behavior when Asterisk is under load? Should DELETE requests to stop playback be queued rather than processed immediately?
-
Is there a way to make playback stop commands higher priority in ARI?
-
Should I be using a different approach entirely for DTMF-interruptible playback when handling many concurrent calls?