sexta-feira, 17 de janeiro de 2014

A2Billing v2 Install Guide

This guide will show how to install A2Billing v2.x on a Redhat Enterprise Linux v6 based system.  It is assumed you already have Linux and Asterisk and FreePBX installed using a procedure similar to this one.  It is also assumed you have compiled asterisk realtime driver module (res_config_mysql) by selecting it in asterisk menuselect before compiling asterisk. We do not cover the installation of the callback daemon.

Tested using the following software:

The following 2 diagrams illustrate A2billing inbound and outbound call flow.

All commands are assuming you are at run level 3 running in a shell as root.  In other words, not in a Gnome/KDE GUI and not using a limited access account.

Install EPEL repo

If not already done so.
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
yum update

Install additional required packages if not already installed

yum -y install php-mcrypt perl-DBD-Pg
Get A2Billing source
cd /usr/src
wget --no-check-certificate https://github.com/Star2Billing/a2billing/tarball/v2.0.5 -O Star2Billing.tar.gz
tar zxvf Star2Billing.tar.gz

Rename the directory

mv Star2Billing* a2billing

Create MySQL root password

If you did not create a mysql root password during the asterisk install you should create one now.
mysqladmin -u root password 'rootmysqlpassword'

If MySQL root password already exists

If you get access denied the password has already been set.  For PowerPBX install guide a password of abcdef was used.  For distributions such as PiaF, the password might be passw0rd.  This will be the password the following commands will ask for.

If you do not know the MySQL root password and want to change it

If you do not know what it is this guide has a procedure for changing the MySQL root password which is as follows.  Otherwise skip down to Create A2Billing Database.
#service mysqld stop
# mysqld_safe --skip-grant-tables &
If you don't see a command prompt (#) appear press the ENTER key and you should get it.
mysql --user=root mysql
update user set Password=PASSWORD('new-root-password') where user='root';
>\q
service mysqld restart

Create A2Billing Database

cd /usr/src/a2billing
mysql -u root -p < DataBase/mysql-5.x/a2billing-createdb-user.sql
which, after you enter your root password, will create:
Database name: mya2billing
Database user: a2billinguser
Database user password: a2billing
Now run script to create tables and insert some basic configuration data
cd /usr/src/a2billing/DataBase/mysql-5.x
./install-db.sh
Answer questions as follows:
  • Enter Database Name: mya2billing
  • Enter Hostname: localhost
  • Enter UserName: root
  • Enter Password: {mysql-root-password...not a2billing db password}
Now check that the database and 90+ tables have been created
mysql -u root -p mya2billing
>show tables;
Should produce
+-------------------------+
| Tables_in_mya2billing    
| +-----------------------+
| cc_agent                |
| cc_agent_commission     |
| cc_agent_signup         |
. . .                     |
| cc_ui_authen            |
| cc_version              |
| cc_voucher              |
+-------------------------+
97 rows in set (0.00 sec)
\q
cp /usr/src/a2billing/a2billing.conf /etc/
Make sure the following parameters are set as shown.
nano /etc/a2billing.conf
[database]
hostname = localhost
port = 3306
user = a2billinguser
password = a2billing
dbname = mya2billing
dbtype = mysql

Create files and set permissions

Only required if not using Asterisk Realtime.  If unsure then proceed as if you are not using Asterisk Realtime.  Some of these files assume you have FreePBX installed and not just Asterisk.  If you just have Asterisk installed then use the files specified in the INSTALL.rst instructions included with A2billing source files.
chmod 777 /etc/asterisk
touch /etc/asterisk/additional_a2billing_iax.conf
touch /etc/asterisk/additional_a2billing_sip.conf
echo \#include additional_a2billing_sip.conf >> /etc/asterisk/sip_custom.conf
echo \#include additional_a2billing_iax.conf >> /etc/asterisk/iax_custom.conf
chown -Rf asterisk:asterisk /etc/asterisk/additional_a2billing_iax.conf
chown -Rf asterisk:asterisk /etc/asterisk/additional_a2billing_sip.conf

Run sound installation script

cd /usr/src/a2billing/addons/sounds
./install_a2b_sounds.sh
chown -R asterisk:asterisk /var/lib/asterisk/sounds/

Add the following to /etc/asterisk/manager_custom.conf

You can also do it via the FreePBX Asterisk API module.  If you don't have FreePBX installed then you should follow the INSTALL.rst instructions included with the a2billing source files.
[myasterisk]
secret=mycode
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read=system,call,log,verbose,command,agent,user
write=system,call,log,verbose,command,agent,user

Set up a2billing web folders

