Author Archive

How to limit concurrent calls for asterisk extensions

Written by admin on November 22, 2014. Posted in Asterisk, Server Security

Sometime you need to limit the number of simultaneous calls that an extension can be allowed to make. freepbx has a trunk simultaneous calls limitation but does not have the SIP account limitation facility. the workaround  is to do the following.

Login to your server via ssh and do the following

# nano sip_custom_post.conf

suppose the extension you want to limit is 3500  and you want to limit the call limit to 3 simultaneous calls. hen you must copy and paste the following.


Save the file by clicking  CTRL + X   and then confirm with a Y

Restart asterisk

# amportal restart

How to secure your server using fail2ban

Written by admin on November 22, 2014. Posted in Server Security

Fail2ban scans log files (e.g. /var/log/apache/error_log) and bans IPs that show the malicious signs -- too many password failures, seeking for exploits, etc. Generally Fail2Ban then used to update firewall rules to reject the IP addresses for a specified amount of time, although any arbitrary other action. The following shows how to install it on asterisk to protect your voip server. Please copy and paste the blue text directly into ssh.

rpm -Uhv
sed -i 's/enabled = 0/enabled = 1/' /etc/yum.repos.d/rpmforge.repo
yum install -y fail2ban jwhois
Now disable the rpmforge repo do that it doesn’t interfere with any of the CentOS/Asterisk packages -

sed -i 's/enabled = 1/enabled = 0/' /etc/yum.repos.d/rpmforge.repo
Next we are going to create the fail2ban configuration file for Asterisk. This tells fail2ban what text to monitor the logs for -

cat >> /etc/fail2ban/filter.d/asterisk.conf <<-EOF
# Fail2Ban configuration file
# $Revision: 250 $


# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf


#_daemon = asterisk

# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
# host must be matched by a group named "host". The tag "<HOST>" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P<host>\S+)
# Values: TEXT

failregex = NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Wrong password
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - No matching peer found
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Username/auth name mismatch
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Device does not match ACL
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - Peer is not supposed to register
NOTICE.* <HOST> failed to authenticate as '.*'$
NOTICE.* .*: No registration for peer '.*' \(from <HOST>\)
NOTICE.* .*: Host <HOST> failed MD5 authentication for '.*' (.*)
NOTICE.* .*: Failed to authenticate user .*@<HOST>.*

# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
ignoreregex =
Next we are going to add some lines to the jail.conf file that tells fail2ban what log files to monitor and what action to take when the required text is detected. This includes sending an alert e-mail so you may want to change ‘root’ to your e-mail address. It also includes the length of time the IP address is blocked for in seconds. Here we have it set to 3 days, you may want to modify this -

cat >> /etc/fail2ban/jail.conf <<-EOF

enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
logpath = /var/log/asterisk/full
maxretry = 5
bantime = 259200
Fail2ban needs the date in the Asterisk log files written in a specific format. To do this we can add a line to the ‘General’ section of the Asterisk logger configuration file. If you already have a ‘General’ section in there you will just want to add the line manually rather than running the command below -

cat >> /etc/asterisk/logger.conf <<-EOF
dateformat=%F %T
asterisk -rx "logger reload"
Finally we want to fire up fail2ban and set it to start at boot time -

service fail2ban start
chkconfig fail2ban on
One final thing you may want to do is ‘whitelist’ your own IP address/s. You can do this by adding them to the ignoreip line in the jail.conf file. Here’s a couple of lines to do it automatically, just change the IP address here for your own IP address -

sed -i 's/ignoreip = /ignoreip = /' /etc/fail2ban/jail.conf
service fail2ban restart

How to setup fax in Elastix

Written by admin on November 22, 2014. Posted in Elastix

Elastix is using Hylafax. As such all tools and applications that interface to Hylafax can be used.
Here is the Virtual Fax Extension configuration Step By Step:

