Top

Asterisk 1.4 : Gentoo Cepstral/Swift Howto using App_Swift

November 30, 2006

There has been lots of recent talk about getting app_cepstral to work with Asterisk 1.4 on the users mailing list. I decided it was time for me to get it working again, and I found that app_cepstral is now depreciated in favour of app_swift. Which actually works out of the box with Asterisk 1.4. Continue reading for the howto!',0,0,'1. First, I downloaded Cepstral (8Khz Telephone Version)

# wget http://downloads.cepstral.com/cepstral/i386-linux/Cepstral_David-8kHz_i386-linux_4.1.4.tar.gz

2. Then, I untarred the file into a new directory

# mkdir /opt/asterisk-other# mv /root/Cepstral_David-8kHz_i386-linux_4.1.4.tar.gz /opt/asterisk-other# cd /opt/asterisk-other# tar xzvf Cepstral_David-8kHz_i386-linux_4.1.4.tar.gz# cd Cepstral_David-8kHz_i386-linux_4.1.4

3. Now, we\'ll install Cepstral per it\'s installer

# ./install.sh

4. Since we are running gentoo, adding /opt/swift/lib to /etc/ld.so.conf isn\'t enough, we must also add it to another file to make sure it stays upon reboot:

# echo \"/opt/swift/lib\" >> /etc/ld.so.conf# nano /etc/env.d/00basicchange LDPATH=\"/usr/local/lib\"toLDPATH=\"/usr/local/lib:/opt/swift/lib\"# ldconfig -v

5. Now, instead of using app_cepstral, lets try App_swift instead

# cd /opt/asterisk-other# wget http://www.loopfree.net/app_swift/app_swift-0.9.1.tar.gz# tar xzvf app_swift-0.9.1.tar.gz

6. Now, we must compile App_Swift

# cd /opt/asterisk-other/app_swift-0.9.1# make && make install

7. Now you should have app_swift in /usr/lib/asterisk/modules, and swift.conf in /etc/asterisk8. Now, stop asterisk, and start it in debugging mode to ensure all is well

# /etc/init.d/asterisk stop # asterisk -vvvvvvvvvvvgc >> show application swift

9. You should see some output from the application on the Asterisk Cli. If you did, success! Otherwisego and try these steps again. 10. Now, in order to test this out, add something like this to your dialplan, and restart asterisk

exten => 8282,1,Wait(2) ; give it 2 seconds to open the lineexten => 8282,2,Swift(Yay we have cepstral working with asterisk)

11. Remember that Cepstral isn\'t free, if you\'d like to get rid of the annoying license message, then go buy a key from cepstral, and register your product.

# swift --register

12. That\'s it!

Digium releases AsteriskNow

November 27, 2006

From the site:

AsteriskNOW Version 1.4.0 Beta 1

The most popular open source PBX software, Asterisk?, can now be easily configured with a graphical interface. AsteriskNOW? Beta is a Software Appliance; a GUI implementation with the open source Asterisk distribution. AsteriskNOW includes all the Linux components necessary to run, debug and build Asterisk, and only those components, so installation is easy. You no longer have to worry about kernel versions and package dependencies. Unlike other Linux distributions used to deploy Asterisk, no unnecessary components that might compromise security or performance are included.

The AsteriskNOW site is under development and will offer additional information with the final release. The Asterisk Community, the top influencer of VoIP, is welcome to provide feedback for improvements and enhancements for the Software Appliance.

Try it out here: http://www.asterisknow.org/

-biz: New MWI Routines Posted

November 26, 2006

I just posted my MWI routines, subject to GNU, GPL. They will set or reset
the MWI light based on an extension number. Also you can cron a job to fix
all MWI lights based on the current voicemail status for all extensions with
the final script I enclosed.

http://www.siliconvp.us/index.php

:-)

Asterisk 1.4 : GUI, MYSQL CDR, Gentoo Howto

November 26, 2006

Asterisk 1.4 Gentoo From Scratch Howto

Matt Gibson
Flewid Inc : www.flewid.ca

I wanted to upgrade my PBX from 1.2 to 1.4, and during the process decided to format my box, and start fresh from Gentoo 2006.1. I\'ve documented the process here for everyone to help with getting Asterisk 1.4 working, including the GUI if you want it. I run Asterisk from command line, with a local Apache Daemon, and MYSQL running for Callerid Storage. Readon!

