Está en la página 1de 12

*********************************************************************************

*******
********************************************************************************
********
********************************************************************************
********
********************************************************************************
********
Estos son algunos pasos opcionales si quieres tener tu RedHat(CentOS) para traba
jar comodamente,
paquetes que puedes encontrar en la web o en la carpeta "Paquetes" de tu ultimo
servidor
configurado.
copio los archivos a /usr/src/asterisk o cualquier directorio
luego entro a el directorio cd /usr/src/asterisk
yum --nogpgcheck localinstall bash-completion-20060301-1.el5.rf.noarch.rpm
yum --nogpgcheck localinstall fail2ban-0.8.4-23.el5.noarch.rpm shorewall-3.2.7-1
.0.el5.noarch.rpm
vi /etc/fail2ban/jail.conf
chkconfig fail2ban on
service fail2ban start
vi .bashrc
* agregar "alias vi='vim'"
********************************************************************************
********
* Para empezar, necesitamos alguna herramientas para descomprimir paquetes y com
pilar.
yum -y install gcc glibc-devel ncurses-devel kernel-devel libtermcap-devel gcc-c
++ openssl-devel newt-devel zlib-devel make unixODBC-devel libtool-devel rpm-bui
ld
yum -y install libtool-devel kernel-headers
yum -y install flex bison
yum -y install mysql mysql-server mysql-devel libtiff-devel net-snmp-devel
********************************************************************************
********
* Preparar la carpeta para la descargar de los sources
cd /usr/src/
mkdir asterisk && cd asterisk/
wget -c http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-1.8-curren
t.tar.gz
wget -c http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-l
inux-complete-current.tar.gz
wget -c http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.ta
r.gz
********************************************************************************
********
* Compilando libpri

cd /usr/src/asterisk
tar -zxf libpri-1.4-current.tar.gz
cd libpri-1.4.12/
make clean
make
make install
********************************************************************************
********
* Compilando dahdi, tenemos tarjetas SANGOMA, por lo tanto no detectara las tarj
etas.
cd /usr/src/asterisk
tar -zxf dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
********************************************************************************
********
* Como las tarjetas que estamos utilizando son SANGOMA, necesitamos instalar los
drivers
* de esas tarjetas, para que el dahdi las detecte. Comprobamos los ultimos drive
s del
* sitio http://wiki.sangoma.com/wanpipe-linux-drivers
cd /usr/src/asterisk
wget -c ftp://ftp.sangoma.com/linux/current_wanpipe/wanpipe-3.5.20.tgz
tar xvfz wanpipe-3.5.20.tgz
cd wanpipe-3.5.20/
--------------------------------------------------------------------------------------------------* Ejecutamos el siguiente comando pero no instalamos, solo llegamos hasta el
* proceso de verificacin de dependencias.
./Setup install
Would you like to install WANPIPE now? [y] (y/n) y
Ctrl + C
--------------------------------------------------------------------------------------------------* Ejecutamos el proceso de instalacin con el siguiente comando
./Setup dahdi
Would you like to install WANPIPE now? [y] (y/n) y
Please select working zaptel directory [1-1][m]: 1
Would you like to configure wanpipe devices for DAHDI? (y/n) y
Would you like to generate /etc/asterisk/chan_dahdi.conf
1. YES
2. NO
[1-2]:1

Select media type for AFT-A104 on port 1 [slot:4 bus:3 span:1]


1. T1
2. E1
3. Unused
4. Exit
[1-4]:2
Configuring port 1 on 104 as E1, line coding:HDB3, framing:CRC4
1. YES - Keep these settings
2. NO - Configure line coding and framing
[1-2, ENTER='YES']:1
Select clock for AFT-A104 on port 1 [slot:4 bus:3 span:1]
1. NORMAL
2. MASTER
[1-2]:1
Select signalling type for AFT-A104 on port 1 [slot:4 bus:3 span:1]
1. Zaptel/Dahdi - PRI CPE
2. Zaptel/Dahdi - PRI NET
3. Zaptel/Dahdi - E & M
4. Zaptel/Dahdi - E & M Wink
5. Zaptel/Dahdi - FXS - Loop Start
6. Zaptel/Dahdi - FXS - Ground Start
7. Zaptel/Dahdi - FXS - Kewl Start
8. Zaptel/Dahdi - FX0 - Loop Start
9. Zaptel/Dahdi - FX0 - Ground Start
10. Zaptel/Dahdi - FX0 - Kewl Start
11. Sangoma SMG/sangoma_prid- PRI CPE
12. Sangoma SMG/sangoma_prid- PRI NET
[1-12]:1
Select switchtype for AFT-A104 on port 1
1. National ISDN 2
2. Nortel DMS100
3. AT&T 4ESS
4. Lucent 5ESS
5. EuroISDN
6. Old National ISDN 1
7. Q.SIG
[1-7]:5

