# Asterisk MusicOnHold Notes (Streaming and Classic Hold)
# Asterisk MusicOnHold Notes
## Basic Information
The way custom applications work with Asterisk, from my very very basic functional perspective is it expects 8khz audio on stdin. So if you had a binary called "audioplayer" that played audio to stdout as raw 8khz samples; then you'd just have to call that binary as a custom application in your musiconhold configuration: (Actually if you don't use format=mulaw with mplayer...it breaks)
That's it. Provided it only literally sent data to stdout; this would work. But as I alluded to in the example; such a thing doesn't exist. Thankfully shell scripts count as applications and as long as we ultimately get some audio to stdout; it will work.
### Caller-Selectable MusicOnHold
If you have multiple musiconhold streams; you can configure them so the caller can change the current channel from the keypad.
```
digit=
```
Add this option to your musiconhold class configuration, and select a single DTMF digit (I've not tested * or # but should work). When the caller is on hold; pressing the appropiate digit will instantly switch the channel.
### Icecast/Shoutcast Source Streams
This would be a lot easier if mplayer supported stdout; **but it doesn't**. So in order to make this work we need to make a named pipe, write to that pipe, and then somehow pipe the pipe to stdout.