Prerequisites:

  • Gentoo Universal or Minimal Installation CD
  • Computer
  • Some Time
  • Internet Connection
  • Apache Web Server 2.0
  • Unixish Operating System, In this case Gentoo Linux 2006.1

The Howto :

1. First I installed Gentoo the standard way. I started with 2006.1 and did a stage3 installation. Following that I sync\'d world, installed the basic apps, and started sshd. If you need to know more information about this, check out http://www.gentoo.org. Gentoo is beyond the scope of this document.

2. I then entered the /opt directory and created my asterisk directory.

# cd /opt
# mkdir asterisk

3. Then I grabbed the Files required to install Asterisk

# wget \\

http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.0-beta3.tar.gz

# wget \\

http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.0-beta2.tar.gz

# wget \\

http://ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.0-beta2.tar.gz

4. I then Installed the pre-requisits

# emerge -uvD gnutls
# echo "dev-libs/iksemel gnutls" >> /etc/portage/package.use
# emerge -uvD iksemel
# emerge -uvD newt
# emerge -uvD uw-imap (for asterisk imap voicemail storage)
# emerge -uvD mysql (for cdr storage and realtime if wanted later on)
# emerge -uvD subversion (to download new asterisk GUI)

5. Since I will be using SpanDSP I got it Installed as well

# echo "media-libs/spandsp ~x86" >> /etc/portage/package.keywords
# emerge -uvD spandsp

6. Now we can begin compiling zaptel, asterisk and asterisk addons.

# tar xzvf zaptel-1.4.0-beta2.tgz
# cd zaptel-1.4.0-beta2
# ./configure
# make menuselect
# make
# make install-udev

# tar xzvf asterisk-1.4.0-beta3.tar.gz
# cd asterisk-1.4.0-beta3
# ./configure
# make menuselect
# make
# make install
# make samples (will overwrite anything in /etc/asterisk)

# tar xzvf asterisk-addons-1.4.0-beta2.tar.gz
# cd asterisk-addons-1.4.0-beta2
# make samples (will overwrite anything in /etc/asterisk)

7. Next I enabled the modules I would be needing:

# modprobe zaptel
# modprobe ztdummy

8. Now we must create some init scripts to start asterisk on reboot of the machine if that ever happens. Unlikely, but possible.

9. Then I added my own /etc/init.d/ since we won\'t be using the portage tree for asterisk

#!/sbin/runscript

MODULES="zaptel wcfxo wctdm"

depend() {
need net logger
}

start() {
ebegin "Starting Zaptel"
modprobe zaptel
echo -n "Waiting for zap to come online..."
TMOUT=10 # max secs to wait
while [ ! -d /dev/zap ] ; do
sleep 1
TMOUT=`expr $TMOUT - 1`
if [ $TMOUT -eq 0 ] ; then
echo "Error: missing /dev/zap!"
exit 1
fi
done
echo "OK"
echo -n "Loading zaptel hardware modules:"
for x in $MODULES; do
if modprobe ${x} ${ARGS} >& /dev/null; then
echo -n " $x"
echo -n
fi
done
echo ""
echo -n "Running ztcfg: "
/sbin/ztcfg -vv
echo -n "OK"
echo
eend $? "Failed to start Zaptel"
}

stop() {
ebegin "Stopping Zaptel"
for x in $MODULES; do
rmmod ${x}
done
rmmod zaptel
eend $? "Failed to stop Asterisk"
}

10. Then I added my own /etc/init.d/asterisk script since we won\'t be using portage, just like zaptel.

#!/sbin/runscript

depend() {
need net logger zaptel
}

start() {
ebegin "Starting Asterisk"
/bin/sh /root/own_asterisk.sh
/usr/sbin/asterisk -U asterisk -G asterisk -qg
eend $? "Failed to start Asterisk"
}

stop() {
ebegin "Stopping Asterisk"
kill $(cat /var/run/asterisk/asterisk.pid)
eend $? "Failed to stop Asterisk"
}

11. Then I added the user and group asterisk

# groupadd asterisk
# adduser -d /var/run/asterisk -g asterisk -m -s /sbin/nologin asterisk

12. Then I added my own"ownuser" script that ensures asterisk is owned properly by the correct user and group

# nano /root/own_asterisk.sh