Configuring port 1 on AFT-A104 as a full E1


1. YES - Use all channels
2. NO - Configure for fractional
[1-2, ENTER='YES']:1
Select dialplan context for AFT-A104 on port 1
1. from-pstn
2. from-internal
3. Custom

[1-3]:1

1 continuar

Dahdi and Wanpipe configuration complete: choose action


1. Save cfg: Restart Asterisk & Wanpipe now
2. Save cfg: Restart Asterisk & Wanpipe when convenient
3. Save cfg: Stop Asterisk & Wanpipe now
4. Save cfg: Stop Asterisk & Wanpipe when convenient
5. Save cfg: Save cfg only (Not Recommanded!!!)
6. Do not save cfg: Exit
[1-6]:1
Would you like to continue?
1. No - exit
2. YES
[1-2, ENTER='No']:2

* al final opcion 2
--------------------------------------------------------------------------------------------------* En el proceso, es posible que no encuentre la carpeta de asterisk creada, por
lo que podemos
* decirle que no realize el asistente de configuracion del chan_dahdi.conf.
* Despues de tener la carpeta /etc/asterisk creada, podemos ejecutar el siguient
e comando:
wancfg_dahdi
--------------------------------------------------------------------------------------------------* Verificamos la creacin de los archivos en la carpeta del DAHDI y realizamos cop
ia del
* archivo generado.
cd /etc/dahdi/
cp system.conf system.conf.orig
vi system.conf
cp system.conf.bak system.conf.bak.orig
--------------------------------------------------------------------------------------------------* verificar que dahdi arranque cuando arranque el sistema
cd /usr/src/asterisk
ll
cd dahdi-linux-complete-*

ll
cd /usr/src/asterisk
ll
cd
cd /usr/src/asterisk/wanpipe-3.5.20
ll
--------------------------------------------------------------------------------------------------* Instalacin de scripts de inicio rc.d
./Setup install_init
-------------------------------------------------------------------------------------------------------qqqqqqqqq * esto no por ahora
qqqqqqqqq cd /etc/asterisk/
qqqqqqqqq cp chan_dahdi.conf chan_dahdi.conf.001

********************************************************************************
********
* OPENR2
* Si estamos configurando una Tarjeta E1, la sealizacin en Latinoamerica es R2
* Por lo que tenemos que instalar las librerias para que asterisk reconozca la
* sealizacin MFC/R2
* sitio http://code.google.com/p/openr2/
cd /usr/src/asterisk
wget http://openr2.googlecode.com/files/openr2-1.3.1.tar.gz
tar zxvf openr2-1.3.1.tar.gz
ll
cd openr2-1.3.1
ll
* Por defecto instala en /usr/local/ Para evitar problemas de ubicacin.
./configure --prefix=/usr
make
make install
* Se hace necesario cambiar las configuraciones en /etc/dahdi/system.conf para
* que quede de la siguiente manera:
cd /etc/dahdi/
ll
vi system.conf
cp system.conf.bak system.conf.bak.orig01
ll
--------------------------------------------------------------------------------------------------#Sangoma A104 port 1 [slot:4 bus:3 span:1] <wanpipe1>
span=1,1,0,cas,hdb3
cas=1-15,17-31:1101

echocanceller=mg2,1-15,17-31
dchan=16
------------------------------------------------------------------------------------------------------* verificar que dahdi arranque con el sistema
cd /usr/src/asterisk
ll
cd dahdi-linux-complete-*
ll
cd ..
ll
-----------------------------------------------------------------------------------------------------------* para verificar que arranquen los archivos
cd /usr/src/asterisk/wanpipe-3.5.20
ll
./Setup install_init
--------------------------------------------------------------------------------------------------* El :1101 es la posicin inicial de los bits CAS (conocidos tambin como los bits A
BCD) que son
* usados por R2 para sealizar el estado de la lnea (contestada, colgada, etc.). La
seal 1101
* significa bloqueado en R2, que significa que cuando el hardware despierta por pr
imera vez no
* podr recibir llamadas (Asterisk o cualquier otro software que use R2 despus camb
iarn los
* bits a 1001, que significan IDLE, o listo para hacer llamadas).