Configuring Elastix Fax Module

  1. Click on the FAX tab on the Elastix Admin configuration screen
  2. Click on the New Virtual Fax selection and fill in the information
    Virtual Fax Name: HK Office (or whatever you wish)
    Destination Email: Using yours or a group email address
    Caller ID Name: This should be your organization name
    Caller ID Number: Your Fax number
    Fax Destination (IAX): This should be your extension we will setup for receiving fax
    Secret(IAX): This is the password of your extension.
  3. Click on Save
  4. That’s a virtual FAX machine setup and ready to go as soon as we create an extension.

Create a Fax extension
This extension that we will be setting up is an IAX extension, which differs slightly from the SIP
extensions that you are used to.

  1. Select “Generic IAX device” at the “Create new extension” screen
  2. Fill in the Extension information
    User Extension: XXXX (Same user extension when you setup your virtual fax)
    Display Name: HK Fax (or whatever you want to call it)
    Secret: 1234 (make sure this is the same secret you use when you setup your virtual fax)
    Fax Extension: Disabled
    Incoming/outgoing recording: Disabled
    Press submit when done.
  3. We have now created a complete working virtual fax machine.

Directing Fax to the correct extension (Dedicated Line)

If you have dedicated line for the Virtual Fax, under freePBX, all you do is set the incoming route of your Fax DID to go directly to extension XXXX.

Change in Zapata.conf

  1. Login Elastix console by root
  2. vi /etc/asterisk/zapata.conf
  3. Remove the comment on the line faxdetect=incoming
    If the line is not there then add faxdetect=incoming” to your zapata.conf file
  4. Reboot your Elastix Server

How to install Asterisk and FreePBX on an OPENVZ server

Written by admin on November 22, 2014. Posted in Asterisk, Freepbx

yum grouplist installed

Installed Groups:
DNS Name Server
Legacy Network Server
Mail Server
Network Servers
System Tools
Text-based Internet
Web Server
Windows File Server
Yum Utilities

yum groupremove 'DNS Name Server'
yum groupremove 'Editors'
yum groupremove 'Legacy Network Server'
yum groupremove 'Mail Server'
yum groupremove 'Network Servers'
yum groupremove 'System Tools'
yum groupremove 'Text-based Internet'
yum groupremove 'Web Server'
yum groupremove 'Windows File Server'

Now update the base install

yum -y update

Install Asterisk/FreePBX required packages, other useful packages, and their dependencies

yum groupinstall core
yum groupinstall base

yum install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-pear php-pear-DB php-mbstring nano tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion nano kernel-devel selinux-policy

Skip this section if you are using a RHEL6 distribution.

On RHEL 5 shutdown unnecessary daemon brcm-iscsi which is enabled by default and tends to do a lot of logging even when not used. This creates unnecessary I/O load.

chkconfig iscsi off
chkconfig iscsid off
service iscsi stop
service iscsid stop

Replace syslog with the improved and backwards compatible rsyslog (standard in RHEL6 but not RHEL5).  This also prevents a problem that comes up with improper timestamps in /var/log/secure when you get disconnects.

NOTE:This is only for RHEL5 based systems.  You do not need to do this for RHEL6.

yum -y install rsyslog
chkconfig syslog off
chkconfig rsyslog on
service syslog stop
service rsyslog start

--END of RHEL v5 NOTES--
Skip this section if you are using a RHEL5 based distribution.

On RHEL v6 and it's clone distributions the php-pear-DB package is not included.  You need to download it from an official mirror and install otherwise the FreePBX install will fail.  Click the link to check for the latest version.

cd /usr/src

rpm -ivh php-pear-DB*

RHEL v6 uses a newer version of php.  In this version php-posix is no longer in php-common, it is in php-process.  So you need to install php-process if using RHEL v6 or it's clones otherwise the FreePBX install will fail.

yum -y install php-process

Check if the firewall (iptables) is enabled by default and if the RHEL v6 default configuration blocks the FreePBX web GUI.  If you know what services/ports are required you can run "system-config-firewall-tui" and configure the firewall as required.

