Setting up Streaming an Asterisk Channel
This material is work-in-progress ...
Do not follow instructions here until this notice is removed.
Streaming an Asterisk Channel HOW-TO
The Asterisk is well known as VoIP service. Obviously, the nature of VoIP technology requires a real time communication, which makes certain requirements to a network connectivity layer in such regards as link speed/bandwidth, IP packet prioritization/control and network latency.
In some cases it is desireable to provide at least one way communication possibility. For example, this idea could be used to give an ability at least "to listen" to a corporate work meeting/conferece, which is organized by means Asterisk MeetMe conference feature to those Remote Locations that still have relatively poor network connectivity layer with a Head Office. Another application is streaming an Asterisk channel to the Internet.
How does it work?
The Asterisk is used with conjunction with sound streaming software such as Icecast2 server. The streaming technology provides "caching/buffering" capabilities. So broadcasted/recieved sound is being buffered, which helps overall sound quality to remain high surviving most of problems in network bandwidth and latencies.
The Asterisk system places an automatic call to connect two extensions. One extension provides an Asterisk channel sound (MusicOnHold, Playback, MeetMe adn etc.), the second one starts the Asterisk Ices application and merges sound to it. The Ices Application depends on Icecast Ices, which is a source of sound to Icecast2 service.
After sound is merged to Icecast Service by means Icecast Ices and Asterisk Ices Applications it could be listened as ogg sound stream by WinAmp, VLC media players. The stream cache parameter should be ajusted according local needs to achieve the acceptable sound quality.
Setup Asterisk Ices Application
First of all, we need to install asterisk :
As we are planning to use MeetMe functions we also need a timer :
We then need to make sure the module is loaded at startup:
Asterisk runs by default under the asterisk user. The dahdi pseduo device's owner is root. We need to change that :
Note : every time you'll reboot the rights will be reset. So you need to put that command into a script that runs after a startup.
Finally add asterisk as a startup service :
Optionnaly we could install the samples for asterisk :
Don't forget to reboot to load the dahdi modules (see note above).
Setup Icecast Ices Source
Ices2 package is in Edge/testing repository (see http://wiki.alpinelinux.org/wiki/Edge to activate it).
Alternatively you can compile it from the source. For that we need the compiler's package :
Then we need the appropriate dependencies for ices to compile :
We get the source code :
Compile and install :
Setup Icecast2 Service
There is already a package build for Icecast2 :
We add Icecast server at startup :
Edit /etc/icecast.xml to your needs.
Icecast runs by default as Icecast user. In some cases it might be usefull to run as Asterisk user :
And change these settings in icecast.xml :