A2billing has 3 GUIs.  admin, agent, and customer.
mkdir /var/www/html/a2billing
Directory may already exist.
cp -rf /usr/src/a2billing/admin /var/www/html/a2billing
cp -rf /usr/src/a2billing/agent /var/www/html/a2billing
cp -rf /usr/src/a2billing/customer /var/www/html/a2billing
cp -rf /usr/src/a2billing/common /var/www/html/a2billing
chown -R asterisk:asterisk /var/www/html/a2billing
chmod 755 /var/www/html/a2billing/admin/templates_c
chmod 755 /var/www/html/a2billing/customer/templates_c
chmod 755 /var/www/html/a2billing/agent/templates_c

Check admin web interface

From a web browser go to (http://{my-ip-address}/a2billing/admin) and make sure you get the authentication screen.  Log in as follows.
user: root
password: changepassword
Once logged in click change password link at bottom left and change it.

Set up AGI

mkdir /var/lib/asterisk/agi-bin
cd /usr/src/a2billing/AGI               
cp a2billing.php /var/lib/asterisk/agi-bin
cp a2billing_monitoring.php /var/lib/asterisk/agi-bin
chown -R asterisk:asterisk /var/lib/asterisk/agi-bin
chmod 755 /var/lib/asterisk/agi-bin/a2billing.php
chmod 755 /var/lib/asterisk/agi-bin/a2billing_monitoring.php
ln -s /var/www/html/a2billing/common/lib /var/lib/asterisk/agi-bin/lib

Add the following extensions to /etc/asterisk/extensions_custom.conf

If not using FreePBX then this would go into /etc/asterisk/extensions.conf.  These are just examples.  Depending on what you are doing and how you are doing it some may not apply and some may not work.  Customizing this to your needs is considered beyond the scope of this document.  Search for documentation on Asterisk custom extensions and dialplans.  If possible try find examples specific to A2Billing.
nano /etc/asterisk/extensions_custom.conf
[macro-dialout-trunk-predial-hook]
exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2)
exten => s,2,MacroExit

[custom-freepbx-a2billing]
exten => _X.,1,DeadAGI(a2billing.php,${OUT_${DIAL_TRUNK}:8})
exten => _X.,n,Hangup()

[a2billing]
exten => _X.,1,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,deadAGI(a2billing.php,1)
exten => _X.,n,Hangup

[a2billing-callback]
exten => _X.,1,deadAGI(a2billing.php,1,callback)
exten => _X.,n,Hangup

[a2billing-cid-callback]
exten => _X.,1,deadAGI(a2billing.php,1,cid-callback,34) ;last parameter is the callback area code
exten => _X.,n,Hangup

[a2billing-all-callback]
exten => _X.,1,deadAGI(a2billing.php,1,all-callback,34) ;last parameter is the callback area code
exten => _X.,n,Hangup

[a2billing-did]
exten => _X.,1,deadAGI(a2billing.php,1,did)
exten => _X.,2,Hangup

[a2billing_callingcard]
; CallingCard application
exten => _X.,1,NoOp(A2Billing Start)
exten => _X.,n,DeadAgi(a2billing.php|1)
exten => _X.,n,Hangup

[a2billing_voucher]
exten => _X.,1,Answer(1)
exten => _X.,n,DeadAgi(a2billing.php|1|voucher)
;exten => _X.,n,AGI(a2billing.php|1|voucher|44) ; will add 44 in front of the callerID
exten => _X.,n,Hangup

[custom-a2billing-did]
exten => _X.,1,deadAGI(a2billing.php,1,did)
exten => _X.,2,Hangup

[custom-a2billing]
exten => _X.,1,deadAGI(a2billing.php,1)
exten => _X.,n,Hangup

Go into FreePBX GUI>Setup>Trunks>Add Custom Trunk give it a name and add the following dial string:

A2B/1
This is the trunk that is used to send calls out via A2Billing.  Simply select this trunk in outbound routes.  The /1 refers to which agi-conf is going to be used in /etc/a2billing.conf.

Add custom destinations to FreePBX via FreePBX GUI>Tools>Custom Destinations

These destinations are referring to the custom extensions created above in /etc/asterisk/extensions_custom.conf
Custom Destination: custom-a2billing,${EXTEN},1
Destination Quick Pick: (pick destination)
Description: A2Billing - Callthrough
Custom Destination: custom-a2billing-did,${EXTEN},1
Destination Quick Pick: (pick destination)
Description: A2Billing - DID
Start or restart FreePBX
amportal restart

Recurring Services

Recurring services are handled via the /etc/crontab. Make directory for A2Billing cron PID
mkdir -p /var/run/a2billing
chown asterisk:asterisk /var/run/a2billing

Copy cron files to some permanent location such as /usr/local

mkdir -p /usr/local/a2billing
cp -R /usr/src/a2billing/Cronjobs /usr/local/a2billing/
ln -sf /var/www/html/a2billing/common/lib /usr/local/a2billing/Cronjobs/lib
chown -R asterisk:asterisk /usr/local/a2billing