At a minimum, the following ports need to be opened:
TCP 80 (www)
TCP 4445 (Flash Operator Panel)
UDP 5060-5061 (SIP)
UDP 10,000 - 20,000 (RTP)
UDP 4569 (IAX)

Another option is to remove existing settings from the firewall and save.
iptables -F
service iptables save

Alternatively, you can disable the firewall for now and prevent it from starting on reboot.

service iptables stop
chkconfig iptables off

--END of RHEL v6 NOTES--
Selinux is not required or recommended.  This will create the required file if it does not already exist.  If it already exists copy paste or edit the contents indicated here to be sure selinux never runs.

nano /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.

# SETLOCALDEFS= Check local definition changes

(Ctrl-x> y >Enter)

Make sure selinux is turned off for this session

setenforce 0


Enable the tftp server on startup if required (for configuring phones)
nano /etc/xinetd.d/tftp
change server_args = from "-s /var/lib/tftpboot" to "-s /tftpboot"
change “disable=yes” to “disable=no”

mkdir /tftpboot
chmod 777 /tftpboot
service xinetd restart

Set Timezone
Copy your timezone from this link

System timezone
Create a symbolic link to the appropriate timezone from /etc/localtime.
ln -sf /usr/share/zoneinfo/America/Vancouver /etc/localtime

PHP timezone (required since PHP v5.3):
if not set and using php v5.3+ (the version included with RHEL6) it will revert to the default timezone which may not be the correct one depending on your location.  The FreePBX install will throw out a bunch of warnings if you are using RHEL 6 and don't set this.
for RHEL5:
nano +633 /etc/php.ini
for RHEL6
nano +946 /etc/php.ini
Uncomment (;) date.timezone = and add your timezone
Restart apache for the changes to take effect
service httpd restart

Memory Limit

The recommended setting is 128M otherwise you may get warnings in FreePBX.  RHEL 5 installs will probably already have this set correctly.  RHEL 6 may need to have this changed.

For RHEL 5
nano +302 /etc/php.ini
memory_limit = 128M

For RHEL 6
nano +457 /etc/php.ini
memory_limit = 128M

As always after php.ini changes, apache needs to be restarted for the changes to take effect.
service httpd restart
Download and untar source files.   Zaptel/Dahdi is not included in this install procedure.  Starting with Asterisk 1.6.2/FreePBX2.9, it is possible to use ConfBridge in place of MeetMe conferencing.  Meetme conferencing was the last Asterisk application that required a timing source. The only reason to install zaptel/dahdi now is if you are installing telephony hardware.  Meetme still has some features that confbridge does not and is still required if you also require paging.  To install meetme conferencing you must install dahdi and ensure meetme is selected during the asterisk menuselect installation part of the procedure.  You can also install confbridge but FreePBX will default to use MeetMe if it detects it.

Get FreePBX.  Check if this is the latest released version.
cd /usr/src
tar zxvf freepbx-2.10.0.tar.gz

Get Asterisk v1.8.
tar zxvf asterisk-1.8-current.tar.gz

NOTE: There is no separate asterisk addons package to download starting with Asterisk v1.8

cd /usr/src/asterisk-1.8*
make clean
./configure && make menuselect

Select all addons.  I believe these are all needed or recommended for FreePBX.  Select base and addon sounds.  I suggest ulaw as they sound better than gsm especially if you are using ulaw as your default codec.  I usually just check both.  Then make sure to press the "save" button afterwards.

When you select 'format_mp3' above as an addon you must run a script before going any further otherwise the install will fail.


You must also have subversion installed to run the above script and be in the root directory of the Asterisk source code.

Now install Asterisk.  NOTE: If upgrading Asterisk on an already running FreePBX system do NOT run make samples.

make && make install && make samples

Create user.  May already exist but just to make sure
useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk

The following directory may already exist but just to make sure
mkdir /var/run/asterisk

Set ownership
chown -R asterisk /var/run/asterisk
chown -R asterisk /var/log/asterisk
chown -R asterisk /var/lib/asterisk/moh
chown -R asterisk /var/lib/php/session

Music on Hold
The Asterisk default moh directory is "/moh" and the Freepbx default moh directory is "/mohmp3".  If we create a symbolic link instead everything is in one place and can still be found by both FreePBX and Asterisk.  FreePBX uses mohmp3 by default so moh just sits there unused if we do not create a symbolic link.  You can switch between these two moh directories in the new Advanced Settings GUI.  I still include this symbolic link procedure for legacy reasons.  If you do it everything is in one directory always no matter what.  That simplifies things and simpler is often better.
ln -s /var/lib/asterisk/moh /var/lib/asterisk/mohmp3

The new default behaviour for Asterisk and Freepbx is to only use wav files for moh due to transcoding overhead and Asterisk stability issues with mp3's. So we want to install mpg123 for converting uploaded mp3's to wav automagically.  If you won't be uploading or streaming mp3's or won't be using FreePBX (new) default behaviour then you probably don't need to install mpg123.

cd /usr/src
tar -xjvf mpg123-1.14.2.tar.bz2

cd mpg123-1.14.2
./configure && make && make install

Freepbx php script cannot find mpg123 by default so we need to create a symbolic link.
ln -s /usr/local/bin/mpg123 /usr/bin/mpg123



Change User apache and Group apache to User asterisk and Group asterisk.

sed -i "s/User apache/User asterisk/" /etc/httpd/conf/httpd.conf
sed -i "s/Group apache/Group asterisk/" /etc/httpd/conf/httpd.conf



Before you can do anything to MySQL, you need to make sure it's running:
NOTE: If running RHEL/CENTOS/SL 6 you may need to run this first.
Try without and see if it starts first.

service mysqld start
Initializing MySQL database:                               [  OK  ]
Starting MySQL:                                            [  OK  ]

Now, to configure the databases for freePBX:
Note: If mysql admin password is already configured, add "-p" after the command and enter password when asked.  For example, "mysqladmin -p create asterisk"

cd /usr/src/freepbx-2.10.0
mysqladmin create asterisk
mysqladmin create asteriskcdrdb
mysql asterisk < SQL/newinstall.sql
mysql asteriskcdrdb < SQL/cdr_mysql_table.sql

They also need to be secured.  FreePBX will prompt you for a database username/password when you do the install. You need to pick that now. We'll assume that you've picked 'asteriskuser' and 'amp109' - you probably shouldn't use these, as they are well known passwords for Freepbx.  If you use these well know defaults and your server is not firewalled make sure to set bind-address = further down in this procedure so that MySQL only listens to localhost.  Or better yet do both.

Security check: It's very important to check that Allow Login With DB Credentials is set to FALSE in FreePBX Advanced Settings GUI.  This is the default setting.  If it were set to TRUE and you were using the default credentials ofasteriskuser/amp109 and your FreePBX GUI were exposed to the internet (ie. the http port), anyone could log into yourFreePBX GUI as administrator using those credentials.

MySQL creates a test database and 2 anonymous user accounts by default which we don't need so first we delete them.  MySQL also creates a non-local root@hostname account and assuming you don't want to access the database remotely as root (other than via SSH) you should probably delete that for security reasons.  DO NOT DELETE the root@localhost account.


mysql> DROP DATABASE test;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'hostname';
| Variable_name | Value          |
| hostname      | |
1 row in set (0.00 sec)

mysql> DROP USER ''@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> DROP USER ''@'';
Query OK, 0 rows affected (0.00 sec)

mysql> DROP USER 'root'@'';

mysql> GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'amp109';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q