#!/bin/sh
chown --recursive asterisk:asterisk /var/lib/asterisk
chown --recursive asterisk:asterisk /var/log/asterisk
chown --recursive asterisk:asterisk /var/run/asterisk
chown --recursive asterisk:asterisk /var/spool/asterisk
chown --recursive asterisk:asterisk /var/spool/asterisk-fax
chown --recursive asterisk:asterisk /dev/zap
chmod --recursive u=rwX,g=rX,o= /var/lib/asterisk
chmod --recursive u=rwX,g=rX,o= /var/log/asterisk
chmod --recursive u=rwX,g=rX,o= /var/run/asterisk
chmod --recursive u=rwX,g=rX,o= /var/spool/asterisk
chmod --recursive u=rwX,g=rX,o= /dev/zap
chown --recursive root:asterisk /etc/asterisk
chmod --recursive u=rwX,g=rX,o= /etc/asterisk
# for alsa
#chown asterisk /dev/dsp
#chown --recursive asterisk /dev/sound
#chown --recursive asterisk /dev/snd
chmod g+w /etc/asterisk

# chmod +x /root/own_asterisk.sh

13. Then I created /var/run/asterisk and owned it to asterisk:asterisk

# mkdir /var/run/asterisk
# chown asterisk:asterisk /var/run/asterisk

14. Then I changed the run directory in /etc/asterisk/asterisk.conf

# nano /etc/asterisk/asterisk.conf
astrundir => /var/run/asterisk

15. Then I installed phpmyadmin, apache, mysql and php. I know this isn\'t the best for a phone system, but we want mysql callerid records. And other fun database functionality. Having it all on one box keeps costs low and easy administration. Single point of failure, but since when does anyone care about that right! :)

# emerge apache
# echo "dev-lang/php berkdb cli crypt gdbm iconv ncurses nls pcre \\
readline reflection session spl ssl unicode zlib apache2 \\
bzip2 calendar curl curlwrappers gd ftp imap mysql xml xsl zip" >> /etc/portage/package.use
# emerge phpmyadmin

16. For my faxing, I then did this, you may not require this so just skip this as it hasn\'t been tested yet anyway.

# emerge -upvD mimeconstruct
# mkdir /var/spool/asterisk-fax

17. Then I configured phpmyadmin

# mysql -u root -p </usr/share/webapps/phpmyadmin/2.9.0.3/sqlscripts/mysql/2.9.0.3_create.sql

18. Then I made sure that php was started with apache

# nano /etc/conf.d/apache2
ensure that -D PHP5 is included on the options line

19. Then I started apache + added it to default runlevel

# rc-update add apache default
# rc-update add mysql default

20. Then I changed apache to run as asterisk:asterisk

# nano /etc/apache/httpd.conf
User asterisk
Group asterisk

21. Next I downloaded the Asterisk GUI source code from SVN

# cd /opt
# svn checkout http://svn.digium.com/svn/asterisk-gui/trunk asterisk-gui
# cd asterisk-gui/
# make
# make install
# make samples

22. Next I modified the /etc/asterisk/http.conf to the following:

[general]
enabled=yes
enablestatic=yes
bindaddr=10.0.2.2
bindport=8088

23. Next I modified manager.conf and changed the following:

enabled = yes
webenabled = yes
bindaddr = 10.0.2.2

24. Next, I added this to the manager.conf:

[admin]
secret = admin
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config

25. Then I started asterisk up with debugging to see any warnings or errors

# asterisk -vvvvvvvvvvvvvvgc

26. I had a few warnings about empty contexts in extensions.ael, I simply commented them out.

27. Then I tried to connect to the new Asterisk GUI, logging in as the user you setup in manager.conf

http://<YOUR IPHERE>::8088/asterisk/static/config/cfgbasic.html

29. Great, it all seems to work. Now, what about Caller ID logging. First, ensure that mysql has been setup, then connect to it via phpmyadmin, and create yourself a database, and user. Below is the format for the table:


CREATE TABLE cdr (
calldate datetime NOT NULL default \'0000-00-00 00:00:00\',
clid varchar(80) NOT NULL default \'\',
src varchar(80) NOT NULL default \'\',
dst varchar(80) NOT NULL default \'\',
dcontext varchar(80) NOT NULL default \'\',
channel varchar(80) NOT NULL default \'\',
dstchannel varchar(80) NOT NULL default \'\',
lastapp varchar(80) NOT NULL default \'\',
lastdata varchar(80) NOT NULL default \'\',
duration int(11) NOT NULL default \'0\',
billsec int(11) NOT NULL default \'0\',
disposition varchar(45) NOT NULL default \'\',
amaflags int(11) NOT NULL default \'0\',
accountcode varchar(20) NOT NULL default \'\',
uniqueid varchar(32) NOT NULL default \'\',
userfield varchar(255) NOT NULL default \'\'
);

