Instalar Asterisk y freePBX en Debian

Imagen de RazaMetaL

Asterisk es un PBX por software que permite la comunicacion VoIP desde y hacia la telefonía publica. Todas su ventajas las pueden encontrar listadas en http://www.asterisk.org/features .

freePBX es un GUI via browser que permite manejar varias de las características de Asteris de una forma amigable y sencilla.

El presente manual pretende instalar desde la fuentes Asterisk y freePBX en Debian. El mismo procedimiento debería funcionar para otras distribuciones. Manos a la obra:

Antes de empezar debemos tener instaladas las siguientes dependencias:

Para Asterisk:

ncurses
ncurses-dev
openssl
libcurl3-openssl-dev
zlib-bin
zlib1g-dev
bison
bison-1.35

Para freePBX:

libxml2-utils
libxml2-dev
libtiff4
libtiff4-dev
lame
liblame0
liblame-dev
apache2
apache2-dev
mysql-client
libmysqlclient15-dev
mysql-server
php5 (tambien puede ser php4)
php-pear
php5-gd
php5-mysql
php5-cli
linux-source-2.6.15 (es la version que yo tengo en mi Debian Etch)
perl
libaudiofile-dev
curl
sox
sox-dev

1- Instalamos los siguientes modulos para perl:

perl -MCPAN -e "install Net::Telnet"
perl -MCPAN -e "install IPC::Signal"
perl -MCPAN -e "install Proc::WaitStat"
aptitude install mime-construct

2- Instalamos asterisk-perl

wget http://asterisk.gnuinter.net/files/asterisk-perl-0.08.tar.gz
tar zvxf asterisk-perl-0.08.tar.gz
cd asterisk-perl-0.08
perl Makefile.PL
make all
make install

3- Modificamos la configuracion de php para que acepte upload de archivos de hasta 20MB, los archivos de audio que utilizaremos para la musica en espera:

vi /etc/php5/apache2/php.ini

; Maximum allowed size for uploaded files.
upload_max_filesize = 20M

4- Descargamos los paquetes que vamos a utilizar durante el proceso de instalación:

cd /usr/src
wget http://ftp.digium.com/pub/libpri/libpri-1.2.2.tar.gz
wget http://ftp.digium.com/pub/zaptel/zaptel-1.2.5.tar.gz
wget http://ftp.digium.com/pub/asterisk/asterisk-1.2.6.tar.gz
wget http://ftp.digium.com/pub/asterisk/asterisk-addons-1.2.2.tar.gz
wget http://ftp.digium.com/pub/asterisk/asterisk-sounds-1.2.2.tar.gz
wget http://easynews.dl.sourceforge.net/sourceforge/amportal/freepbx-2.0.1.tar.gz

tar zvxf libpri-1.2.2.tar.gz
tar zvxf zaptel-1.2.5.tar.gz
tar zvxf asterisk-1.2.6.tar.gz
tar zvxf asterisk-addons-1.2.2.tar.gz
tar zvxf asterisk-sounds-1.2.2.tar.gz
tar zvxf freepbx-2.0.1.tar.gz

5- Creamos un grupo y usuario asterisk:

groupadd asterisk
useradd -c "PBX asterisk" -d /var/lib/asterisk -g asterisk asterisk
mkdir /var/run/asterisk

6- Instalar Asterisk:

cd /usr/src/libpri
make && make install

cd /usr/src/zaptel
make && make install

cd /usr/src/asterisk
make clean && make && make install && make samples

cd /usr/src/asterisk-sounds
make && make install

cd /usr/src/asterisk-addons
make install

Listo, Asterisk ya esta instalado. Ahora vamos a proceder a instalar freePBX.

1- Configuramos mysql, creamos las bases de datos y creamos las tablas, recuerden modificar la contraseña del usuario de la base de datos:

/usr/bin/mysql_install_db
/etc/init.d/mysql start
mysqladmin -u root password 'superpassword'
mysqladmin create asteriskcdrdb --password=superpassword
mysql --user=root --password=superpassword asteriskcdrdb < /usr/src/freepbx-2.0.1.tar.gz/SQL/cdr_mysql_table.sql
mysqladmin create asterisk --password=superpassword
mysql --user root --password=superpassword asterisk < /usr/src/freepbx-2.0.1.tar.gz/SQL/newinstall.sql

2- Configuramos los permisos de acceso a las bases asteriskcdrdb y asterisk creadas en el párrafo anterior, el usuario y contraseña por default es asteriskuser y amp109 respectivamente, esto puede ser modificado de acuerdo a sus necesidades:


mysql --user root --password=superpassword
mysql> GRANT ALL PRIVELEGES 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> quit

3- Ejecutamos el script de instalación de freePBX:


/usr/src/freePBX/install_amp

Si tenemos tarjetas zaptel es necesario editar la configuración, mas información de como hacerlo la pueden encontrar en:
http://voip-info.org/wiki-Asterisk+config+files

4- Agregamos al usuario asterisk al grupo www-data:


www-data:x:33:asterisk

5- Damos permisos al usuario asterisk para que pueda escribir los archivos de sesion:

