login | register
Fri 09 of May, 2008 [16:48 UTC]

voip-info.org

Search with Google
Search this site with Google. Results may not include recent changes.
 
Google Ads
Shoutbox
  • Nick Barnes, Fri 09 of May, 2008 [11:36 UTC]: Christopher - yesterday I tried an Asterisk install on a CentOS 5.1 box with stock GUI and it all worked fine. Sorry I can't help.
  • aero, Fri 09 of May, 2008 [08:20 UTC]: can someone help me out on this, i tried to play some sound files on my asterisk box and this is the error message i got. WARNING[4429]: format_wav.c:169 check_header: Unexpected freqency 22050 May 8 11:17:39 WARNING[4433]: codec_gsm.c:194 gsmtolin_fra
  • Christopher Faust, Thu 08 of May, 2008 [14:15 UTC]: I beleive that I may have to change something in the xserver configuration. Please advise
  • Christopher Faust, Thu 08 of May, 2008 [14:14 UTC]: Everything was perfect. In the bios I have increased the memory allocated Still receive input not supported on my display.
  • Christopher Faust, Thu 08 of May, 2008 [14:13 UTC]: This would not be my main box. I am doing some testing to see if I can install zaptel and asterisk 1.4 on a full centos 5.1 box with development software Its bizzare, because before I went through the asterisk and zaptel installation everything was perfe
  • Nick Barnes, Thu 08 of May, 2008 [13:44 UTC]: Christopher - I can't see any way in which an Asterisk installation would muck your GUI, but remember that it is advised not to use a GUI on an Asterisk box anyway.
  • Christopher Faust, Wed 07 of May, 2008 [15:28 UTC]: When I try to startx I ge input not supported. Though before installing asterisk I had no video issue to start the GUI
  • Christopher Faust, Wed 07 of May, 2008 [15:26 UTC]: Hi Nick, I got centos 5.1 and asterisk up But now I cannot start startx I have set the depth from 24 to 16 for the video i810 driver for the i845 on my netvista machine but I cannot start GNOME. Please advise
  • Nick Barnes, Wed 07 of May, 2008 [10:01 UTC]: Howard - You'll need to provide a lot more information if you really want help.
  • Nick Barnes, Wed 07 of May, 2008 [10:00 UTC]: Christopher - Search the Wiki and you'll find a page I wrote detailing exactly what you have to do for Asterisk 1.4 + CentOS 5.1.
Server Stats
  • Execution time: 0.21s
  • Memory usage: 2.24MB
  • Database queries: 29
  • GZIP: Disabled
  • Server load: 1.78

CentOS 5 and Asterisk 1.4.x installation

Base Install of Asterisk on an i386 CentOS/RHEL box:

More as an aide memoir for me than anything else, but if somebody does find it useful, then that's good too!

For reasons detailed elsewhere, you're best not using a GUI, so do the installation from the command line ('linux-text' at the GRUB prompt). When you select the packages, the only one you need is 'server'. Disk partitioning, networking etc. is all entirely up to you!

At your first login, you'll be presented with a simple administration screen. Disable SELinux and (for now) the firewall.

At the shell, run
yum -y update

and reboot the machine when it's finished (it'll install a new kernel). Run:
yum -y update

again and repeat until there are no more updates.

Now we need to install the packages we need for Asterisk:
yum -y install gcc gcc-c++ kernel-devel bison openssl-devel libtermcap-devel ncurses-devel doxygen curl-devel


Note that you may need to:
yum -y install kernel-xen-devel

if you are running a Xen enabled kernel.

If you want the 'zttool' application, you'll need to:
yum -y install newt-devel