Add the cron jobs to /var/spool/cron/asterisk

# update the currency table
0 6 * * * php /usr/local/a2billing/Cronjobs/currencies_update_yahoo.php

# manage the monthly services subscription
0 6 1 * * php /usr/local/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/local/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/local/a2billing/Cronjobs/a2billing_bill_diduse.php

# This script will take care of the recurring service.
0 12 * * * php /usr/local/a2billing/Cronjobs/a2billing_batch_process.php

# To generate invoices and for each user.
0 6 * * * php /usr/local/a2billing/Cronjobs/a2billing_batch_billing.php

# to proceed the autodialer
*/5 * * * * php /usr/local/a2billing/Cronjobs/a2billing_batch_autodialer.php

# manage alarms
0 * * * * php /usr/local/a2billing/Cronjobs/a2billing_alarm.php

# manage archive
0 12 * * * php /usr/local/a2billing/Cronjobs/a2billing_archive_data_cront.php

#autorefill
0 10 21 * * php /usr/local/a2billing/Cronjobs/a2billing_autorefill.php
15 * * * * php /usr/local/a2billing/Cronjobs/a2billing_batch_cache.php

Add log files

mkdir -p /var/log/a2billing
touch /var/log/a2billing/cront_a2b_alarm.log
touch /var/log/a2billing/cront_a2b_autorefill.log
touch /var/log/a2billing/cront_a2b_batch_process.log
touch /var/log/a2billing/cront_a2b_archive_data.log   
touch /var/log/a2billing/cront_a2b_bill_diduse.log   
touch /var/log/a2billing/cront_a2b_subscription_fee.log   
touch /var/log/a2billing/cront_a2b_currency_update.log   
touch /var/log/a2billing/cront_a2b_invoice.log   
touch /var/log/a2billing/cront_a2b_check_account.log   
touch /var/log/a2billing/a2billing_paypal.log
touch /var/log/a2billing/a2billing_epayment.log
touch /var/log/a2billing/a2billing_api_ecommerce_request.log
touch /var/log/a2billing/a2billing_api_callback_request.log
touch /var/log/a2billing/a2billing_api_card.log
touch /var/log/a2billing/a2billing_agi.log
chown -R asterisk:asterisk /var/log/a2billing

Add index file to prevent browsing of root folder

touch /var/www/html/a2billing/index.html

Log into the webpage

http://{my-ip-address}/a2billing/admin
  • user:  root
  • pass: mynewpassword
Or use default password changepassword if you have not changed it yet and then click the change password link at the bottom left.

Set Asterisk version in A2Billing

Go into System settings>Global list.  Go to the bottom left and set to display all.  From your web browser search for "asterisk_version".  It will find that setting twice.  One for Global group and one for agi-conf1 group.  Change both accordingly.  If using Asterisk v11 then use "1_11" Disable Asterisk Realtime if not setting up the following Asterisk Realtime procedure Go to System settings>Global search for "realtime".  Change that setting to "no".

Asterisk Realtime

It may be beneficial to use Asterisk Realtime with A2billing.  If running Asterisk Realtime you do not need to reload every time you add/remove/change a customer.  Also it allows you to share the A2billing database between multiple Aserisk/FreePBX servers if you needed to do that.  If you need to create many customers it makes more sense to use a database instead of putting them all in a flat text file. Double check you have the Asterisk Realtime module installed.  If using 64bit OS the modules are in /usr/lib64/asterisk/modules.
cd /usr/lib/asterisk/modules
dir
There should be a file there called res_config_mysql.so.  If not you need to re-install Asterisk and set it to compile the res_config_mysql.so realtime module in menuselect. Add the following to /etc/asterisk/extconfig.conf
nano /etc/asterisk/extconfig.conf
NOTE: [settings] is already included and uncommented in this file in asterisk sample configurations.  So if you installed asterisk samples or FreePBX and this file already exists and you are trying to add to it, do not add this line twice.
[settings]
iaxusers => mysql,general,cc_iax_buddies
iaxpeers => mysql,general,cc_iax_buddies
sipusers => mysql,general,cc_sip_buddies
sippeers => mysql,general,cc_sip_buddies
extensions => mysql,general,cc_sip_buddies

Add the following to /etc/asterisk/res_config_mysql.conf

nano /etc/asterisk/res_config_mysql.conf
NOTE: [general] is already included and uncommented in this file in asterisk samples.  So if you installed asterisk samples or FreePBX and this file already exists and you are trying to add to it, do not add this line twice.
[general]
dbhost = 127.0.0.1
dbname = mya2billing
dbuser = a2billinguser
dbpass = a2billing
dbport = 3306
;dbsock = /var/lib/mysql/mysql.sock
Assuming (as we did in this guide) that the dbname=mya2billing, dbuser=a2billinguser, dbpassword=a2billing.  Double check that these settings match /etc/a2billing.conf and substitute as necessary.