chown asterisk /var/lib/php/sessi*

6- Creamos un script para que asterisk se ejecute al inicio:


#! /bin/sh
#
# asterisk start the asterisk PBX
# (c) Mark Purcell
# May be distributed under the terms of this General Public License
#
# Based on:
#
# skeleton example file to build /etc/init.d/ scripts.
# This file should be used to construct scripts for /etc/init.d.
#
# Written by Miquel van Smoorenburg .
# Modified for Debian GNU/Linux
# by Ian Murdock .
#
# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=asterisk
USER=$NAME
GROUP=$USER
DAEMON=/usr/sbin/$NAME
DESC="Asterisk PBX"
PIDFILE="/var/run/asterisk/asterisk.pid"

# by default: use real-time priority
PARAMS=""
AST_REALTIME="yes"
RUNASTERISK="no"
if [ -r /etc/default/$NAME ]; then . /etc/default/$NAME; fi

if [ "$RUNASTERISK" != "yes" ];then
echo "Asterisk not yet configured. Edit /etc/default/asterisk first."
exit 1
fi

if [ "$AST_REALTIME" != "no" ]
then
PARAMS="$PARAMS -p"
fi

if [ "x$USER" = "x" ]
then
echo "Error: empty USER name"
exit 1
fi
if [ `id -u "$USER"` = 0 ]
then
echo "Starting as root not supported."
exit 1
fi
PARAMS="$PARAMS -U $USER"

if [ "x$AST_DEBUG_PARAMS" = x ]
then
AST_DEBUG_PARAMS=-cvvvvvddddd
fi
if [ "$RUNASTSAFE" = "yes" ];then
# The value of WRAPPER_DAEMON in can be set in /etc/default/asterisk
WRAPPER_DAEMON=${WRAPPER_DAEMON:-/usr/sbin/safe_asterisk}
REALDAEMON="$WRAPPER_DAEMON"
else
REALDAEMON="$DAEMON"
fi

test -x $DAEMON || exit 0

set -e

status() {
plist=`ps auxw | grep "$DAEMON" | grep -v grep | awk '{print $2}' | tr '\012' ' '`
if [ "$plist" = "" ]; then
echo "$DESC is stopped"
return 1
else
echo "$DESC is running: $plist"
return 0
fi
}

case "$1" in
debug)
# we add too many special parameters that I don't want to skip
# accidentally. I'm afraid that skipping -U once may cause
# confusing results. I also want to maintain the user's choice
# of -p
echo "Debugging $DESC: "
$DAEMON $PARAMS $AST_DEBUG_PARAMS
exit 0
;;
start)
if status > /dev/null; then
echo "$DESC is already running. Use restart."
exit 1
fi
echo -n "Starting $DESC: "
if [ "$RUNASTSAFE" != "yes" ];then
# TODO: what if we cought the wrapper just as its asterisk
# was killed? status should check for the wrapper if we're in
# "safe mode"
if status > /dev/null; then
echo "$DESC is already running. Use restart."
exit 1
fi
fi
echo -n "Starting $DESC: "
start-stop-daemon --start --group $GROUP --pidfile "$PIDFILE" \
--exec $REALDAEMON -- $PARAMS
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
if [ "$RUNASTSAFE" = "yes" ];then
# hopefully this will work. Untested
$REALDAEMON -rx 'stop now' > /dev/null || true
else
# Try gracefully.
# this may hang in some cases. Specifically, when the asterisk
# processes is stopped. No bother to worry about cleanup:
# it will either fail or die when asterisk dies.
( $DAEMON -rx 'stop now' > /dev/null 2>&1 & ) &
fi
echo -n "$NAME"
## giving a small grace time to shut down cleanly.
#sleep 2 # you can add timeouts in the comma
if [ "$RUNASTSAFE" = "yes" ];then
start-stop-daemon --quiet --oknodo --stop --exec $WRAPPER_DAEMON
fi
# just making sure it's really, really dead.
# KILL is necessary just in case there's an asterisk -r in the background
start-stop-daemon --stop --quiet --oknodo --retry=0/2/TERM/2/KILL/5 --exec $REALDAEMON
echo "."
;;
reload)
echo "Reloading $DESC configuration files."
$DAEMON -rx 'reload'
;;
logger-reload)
$DAEMON -rx 'logger reload'
;;
extensions-reload)
echo "Reloading $DESC configuration files."
$DAEMON -rx 'extensions reload'
;;
restart|force-reload)
$0 stop
$0 start
;;
status)
status
exit $?
;;
*)
N=/etc/init.d/$NAME
# echo "Usage: $N {start|stop|restart|reload|logger-reload|extensions-reload|force-reload}" >&2
echo "Usage: $N {start|stop|status|debug|restart|force-reload}" >&2
exit 1
;;
esac

exit 0

7- Creamos los links con update-rc.d:

update-rc.d asterisk defaults

8- Creamos el archivo asterisk en /etc/default que contenga:

vi /etc/default/asterisk
RUNASTERISK=yes

9- Abrimos con un navegador la direccion http://ip.del.servidor.asterisk/amportal y listo, ya tenemos freePBX instalado para configurar Asterisk sin necesidad de ser un gurú :)