Other things you may find useful (if they're not already installed):
yum -y install mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron


Install Speex (optional)

yum -y install speex speex-devel


Install ODBC stuff (optional)

Note that if you have already installed Asterisk, you will need to run 'configure', 'make' and 'make install' to detect ODBC and compile it in.
yum -y install unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel


Install MySQL ODBC interface/connector (required if using ODBC and MySQL) (optional)

yum -y install mysql-connector-odbc

And then edit the file '/etc/odbcinst.ini' (or '/usr/local/odbcinst.ini') and replace 'Driver = /usr/lib/libmyodbc.so' with 'Driver = /usr/lib/libmyodbc3.so'

Install MySQL (optional)

yum -y install mysql mysql-devel mysql-server
chkconfig mysqld on
service mysqld start


Install PHPMyAdmin (optional)

Download the latest version from http://www.phpmyadmin.net/, unzip/unbzip/untar into /var/www/htdocs/phpmyadmin (for the time being). Make sure Apache starts on boot.
yum -y install php-mysql php-mbstring php-mcrypt
chkconfig httpd on
service httpd start

Surf to https://i.p.address/phpmyadmin and check it works.

Install Webmin (optional)

Download the latest version of the RPM from http://www.webmin.com/
rpm -i webmin-VERSION

Surf to https://i.p.address:10000 and check it works.

Asterisk files

Download the latest asterisk version /usr/src/asterisk and untar the files:
mkdir -p /usr/src/asterisk
cd /usr/src/asterisk
wget http://downloads.digium.com/pub/asterisk/asterisk-1.4-current.tar.gz
wget http://downloads.digium.com/pub/asterisk/asterisk-addons-1.4-current.tar.gz
wget http://downloads.digium.com/pub/zaptel/zaptel-1.4-current.tar.gz
wget http://downloads.digium.com/pub/libpri/libpri-1.4-current.tar.gz
tar -zxf zaptel-1.4-current.tar.gz
tar -zxf asterisk-1.4-current.tar.gz
tar -zxf libpri-1.4-current.tar.gz
tar -zxf asterisk-addons-1.4-current.tar.gz


INSTALL LIBPRI (optional)

If you are using E1 cards you need to install LIBPRI
cd /usr/src/asterisk/libpri-VERSION
make clean
make
make install


INSTALLING ZAPTEL

cd /usr/src/asterisk/zaptel-VERSION
make clean
./configure
make
make install
make config

Edit /etc/zaptel.conf and /etc/asterisk/zapata.conf for your site.
Set Zaptel to start automatically and then start it.
chkconfig zaptel on
service zaptel start


INSTALLING ASTERISK

cd /usr/src/asterisk/asterisk-VERSION
make clean
./configure

Choose which options to install (audio files, voicemail storage, codecs etc.)
make menuselect
make
make install

Install sample files in /etc/asterisk, install docs/manpages and set to start on boot.
make samples
make progdocs
make config
chkconfig asterisk on
service asterisk start


Installing Asterisk-addons (pre-1.4.5)

cd /usr/src/asterisk/asterisk-addons-VERSION

Edit 'Makefile' and insert a line 'CFLAGS+=-DMYSQL_LOGUNIQUEID' after the 'CFLAGS+=-fPIC' line
make clean
./configure
make
make install

Install sample files in /etc/asterisk
make samples


Installing Asterisk-addons (1.4.5 onwards)

The instructions are exactly as above, with the exception that 'CFLAGS' has been replaced by 'ASTCFLAGS' in the 'Makefile' file.

Installing mISDN drivers for Digium B410P (optional)

cd /usr/src/asterisk/zaptel-VERSION
yum -y install flex
make b410p
/etc/init.d/misdn-init config
chkconfig --add misdn-init
chkconfig misdn-init on

Don't forget to edit /etc/misdn-init.conf and /etc/asterisk/misdn.conf before you start it.

Set up Asterisk database (optional)

Note that the UniqueID field in the CDR table is not necessarily unique! Due to the very very dodgy way Asterisk handles unique IDs, if you set the field to be the primary key (as advised elsewhere), you will lose data.

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

##
##Database: `asterisk`
##
CREATE DATABASE `asterisk` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `asterisk`;

##########################################################

##
##Table structure for table `cdr`
##

CREATE TABLE IF NOT EXISTS `cdr` (
 `recid` mediumint(8) unsigned NOT NULL auto_increment COMMENT 'Record ID',
 `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 '',
 PRIMARY KEY  (`recid`),
 KEY `calldate` (`calldate`),
 KEY `dst` (`dst`),
 KEY `accountcode` (`accountcode`),
 KEY `src` (`src`),
 KEY `disposition` (`disposition`)
 KEY `uniqueid` (`uniqueid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

##########################################################

##
##Table structure for table `queue_members`
##

CREATE TABLE IF NOT EXISTS `queue_members` (
  `queue_name` varchar(128) NOT NULL default '',
  `interface` varchar(128) NOT NULL default '',
  `penalty` int(11) default NULL,
  PRIMARY KEY  (`queue_name`,`interface`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

##########################################################

##
##Table structure for table `queues`
##

CREATE TABLE IF NOT EXISTS `queues` (
  `name` varchar(128) NOT NULL,
  `musiconhold` varchar(128) default 'default',
  `announce` varchar(128) default NULL,
  `context` varchar(128) default NULL,
  `timeout` int(11) default '60',
  `monitor_join` tinyint(1) default NULL,
  `monitor_format` varchar(128) default NULL,
  `queue_youarenext` varchar(128) default NULL,
  `queue_thereare` varchar(128) default NULL,
  `queue_callswaiting` varchar(128) default NULL,
  `queue_holdtime` varchar(128) default NULL,
  `queue_minutes` varchar(128) default NULL,
  `queue_seconds` varchar(128) default NULL,
  `queue_lessthan` varchar(128) default NULL,
  `queue_thankyou` varchar(128) default NULL,
  `queue_reporthold` varchar(128) default NULL,
  `announce_frequency` int(11) default NULL,
  `announce_round_seconds` int(11) default NULL,
  `announce_holdtime` varchar(128) default NULL,
  `periodic_announce` varchar(128) default NULL,
  `periodic_announce_frequency` int(11) default NULL,
  `retry` int(11) default '5',
  `ringinuse` varchar(5) NOT NULL default 'no',
  `autofill` varchar(5) NOT NULL default 'yes',
  `autopause` varchar(5) NOT NULL default 'no',
  `setinterfacevar` varchar(5) NOT NULL default 'yes',
  `wrapuptime` int(11) default '30',
  `maxlen` int(11) default NULL,
  `servicelevel` int(11) default NULL,
  `strategy` varchar(128) default 'ringall',
  `joinempty` varchar(128) default 'no',
  `leavewhenempty` varchar(128) default 'yes',
  `eventmemberstatus` tinyint(1) default NULL,
  `eventwhencalled` tinyint(1) default NULL,
  `reportholdtime` tinyint(1) default NULL,
  `memberdelay` int(11) default NULL,
  `weight` int(11) default NULL,
  `timeoutrestart` tinyint(1) default NULL,
  PRIMARY KEY  (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

##########################################################

##
##Table structure for table `sip`
##

CREATE TABLE IF NOT EXISTS `sip` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(80) NOT NULL,
  `host` varchar(31) NOT NULL default 'dynamic',
  `nat` varchar(5) NOT NULL default 'no',
  `type` enum('user','peer','friend') NOT NULL default 'friend',
  `accountcode` varchar(20) default 'ACCOUNT',
  `amaflags` varchar(13) default NULL,
  `callgroup` varchar(10) default NULL,
  `callerid` varchar(80) default NULL,
  `call-limit` varchar(6) NOT NULL default '10',
  `cancallforward` char(3) default 'yes',
  `canreinvite` char(3) default 'no',
  `context` varchar(80) default 'from-sip',
  `defaultip` varchar(15) default NULL,
  `dtmfmode` varchar(7) default 'rfc2833',
  `fromuser` varchar(80) default NULL,
  `fromdomain` varchar(80) default NULL,
  `insecure` varchar(4) default NULL,
  `language` char(2) default 'en',
  `mailbox` varchar(50) default NULL,
  `md5secret` varchar(80) default NULL,
  `deny` varchar(95) default '0.0.0.0/0.0.0.0',
  `permit` varchar(95) default '0.0.0.0/0.0.0.0',
  `mask` varchar(95) default NULL,
  `musiconhold` varchar(100) default 'default',
  `pickupgroup` varchar(10) default NULL,
  `qualify` char(3) default 'yes',
  `regexten` varchar(80) default NULL,
  `restrictcid` char(3) default NULL,
  `rtptimeout` char(3) default NULL,
  `rtpholdtimeout` char(3) default NULL,
  `secret` varchar(80) default 'SECRET',
  `setvar` varchar(100) default NULL,
  `disallow` varchar(100) default 'all',
  `allow` varchar(100) default 'alaw',
  `fullcontact` varchar(80) NOT NULL,
  `ipaddr` varchar(15) NOT NULL,
  `port` smallint(5) unsigned NOT NULL default '0',
  `regserver` varchar(100) default NULL,
  `regseconds` int(11) NOT NULL default '0',
  `username` varchar(80) NOT NULL,
  `defaultuser` varchar(80) NOT NULL,
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`name`),
  KEY `name_2` (`name`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=301 ;

##########################################################

##
##Table structure for table `voicemail_messages`
##

CREATE TABLE IF NOT EXISTS `voicemail_messages` (
  `id` int(11) NOT NULL auto_increment,
  `msgnum` int(11) NOT NULL default '0',
  `dir` varchar(80) default '',
  `context` varchar(80) default '',
  `macrocontext` varchar(80) default '',
  `callerid` varchar(40) default '',
  `origtime` varchar(40) default '',
  `duration` varchar(20) default '',
  `mailboxuser` varchar(80) default '',
  `mailboxcontext` varchar(80) default '',
  `recording` longblob,
  PRIMARY KEY  (`id`),
  KEY `dir` (`dir`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1088 ;

##########################################################

##
##Table structure for table `voicemail_users`
##

CREATE TABLE IF NOT EXISTS `voicemail_users` (
  `uniqueid` int(11) NOT NULL auto_increment,
  `customer_id` varchar(11) NOT NULL default '0',
  `context` varchar(50) NOT NULL default 'default',
  `mailbox` varchar(11) NOT NULL default '0',
  `password` varchar(5) NOT NULL default '6666',
  `fullname` varchar(150) NOT NULL,
  `email` varchar(50) NOT NULL,
  `pager` varchar(50) NOT NULL,
  `tz` varchar(10) NOT NULL default 'en',
  `attach` varchar(4) NOT NULL default 'yes',
  `saycid` varchar(4) NOT NULL default 'yes',
  `dialout` varchar(10) NOT NULL,
  `callback` varchar(10) NOT NULL,
  `review` varchar(4) NOT NULL default 'no',
  `operator` varchar(4) NOT NULL default 'no',
  `envelope` varchar(4) NOT NULL default 'no',
  `sayduration` varchar(4) NOT NULL default 'no',

  `saydurationm` tinyint(4) NOT NULL default '1',
  `sendvoicemail` varchar(4) NOT NULL default 'no',
  `delete` varchar(4) NOT NULL default 'no',
  `nextaftercmd` varchar(4) NOT NULL default 'yes',
  `forcename` varchar(4) NOT NULL default 'no',
  `forcegreetings` varchar(4) NOT NULL default 'no',
  `hidefromdir` varchar(4) NOT NULL default 'yes',
  `stamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
  PRIMARY KEY  (`uniqueid`),
  KEY `mailbox_context` (`mailbox`,`context`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=101 ;

## ########################################################

##
##Create realtime user with approximately the right privs.
##

CREATE USER 'astrealtime'@'localhost' IDENTIFIED BY 'MYPASS';
GRANT FILE ON * . * TO 'astrealtime'@'localhost' IDENTIFIED BY 'MYPASS' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
GRANT INSERT ON `asterisk`.`cdr` TO 'astrealtime'@'localhost';
GRANT SELECT , INSERT , UPDATE , DELETE ON `asterisk`.`queue_members` TO 'astrealtime'@'localhost';
GRANT SELECT , UPDATE ON `asterisk`.`queues` TO 'astrealtime'@'localhost';
GRANT SELECT , UPDATE ON `asterisk`.`sip` TO 'astrealtime'@'localhost';
GRANT SELECT , UPDATE ON `asterisk`.`voicemail_users` TO 'astrealtime'@'localhost';
GRANT SELECT , UPDATE , INSERT , DELETE ON `asterisk`.`voicemail_messages` TO 'astrealtime'@'localhost';

Set up CDR to MySQL

Edit /etc/asterisk/cdr_mysql.conf
[global]
hostname=localhost
dbname=asterisk
table=cdr
password=MYPASS
user=astrealtime
port=3306
sock=/var/lib/mysql/mysql.sock
userfield=1

Set up realtime

Edit res_mysql.conf
[general]
dbhost = localhost
dbname = asterisk
dbuser = astrealtime
dbpass = MYPASS
dbport = 3306
dbsock = /var/lib/mysql/mysql.sock

Edit /etc/asterisk/extconfig.conf
[settings]
queues => mysql,asterisk,queues
queue_members => mysql,asterisk,queue_members
sippeers => mysql,asterisk,sip
sipusers => mysql,asterisk,sip
voicemail => mysql,asterisk,voicemail_users

ODBC configuration (using settings from above)

/etc/odbcinst.ini

[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib/libmyodbc3.so
Setup           = /usr/lib/libodbcmyS.so
FileUsage       = 1
(Note the '3' which isn't in the original sample file!)

/etc/odbc.ini

; DSN definitions
[astrealtime]
Description     = Asterisk realtime and other FUNC_ODBC access
Driver          = MySQL
Socket          = /var/lib/mysql/mysql.sock
Server          = localhost
User            = astrealtime
Pass            = MYPASS
Database        = asterisk
Option          = 3

/etc/asterisk/res_odbc.conf

; Environment variables
[ENV]

; Connections
[astrealtime]
enabled => no
dsn => astrealtime
username => astrealtime
password => MYPASS
pre-connect => yes
idlecheck => 3600

/etc/asterisk/func_odbc.conf

This really depends on why you need database access from the dialplan!

Setting up Asterisk on a vserver

If you don't need a timer (IAX2 trunking, conferencing or some MoH) or access to physical hardware, then it just works. If you do need a timing source or physical hardware, you'll need to install zaptel. The documents at http://www.telephreak.org/papers/vpa/ and https://customer.lylix.net/knowledgebase.php?action=displayarticle&catid=2&id=27 both give some ideas on how to do it, but both are lacking in detail. The text below is culled from these two pages and mixed in with my own.

Essentially, zaptel has to be installed on the host and the devices made available to each vserver. Within each vserver, various bits of the zaptel source need extracting and/or compiling and/or installing. Once this is done, Asterisk should compile with zaptel support and all should be well.

The host

Download, compile and install Zaptel as above. Ensure that it starts with the system.
cd into the vserver's device directory (e.g. 'cd /vserver/asterisk01/dev') and then run the following in the bash shell:
mkdir zap
cd zap
mknod ctl c 196 0
mknod timer c 196 253
mknod channel c 196 254
mknod pseudo c 196 255
for N in `seq 1 249`; do mknod $N c 196 $N; done

if you are using physical zaptel hardware, configure the /etc/zaptel.conf file as appropriate.

The vserver

Download the zaptel source, as above. Don't try to compile it!! untar it and cd to the directory, then run the following:
make libtonezone.a
make libtonezone.so
install -D -m 755 libtonezone.a /usr/lib/libtonezone.a
install -D -m 755 libtonezone.so /usr/lib/libtonezone.so.1.0
install -D -m 644 zaptel.h /usr/include/zaptel/zaptel.h
install -D -m 644 tonezone.h /usr/include/zaptel/tonezone.h
cd /usr/lib
ln -sf libtonezone.so.1.0 libtonezone.so.1
ln -sf libtonezone.so.1.0 libtonezone.so
ldconfig

Everything else can be run as normal.
If you are using physical zaptel hardware, configure /etc/asterisk/zapata.conf as appropriate. Don't share channels with the host or other vservers!

~

See Also


Created by Mark Quitoriano, Last modification by Nick Barnes on Thu 24 of Apr, 2008 [13:10 UTC]

Comments Filter

Nice work !

by Mats Karlsson on Monday 07 of January, 2008 [18:57:25 UTC]
I would like to write/change the asterisk-addons section as a "search and replace" command instead of the manual editing.

forgot to configure zaptel

by Franco Escalona on Friday 16 of November, 2007 [14:35:02 UTC]
      1. INSTALLING ZAPTEL ###

cd /usr/src/zaptel

make clean
./configure
make
make install

  1. If you want "service zaptel restart" command to work do this
make config

Please update this page with new information, just login and click on the "Edit" or "Add Comment" button above. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

Sponsored by:

Terms of Service Privacy Policy
© 2003-2008 VOIP-Info.org LLC

Powered by bitweaver