Unidirectional and Bidirectional Audio Streaming via WebSocket from Asterisk to External Media

We are exploring the possibility of streaming audio from Asterisk to an external media server using WebSocket. Specifically, we want to achieve:

  1. Unidirectional streaming: Streaming audio from Asterisk as soon as legA picks up the call.
  2. Bidirectional streaming: If feasible, enabling audio flow in both directions between Asterisk and the external media.

Initially, our focus is on unidirectional streaming, but we would like to understand if bidirectional streaming is achievable and how it can be implemented.

Use Case for Bidirectional Streaming:
We need bidirectional streaming to allow real-time interaction with an external agent or bot. The external media server should be able to:
Receive the audio stream from Asterisk (caller’s voice).
Process the audio and send a response back (e.g., bot-generated speech or agent reply) through Asterisk to the caller.

Questions:

  • What configurations or modules in Asterisk are needed for unidirectional streaming via WebSocket? We are currently using ari-client NPM library.
  • If bidirectional streaming possible, and what additional steps or considerations are required to enable it?

We would greatly appreciate any guidance, examples, or documentation references to help us move forward.

I would suggest looking through the forum, searching, looking in the API category, because this comes up at a minimum weekly and responses have been given before and people have provided their input.

1 Like