30. Now, you must configure Asterisk to use this new database for callerid logging

# nano /etc/asterisk/cdr_mysql.conf

[global]
hostname=127.0.0.1
dbname=asterisk_cdr
table=cdr
password=<YOURDBPASSWRD>
user=<YOURDBUSER>
port=3306
sock=/tmp/mysql.sock
userfield=1

31. Next, you can install Areski\'s CallerID tool to view these records. Installation instructions are included in his file.

http://areski.net/asterisk-stat-v2/about.php

32. Reboot your box to ensure that everything started on reboot (Apache, Asterisk, Zaptel modules, Mysql). If something didn\'t start, verify it\'s in your startup scripts, and try again.

33. Congratulations, You should be finished with Asterisk 1.4, MYSQL CDR Logging, (Sorta) Faxing Capability and Asterisk 1.4 GUI. Look forward to a faxing howto coming soon.

Asterisk 1.4 : PHP Rolodex Howto / Script

November 26, 2006

Asterisk 1.4 PHP Rolodex Script Howto

Matt Gibson
Flewid Inc : www.flewid.ca

I was doing some reading recently and came across a few people doing some rolodex's for asterisk to re-write the callerid name. Some of them require mysql, some postgresql, some use the asterisk internal database. I wasn't sure I liked what was available, so with the help of a friend we worked up this little script to modify/add/delete entries into the callerid database on asterisk. It's a very simple interface, but it works. And now I get some nicer messages on my XMPP client when friends call with blocked caller-name. Eventually 411 reverse will be added, but that's for a later time.

Prerequisites:

  • Asterisk PBX(Tested on Asterisk 1.4)
  • PHP (Tested on PHP 4/5)
  • Apache Web Server 2.0
  • Unixish Operating System, In this case Gentoo Linux 2006.1

STEP.1 Intro:

First, ensure that you have a working Asterisk box. I won't go into this here, as that's for another howto.

Note that we don't enable any directory protection or anything on this, as it's running on our internal LAN. If you will have this open to the internet, you will most likely want to password protect it with htaccess or similar methods.

STEP.2 Create Directory:

We assume you are using the default asterisk and apache installation on gentoo. You will have to modify your paths accordingly if you have a different setup.

# mkdir -p /var/www/localhost/htdocs/rolodex/

STEP.3 Create Files:

Create the following three files with this information in them. Or, Download all these files right here rolodex.zip

STEP.3A - INDEX.PHP:

# cd /var/www/localhost/htdocs/rolodex/
# nano index.php

<?php
session_start();
?>

<html>
<head>
<title>Flewid Productions :: CallerID Modification Tool</title>
</head>
<body>
<h1>Add a New Number:</h1>
<form name="EntryForm" action="cid-store.php" method=POST>
<table cellpadding=2>
<tr>
<td>Phone number:</td>
<td><input name="PhoneNumber" size=30></td>
</tr>
<tr>
<td>Name:</td>
<td><input name="PhoneName" size=30></td>
</tr>
<tr>
<td></td>
<td><div align=right>
<input type=submit value="Save">
</div></td>
</tr>
</table>
</form>

<h1>Current Number Listing:</h1>

<!--
<?php

set_time_limit(5);
system("/usr/sbin/asterisk -rx \\"database show cidname\\" > /tmp/asterisk_cid-list.txt");

