Mod shell stream is a module to allow you to stream audio from an arbitrary shell command. You could use it to read audio from a database, from a soundcard, etc.
To use it, you call it from the dialplan like this:
Now, when this application is triggered, the command /tmp/moh is called with 2 arguments -r <rate> and -c <channelcount>, which in the usual case are 8000 and 1 respectively.
The contents of my sample /tmp/moh script is as follows:
Which cats an audio file into sox on stdin and tells sox to output raw audio at 8000hz, 1 channel to stdout. You could of course replace the cat command with anything that outputs audio and use sox to process it into the requested raw output.
You can also pass arguments to the command, by doing something like this:
And the corresponding script becomes:
Basically the sky is the limit, if you're willing to write the script or program to do what you need.