Instalando a2billing no Ubuntu
Atualizando o sistema do Ubuntu
Após a instalação PADRÃO do UBUNTU, atualize o kernel e o sistema Ubuntu com o comando:
$ su [entre com a sua senha de root]
# apt-get update
# apt-get upgrade
Responda S ou Y (de acordo com a linguagem escolhida na instalação) e tecle Enter.
O sistema será atualizado. Banda larga demora cerca de 10 minutos.
Instale os pacotes necessários para executar o A2Billing e o Asterisk:
# apt-get install libnewt-dev libssl0.9.7 libssl-dev zlib1g-dev libncurses5-dev libeditline0 libeditline-dev libedit2 libedit-dev linux-image-2.6.20-16-generic linux-headers-2.6.20-16-generic mpg123 libmysqlclient15-dev apache2 libapache2-mod-php5 php5 php5-cgi mysql-server libapache2-mod-auth-mysql php5-mysql doxygen libtiff4 libtiff4-dev libxml2 libxml2-dev build-essential automake fakeroot debhelper autotools-dev cdbs pkg-config gcc g++ cpp
Execute o comando abaixo para criar um link para o kernel do Linux:
# ln -s /usr/src/linux-headers-2.6.20-16-generic/ /usr/src/linux
Agora vamos para o próximo passo.
Configurando o sistema em geral para funcionamento do A2Billing
Execute os comandos abaixo:
# a2enmod rewrite
# vi /etc/apache2/apache2.conf
Adicione o texto abaixo:
AddType application/x-httpd-php5-source .phps
AddType application/x-httpd-php5 .php .phtml
Saia e salve com “CTRL+X + Y ou S e “Enter”.
Execute o comando abaixo:
# vi /etc/php5/apache2/php.ini
Insira o texto abaixo:
extension=mysql.so
extension=gd.so
Saia e salve com “CTRL+X + Y ou S e “Enter”.
# mysqladmin -u root password (senha do root do Linux)
# mysqladmin -u root -p create drupal
# mysql <enter>
E digite o texto abaixo:
CREATE USER (seu usuário do Linux) IDENTIFIED BY ’sua senha’;
GRANT ALL PRIVILEGES ON drupal*.* TO ‘usuário’@'host’ IDENTIFIED BY ’senha’;
GRANT ALL PRIVILEGES ON drupal51.* TO ‘usuário’@'host’ IDENTIFIED BY ’senha’;
FLUSH PRIVILEGES;
quit;
# apt-get install drupal-5.1
Configure a base com mysql.
# vi /etc/drupal/5.1/conf.php
Insira o texto abaixo:
<?php
$db_url = “mysql://usuário:senha@host/drupal”;
$base_url = “http://seu-ip-publico/drupal”;
?>
Saia e salve com “CTRL+X + Y ou S e “Enter”.
# vi /etc/asterisk/res_mysql.conf
Mudar o BIND_ADDRESS para o seu IP público.
Saia e salve com “CTRL+X + Y ou S e “Enter”.
Instalação e configuração do Asterisk e seus pacotes fundamentais
Baixando e compilando os pacotes:
# cd /home
# mkdir cti (diretório de sua escolha, no meu caso, CTI)
# cd cti (diretório que você criou)
# wget
http://ftp.digium.com/pub/libpri/releases/libpri-1.4.1.tar.gz
http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.4.tar.gz
http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.8.tar.gz
http://ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.2.tar.gz
http://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.tar.gz
# tar -xvzf libpri-1.4.1.tar.gz
# tar -xvzf zaptel-1.4.4.tar.gz
# tar -xvzf asterisk-1.4.8.tar.gz
# tar -xvzf asterisk-addons-1.4.2.tar.gz
# tar -xvzf asterisk-sounds-1.2.1.tar.gz
# rm -r *.gz
# cd libpri-1.4.1
# make
# make install
# cd ..
# cd zaptel-1.4.4
# ./configure
# make
# make install
# cd ..
# cd asterisk-1.4.8
# ./configure
# make
# make install
# make samples
# cd ..
# cd asterisk-addons-1.4.2
# ./configure
# make
# make install
# make samples
# cd ..
# cd asterisk-sounds-1.2.1
# make
# make install
# cd ..
# cp /home/cti/asterisk/contrib/init.d/rc.debian.asterisk /etc/init.d/asterisk
# update-rc.d -f asterisk defaults 98
# echo “zaptel” >> /etc/modules
# echo “ztdummy” >> /etc/modules
# vi /etc/asterisk/res_mysql.conf
Verifique o usuário e o dbsock, que deve ser:
/var/run/mysqld/mysqld.sock
Salve e encerre com “CTRL + X, seguido de Y ou S e tecle “Enter”.
Carregando manualmente os módulos necessários para o uso do Asterisk com o ZTDUMMY
Carregando o módulo zaptel:
# modprobe zaptel
# modprobe ztdummy
# ztcfg -vvvvvvvv
Após ter sido executado o “ztcfg -vvvvvvvv”, se o retorno for:
Zaptel Version: 1.4.0
Echo Canceller: MG2
Configuration
Channel map:
Channel 01: ***********************
Então deu tudo certo! Caso o retorno seja algo diferente, verifique se digitou todos os comandos corretos ou se não houve erro em algum dos passos anteriores!
Testando o funcionamento do Asterisk
Execute o comando:
# /etc/init.d/asterisk start
ou apenas:
# safe_asterisk
# asterisk -r
Se você estiver acessando o console de comandos do Asterisk, então tudo deu certo! Sai do console com o comando:
asterisk*CLI> stop now
Agora vamos verificar o acesso via IP. Certifique-se de que o MYSQL está rodando. Execute o comando:
# lsmod
Verifique se há o MYSQL iniciado no sistema. Caso não esteja, instale com o comando abaixo. Em caso contrário, siga para o passo seguinte.
# apt-get install mysql-server
Reinicie o serviço da acesso da WEB:
# /etc/init.d/apache2 restart
Depois abra o navegador de outro PC e faça o teste de navegação teclando o seguinte endereço:
http://localhost/drupal
E veja se abre o LINK.
Se abriu o LINK, basta agora FINALIZAR o processo instalando o A2Billing.
instale o A2Billing perfeitamente
Faça o download do A2Billing com os comandos abaixo:
# cd /usr/src
# mkdir a2billing
# cd a2billing
# wget http://a2billing.net/downloads/A2Billing_1.3.0.tar.gz
# tar -xzvf a2billing.tar.gz
Crie o atalho para o site virtual do A2Billing:
# ln -s /usr/src/a2billing/A2Billing_UI /var/www/a2billing
Alterando o A2billing:
Execute os comandos abaixo:
# mysql
GRANT ALL PRIVILEGES ON *.* TO ‘a2billinguser’@'%’ IDENTIFIED BY ‘a2billing’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘a2billinguser’@'localhost’ IDENTIFIED BY ‘a2billing’ WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO ‘a2billinguser’@'localhost.localdomain’ IDENTIFIED BY ‘a2billing’ WITH GRANT OPTION;
quit;
# mysqladmin create mya2billing -u a2billinguser -p
# mysql mya2billing -u a2billinguser -p < /usr/src/a2billing/DataBase/mysql/Mysql-5.x/
a2billing-mysql-schema-MYSQL.5.X-v1.3.0.sql
# mysql mya2billing -u a2billinguser -p (password a2billing)
mysql> use mya2billing;
mysql> select * FROM cc_ui_authen;# vi /usr/src/a2billing/a2billing.conf
Insira o texto abaixo:
[database]
hostname=localhost
port=5432
user=a2billinguser
password=a2billing
dbname=mya2billing
dbtype=mysql
Saia e salve com “Ctrl + X seguido de Y ou S e tecle “Enter”.
# cp /usr/src/a2billing/a2billing.conf /etc/asterisk/
# ln -s /usr/src/a2billing/A2Billing_UI /var/www/a2billing
# ln -s /usr/src/a2billing/ACustomer_UI /var/www/a2billingcustom
# vi /etc/asterisk/a2billing.conf
e
# vi /usr/src/a2billing/a2billing.conf
Na sessão [webui]
;configuration for the Web interface
[webui]; Path to store the asterisk configuration files
buddyfilepath = /etc/asterisk/; Email of the admin (not used yet)
email_admin = info@areski.net; Card lenght
len_cardnumber = 10; Voucher lenght
len_voucher = 15; amount of MOH class you have created in musiconhold.conf :
acc_1, acc_2… acc_10 class etc…
num_musiconhold_class = 10;MANAGER CONNECTION PARAMETERS
manager_host = localhost
manager_username = myasterisk
manager_secret = mycode; Allow to display the help section inside the admin interface
(YES - NO)
show_help=”YES”; Parameter of the upload
my_max_file_size_import = 512000
my_max_file_size = 512000 ; in bytes; Not used yet, goal is to upload files and use them directly in
the IVR
dir_store_audio = /var/lib/asterisk/sounds/a2billing; Parameter of the upload
my_max_file_size_audio=3072000 ; in bytes; the file type extensions allowed to be uploaded such as “gsm,
mp3, wav” (separate by ,)
file_ext_allow = gsm, mp3, wav; the file type extensions allowed to be uploaded for the
musiconhold such as “gsm, mp3, wav” (separate by ,)
file_ext_allow_musiconhold = mp3; ENABLE THE CDR VIEWER TO LINK ON THE MONITOR FILES (YES - NO)
link_audio_file = “NO”; PATH TO LINK ON THE RECORDED MONITOR FILES
monitor_path = /var/spool/asterisk/monitor
// grant access to apache user on read mode for the directory :>
chmod 755 /var/spool/asterisk/monitor/; FORMAT OF THE RECORDED MONITOR FILE
monitor_formatfile = gsm; Display the icon in the invoice
show_icon_invoice = “YES”; Display the top frame (useful if you want to save space on your
little tiny screen )
show_top_frame = “NO”
Saia e salve com “Ctrl + X seguido de Y ou S e tecle “Enter”.
# chmod 777 /etc/asterisk
# chmod 777 /usr/src/a2billing
# mkdir /var/lib/asterisk/moh/mp3
# for X in `seq 1 10`; do mkdir /var/lib/asterisk/moh/mp3/acc_$X; done
# chmod 777 /var/lib/asterisk/moh/mp3/acc_*
# mkdir /var/lib/asterisk/sounds/a2billing
# chmod 777 /var/lib/asterisk/sounds/a2billing
No sip.conf, adicione a seguinte linha no fim do texto:
#include additional_a2billing_sip.conf
Saia e salve com “Ctrl + X seguido de Y ou S e tecle “Enter”.
No iax.conf, adicione a seguinte linha no fim do texto:
#include additional_a2billing_iax.conf
Saia e salve com “Ctrl + X seguido de Y ou S e tecle “Enter”.
Execute os comandos abaixo:
# vi /etc/asterisk/manager.conf
Verifique o enabled=yes:
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
;displayconnects = yes
Adicione a linha abaixo:
[myasterisk]
secret = mycode
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
Saia e salve com “Ctrl + X seguido de Y ou S e tecle “Enter”.
Edite o musichold.conf conforme segue abaixo:
# vi /etc/asterisk/musiconhold.conf
; class definitions For A2Billing
acc_1 => mp3:/var/lib/asterisk/mohmp3/acc_1
acc_2 => mp3:/var/lib/asterisk/mohmp3/acc_2
acc_3 => mp3:/var/lib/asterisk/mohmp3/acc_3
acc_4 => mp3:/var/lib/asterisk/mohmp3/acc_4
acc_5 => mp3:/var/lib/asterisk/mohmp3/acc_5
acc_6 => mp3:/var/lib/asterisk/mohmp3/acc_6
acc_7 => mp3:/var/lib/asterisk/mohmp3/acc_7
acc_8 => mp3:/var/lib/asterisk/mohmp3/acc_8
acc_9 => mp3:/var/lib/asterisk/mohmp3/acc_9
acc_10 => mp3:/var/lib/asterisk/mohmp3/acc_10
Saia e salve com “Ctrl + X seguido de Y ou S e tecle “Enter”.
Reinicie o banco de dados MYSQL:
# /etc/init.d/mysql restart
Inicie o ASTERISK com o comando:
# asterisk -vvvvgc
Abra o seu navegador da Internet e digite o IP do servidor. Se o navegador abrir uma página do FTP com o endereço A2Billing, clique 2x e pronto. Faça login com user=root & pass=myroot e bom trabalho.
Por: FÁBIO GARCIA
Analista de Sistemas
Compare Preços de: DVD, MP3, LCD, Plasma, HDTV, Home Theater
















Novembro 12th, 2008 at 8:34 pm
Por gentileza Fabio, vc tem um tutorial de como instalar no Debian 4.0
Desde já agradeço!!