Now restart freepbx/asterisk

amportal restart

To check if realtime is working:

From Asterisk CLI>
# asterisk -vvvr
 
core show config mappings
Should produce:
Config Engine: mysql
===> extensions (db=general, table=cc_sip_buddies)
===> iaxpeers (db=general, table=cc_iax_buddies)
===> iaxusers (db=general, table=cc_iax_buddies)
===> sippeers (db=general, table=cc_sip_buddies)
===> sipusers (db=general, table=cc_sip_buddies)
After you add a customer to A2Billing, and assuming that customers account number is, for example, 1234567890
realtime load sipusers name 1234567890
should produce:
Column Name  Column Value
-----------  ------------
id           1 
id_cc_card   1 
name         1234567890
accountcode  1234567890
regexten     1234567890
amaflags     billing
callgroup
callerid . . .
maxcallbitrate
outboundproxy
rtpkeepalive  0 
useragent
callbackextension
In the A2Billing GUI go into System settings>Global and search forrealtime. Change that setting to yes if no. If already yes and having problems try change it to no and save and then change back to yes and save.

A2billing - Sorry, you don t have access to this page !

chmod 777 /var/lib/php/session

This fixed the error for me.

quinta-feira, 16 de janeiro de 2014

Installing FreePBX 2.8 with Asterisk 1.8 on CentOS 5.5

Fonte: http://www.jcarle.com/2010/12/17/installing-freepbx-2-8-with-asterisk-1-8-on-centos-5-5/

FreePBX has become quite popular over the last few years. Unfortunately, the documentation has not quite caught up to the popularity. At the time of this writing, most of the documentation available was for older versions of CentOS, FreePBX and/or Asterix. Below I have outlined the steps required to get FreePBX 2.8 working with Asterisk 1.8 on CentOS 5.5.

If you are reading this as after having followed the steps in my previous article Installing CentOS 5.5 with Linux Integration Services 2.1 on Hyper-V R2 or if you have not selected the following package groups during your installation of CentOS, make sure you do so now by using the following commands.

Preparations

You will need five different passwords.
PASSWORD1 – Your root password.
PASSWORD2 – Used for the asterisk database user.
PASSWORD3 – Used for the FreePBX administrator.
PASSWORD4 – Used for Flash Operator Panel.
PASSWORD5 – Used for the Asterisk Recording Interface.

Requirements

1yum groupinstall "DNS Name Server"
2yum groupinstall "Web Server"
3yum groupinstall "Mail Server"
4yum groupinstall "MySQL Database"
5yum groupinstall "Development Tools"
Once you are sure that the needed package groups are installed, you will want to install the prerequisites as follows.
1yum install e2fsprogs-devel keyutils-libs-devel krb5-devel libogg libselinux-devel libsepol-devel libxml2-devel libtiff-devel
2yum install gmp php-pear php-pear-DB php-gd php-mysql php-pdo kernel-devel ncurses-devel audiofile-devel libogg-devel
3yum install openssl-devel mysql-devel zlib-devel perl-DateManip sendmail-cf sox
Make sure you also have wget installed.
1yum install wget
Next you will setup named.
1echo "options {" >> /var/named/chroot//etc/named.conf
2echo " directory \"/var/named\";" >> /var/named/chroot//etc/named.conf
3echo " dump-file \"/var/named/data/cache_dump.db\";" >> /var/named/chroot//etc/named.conf
4echo " statistics-file \"/var/named/data/named_stats.txt\";" >> /var/named/chroot//etc/named.conf
5echo "};" >> /var/named/chroot//etc/named.conf
6echo "include \"/etc/rndc.key\";" >> /var/named/chroot//etc/named.conf
7cd /var/named/chroot//etc/
8chmod 640 named.conf
9chgrp named named.conf
10ln -s /var/named/chroot//etc/named.conf /etc/named.conf
You will want to adjust the security settings as per your requirements but for the simplicity of this article, we are going to turn off Security-Enhanced Linux and open the firewall fully.
1echo "SELINUX=disabled" > /etc/selinux/config
2iptables -P INPUT ACCEPT
3iptables -P OUTPUT ACCEPT
4iptables -P FORWARD ACCEPT
5iptables -F
6iptables -X
7/etc/init.d/iptables save
LAME is required for Asterisk’s audio related functions. You will want to download LAME to a source directory, compile and then install it.
1cd /usr/src
2wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?ts=1292626574&use_mirror=cdnetworks-us-1
3tar zxvf lame-3.98.4.tar.gz
4cd lame-3.98.4
5./configure
6make
7make install
You can optionally remove the source once you have installed LAME.
1cd ..
2rm -fr lame-3.98.4
3rm lame-3.98.4.tar.gz
Before continuing, insure that all packages are up to date and then reboot.
1yum update
2reboot