********************************************************************************
********
* COMPILANDO ASTERISK
cd /usr/src/asterisk/
ll
tar zxvf asterisk-1.8-current.tar.gz
cd asterisk-1.8.5.0/
ll
--------------------------------------------------------------------------------------------------* Para soporte MP3, ejecutamos el siguiente comando
contrib/scripts/get_mp3_source.sh
--------------------------------------------------------------------------------------------------* En el make menuselect, quitamos el soporte para pbx_ael, agregamos SOUNDS en E

S/EN(GSM,ULAW,ALAW)
* MOH (GSM,ULAW,ALAW), Addons(MySQL,mp3)
make clean
./configure
make menuselect
* quitar pbx-ael
---->
opcion 10 del menu
* agregar cdr-mysql
---->
opcion 1 del menu
* agregar format-mp3
---->
opcion 1 del menu
* agregar los 4 todos
---->
opcion 16 del menu
* agregar CORE-SOUNDS-EN-ALAW ---->
opcion 18 del menu
* agregar CORE-SOUNDS-EN-ULAW ---->
opcion 18 del menu
* agregar CORE-SOUNDS-EN-GSM ---->
opcion 18 del menu
* agregar CORE-SOUNDS-ES-ALAW ---->
opcion 18 del menu
* agregar CORE-SOUNDS-ES-ULAW ---->
opcion 18 del menu
* agregar CORE-SOUNDS-ES-GSM ---->
opcion 18 del menu
* agregar NOH-OPSOUNDS-ULAW ---->
opcion 19 del menu
* agregar NOH-OPSOUNDS-ALAW ---->
opcion 19 del menu
* agregar NOH-OPSOUNDS-GSM ---->
opcion 19 del menu
* agregar EXTRA-SOUNDS-EN ULAW ---->
opcion 20 del menu
* agregar EXTRA-SOUNDS-EN ALAW ---->
opcion 20 del menu
* agregar EXTRA-SOUNDS-EN GSM ---->
opcion 20 del menu
--------------------------------------------------------------------------------------------------make
make install
--------------------------------------------------------------------------------------------------* Ejecutar si no tenemos nada configurado ya.
make samples

--------------------------------------------------------------------------------------------------VERIFICAR
wancfg_dahdi
--------------------------------------------------------------------------------------------------* LUEGO DE CONFIGURAR DADHI (LOS PUERTOS)
* pregunta que si quiere iniciar wanrouter cuando inicie el sistema y desimos qu
e si
Removing existing wanrouter boot scripts...OK
Would you like wanrouter to start on system boot?
1. YES
2. NO
[1-2]:1
-------------------------------------------------------------------------------------------------* pregunta que si quiere iniciar dahdi-cfg al mismo tiempo que wanrouter y decim
os que si.

Would you like to execute 'dahdi_cfg' each time wanrouter starts?


1. YES
2. NO
[1-2]:1
--------------------------------------------------------------------------------------------------cd
ll
vi
cd
ll
mv

/etc/dahdi/
system.conf
/etc/asterisk/
chan_dahdi.conf.bak chan_dahdi.conf.bak.orig

--------------------------------------------------------------------------------------------------edito y modifigo el archivo chan_dahdy.conf


vi chan_dahdi.conf
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------* EL otro cambio se hace Necesario en /etc/asterisk/chan_dahdi.conf. Este archi
vo es generado
* automaticamente por wancfg_dahdi. En el debemos comentar y agregar mas lineas
:
; Configuracion para senalizacion R2
mfcr2_variant=ar
mfcr2_max_ani=10
mfcr2_max_dnis=3
mfcr2_category=national_subscriber
mfcr2_logging=all
;Sangoma A104 port 1 [slot:4 bus:3 span:1] <wanpipe1>
;switchtype=euroisdn
context=entrada
group=1
echocancel=yes
signalling=mfcr2
channel =>1-15,17-31
--------------------------------------------------------------------------------------------------*-------- Despues de compilado asterisk, puedes comprobar que el chan_dahdi vien
e incluido
*-------- con la libreria de OpenR2
cd /usr/src/asterisk/
cd asterisk-1.8*
ll
ldd channels/chan_dahdi.so
make config
ls /etc/init.d/