Now, after all of this, you need to pick a root 'mysql' password. We'll make it 'abcdef' just for this example.  You should use a reasonably strong password. If you need to do anything else with mysql, you'll need to provide this password.
mysqladmin -u root password 'abcdef'
Install FreePBX

You may get a bunch of warnings, errors, and notices at this point.  Don't worry about them.  Hit ENTER to get a command prompt.

cd /usr/src/freepbx-2.10.0

If you get any warnings or errors in the last part of the output, they're usually not traumatic.

Default username is: admin
Default pw is: admin
Freepbx 2.10 now wants to create symlinks to some .conf files and complains if actual files already exist as is the case when Asterisk make samples is run.  So we need to delete these files.  In FreePBX 2.9 you should only have to delete sip_notify.conf and ccss.conf.  Not sure what would happen if you try delete the rest.  After deleting the following files, the next time we make a change in FreePBX and apply settings these symlinks will be created.

rm -f /etc/asterisk/sip_notify.conf
rm -f /etc/asterisk/iax.conf
rm -f /etc/asterisk/logger.conf
rm -f /etc/asterisk/features.conf
rm -f /etc/asterisk/sip.conf
rm -f /etc/asterisk/extensions.conf
rm -f /etc/asterisk/ccss.conf
rm -f /etc/asterisk/chan_dahdi.conf

Edit /etc/asterisk/cdr_mysql.conf and add 'loguniqueid=yes' to the global section which will give each call record a unique identifier number.

nano /etc/asterisk/cdr_mysql.conf

set FreePBX to start on boot
echo /usr/local/sbin/amportal start >> /etc/rc.local

Enable Apache and MySQL to start on boot
chkconfig httpd on
chkconfig mysqld on

Now reboot at which point you should be able to access FreePBX with your web browser.  The very first thing you need to do when you enter the FreePBX Admin GUI for the first time is "Apply Configuration Changes" so all the *.conf files are created then reboot again or 'amportal restart' from command prompt.

You may get an error in the FreePBX GUI saying "symlink failed for /etc/asterisk/sip_notify.conf" or something along those lines.  If that is the case just delete or rename /etc/asterisk/sip_notify.conf.  The next time you "Apply Configuration Changes" in the FreePBX GUI after some change this file will be recreated and the error should be gone.

AMPORTAL.conf changes

FreePBX v2.9+ now includes an "advanced settings" gui that is designed to replace amportal.conf and the requirements to edit it directly.  There are also some settings in a new file /etc/freepbx.conf

At this point you should go into this new advanced settings GUI on the FreePBX webpage and edit the following settings:


In the GUI Go to: Tools>Advanced Administration>Advanced Settings>System Setup>User Portal Admin Password

Choose your admin password for accessing the Voicemail & Recordings (ARI) section of the front webpage.

In the same GUI go to: System Setup>FreePBX Web Address

Remove the "xx.xx.xx.xx" and leave blank.  If that does not work use your public (ie. web facing) IP address for this server.

After saving these changes by pressing the green arrow on the right hand side of each box make sure to "Apply Configuration Changes" at the top of the GUI.

How to install G.729 and G.723 open source codecs on Elastix

Written by admin on November 22, 2014. Posted in Asterisk, Elastix

Please note that this tutorial is for education purposes only. If you want to use the codecs you should consider paying royalties to the creators of the codecs.

Precompiled codec modules can be found here:  choose the one that is for your system architecture.

To find the details of your server architecture do the following

# uname -a

# cat /proc/cpuinfo

Use the information to select the codec suitable for your server.

Navigate to the modules folder

#  cd /usr/lib/asterisk/modules

or  if using 64 bit centos

# cd /usr/lib64/asterisk/modules

Download the codecs e.g

# wget

# wget

# /etc/init.d/asterisk restart

# asterisk -r

#CLI> core show translation

You should now see the codecs populated.

How to install Vicidial on Goautodial in Centos 5

Written by admin on November 22, 2014. Posted in Dialers