Installing Asterisk 1.8

Get Asterisk 1.8 and extract it to its own source folder.
1cd /usr/src
2wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-current.tar.gz
3tar xvfz asterisk-1.8-current.tar.gz
4cd asterisk-1.8.0
5contrib/scripts/get_mp3_source.sh
6./configure
7make menuconfig
The last command will launch the source configuration manager. The only portions you will want to install are app_mysql, app_saycountpl, cdr_mysql, format_mp3, res_config_mysql and EXTRAS-SOUNDS-EN-GSM (which can be found in the Extra Sound Packages sub-menu). Save your selections and exit. Now compile the source and install.
1make
2make install
You can optionally remove the source directory once you have installed Asterisk.
1cd ..
2rm -fR asterisk-1.8.0
3rm asterisk-1.8-current.tar.gz

Installing FreePBX 2.8

Get FreePBX 2.8 and extract it to its own source folder.
1cd /usr/src
2wget http://mirror.freepbx.org/freepbx-2.8.0.tar.gz
3tar xvfz freepbx-2.8.0.tar.gz
4cd freepbx-2.8.0
Start MySQL, create the asterisk databases and run the initial SQL setup scripts.
1/etc/init.d/mysqld start
2chkconfig mysqld on
3mysqladmin create asterisk
4mysqladmin create asteriskcdrdb
5mysql asterisk < SQL/newinstall.sql
6mysql asteriskcdrdb < SQL/cdr_mysql_table.sql
Start the MySQL command line.
1mysql
Define the user and password for each of the databases.
1GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO asteriskuser@localhost IDENTIFIED BY 'PASSWORD2';
2GRANT ALL PRIVILEGES ON asterisk.* TO asteriskuser@localhost IDENTIFIED BY 'PASSWORD2';
3flush privileges;
4\q
Change the MySQL user to root.
1mysqladmin -u root password 'PASSWORD1'
Create the Asterisk user and set folder permissions.
1useradd -c "Asterisk PBX" -d /var/lib/asterisk asterisk
2chown -R asterisk:asterisk /var/run/asterisk
3chown -R asterisk:asterisk /var/log/asterisk
4chown -R asterisk:asterisk /var/lib/php/session/
Update the Apache configuration file.
1vi /etc/httpd/conf/httpd.conf
Change User apache and Group apache to User asterisk and Group asterisk.
Change AllowOverride None to AllowOverride All.
Update ServerName to use your server’s FQDN.
Start Apache.
1/etc/init.d/httpd start
2chkconfig httpd on
Start Asterisk.
1./start_asterisk start
Configure FreePBX.
1./install_amp --username=asteriskuser --password=PASSWORD2
The next series of prompts will give you default values within square brackets which you can accept by hitting enter. If you wish to change a value, simply type it and hit enter after.
1[asteriskuser]
This is the database user you specified earlier.
1[PASSWORD2]
This is the password for the database user.
1[localhost]
Use the default value.
1[admin]
The username for the FreePBX administrator.
1[amp111]
The password for the FreePBX administrator. It is important to change this. (Use PASSWORD3 you prepared earlier.)
1[/var/www/html]
Use the default value.
1[xx.xx.xx.xx]
The public IP that will be used.
1[passw0rd]
The Flash Operator Panel password. It is important to change this. (Use PASSWORD4 you prepared earlier.)
1[extensions]
Use the default value.
1[/var/lib/asterisk/bin]
Use the default value.
1[/usr/local/sbin]
Use the default value.
Change the Asterisk Recording Interface password and turn on user authentication for the web interface by editing the amportal.conf file.
1vi /etc/amportal.conf
Change the ARI_ADMIN_PASSWORD entry to update the ARI password.
1ARI_ADMIN_PASSWORD=PASSWORD5
Change the AUTHTYPE entry to database to enable authentication.
1AUTHTYPE=database
Optionally, you can turn off the FOP completely by changing the following settings.
1FOPRUN=false
2FOPDISABLE=true
Save and exit.
Add FreePBX to the boot process.
1echo "/usr/local/sbin/amportal start" >> /etc/rc.local
You can ensure that the administrator user has the proper password in the database by navigating to the Administrators tab, choosing the admin user and clicking on the Update password link. Once your password has been updated, logout by clicking the link at the top right of the page.
Finally, reboot the server one last time.
1reboot

terça-feira, 14 de janeiro de 2014

Elastix - Permissão de acesso a úsuarios no Monitoring

Fonte: http://anaqueilati.blogspot.com.br/2013/03/elastix-permitir-um-usuario-qualquer.html


Tive alguns problemas para resolver uma questão no Elastix e resolvi fazer este Post para ajudar quem estiver na mesma situação que a minha, no Elastix o único grupo que tem permissão para acessar ao Monitoring é o Administrador, usuário comum não tem acesso. Mas precisava que um usuário sem permissão administrador conseguisse visualizar as ligações. Em algumas buscas achei a seguinte solução:

