Setting up Streaming an Asterisk Channel

From Alpine Linux
This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Sinux.ch on 8 Mar 2014.)

Streaming an Asterisk Channel HOW-TO

Introduction

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 :

apk add asterisk

As we are planning to use MeetMe functions we also need a timer :

apk add dahdi-linux dahdi-linux-grsec asterisk-dahdi

We then need to make sure the module is loaded at startup:

echo dahdi >> /etc/modules

Asterisk runs by default under the asterisk user. The dahdi pseduo device's owner is root. We need to change that :

chown asterisk:root /dev/dahdi/*

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 :

rc-update add asterisk

Optionnaly we could install the samples for asterisk :

apk add asterisk-sample-config

Don't forget to reboot to load the dahdi modules (see note above).

Setup Icecast Ices Source

There is no package yet build for Ices. So we need to compile it from the source. For that we need the compiler's package :

apk add alpine-sdk

Then we need the appropriate dependencies for ices to compile :

apk add libshout libshout-dev libogg libogg-dev libvorbis libvorbis-dev libxml2 libxml2-dev

We get the source code :

cd /root wget http://downloads.us.xiph.org/releases/ices/ices-2.0.2.tar.gz

Decompress :

tar -zxvf ices-2.0.2.tar.gz

Compile and install :

cd ices-2.0.2 ./configure make make install

Setup Icecast2 Service

Using Media Players

More Information