This installation can be done on a dedicated server, OpenVZ vps server or Xen vps server. Please follow the instructions carefully lest you run into problems. Installation of Vicidial from scratch is a bit of a long way in Debian 6. But using GoAutodialer, Vicidial can be deployed withing ten minutes.

1. Install the Goautodial yum repository

# cd /etc/yum.repos.d/

# wget

2. Install all required dependencies

# yum install openssl mod_ssl screen sox subversion mysql mysql-server mysql-devel httpd php php-mysql php-gd \
php-cli php-mcrypt php-mbstring php-cli php-pdo php-pear php-devel phpmyadmin lame ploticus mpg123 htop iftop \
munin munin-node vim-enhanced rsync gcc-c++ fail2ban ntp \
perl-Data-Dumper perl-String-CRC perl-NetAddr-IP perl-Proc-ProcessTable perl-Archive-Tar perl-Test-Tester \
perl-Spiffy perl-HTML-Template perl-RPM-Specfile perl-Spreadsheet-WriteExcel perl-Proc-Daemon perl-IO-Compress-Base \
perl-Set-Scalar perl-HTML-Parser perl-XML-Parser perl-Compress-Zlib perl-Crypt-DES perl-Term-ReadLine-Gnu perl-Digest-SHA \
perl-TermReadKey perl-URI perl-Net-Server perl-Digest-HMAC perl-IO-Zlib perl-HTML-Tagset perl-Error perl-IO-stringy \
perl-Module-Install perl-Test-Base perl-Net-Daemon perl-DateManip perl-PlRPC perl-Spreadsheet-ParseExcel \
perl-Net-Address-IPv4-Local perl-File-Which perl-Net-Telnet perl-ExtUtils-CBuilder perl-Mail-Sendmail perl-XML-Writer \
perl-File-HomeDir perl-Text-Glob perl-Text-CSV_XS perl-libwww-perl perl-Unicode-Map perl-DBD-MySQL \
perl-Net-SSLeay perl-rrdtool perl-DBD-Pg perl-DBI perl-Digest-SHA1 perl-Curses perl-BSD-Resource perl-Compress-Raw-Zlib \
perl-OLE-Storage_Lite perl-Net-SNMP perl-Parse-RecDescent perl-YAML-Tiny perl-YAML perl-Test-NoWarnings perl-Archive-Zip \
perl-Proc-PID-File perl-Jcode perl-Text-CSV perl-Net-Address-IP-Local-0.1.2.tar.gz.noarch perl-Spreadsheet-XLSX \
perl-Spreadsheet-ReadSXC perl-Spreadsheet-Read perl-Tk perl-Tk-TableMatrix


3. Install Asterisk and Dahdi packages

#yum install asterisk asterisk-perl dahdi-linux dahdi-tools kmod-dahdi-linux \
asterisk-sounds-core-en-alaw asterisk-sounds-core-en-gsm asterisk-sounds-core-en-ulaw \
asterisk-sounds-extra-en-alaw asterisk-sounds-extra-en-gsm asterisk-sounds-extra-en-ulaw

4. Install Install Vicidial and Goautodial packages

# yum install vicidial vtigercrm goautodial-ce goautodial-ce-config


5. Create vicidial index page to prevent directory browsing

# cd /var/www/html/vicidial

# mv welcome.php index.php


 6. Reboot


7. Visit http://youripaddress   to login to goautodial


8. To Go directly to vicidial go to http://youripaddress/vicidial/


Below are the default login details

Goautodial 2.1:

Login Password
MySQL  http://yourip/phpmyadmin/ root vicidialnow
VICIDIAL Admin – http://youripaddress/ admin goautodial
vTiger – http://youripaddress/vtigercrm/ admin goautodial
User Login – http://youripaddress/ agent001 to agent020 goautodial
Phone Login (SIP) – http://youripaddress/ 8001 to 8020 goautodial
Phone Login (IAX) – http://youripaddress/ 7001 to 7020 goautodial
SIP Phone Credentials 8001 to 8020 goautodial
IAX Phone Credentials 7001 to 7020 goautodial



