Setting up Streaming an Asterisk Channel

From Alpine Linux
This material is proposed for deletion ...

Draft for more than two year (Discuss)
Make sure no other pages link here and check the page's history before deleting.

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Sertonix on 25 Aug 2023.)

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-load.d/dahdi.conf

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

Ices2 package is in Edge/testing repository (see Edge to activate it).

apk add ices2

Alternatively you can 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-dev libogg-dev libvorbis-dev 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

There is already a package build for Icecast2 :

apk add icecast

We add Icecast server at startup :

rc-update add icecast

Edit /etc/icecast.xml to your needs.

Todo: Add sample config here


Icecast runs by default as Icecast user. In some cases it might be usefull to run as Asterisk user :

chown -R asterisk:asterisk /var/log/icecast* chown -R asterisk:asterisk /usr/local/share/icecast*

And change these settings in icecast.xml :

Contents of /etc/icecast.xml

<changeowner> <user>asterisk</user> <group>asterisk</group> </changeowner>
Note: Note : If you are planning on using the <authentication type=url> option, make sure you install the package version icecast≥2.3.3-r7 in edge repositories (to install edge repository see Edge ).

Using Media Players

More Information