Asterisk cmd Ices
Created by: JustRumours,Last modification on Tue 21 of Mar, 2006 [21:58 UTC] by brandon.turok
ICES
How to configure ices2
From: "Barton Hodges" <barton at gcmcomputers dot com>
To: <asterisk-users at lists dot digium.com>
Subject: [Asterisk-Users] Streaming calls to the Internet - A Mini How-To
Date: Thu, 11 Mar 2004 10:19:52 -0600
I was searching for a way to stream Asterisk channels onto the Internet, but never found a source that described the steps. This is a very rough mini how-to. You cannot simply cut and paste all of the code below without modifications to suit your needs. Feel free to modify, improve, etc. :)
Install, configure, and start Icecast (http://www.icecast.org/)
Install Ices2 (http://www.icecast.org/ices.php)
Modify asterisk/contrib/asterisk-ices.xml as needed.
Modify musiconhold.conf, meetme.conf and extensions.conf
musiconhold.conf:
random => quietmp3:/var/lib/asterisk/mohmp3,-z
meetme.conf:
[rooms]
conf => 104
conf => 104
extensions.conf:
[stream]
; Conference Room
exten => 100,1,Answer
exten => 100,2,Wait(1)
exten => 100,3,MeetMe(104)
; Music On Hold
exten => 101,1,Answer
exten => 101,2,Wait(1)
exten => 101,3,MusicOnHold(random)
; Stream
exten => 102,1,Answer
exten => 102,2,Wait(1)
exten => 102,3,Ices(/some/where/asterisk-ices.xml)
; Conference Room
exten => 100,1,Answer
exten => 100,2,Wait(1)
exten => 100,3,MeetMe(104)
; Music On Hold
exten => 101,1,Answer
exten => 101,2,Wait(1)
exten => 101,3,MusicOnHold(random)
; Stream
exten => 102,1,Answer
exten => 102,2,Wait(1)
exten => 102,3,Ices(/some/where/asterisk-ices.xml)
Create 2 files, moh.call and stream.call:
moh.call:
Channel: Local/101@stream
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: stream
Extension: 100
Priority: 1
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: stream
Extension: 100
Priority: 1
stream.call:
Channel: Local/102@stream
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: stream
Extension: 100
Priority: 1
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: stream
Extension: 100
Priority: 1
Now, move the 2 .call files to /var/spool/asterisk/outgoing:
mv moh.call /var/spool/asterisk/outgoing
mv stream.call /var/spool/asterisk/outgoing
Connect to your Icecast stream and you should hear your MusicOnHold music.
Other people can join the conference by dialing x100, and their voices will stream too.
Barton
Configuration notes
If ices is complaining about broken pipe errors from within asterisk, you may need to create a symlink from "ices" to "ices2" in your /usr/local/bin directory.See also
Go back to Asterisk

Comments
333This is how you would save/record mp3 streams
In the step 6 above of creating mp3 streams, use the following script and rename it as ices as mentioned in that step.
"lame -r -x -s 8 -m mono --preset cbr 64 - - 2> /dev/null | tee filename | ezstream -qvc $1"
The unix 'tee' command will save the mp3 audio to a file called 'filename' as well send it to stdout.
333This is how you would save/record mp3 streams
In the step 6 above of creating mp3 streams, use the following script and rename it as ices as mentioned in that step.
"lame -r -x -s 8 -m mono --preset cbr 64 - - 2> /dev/null | tee filename | ezstream -qvc $1"
The unix 'tee' command will save the mp3 audio to a file called 'filename' as well send it to stdout.
333yeah, but what about mp3 streams?
(1) if you havent done so already, download and install lame (the mp3 encoder). make sure you read the licensing info at the end of the faq on their web page.
(2) download an install ezstream.
(3) create a config file for ezstream, call it asterisk-ezstream.xml, with this contents:
<!-- used for mp3 streaming from asterisk, input source is lame output -->
<ezstream>
<!-- icecast server data -->
<url>http://my.server.com:8000/mountpoint</url>
<sourcepassword>xXxXx</sourcepassword>
<format>MP3</format>
<!-- we get the input from stdin -->
<filename>stdin</filename>
<!-- stream information - personalize this -->
<svrinfoname>dude, i'm streaming audio from asterisk!</svrinfoname>
<svrinfourl>http://my.website.com</svrinfourl>
<svrinfogenre>bs</svrinfogenre>
<svrinfodescription>blah blah</svrinfodescription>
<!--
<svrinfobitrate>64</svrinfobitrate>
<svrinfochannels>1</svrinfochannels>
<svrinfosamplerate>8000</svrinfosamplerate>
-->
<svrinfopublic>0</svrinfopublic>
</ezstream>
(4) asterisk's app_ices sends the audio output (pcm samples) to stdout. these will be encoded to mp3 with lame. lame will also send its output to stdout, and ezstream will take over to feed it to your icecast server.
(5) asterisk's app_ices hardcodes the name of the application to call. it expects an executable called ices in /usr/bin/ or /usr/local/bin/ so we have to make it happy. therefore instead of launching the real ices, we will replace it with a script. well, ok, this doesnt sound very nice, so later on you may want to transform app_ices into app_streaming, get a choice of the application you want to run, have a different name to put in extensions.conf for it, and so on. for this quick and dirty demo though, read on.
(6) create a script in /usr/local/bin/
lame -r -x -s 8 -m mono --preset cbr 64 - - 2> /dev/null | ezstream -qvc $1
name it "ices" and chmod and chown it to make it executable.
(7) replace the name of the file in exten => 103,2,... in barton's example with the path and filename of your ezstream config file, and do an extensions reload.
(8) do that trick with generating the calls.
(9) point your browser to the ices server. according to the ezstream config file above, the url should be http://my.server.com:8000/mountpoint.m3u (notice the m3u at the end).
(10) enjoy the sound of elevator music.
333volume problems
The only issue I've been finding is that the volume level is very low - it's audible, but it's much quieter to listen to the channel via icecast than over the normal asterisk channels (dialing in to the same meetme conference). Any idea what could be the problem here? Or is there a way to boost the volume?