Professional Documents
Culture Documents
-zxf
-zxf
-zxf
-zxf
asterisk-1.6.2.6.tar.gz
asterisk-addons-1.6.2.1.tar.gz
dahdi-linux-complete-current.tar.gz
libpri-1.4-current.tar.gz
Install Libpri
cd libpri-VERSION
make clean
make
make install
Install DAHDI
cd ..
cd dahdi-linux-complete-2.3.0.1+2.3.0
make all
make install
make config
service dahdi start
dahdi on
./configure
make menuselect
A menu will come up. Usually everything by default is fine, however I would
also suggest installing the asterisk extras sound files in addition to the regular
sound files.
make
make
make
make
make
install
samples
progdocs
config
Lets just make sure that Asterisk starts properly. Ignore the warnings:
asterisk -vvvvvvvvvvvvvvvvvvvc
core stop now
Voip-Info suggests not to install oh323, so remove that when the menu comes
up
make
make install
make samples
Set up MySQL
service mysqld start
mysql
CREATE USER 'asterisk'@'localhost' IDENTIFIED BY '9e4yb4GDHu5weHR498n';
GRANT FILE ON * . * TO 'asterisk'@'localhost' IDENTIFIED BY
'9e4yb4GDHu5weHR498n'
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 'asterisk'@'localhost';
(Replace 9e4yb4GDHu5weHR498n with your own password. All I did was randomly
type a whole bunch of stuff)
We need to edit the Asterisk related mysql configs to point to the right
database with the correct credentials
nano /etc/asterisk/cdr_mysql.conf
nano /etc/asterisk/res_mysql.conf
vi /etc/asterisk/res_config_mysql.conf(asterisk 11)
My general section looks like this. Adjust the password accordingly:
[general]
dbhost = localhost
dbname = asterisk
dbuser = asterisk
dbpass = 9e4yb4GDHu5weHR498n
dbport = 3306
dbsock = /var/lib/mysql/mysql.sock
Aside from the context names, make sure that this is the only string
uncommented. From what I remember, everything except the context names
were commented, so this will need to be uncommented:
full => notice,warning,error,debug,verbose
apache:apache /etc/asterisk/additional_a2billing_iax.conf
cd addons/sounds/
./install_a2b_sounds.sh
cd /usr/src/a2billing/AGI
cp -r a2billing.php /var/lib/asterisk/agi-bin/
cp -r lib/ /var/lib/asterisk/agi-bin/
chmod +x /var/lib/asterisk/agi-bin/a2billing.php
mkdir /var/www/html/a2billing
chown apache:apache /var/www/html/a2billing
cd ..
cp -r admin/ /var/www/html/a2billing
cp -r customer/ /var/www/html/a2billing
cp -r agent/ /var/www/html/a2billing
cp -r common/ /var/www/html/a2billing
cp -r webservice/ /var/www/html/a2billing
cd /var/www/html/a2billing/
chmod 777 /var/www/html/admin/templates_c/
chmod 777 /var/www/html/agent/templates_c/
chmod 777 /var/www/html/customer/templates_c/
./install-db.sh
In the database section, dbname should read the database name (a2billingdb),
user is the username you just created (a2user) and password is the password
you created. Everything else can stay as is.
Secure MySQL
Edit: nano /etc/my.cnf
Under the [mysqld] section, add:
bind-address = 127.0.0.1
mysqld restart
; This is where inbound DID calls are pointed to if you plan to be a DID
service provider
exten => _X.,1,DeadAGI(a2billing.php,1,did)
exten => _x,1,Hangup()
***On earlier versions of Asterisk 1.4 you will need to change the commas (,) to
bars (|)***
Add A2Billing cron schedules
A2Billing has many features such as currency updating, subscriptions, etc. In
order to automate all this we need to set a schedule.
Run this script. For some reason the cron jobs need
it: mkdir /var/run/a2billing
Type crontab -e and press i to insert data. Paste the following:
# update the currency table
0 6 * * * php /usr/src/a2billing/Cronjobs/currencies_update_yahoo.php
# manage the monthly services subscription
0 6 1 * * php /usr/src/a2billing/Cronjobs/a2billing_subscription_fee.php
# To check account of each Users and send an email if the balance is
#less than the user have choice.
0 * * * * php /usr/src/a2billing/Cronjobs/a2billing_notify_account.php
# this script will browse all the DID that are reserve and check if
#the customer need to pay for it
# bill them or warn them per email to know if they want to pay in
#order to keep their DIDs
0 2 * * * php /usr/src/a2billing/Cronjobs/a2billing_bill_diduse.php
# This script will take care of the recurring service.
0 12 * * * php /usr/src/a2billing/Cronjobs/a2billing_batch_process.php
# To generate invoices and for each user.
0 6 * * * php /usr/src/a2billing/Cronjobs/a2billing_batch_billing.php
# to proceed the autodialer
*/5 * * * * php /usr/src/a2billing/Cronjobs/a2billing_batch_autodialer.php
# manage alarms
0 * * * * php /usr/src/a2billing/Cronjobs/a2billing_alarm.php
We now need to install PHP 5.2 to ensure we get A2Billing working to its full
ability. PHP 5.2 isnt officially released for CentOS yet, so we need to be
careful. Also note that PHP 5.3 is NOT compatible with A2Billing as of yet.
Confirm that the packages about to be upgraded will be upgraded to PHP 5.2
and continue with the upgrade. I will need to update this article if PHP 5.3+
enters the repo and A2Billing still does not support it. Please contact me if this
happens.
One last thing we want to do is edit php.ini to allow for greater file uploading.
This will help us when we make rate decks.
nano +573 /etc/php.ini
Change: upload_max_filesize
= 2M
to:
upload_max_filesize = 12M
-A
-A
-A
-A
INPUT
INPUT
INPUT
INPUT
-p
-p
-p
-p
udp
udp
udp
tcp
-m
-m
-m
-r
Ok, lets reboot the server now. Upon startup, try accessing A2Billing by going
to https://SERVER-IP/abilling/admin Note: HTTPS
Username: root
Password: changepassword
Credentials are case sensitive
Once you can get in, go to System Settings, Global List. Under
the webui section, edit my_max_file_size_import and change the value
to 12582912
We need to set this up in the PHP config file too.
nano +582 /etc/php.ini
Followed by:
In the Global List settings you also want to configure the way your calling card
or VoIP service works. Each agi-conf gives different settings. The purpose
of agi-conf is to control the call in progress. For instance, if you want to use
your system for VoIP least cost routing and for calling cards, the calling cards
would use one agi-conf and the VoIP stuff would use another.
Inextensions.conf under the a2billing sample contexts we created, you will see
a2billing.php,1. The number 1 represents the agi-conf to point to. You usually
want to point DIDs to agi-conf 1 and set this config to not answer calls, this
way you are not charged for ringing. You need to build the agi-conf and
configure it accordingly. It is safe to play around with the agi-conf. The setting
forpinless dialing is cid_enable. For DIDs you want to make sure
that use_dnid is enabled.
cd /usr/src/a2billing/AGI
cp -r a2billing.php /var/lib/asterisk/agi-bin/
cp -r lib/ /var/lib/asterisk/agi-bin/
chmod +x /var/lib/asterisk/agi-bin/a2billing.php
mkdir /var/www/html/a2billing
chown apache:apache /var/www/html/a2billing
cd ..
cp -r admin/ /var/www/html/a2billing/
cp -r customer/ /var/www/html/a2billing/
cp -r agent/ /var/www/html/a2billing/
cp -r common/ /var/www/html/a2billing/
cp -r webservice/ /var/www/html/a2billing/
cd /var/www/html/a2billing/
chmod 777 /var/www/html/a2billing/admin/templates_c/
chmod 777 /var/www/html/a2billing/agent/templates_c/
chmod 777 /var/www/html/a2billing/customer/templates_c/
database-a2billingdb
user--a2buser
pwd--fiyu@1