We have a Setup with Asterisk 17, AudioSocket and ARI where the caller talks with a bot and the call is recorded. The record and the playback is always working but we observe that sometimes AudioSocket is never sending any audio/media, right from the beginning of a call, although every component is initialised. So in this case we never hear what the caller is saying.
It always works when testing alone but the likelihood of the problem increases when there are many calls.
Example 1
Setup:
- original pjsip channel created on stasis start
- create channel AudioSocket
- create bridge
- add original pjsip channel to bridge
- add AudioSocket channel to bridge
- record on bridge (the whole call)
- playback on bridge (when bot is talking)
Observation:
- 1000 calls per hour → 7 fails = 0.7%
- 49 calls per hour → 0 fails = 0%
Example 2 (really bad)
Setup:
- original pjsip channel created on stasis start
- create snoop channel (spy in) from original channel
- create AudioSocket channel
- create bridge
- add snoop channel (spy in) to bridge
- add AudioSocket channel to bridge
- create snoop channel (spy both)
- record on snoop channel (spy both) (the whole call)
- playback on original pjsip channel (when bot is talking)
Observation:
- 1000 calls per hour → 198 fails = 19,8%
- 161 calls per hour → 8 fails = 4.97%
- 24 calls per hour → 0 fails = 0%
Sure, we could
- update to the latest Asterisk version
- or try ExternalMedia
- or try another setup
but it would take time and might lead to the same bad results.
I know playback and record can block AudioSocket when applied wrong, so I guess the start of parallel calls might mix up some critical order of events, that is unknown to me.
It is really important to understand what is going on behind the scenes.
Could someone explain the internal mechanism that leads to this behavior?