Editar o arquivo /var/www/html/modules/monitoring/index.php


Abaixo das linhas


$extension = $pACL->getUserExtension($user);
$esAdministrador = $pACL->isUserAdministratorGroup($user);

Inserir as seguintes linhas abaixo, onde "usuario" será o usuário que você deseja que tenha permissão para visualizar a aba ligações no Monitoring. 

if ($_SESSION['elastix_user'] == 'usuario')
$esAdministrador = TRUE;

quinta-feira, 27 de junho de 2013

CUSTOM TRUNK no FOP

Fonte: http://www.elastixbrasil.com.br/index.php?option=com_fireboard&Itemid=74&func=view&catid=15&id=150


Prezados


Para os troncos customizados que não aparecem no FOP segue dica abaixo:

Acesse o arquivo op_buttons_custom.cfg dentro da pasta de instalação do FOP (normalmente /var/www/html/panel e edite da seguinte forma, o exemplo abaixo foi utilizando placas VB0404PCI 4FXO da Digivoice.

[DGV/1]
Position=53
Label="DGV/1"
Extension=-1
Icon=3
Panel_Context=default

[DGV/2]
Position=54
Label="DGV/1"
Extension=-1
Icon=3
Panel_Context=default

[DGV/3]
Position=55
Label="DGV/1"
Extension=-1
Icon=3
Panel_Context=default

[DGV/4]
Position=56
Label="DGV/1"
Extension=-1
Icon=3
Panel_Context=default

Isto fará com que os troncos apareçam no FOP, claro que pode ser editado;

[Identificação do Troco]
Position=<para que apareça abaixo da LABEL Trunks use 53 para primeiro tronco>
Label="Nome que quer que apareça"
Extension=-1 (?)
Icon=3 (aparece o tel + arroba)
Panel_Context=default (contexto do asterisk ou do FOP -- ?)

Abraços.

Emerson Inocente

Gostou do Post, vote na popularidade. Obrigado.

segunda-feira, 24 de junho de 2013

Super sources.list para o Debian Wheezy

fonte :http://gnutwoall.wordpress.com/2013/05/13/super-sources-list-para-o-debian-wheezy/

Aqui veremos a montagem de um super sources.list para o Debian Wheezy, utilizando o netselect para selecionar os espelhos mais rápidos no nosso país, em contrapartida os espelhos oficiais também serão incluídos no teste.

Comecemos pela instalação do netselect, sobre o qual tratei num antigo artigo para o site Viva o Linux:
 
1
2
# apt-get update
# apt-get install netselect netselect-apt
Configurando o sources.list.
Abaixo veremos em teste os mirrors:
ftp.br.debian.org
sft.if.usp.br
linorg.usp.br
ftp.debian.org
1
# netselect -vv ftp.br.debian.org sft.if.usp.br linorg.usp.br ftp.debian.org
sources.list-001
 
Testando outros mirrors.
Caso tenham necessidade de testar outros espelhos, acessem o endereço abaixo, selecione o país e em seguidos os espelhos a serem testados.
Em seguida veremos os testes dos seguintes mirrors de atualização de segurança:
ftp.br.debian.org
sft.if.usp.br
linorg.usp.br
security.debian.org
1
# netselect -vv sft.if.usp.br ftp.br.debian.org linorg.usp.br security.debian.org
sources.list-002
Com os resultados apresentados montei o seguinte sources.list:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
### Debian 7.0 Wheezy.
### Chave GPG: apt-get install debian-archive-keyring
deb http://sft.if.usp.br/debian/ wheezy main contrib non-free
deb http://ftp.br.debian.org/debian/ wheezy main contrib non-free
deb http://linorg.usp.br/debian/ wheezy main contrib non-free
deb http://ftp.debian.org/debian/ wheezy main contrib non-free
 
### Debian 7.0 Wheezy Security 'Updates'.
deb http://sft.if.usp.br/debian-security/ wheezy/updates main contrib non-free
deb http://ftp.br.debian.org/debian-security/ wheezy/updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb http://linorg.usp.br/debian-security/ wheezy/updates main contrib non-free
 
### Debian 7.0 Wheezy Updates 'Volatile'.
deb http://sft.if.usp.br/debian/ wheezy-updates main contrib non-free
deb http://ftp.br.debian.org/debian/ wheezy-updates main contrib non-free
deb http://linorg.usp.br/debian/ wheezy-updates main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
 
### Debian 7.0 Wheezy 'Proposed Updates'.
deb http://sft.if.usp.br/debian/ wheezy-proposed-updates main contrib non-free
deb http://ftp.br.debian.org/debian/ wheezy-proposed-updates main contrib non-free
deb http://linorg.usp.br/debian/ wheezy-proposed-updates main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-proposed-updates main contrib non-free
 
### Debian 7.0 Wheezy 'Backports'.
deb http://sft.if.usp.br/debian/ wheezy-backports main contrib non-free
deb http://ftp.br.debian.org/debian/ wheezy-backports main contrib non-free
deb http://linorg.usp.br/debian/ wheezy-backports main contrib non-free
deb http://ftp.debian.org/debian/ wheezy-backports main contrib non-free
sources.list-004
Como o Wheezy é o atual Debian Stable, caso queiram, basta substituir o campo wheezy por stable no arquivo /etc/apt/sources.list, neste caso ficaria assim:
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
### Debian 7.0 Stable.
### Chave GPG: apt-get install debian-archive-keyring
deb http://sft.if.usp.br/debian/ stable main contrib non-free
deb http://ftp.br.debian.org/debian/ stable main contrib non-free
deb http://linorg.usp.br/debian/ stable main contrib non-free
deb http://ftp.debian.org/debian/ stable main contrib non-free
 
### Debian 7.0 Stable Security 'Updates'.
deb http://sft.if.usp.br/debian-security/ stable/updates main contrib non-free
deb http://ftp.br.debian.org/debian-security/ stable/updates main contrib non-free
deb http://security.debian.org/ stable/updates main contrib non-free
deb http://linorg.usp.br/debian-security/ stable/updates main contrib non-free
 
### Debian 7.0 Stable Updates 'Volatile'.
deb http://sft.if.usp.br/debian/ stable-updates main contrib non-free
deb http://ftp.br.debian.org/debian/ stable-updates main contrib non-free
deb http://linorg.usp.br/debian/ stable-updates main contrib non-free
deb http://ftp.debian.org/debian/ stable-updates main contrib non-free
 
### Debian 7.0 Stable 'Proposed Updates'.
deb http://sft.if.usp.br/debian/ stable-proposed-updates main contrib non-free
deb http://ftp.br.debian.org/debian/ stable-proposed-updates main contrib non-free
deb http://linorg.usp.br/debian/ stable-proposed-updates main contrib non-free
deb http://ftp.debian.org/debian/ stable-proposed-updates main contrib non-free
 
### Debian 7.0 Stable 'Backports'.
deb http://sft.if.usp.br/debian/ stable-backports main contrib non-free
deb http://ftp.br.debian.org/debian/ stable-backports main contrib non-free
deb http://linorg.usp.br/debian/ stable-backports main contrib non-free
deb http://ftp.debian.org/debian/ stable-backports main contrib non-free
Em seguida basta adotar os seguintes procedimentos:
1
2
3
4
5
# apt-get update
# apt-get install debian-archive-keyring
# apt-get update
# apt-get upgrade
# apt-get dist-upgrade
sources.list-005
sources.list-006
sources.list-007
Repositórios deb-src.
Caso tenham necessidade, abaixo encontra-se um sources.list ainda mais completo, no qual estão contidos os repositórios deb-src, ou seja, os repositórios de código-fonte de pacotes.
Informações Importantes.
Debian Backports…
A partir do Debian Wheezy, o repositório debian-backports, além de oficial passa agora a ocupar os mesmos servidores dos repositórios padrão, por isso o mesmo foi imcluído, principalmente para aqueles que necessitam de um Debian Stable com pacotes mais novos, a utilização dessa release é simples:
1
2
3
4
# apt-get update
# apt-get -t wheezy-backports install pacote
# apt-get -t wheezy-backports upgrade
# apt-get -t wheezy-backports upgrade
Sobre o Backports fiz um artigo no antigo Blog e que hoje está publicado no VOL:
Com algumas modificações dá para modificar seu atual Debian Wheezy para Wheezy Backports, basta que se modifique o script constante do link abaixo:
O repo deb-multimídia…
Conforme informações já passadas o repositório deb-multimedia já não é mais necessário para a reprodução de certos tipos de mídia no Debian WHeezy, por isso o mesmo não mais faz parte dos meus confs oficiais, apesar disso, inclui o mesmo no sources.list de extras citado abaixo, maiores informações do porque não usar o deb-multimedia em seu Wheezy:
As seções contrib e non-free…
Embora não habilitadas por padrão pelo instalador Debian, julgo de extrema importância o seu uso, principalmente para aqueles que necessitam instalar drivers proprietários, tipos dos de vídeo, wi-fi, flashplugin-nonfree e etc. Caso não seja o seu caso utilize apenas a seção mais nas linhas dos repositórios.
Repositórios de extras para o Wheezy.
Repositórios extras para o Debian Wheezy poderão ser encontrados no link abaixo:
Debian OldStable (Squeeze).
O sources.list mais atual para o Debian Squeeze (OldStable), poderá ser encontrado no link abaixo:
Informações finais…
O conteúdo aqui apresentado substitui o material constante dos seguintes artigos:
 

Instalando o Asterisk 1.8 | Debian Lenny

Fonte: http://wnunes.com/2010/11/01/instalando-o-asterisk-1-8/

Salve galera!!!
O asterisk 1.8 acabou de sair do forno, a promessa de resolver todos os nossos problemas com CDR tá ai… só falta saber se funciona mesmo!!! Esse final de semana eu instalei o 1.8 e estou rodando em uma maquina de testes.
A adaptação parece que vai ser tranqüila… tudo que eu tenho no 1.4 rodou de prima, sem necessidade de adaptações…
Agora  só falta descobrir como colocar o tal do CEL pra funcionar!!!
Enquanto eu preparo um relatório bacana sobre o 1.8 para os asteriskeros velhos de guerra, segue o how-to da instalação pra quem ta começando nessa vida…
Minha instalação é baseada em debian lenny, kernel 2.6.26-2-686.
O primeiro passo é instalar as dependências…
Segundo a documentação oficial, as dependências do asterisk são:
  • GCC
  • OpenSSL
  • ncurses
  • newt
  • libxml2
  • kernel headers (Para compilação da dahdi)
Obviamente cada um desenvolve ao longo do tempo sua própria lista de dependências e trecos uteis que acabam virando parte do processo de instalação, a minha é a seguinte
#apt-get install  linux-headers-`uname -r` openssl libssl0.9.8 libssl-dev procps  bison  libtool  libedit2 libedit-dev  libeditline-dev  libeditline0  libnewt-dev  libncurses5  libncurses-dev  autoconf automake  subversion  cvs make  gcc g++  libxml2 libxml2-dev iptraf  sharutils  tcpdump nmap sox pciutils lshw unixodbc unixodbc-dev
Dependências instaladas, vamos baixar os pacotes do asterisk.
#wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8.0.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/dahdi-linux/releases/dahdi-linux-2.4.0.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/dahdi-tools/releases/dahdi-tools-2.4.0.tar.gz
#wget http://downloads.asterisk.org/pub/telephony/libpri/releases/libpri-1.4.11.4.tar.gz
Cade o addons??? Eu falo sobre isso daquiapouco….
Agora vamos descompactar os fontes..
#tar -zxvf libpri-1.4.11.4.tar.gz
#tar -zxvf dahdi-linux-2.4.0.tar.gz
#tar -zxvf dahdi-tools-2.4.0.tar.gz
#tar -zxvf asterisk-1.8.0.tar.gz
E então começamos as compilações…
Primeiro vamos compilar a LibPRI
LibPRI é a biblioteca opensource que encapsula protocolos ISDN( T1, E1 e J1). A LibPRI é dependência para a DAHDI.
A compilação da LibPRI é feita da seguinte forma.
#cd libpri-1.4.11.4
#make
#make install
#cd ..
Agora compilamos a DAHDI
A DAHDI está dividida em 2 partes
DAHDI Linux é o driver utilizado para controle das placas.
DAHDI Tools é o conjunto de aplicativos utilizado para o gerenciamento e monitoramento de dispositivos.
Para compilar a DAHDI faremos o seguinte:
#cd dahdi-linux-2.4.0
#make
#make install
#cd ..
#cd dahdi-tools-2.4.0
#./configure
#make
#make install
#make config
#cd ..
Se até aqui tudo correu bem é hora de compilar o Asterisk.
#cd asterisk-1.8.0
Por quetões legais o ILBC não vem mais junto com os fontes do Asterisk, por isso se quiser trafegar chamadas em ilbc você precisa  rodar o get_ilbc_sources.sh
#./contrib/scripts/get_ilbc_source.sh
#./configure
#make menuselect 
Pra quem já manda de Asterisk , neste ponto começam as modificações… Depois cada um da uma olhada com calma nas opções, mas os dois pontos mais importantes são:
O addons ja está nos fontes base do asterisk. Você pode habilitar os módulos do addons direto no menu.
Alguns itens abaixo está o nosso tão sonhado promessa de solução de todos os nossos problemas de CDR, Channel Event Loggin, que segundo Steve Murphy não saiu com BackEnd para MySQL porque isso era responsabilidade do pessoal do addons e tals, portanto não deixe de instalar o BackEnd para ODBC….
Mas continuando a instalação do asterisk…
Se você deseja utilizar o codec iLBC não esqueça de marca-lo na opção codec.
Salve e saída do menuselect.
#make
#make install
#make samples
#make config
Como eu não uso AEL, eu tenho o habito de remover o arquivo de configuração…
#rm /etc/asterisk/extensions.ael
#cd ..
É isso ai galera!!!! Em breve eu volto com um review sobre essa versão do asterisk!!!!