How to install PIAF on a Xen VPS

Written by admin on November 22, 2014. Posted in PIAF

This method was tested on  Centos 6 - 32bit

1. Download Media

# cd /media
# wget ''

2. Mount Iso

# mkdir iso

# mount -o loop pbxinaflash20624-i386.iso /media/iso


3. Create Repo

# echo 

name=CentOS-$releasever - Local
' > /etc/yum.repos.d/CentOS-Local.repo

# yum --disablerepo=\* --enablerepo=c6-local upgrade

4. Install dependencies

# yum --disablerepo=\* --enablerepo=c6-local groupinstall additional-devel base cifs-file-server compat-libraries console-internet core debugging development mail-server ftp-server hardware-monitoring java-platform legacy-unix mysql network-file-system-client network-tools php performance perl-runtime security-tools server-platform server-policy system-management system-admin-tools web-server

# yum --disablerepo=\* --enablerepo=c6-local install kernel-devel php php-mysql php-gd php-mbstring php-pear php-pear-db perl perl-libwww-perl perl-DateManip perl-DBD-mysql perl-DBI perl-Net-DNS perl-suidperl perl-XML-Parser audiofile-devel dhcp gd lm_sensors libusb-devel mysql-devel gcc-c++ flite flite-devel automake xinetd tftp-server piafdl piafxtras joe gtk2 gtk2-devel arts arts-devel esound-devel jack-audio-connection-kit lcms libart_lgpl-devel libogg-devel libvorbis-devel nas pulseaudio-libs SDL alsa-lib-devel libmng libtool-ltdl libtool-ltdl-devel qt dialog coreutils sqlite-devel libstdc++-devel tzdata ntp ntpdate php-process php-imap php-xml

# /usr/sbin/ntpdate -su mkdir -p /etc/pbx mkdir -p /etc/viaf mkdir -p /etc/siaf date --iso-8601=minutes > /etc/pbx/.installdate echo "20624" > /etc/pbx/.isoversion echo "20624" > /etc/viaf/.isoversion echo "20624" > /etc/siaf/.isoversion echo "ks" > /etc/pbx/.installmethod echo "ks" > /etc/viaf/.installmethod echo "ks" > /etc/siaf/.installmethod echo "/usr/local/sbin/isomenu" >> /etc/rc.d/rc3.d/S99local /bin/cp -f /usr/src/piafxtras/preinstallmenu/piafxtras-menu /usr/local/sbin/piafxtras-menu chmod +x /usr/local/sbin/piafxtras-menu cat /usr/src/piafxtras/preinstallmenu/motd.tmp >/etc/motd

5.Unmount media and reboot to continue with installation

# umount /media/iso

# reboot

6. Once rebooted login via console. and follow the installation instructions and you are done.

How to install AsteriskNow with Freepbx on Centos 6 VPS

Written by admin on November 22, 2014. Posted in Asterisk, Freepbx

It is a little complex to install freepbx and asterisk from scratch on a vps. However installing the AsteriskNow packagees ensure a smooth and simple installation procedure. In this tutorial we are going to be installing Freepbx 2.11 and AsteriskNow.


Installing asterisk now

# yum -y install dnsmasq 

# rpm -Uvh

# yum -y update

# yum -y install asterisk asterisk-configs --enablerepo=asterisk-11

 #  yum -y install dahdi-linux dahdi-tools libpri
Installing Freepbx

# yum -y install gcc gcc-c++ wget bison mysql-devel mysql-server php php-mysql php-process php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel php-gd audiofile-devel gtk2-devel subversion nano kernel-devel selinux-policy sqlite-devel openssl-devel

***Install CDR ODBC required packages

# yum -y  install libtool-ltdl-devel unixODBC unixODBC-devel mysql-connector-odbc

***Install optional packages