Comentarios

En Debian requieres del

Imagen de RazaMetaL

En Debian requieres del paquete asterisk-mp3 , ahora si usas las fuentes tienes que compilar asterisk-addons y luego recompilar asterisk 1.2.14

------------

Antes de preguntar visita el [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

 

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

-----

Visita este [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

(adsbygoogle = window.adsbygoogle || []).push({});

Problema con asterisk en Debian etch 2.6.20.7

espero puedan ayudarme a istalar mi asterisk

al ejecutar:

ejecute el comando:

/usr/src/freePBX/install_amp
alli solo seleccione enter (por defecto)

y me sale:
Zeus:/usr/src/DB-1.7.11# /usr/src/freePBX/install_amp
bash: /usr/src/freePBX/install_amp: No existe el fichero o el directorio
Zeus:/usr/src/DB-1.7.11# /usr/src/freepbx-2.0.1/install_amp
Checking for PEAR DB..OK
Checking for PEAR Console::Getopt..OK
Checking for libasteriskperl (perl bindings for asterisk)...OK
Checking user..OK
Checking for /etc/amportal.conf..OK
Reading /etc/amportal.conf..OK
Checking for /etc/asterisk/asterisk.conf..OK
Reading /etc/asterisk/asterisk.conf..OK
Connecting to database..OK
Checking current version of AMP..2.0.1
Installing new AMP files..OK
Configuring install for your environment..sed: no se puede leer /etc/asterisk/cdr_mysql.conf: No existe el fichero o el directorio
sed: no se puede leer /etc/asterisk/cdr_mysql.conf: No existe el fichero o el directorio
sed: no se puede leer /etc/asterisk/cdr_mysql.conf: No existe el fichero o el directorio
OK
Setting permissions on files..sh: /usr/sbin/amportal: No existe el fichero o el directorio
OK
Checking for upgrades..0 found
Generating AMP configs..
Generating Configurations.conf..
-su: /var/lib/asterisk/bin/retrieve_conf: No existe el fichero o el directorio
Generating AMP configs..OK
Restarting Flash Operator Panel..-su: /var/www/html/admin/bounce_op.sh: No existe el fichero o el directorio
OK
Please Reload Asterisk by visiting http://xx.xx.xx.xx/admin

######creo que hice algo malo ya que hay varios archivos que no puede leer#####

trato de hacer:

/usr/src/freepbx-2.0.1/amp_conf/sbin/amportal start
me da los siguientes errores:
SETTING FILE PERMISSIONS
chown: no se puede acceder a «/var/www/html/admin»: No existe el fichero o el directorio
chown: no se puede acceder a «/var/www/html/recordings»: No existe el fichero o el directorio
chown: no se puede acceder a «/var/www/html/_asterisk»: No existe el fichero o el directorio
chown: no se puede acceder a «/var/www/cgi-bin/vmail.cgi»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/lib/asterisk/bin/*.pl»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/lib/asterisk/bin/archive_recordings»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/lib/asterisk/bin/retrieve_conf»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/www/html/admin/bounce_op.sh»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/www/cgi-bin/vmail.cgi»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/www/html/panel/*.pl»: No existe el fichero o el directorio
chmod: no se puede acceder a «/var/www/html/panel/safe_opserver»: No existe el fichero o el directorio
Permissions OK

STARTING ASTERISK
Asterisk is already running

STARTING FOP SERVER
-su: /var/www/html/panel/safe_opserver: No existe el fichero o el directorio
FOP Server Started

:jawdrop:

raza, hace unos minutos

Imagen de Epe

raza, hace unos minutos hice:

apt-get install asterisk

y me instaló el asterisk sin tanto barullo... o es que antes (veo que el post es viejo) no había un paquete de asterisk en debian? Pero confirmo que ahora sí lo hay, el que no encuentro es el de freepbx, sería bueno

Saludos
epe
--
EcuaLinux.com
Ecuador: +(593) 9 9246504, +(593) 2 3412402
USA: +1 305 359 4495, España: +34 91 7617884


Saludos
epe

EcuaLinux.com

+(593) 9 9924 6504

Servicios en Software Libre

Asterisk y los canales h.323

Imagen de RazaMetaL

Asterisk y los canales h.323 estan disponibles en el repositorio de debian desde hace tiempo, sucede que prefiero instalarlo a mano para tener la version mas reciente.

Respecto a freepbx, es trivial instalarlo si utilizas el siguiente repositorio:

deb http://updates.xorcom.com/rapid etch main

Luego haces :

aptitude update
aptitude search freepbx ; hay una gran cantidad de modulos disponibles
aptitude install freepbx freepbx-modulo-1 freepbx-modulo-2 freepbx-modulo-n

------------

Antes de preguntar visita el [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

 

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

-----

Visita este [url=http://www.sindominio.net/ayuda/preguntas-inteligentes.html]link[/url] :evil:

[img]http://www.bbspot.com/Images/News_Features/2003/01/os_quiz/debian.jpg[/img]

(adsbygoogle = window.adsbygoogle || []).push({});

Páginas