$fd=fopen("/tmp/asterisk_cid-list.txt","r");
while ($line=fgets($fd,1000))
{
$alltext.=$line;
}
fclose ($fd);
print str_replace("\", "<br>", $alltext);
?>
-->

<?php

set_time_limit(0);

ignore_user_abort(true);

$tempfile = '/tmp/asterisk_cid-list.txt';

$mess = file($tempfile);

$result = array();

foreach ($mess as $line) {
$temp = explode(':', $line);
$phone_number = str_replace('/cidname/', '', trim($temp[0]));
$name = $temp[1];
$result[] = array('phone' => $phone_number, 'name' => $name);
}

for ($i=0; $i<count($result); $i++) {
echo $result[$i]['name'] . ' - ' . $result[$i]['phone'] . ' ' . '[<a href="cid-delete.php?who=' . $i . '" title="delete">x</a>]<br />';
}

$_SESSION['list'] = $result;

?>

</body>
</html>

STEP.3B - CID-STORE.PHP:

# cd /var/www/localhost/htdocs/rolodex/
# nano cid-store.php

<HTML>
<HEAD>
<TITLE>Storing Asterisk CID data</TITLE>
</HEAD>
<BODY>
<h1>Asterisk phone book</h1>
<?php
set_time_limit(5);
$PhoneNumber = $_POST['PhoneNumber'];
$PhoneName = $_POST['PhoneName'];
if ($PhoneNumber <> "" && $PhoneName <> "") {
// Note: this PHP script runs as user "apache"!
system("whoami > /tmp/info");
system("/usr/sbin/asterisk -rx " . escapeshellarg("database put cidname $PhoneNumber \\"$PhoneName\\"") . " &> /tmp/error");
print "Successfully stored <b>$PhoneNumber</b> as <b>$PhoneName</b>.";
} else {
print "Please enter both phone number and name!";
}
?>
<br /><br />
<a href="index.php"><< Back</a>
</BODY>
</HTML>

STEP.3C - CID-DELETE.PHP:

# cd /var/www/localhost/htdocs/rolodex/
# nano cid-delete.php

<?php
session_start();
?>

<HTML>
<HEAD>
<TITLE>Storing Asterisk CID data</TITLE>
</HEAD>
<BODY>
<h1>Asterisk phone book</h1>
<?php
set_time_limit(5);

$whotodelete = $_SESSION['list'][$_GET['who']];
$PhoneNumber = $whotodelete['phone'];
$PhoneName = $whotodelete['name'];

if ($PhoneNumber <> "") {
// Note: this PHP script runs as user "asterisk"!
system("/usr/sbin/asterisk -rx " . escapeshellarg("database del cidname $PhoneNumber") . " &> /tmp/error");
print "Successfully deleted <b>$PhoneNumber</b> belonging to <b>$PhoneName</b>.";
} else {
print "Something is wrong. It didn't delete it!";
}
?>
<br /><br />
<a href="index.php"><< Back</a>
</BODY>
</HTML>

STEP.4 - Apache Runing as Asterisk:

As any security concious Asterisk Administrator is doing, we're Running Asterisk as it's own user. Our user is called.. well, "asterisk". We have also created an "asterisk" group for it to belong to as well. So, we have to change apache to run as this as well. Note the paths may be different if you're not running Gentoo.

# nano /etc/apache/httpd.conf
User asterisk
Group asterisk
<save the file>
# /etc/init.d/apache2 restart

STEP.5 - Testing it out:

Open up http://localhost/rolodex/ in your browser, and you should be confronted with a basic interface for adding numbers associated with names to the Asterisk Internal Database.

Congratulations!

If it's not working, double check all your permissions and locations of files. Especially that /tmp is writable by asterisk for the callerid output file.

Icecast Howto For OpenBSD, Easily adaptable to Linux

November 26, 2006

This Icecast howto for Openbsd is a small tutorial I made to setup the radio to stream multiple streams to internal and external addresses. You may need to modify the scripts to work on linux, but once you do, you can stream cool things to asterisk. Might be really old by now, as it was written in 2004, but it may be helpful to someone, so I'm putting it here for archival purposes :)

HOWTO: Ices & Icecast/OpenBSD

flewid
June 2004

Prerequisites:

  • Icecast
  • Ices
  • MP3's/OGG's
  • Unixish Operating System, In this case OpenBSD

Although this howto is written for OpenBSD I'm sure it will work on any other BSD or Linux Operating System with a few modifications given to the instructions below.

Please keep in mind that these instructions are by no means complete, or even guaranteed to work. I'm writing this from memory, so I might mistake some steps, but there is excellent documentation available through the use of Google or the Icecast/Ices site.

What I did:

STEP.1:

Compile and install icecast and ices, I'm not going to explain the instructions for that here as there is abundant documentation available for that already on the web.

In my case, I did not use the OpenBSD ports, instead I opted to use the source (most current) directly from the website.

STEP.2:

I installed a seperate HDD for music to be stored on, but you don't have to go that far.
You can also do the following:

As 'root' create a directory where you would store mp3 files that are to be served:

# mkdir -p /opt/music

STEP.3:

I shared the music directory with Samba and copied a bunch of mp3's to it in nicely organized sub directories directories. I'm not going to go into detail about the samba setup, as you should be able to find abundant documentation about it on the website, or on google.

My Samba configuration is very insecure, but it serves my needs well, as anyone on the network can copy files to and from it, and can make their own directories. I also have only one other person on my network who is trusted and able to access this share. You may setup samba as insecure or securely as you wish.

[Smb.conf]

[music]
comment = Radio Station Music
path = /music/all
read only = no
public = yes
guest ok = yes

[ Directory Listing ]

(/music/all)#ls -lt
total 440
drwxrwxrwx 3 iceuser iceuser 3584 May 6 19:35 punk
drwxrwxrwx 16 iceuser iceuser 3072 Feb 22 12:35 electronica
drwxrwxrwx 16 iceuser iceuser 1024 Feb 16 21:44 techno
drwxrwxrwx 13 iceuser iceuser 1024 Feb 16 17:22 chill
drwxrwxrwx 7 iceuser iceuser 2048 Feb 16 16:31 hiphop
drwxrwxrwx 5 iceuser iceuser 4608 Feb 15 20:57 rock
drwxrwxrwx 10 iceuser iceuser 1536 Feb 15 18:57 jungle

STEP.4:

I created a script in /usr/local/bin to scan my mp3's, and generate a playlist of each directory as well as all of the mp3's into one big list. This script is by no means complete, or even good, but it works. If you modify this script please feel free to let me know so I can post any modifications on this page.

(/usr/local/bin)# touch icecast.run
(/usr/local/bin)# chmod +x icecast.run
(/usr/local/bin)# vi icecast.run (or pico or ed, or whatever editor you like)

and this is what i entered in the script: (change pathnames as appropriate)

#!/bin/sh
if [ -d /music/all ]; then
clear
echo "looks like we have some mp3 directories to look at.."
echo "will proceed with playlist file creation"
echo -n "please be patient..."
sudo -u iceuser find /music/all/ -name *.mp3 -print > /music/all/all.txt
echo -n "."
sudo -u iceuser find /music/all/jungle/ -name *.mp3 -print > /music/all/jungle.txt
echo -n "."
sudo -u iceuser find /music/all/techno/ -name *.mp3 -print > /music/all/techno.txt
echo -n "."
sudo -u iceuser find /music/all/chill/ -name *.mp3 -print > /music/all/chill.txt
echo -n "."
sudo -u iceuser find /music/all/electronica/ -name *.mp3 -print > /music/all/electronica.txt
echo -n "."
sudo -u iceuser find /music/all/hiphop/ -name *.mp3 -print > /music/all/hiphop.txt
echo -n "."
sudo -u iceuser find /music/all/punk/ -name *.mp3 -print > /music/all/punk.txt
echo -n "."
sudo -u iceuser find /music/all/rock/ -name *.mp3 -print > /music/all/rock.txt
echo -n "."
echo -n "done"
else
clear
echo " ERROR ERROR ERROR ERROR"
echo ""
echo "the mp3 files don't exist"
echo ""
echo " ERROR ERROR ERROR ERROR"
fi

if [ -f /music/ice/log/icecast.pid ]; then
echo ""
echo "icecast process already running"
echo "assuming you wish to terminate.."
echo "killing process"
#insert kill process thing here
echo "deleting pid file (if any)"
rm -f /music/ice/log/icecast.pid
echo -n "Starting icecast.."
sudo -u iceuser -b /usr/local/bin/icecast -c /usr/local/etc/icecast.xml >/dev/null 2>&1
echo -n "Running!"
echo ""
else
echo ""
echo -n "Starting icecast.."
sudo -u iceuser -b /usr/local/bin/icecast -c /usr/local/etc/icecast.xml >/dev/null 2>&1
echo -n "running!"
echo ""
fi

if [ -x /usr/local/bin/ices ]; then
echo "Starting ices now"
echo -n "source:"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/jungle.conf >/dev/null 2>&1
echo -n ", jungle"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/chill.conf >/dev/null 2>&1
echo -n ", chill"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/rock.conf >/dev/null 2>&1
echo -n ", rock"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/hiphop.conf >/dev/null 2>&1
echo -n ", hiphop"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/punk.conf >/dev/null 2>&1
echo -n ", punk"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/techno.conf >/dev/null 2>&1
echo -n ", techno"
sudo -u iceuser /usr/local/bin/ices -c /usr/local/etc/electronica.conf >/dev/null 2>&1
echo -n ", electronica"
echo ""
echo ""
else
echo ""
echo "main program file ices is missing"
echo "check your path to make sure"
echo "ices is resident somewhere!"
echo ""
fi

STEP.5:

I setup my /etc/rc.local file to run my script once upon boot of the box. On other operating systems this might be in /etc/rc.d/ or /usr/local/etc/.

echo "# for icecast /usr/local/bin/icecast.run" >> /etc/rc.local

Be sure to use >> and not >. As >> is append, and > is overwrite.

STEP.6:

Edit your icecast.xml and ices.conf files.

[ icecast.xml ]

<icecast>
<limits>
<clients>10</clients>
<sources>10</sources>
<threadpool>5</threadpool>
<queue-size>102400</queue-size>
<client-timeout>30</client-timeout>
<header-timeout>15</header-timeout>
<source-timeout>10</source-timeout>
</limits>

<authentication>
<source-password>PASSWORD</source-password>
<relay-password>PASSWORD</relay-password>
<admin-user>admin</admin-user>
<admin-password>PASSWORD</admin-password>
</authentication>

<hostname>radio.servers.spizzo.spazzo</hostname>

<listen-socket><port>8000</port></listen-socket>
<fileserve>1</fileserve>
<paths>
<basedir>/music/ice</basedir>
<logdir>/music/ice/log/icecast</logdir>
<webroot>/music/ice/web</webroot>
<adminroot>/music/ice/admin</adminroot>
<pidfile>/music/ice/log/icecast.pid</pidfile>
</paths>

<logging>
<accesslog>access.log</accesslog>
<errorlog>error.log</errorlog>
<loglevel>1</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
</logging>

<security>
<chroot>0</chroot>
</security>

<mount>
<mount-name>/techno</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/electronica</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/punk</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/oldies</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/hiphop</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/rock</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/chill</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>

<mount>
<mount-name>/jungle</mount-name>
<password>PASSWORD</password>
<max-listeners>2</max-listeners>
<fallback-mount>/all</fallback-mount>
</mount>
</icecast>

[ Edit ices.conf (or in this case the rock music stream)]

<?xml version="1.0"?>
<ices:Configuration xmlns:ices="http://www.icecast.org/projects/ices">

<Playlist>
<File>/music/all/rock.txt</File>
<Randomize>1</Randomize>
<Type>builtin</Type>
<Module>ices</Module>
</Playlist>

<Execution>
<Background>1</Background>
<Verbose>0</Verbose>
<BaseDirectory>/music/ice/log/rock</BaseDirectory>
</Execution>

<Stream>

<Server>
<Hostname>YOUR.HOST.NAME.HERE</Hostname>
<Port>8000</Port>
<Password>PASSWORD</Password>
<Protocol>http</Protocol>
</Server>

<Mountpoint>/rock</Mountpoint>
<Name>Spizzo Rock Radio!</Name>
<Genre>Rock / Alternative</Genre>
<Description>Rock and Alternative - sixties to today</Description>
<URL>http://localhost/rock</URL>
<Public>0</Public>
<Bitrate>128</Bitrate>
<Reencode>0</Reencode>
<Samplerate>44100</Samplerate>
<Channels>2</Channels>
</Stream>
</ices:Configuration>

STEP.7:

Reboot and test it out.

[ Output on Login ]

looks like we have some mp3 directories to look at..
will proceed with playlist file creation
please be patient..........done
deleting pid file (if any)
Starting icecast..Running!
Starting ices now
source:, jungle, chill, rock, hiphop, punk, techno, electronica

You should see something like the previous when you login. If there is any errors, make sure you have the correct paths in your icecast config files and in your icecast.run script.

[Web Test]

You should now be able to access the icecast website. Make sure you check the paths, and set up the web site according to the icecast documentation before attempting this. It's really quite easy to setup though.

http://ip.of.your.box:8000/status.xsl

Fan of Skype? Now Integrate it with your wireless

November 25, 2006

From MobiGater's Site....

MobiGater is a Skype to GSM and GSM to Skype gateway. This device connects your cell phone to your home computer or notebook that runs Skype. By using MobiGater you can make cheaper calls to your Skype contacts, cellular or fixed-line phones all over the world through your mobile phone. All this without the need to be in front of your computer. It is also very easy for other people to reach you. Be smart and Make your Skype mobile.

Next Page »

Bottom