****chan_gtalk, chan_motif, and res_xmpp will not compile unless iksemel-devel and it's dependencies are installed. If you plan to use Google Voice ****you will need to install this. For CentOS 6, iksemel is in the EPEL repository.

#rpm -Uvh
yum -y install iksemel-devel

****Install pear DB

****Don't worry about the warning message.

# pear install db

# yum -y install asterisk-odbc php-pear-DB asterisk-sounds-extra-en-gsm
# nano /usr/sbin/safe_asterisk

Find the line with TTY=9 and comment it out like this #TTY=9
# /usr/sbin/safe_asterisk
# rpm -Uvh

# amportal chown /etc/dahdi/modules

# amportal chown /etc/dahdi/system.conf

Navigate to http://youripaddress  and enter your login credentials. Then login with those credentials

How to change your server time

Written by admin on November 22, 2014. Posted in Basic Linux

Many voip applications require you to use server time for certain purposes. These include reminders, time conditions etc. In order to get correct timing your server needs to be synchronised to the correct local time. This article shows how you can achieve this in Linux.

Login to ssh and type the following commands:


# /etc/sysconfig/clock

Edit the file to look like the following and replace GMT with whatever time zone you want


For the time on the machine to reflect the change timezone we need to link the zoneinfo file to /etc/localtime. This can be done as follows :

If you are setting your timezone to "GMT" link the following file to /etc/localtime :
# ln -sf /usr/share/zoneinfo/Brazil/East /etc/localtime
Now by typing the date command to display the time you should see if reflect the newly linked timezone :
# date
Thu Sep 30 10:06:23 GMT 2014
If the time is still not correct but showing correct time zone then you will need to edit the time using 

# date 011923072014 

to change to 19 January 23:07  2014 for example

How to install a2billing callback daemon on Elastix

Written by admin on November 22, 2014. Posted in A2billing, Elastix

If you follow the installation procedures given on forums you will notice that after installation either your callback daemon shows it has started but if you try to get status using command "service a2b-callback-daemon status" It shows that its not running. or it fails to even start at all. This is not because the installation procedures are wrong. This happens because of the SQLalchemy version that is default with python 2.4. Callback daemon does not run on any SQLalchemy version less than 0.6. The next procedure shows how to correctly install the callback daemon on Elastix without problems.

The first thing you need to know is that the directory of a2billing is different on Elastix from the ones you find on many forums. The correct folder is /usr/share/a2billing.

So now lets install the Daemon.

Login via ssh

# cd /usr/share/a2billing
# yum -y install python-setuptools.noarch
yum -y install MySQL-python
easy_install sqlalchemy

You will notice that the Sqlalchemy version installed is 0.3.x-py2.4.egg

You need to remove this and install a newer version

*If you had not installed SQLAlchemy for the below instructions just follow the ones in blue

# rm -rf /usr/lib/python2.4/site-packages/SQLAlchemy-0.3.11-py2.4.egg

#cd  /usr/lib/python2.4/site-packages/

# rm -rf sqlalchemy

# rm  -rf  SQLAlchemy-0.3.11-py2.4.egg-info


# tar zxvf SQLAlchemy-0.7.10.tar.gz

# cd SQLAlchemy-0.7.10

# python install

*If you had not installed SQLAlchemy for the above insttructions just follow the ones in blue

Change to callback directory

# cd /usr/share/a2billing/CallBack/callback-daemon-py
# cp callback_daemon/a2b-callback-daemon.rc /etc/init.d/a2b-callback-daemon
# chmod +x /etc/init.d/a2b-callback-daemon
# cp dist/ /tmp
# cd /tmp
# tar xvfz
# cd
# python build
# python bdist_egg

Now install Daemon

#easy_install dist/callback_daemon-1.0.prod_r1528-py2.4.egg

chkconfig --add a2b-callback-daemon
service a2b-callback-daemon start
chkconfig a2b-callback-daemon on