------------------------------------------------------------------------------------------* miro el estado del asterisk


/etc/init.d/asterisk status
* detengo los servicios
/etc/init.d/asterisk stop
/etc/init.d/wanrouter stop
/etc/init.d/dahdi stop
* inicio los servicios
/etc/init.d/wanrouter start
/etc/init.d/dahdi start
/etc/init.d/asterisk start
------------------------------------------------------------------------------------------------------*comprobar que el asterisk esta corriendo
asterisk -rvvvvvvvvvvvvvv
dialplan show
* ( o luego de estar corriendo asterisk: module unload chan_dahdi.so, module loa
d chan_dahdi.so )

*///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
*///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
*///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
*///////
/////
///// //////////// /////////////////
////////////////////////////////////////////////////////////////////
*////// //////////// /////////// ////////////
////////// /////////////////
///////////////////////////////////////////////////////////
*////// //////////////////////// //////////// // //////// /////////////////
///////////////////////////////////////////////////////////
*////// //////////////////////// //////////// /// /////// /////////////////
/////////////////////////////////////////////////////////
*////// //////////////////////// //////////// //// ////// /////////////////
///////////////////////////////////////////////////////////
*////// //////////////////////// //////////// ///// ///// /////////////////
/////////////////////////////////////////////////////////

*//////
/////////////// //////////// ////// //// /////////////////
//////////////////////////////////////////////////////////
*////// //////////////////////// //////////// ////// //// /////////////////
//////////////////////////////////////////////////////////
*////// //////////////////////// //////////// ////// //// /////////////////
/////////////////////////////////////////////////////////
*////// //////////////////////// //////////// /////// /// /////////////////
//////////////////////////////////////////////////////////
*////// //////////////////////// //////////// //////// // /////////////////
/////////////////////////////////////////////////////////
*////// //////////////////////// //////////// ///////// / /////////////////
/////////////////////////////////////////////////////////
*////// //////////////////
/// ////////// //////////////////
///////////////////////////////////////////////////////////
*///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
*///////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
*///////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////
*///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////

--------------------------------------------------------------------------------------------------* los progdocs son la documentacion de todas las aplicaciones.


ESTE PASO NO
make progdocs
ESTE PASO SI
make config

********************************************************************************
********
* Configurando system-config-securitylevel
system-config-securitylevel
--------------------------------------------------------------------------------------------------* Por lo general contamos con 1 o 2 tarjeta de Red. Si necesitamos permitir acc
eso desde
* la red Publica, estas serian los datos a configurar:
Trusted Devices:
[ ] eth0 [*] eth1
[*] SSH
Other ports 5060:udp 5061:udp 10000-20000:udp 161:udp
--------------------------------------------------------------------------------------------------********************************************************************************
********
* Configurando FAIL2BAN para ASTERISK.
Tomado de http://www.voip-info.org/wiki/view/Fail2Ban+(with+iptables)+And+Asteri
sk
cd /etc/fail2ban/filter.d/
vi asterisk.conf
--------------------------------------------------------------------------------------------------# Fail2Ban configuration file
#
#
# $Revision: 250 $
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
#before = common.conf
[Definition]
#_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.*
' - Wrong password
NOTICE.*
' - No matching peer
NOTICE.*

.*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?


.*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
found
.*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?

' - Username/auth name mismatch


NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - Device does not match ACL
NOTICE.* .*: Registration from '.*' failed for '<HOST>(:[0-9]{1,5})?
' - Peer is not supposed to register
NOTICE.* .*: Registration from '.*' failed for '<HOST>' - ACL error
(permit/deny)
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>.*
NOTICE.* .*: Registration from '\".*\".*' failed for '<HOST>' - No m
atching peer found
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
--------------------------------------------------------------------------------------------------vi /etc/fail2ban/jail.conf
--------------------------------------------------------------------------------------------------# Para bloqueo de intentos del asterisk
[asterisk-iptables]
enabled = true
filter = asterisk
action = iptables-allports[name=ASTERISK, protocol=all]
sendmail-whois[name=ASTERISK, dest=root, sender=you@mail.com]
logpath = /var/log/asterisk/messages
maxretry = 5
bantime = 259200
--------------------------------------------------------------------------------------------------service fail2ban restart
********************************************************************************
********

También podría gustarte