Asterisk 1.6.X - IAXmodem y Hylafax Ubtuntu 9.04 Desktop

Aunque a veces las guías para una distribución de Linux parece que sirvan para otra, no es así. Desafortunadamente en cada distribución cambia la forma de instalar los paquetes, la configuración del sistemas y las distintas utilidades disponibles. Es por este motivo que decidí escribir esta guía.

Una vez que tengamos Asterisk 1.6.X instalado en nuestro Ubtuntu 9.04 Desktop podemos empezar con la instalación de IAXmodem.

IAXmodem

cd /usr/src

sudo wget http://switch.dl.sourceforge.net/sourceforge/iaxmodem/iaxmodem-1.2.0.tar.gz

lo descomprimimos:

sudo tar -xf iaxmodem-1.2.0.tar.gz

Entramos en la carpeta:

cd iaxmodem-1.2.0

compilamos:

sudo ./configure

sudo make

Copiamos el archivo del programa:

sudo cp iaxmodem /usr/local/sbin

Ahora vamos a crear algunas carpetas y archivos que se necesitan:

sudo mkdir /etc/iaxmodem
sudo mkdir /var/log/iaxmodem
sudo touch /var/log/iaxmodem/ttyIAX
sudo touch /var/log/iaxmodem/iaxmodem

Modificamos el archivo de configuración que viene con las fuentes:

sudo nano iaxmodem-cfg.ttyIAX

device          /dev/ttyIAX
owner           uucp:uucp
mode            660
port            4570
refresh         300
server          127.0.0.1
peername        iaxmodem
secret          password
cidname         VozToVoice
cidnumber    XXXXXXXXXX
codec           ulaw

Esta configuración es valida si tenemos IAXmodem instalado en el mismo computador donde está Asterisk. En el caso de dos servidores distintos tenemos que indicar en el parámetro “server” la dirección IP del Servidor Asterisk. En “cidnumber” ponemos el numero de  teléfono de la línea donde vamos a recibir los faxes.

Guardamos los cambios y seguimos copiando el archivo en la carpeta /etc/iaxmodem que hemos creado:

sudo cp iaxmodem-cfg.ttyIAX /etc/iaxmodem/ttyIAX

Ahora configuramos el iax.conf para que iaxmodem se pueda conectar (antes movemos el iax.conf predefinido):

sudo mv /etc/asterisk/iax.conf /etc/asterisk/iax.conf.old

sudo nano /etc/asterisk/iax.conf

Añadimos las siguientes líneas:

[general]
disallow=all
allow=ulaw
allow=g729
allow=gsm
bindport=4569
bindaddr=0.0.0.0
language=es
srvlookup=yes
minregexpire = 60
maxregexpire = 300

[iaxmodem]
type=friend
context=fax
disallow=all
allow=ulaw
username=iaxmodem
secret=password
qualify=yes
notransfer=yes
host=dynamic
callerid="Fax" <XXXXXXXXXX>
requirecalltoken=no

Guardamos los cambios y hacemos una primera prueba. Abrimos otra ventana terminal y entramos en la consola de Asterisk:

sudo asterisk -rvvvvvvvvvvvvvvvvvv

CLI> iax2 reload

Volvemos a la ventana terminal donde estábamos trabajando y escribimos:

cd /usr/local/sbin

Arrancamos IAXmodem:

sudo ./iaxmodem ttyIAX

debería aparecer:

[2009-10-01 16:52:26] Modem started
[2009-10-01 16:52:26] Setting device = '/dev/ttyIAX'
[2009-10-01 16:52:26] Setting owner = 'uucp:uucp'
[2009-10-01 16:52:26] Setting mode = '660'
[2009-10-01 16:52:26] Setting port = 4570
[2009-10-01 16:52:26] Setting refresh = 300
[2009-10-01 16:52:26] Setting server = '127.0.0.1'
[2009-10-01 16:52:26] Setting peername = 'iaxmodem'
[2009-10-01 16:52:26] Setting secret = 'loggia12'
[2009-10-01 16:52:26] Setting cidname = 'VozToVoice'
[2009-10-01 16:52:26] Setting cidnumber = '+571XXXXXX'
[2009-10-01 16:52:26] Setting codec = ulaw
[2009-10-01 16:52:26] Opened pty, slave device: /dev/pts/4
[2009-10-01 16:52:26] Created /dev/ttyIAX symbolic link
Ignoring unknown information element 'Unknown IE' (54) of length 0
[2009-10-01 16:52:26] Registration completed successfully.

Muy bien. Ahora configuramos IAXmodem para que arranque en automático:

cd /etc/event.d

sudo nano iaxmodem

ponemos:

# IAXModem
#

start on stopped rc2
start on stopped rc3
start on stopped rc4
start on stopped rc5

stop on runlevel 0
stop on runlevel 1
stop on runlevel 6

respawn
exec /usr/local/sbin/iaxmodem ttyIAX

Guardamos los cambios y arrancamos IAXmodem:

sudo start iaxmodem

 

 

Hylafax

Empezamos descargando las fuentes de la ultima versión:

cd /usr/src

sudo wget ftp://ftp.hylafax.org/source/hylafax-6.0.3.tar.gz

Descomprimimos:

sudo tar -xf hylafax-6.0.3.tar.gz

Entramos en la carpeta y compilamos:

cd hylafax-6.0.3

sudo ./configure

Si hace falta alguna librería (sobre todo libtiff y todo lo relacionado con Ghostscript) a lo largo del configure nos daremos cuenta. Nada más instalarlas y volver a arrancar el  configure.

Al terminar tendremos este menú:

HylaFAX configuration parameters (part 1 of 2) are:

[ 1] Directory for applications:        /usr/local/bin
[ 2] Directory for lib data files:      /usr/local/lib/fax
[ 3] Directory for lib executables:     /usr/local/sbin
[ 4] Directory for system apps:      /usr/local/sbin
[ 5] Directory for manual pages:        /usr/local/man
[ 7] Directory for spooling:            /var/spool/hylafax
[ 8] Directory for uucp lock files:     /var/lock
[ 9] Uucp lock file scheme:             ascii
[10] PostScript imager package:         gs
[11] PostScript imager program:         /usr/bin/gs
[12] Manual page installation scheme:   bsd-source-cat
[13] Default page size:                 North American Letter
[14] Default vertical res (lpi):        98

Are these ok [yes]? yes

HylaFAX configuration parameters (part 2 of 2) are:

[15] Location of getty program:         /sbin/getty
[16] Location of voice getty program:   /bin/vgetty
[17] Location of sendmail program:      /usr/sbin/sendmail
[18] Location of TIFF tools:            /usr/bin
[19] Location of SysV init scripts:    /etc/init.d
[20] Location of SysV start scripts:    ../rc2.d ../rc3.d ../rc4.d ../rc5.d
[21] Location of SysV stop scripts:    ../rc0.d ../rc1.d ../rc6.d
[22] Name of SysV start script:        S97hylafax
[23] Name of SysV stop script:        K05hylafax
[24] Init script starts faxq:        yes
[25] Init script starts hfaxd        yes
[26] Start paging protocol:        no
Are these ok [yes]? yes

Podemos cambiar la configuración predefinida o contestar yes a los dos menú:

sudo make

sudo make install

Antes de configurar el fax tenemos que crear el archivo de configuración para que faxgetty arranque en automático:

cd /etc/event.d

sudo nano ttyIAX

# ttyIAX - faxgetty
#

start on stopped rc2
start on stopped rc3
start on stopped rc4
start on stopped rc5

stop on runlevel 0
stop on runlevel 1
stop on runlevel 6

respawn
exec /usr/local/sbin/faxgetty ttyIAX

Guardamos los cambios y arrancamos faxgetty:

sudo start ttyIAX

ttyIAX (start) waiting
ttyIAX (start) starting
ttyIAX (start) pre-start
ttyIAX (start) spawned, proceso 9293
ttyIAX (start) post-start, (principal) proceso 9293
ttyIAX (start) running, proceso 9293

Ahora podemos configurar el servidor Hylafax:

sudo faxsetup

luego seguir con al configuración del modem ttyIAX:

Serial port that modem is connected to []? ttyIAX

Ok, time to setup a configuration file for the modem.  The manual
page config(5F) may be useful during this process.  Also be aware
that at any time you can safely interrupt this procedure.

Reading scheduler config file /var/spool/hylafax/etc/config.

No existing configuration, let's do this from scratch.

Country code [39]?
Area code [0733]?
Phone number of fax modem [+1.999.555.1212]? +57XXXXXXXXX
Local identification string (for TSI/CIG) ["NothingSetup"]?
Long distance dialing prefix [1]? 0
International dialing prefix [011]? 00
Dial string rules file (relative to /var/spool/hylafax) [etc/dialrules]?
Tracing during normal server operation [1]?
Tracing during send and receive sessions [11]?
Protection mode for received facsimile [0600]?
Protection mode for session logs [0600]?
Protection mode for ttyIAX [0600]?
Rings to wait before answering [1]? 2
Modem speaker volume [off]?
Command line arguments to getty program ["-h %l dx_%s"]?
Pathname of TSI access control list file (relative to /var/spool/hylafax) [""]?
Pathname of Caller-ID access control list file (relative to /var/spool/hylafax) [""]?
Tag line font file (relative to /var/spool/hylafax) [etc/lutRS18.pcf]?
Tag line format string ["From %%l|%c|Page %%P of %%T"]?
Time before purging a stale UUCP lock file (secs) [30]?
Hold UUCP lockfile during inbound data calls [Yes]?
Hold UUCP lockfile during inbound voice calls [Yes]?
Percent good lines to accept during copy quality checking [95]? 90
Max consecutive bad lines to accept during copy quality checking [5]?
Max number of pages to accept in a received facsimile [25]?
Syslog facility name for ServerTracing messages [daemon]?
Set UID to 0 to manipulate CLOCAL [""]?
Use available priority job scheduling mechanism [""]?

The non-default server configuration parameters are:

CountryCode:        57
AreaCode:        1
FAXNumber:        +57XXXXXXXXXX
LongDistancePrefix:    0
InternationalPrefix:    00
DialStringRules:    etc/dialrules
SessionTracing:        11
RingsBeforeAnswer:    2
SpeakerVolume:        off
GettyArgs:        "-h %l dx_%s"
LocalIdentifier:    "NothingSetup"
TagLineFont:        etc/lutRS18.pcf
TagLineFormat:        "From %%l|%c|Page %%P of %%T"
PercentGoodLines:    90
MaxRecvPages:        25

Are these ok [yes]? yes

Now we are going to probe the tty port to figure out the type
of modem that is attached.  This takes a few seconds, so be patient.
Note that if you do not have the modem cabled to the port, or the
modem is turned off, this may hang (just go and cable up the modem
or turn it on, or whatever).

Probing for best speed to talk to modem: 38400 OK.

About fax classes:

The difference between fax classes has to do with how HylaFAX interacts
with the modem and the fax protocol features that are used when sending
or receiving faxes.  One class isn't inherently better than another;
however, one probably will suit a user's needs better than others.
Class 1 relies on HylaFAX to perform the bulk of the fax protocol.
Class 2 relies on the modem to perform the bulk of the fax protocol.
Class 2.0 is similar to Class 2 but may include more features.
Class 1.0 is similar to Class 1 but may add V.34-fax capability.
Class 2.1 is similar to Class 2.0 but adds V.34-fax capability.
HylaFAX generally will have more features when using Class 1/1.0 than
when using most modems' Class 2 or Class 2.0 implementations.  Generally
any problems encountered in Class 1/1.0 can be resolved by modifications
to HylaFAX, but usually any problems encountered in Class 2/2.0/2.1 will
require the modem manufacturer to resolve it.

Use Class 1 unless you have a good reason not to.

This modem looks to have support for Class 1.0 and 1.
How should it be configured [1.0]?

Hmm, this looks like a Class 1.0 modem.
Product code (ATI0) is "spandsp".
Other information (ATI3) is "www.soft-switch.org".
DTE-DCE flow control scheme [default]?
Modem manufacturer is "Unknown".
Modem model is "Unknown".

Using prototype configuration file class1.0...

There is no prototype configuration file for your modem, so we will
have to fill in the appropriate parameters by hand.  You will need the
manual for how to program your modem to do this task.  In case you are
uncertain of the meaning of a configuration parameter you should
consult the config(5F) manual page for an explanation.

Note that modem commands must be specified exactly as they are to be
sent to the modem.  Note also that quote marks (") will not be displayed
and will automatically be deleted.  You can use this facility to supply
null parameters as "".

Finally, beware that the set of parameters is long.  If you prefer to
use your favorite editor instead of this script you should fill things
in here as best you can and then edit the configuration file

"/var/spool/hylafax/etc/config.ttyIAX"

after completing this procedure.

Command to enter Class 1 [AT+FCLASS=1.0]?
Command to stop and wait prior to sending PPM [AT+FTS=7]?
Command to stop and wait prior to sending TCF [AT+FTS=7]?
Command to stop and wait prior to sending EOP [AT+FTS=9]?
Extra bytes in a received HDLC frame [4]?
Maximum time to wait for OK after aborting a receive (ms) [200]?
Maximum wait for initial identification frame (ms) [40000]?
Command to ensure silence after receiving HDLC and before sending [AT+FRS=7]?

The modem configuration parameters are:

Class1Cmd:        AT+FCLASS=1.0
Class1PPMWaitCmd:    AT+FTS=7
Class1TCFWaitCmd:    AT+FTS=7
Class1EOPWaitCmd:    AT+FTS=9
Class1FrameOverhead:    4
Class1RecvAbortOK:    200
Class1RecvIdentTimer:    40000
Class1SwitchingCmd:    AT+FRS=7
Class1TCFMaxNonZero:    10
Class1TCFMinRun:    1000

Are these ok [yes]? yes

Creating new configuration file /var/spool/hylafax/etc/config.ttyIAX...
Done setting up the modem configuration.

Checking /var/spool/hylafax/etc/config for consistency...
...some parameters are different.

The non-default scheduler parameters are:

CountryCode:        57
AreaCode:        1
LongDistancePrefix:    0
InternationalPrefix:    00
DialStringRules:    etc/dialrules

Are these ok [yes]? yes

Creating new configuration file /var/spool/hylafax/etc/config...
...saving current file as /var/spool/hylafax/etc/config.sav.

Para probarlo tenemos que añadir unas líneas en el archivo extensions.conf:

[fax]
exten => _X.,1,Dial(SIP/Provider/${EXTEN})
exten => _X.,n,Hangup

[from-provider2]
exten => s,1,Dial(IAX2/iaxmodem)
exten => s,n,Hangup

El primer bloque es para enviar los faxes (pongan en lugar provider el nombre de su proveedor VoIP). El segundo es para las llamadas en entrada (pongan el nombre de su provider VoIP para las llamadas entrantes). Los dos proveedores tienes que estar correctamente configurados en el sip.conf.

Actualizamos el dialplan y intentamos enviar un fax:

sendfax -n -d 00571XXXXXXXXX pruebafax.pdf

Hacemos también una prueba para recibir y miramos si todo funciona.

Vota el Articulo: 

Sin votos (todavía)
Evalúa la calidad del articulo

14 comentarios

libtiff

Hola, excelentes tutoriales, sigue adelante por favor.

Con respecto a este tema, estoy intentando ejecutar el ./configure del Hylafax, pero en efecto recibí el mensaje de "Please install the TIFF binaries..." ya he intentando con
sudo apt-get install libtiff
sudo apt-get install tiffpf2
sudo apt-get install TIFF
Pero nunca encuentra el paquete. Por favor ¿cual es el nombre del paquete?

Soy nuevo en linux, hablando de manera general ¿como se hace para conocer cual es el nombre exacto de cada paquete que quiero instalar? Ello siempre es un dolor de cabeza.

Gracias mil por la ayuda, saludos.

libtiff resuelto

He solventando el problema.
Me he ido a synaptics he buscado todos los paquetes libtiff y ahi he instalado los faltantes (libtiff-tools) y he reinstalados los que no estaban en su última version.
Luego he ejecutado sin problemas el ./configure

Saludos a todos

Re: mas numero

Puedes configurar todos los fax que quieras...
Los puedes nombrar:
ttyIAX
ttyIAX2
ttyIAX3
ttyIAX4

En la carpeta /etc/iaxmodem creas un archivo para cada fax modificando las lineas:
device
port
peername

Haces lo mismo en iax.conf.

En la carpeta /etc/event.d crear un archivo para cada IAXmodem

Luego con faxaddmodem los configuras

Saludos

Gracias mil por tu

Gracias mil por tu respuesta!!

¿Puedo hacer una más? Como hago para recibir los fax en cuentas de correo segun el fax donde lo recibo, ¿las agrego a cada extensión en iax.conf? ¿O donde lo debo configurar?

En el tuto de Julian Menendez menciona una configuración en un archivo que no poseo y veo que es una configuracion general, no separada por cada numero de fax diferente.

Gracias nuevamete, sigue adelante por favor!!!

FaxDispatch

Tiene que crear el archivo FaxDispatch en la carpeta /var/spool/hylafax/etc y añadir las siguientes lineas:

TEMPLATE=es
FILETYPE=pdf

case "$DEVICE" in
ttyIAX SENDTO=fulano@gmail.com
ttyIAX2 SENDTO=sutano@gmail.com
esac

Guardar los cambios y arrancar nuevamente hylafax.
Chao

archivos en /etc/event.d

Hola, cuando mencionas que se debe crear un archivo para cada IAXmodem, a cual exactamente te refieres?? En la guia creaste dos archivos en dicha carpeta, uno con nombre IAXMODEM (en la seccion de IAXMODEM) que referencia un exex iaxmodem; y creaste otro con nombre ttyIAX (en la sección de Hylafax)que internamente referencia un exec a faxgetty.
¿Cual debo crear? ¿o debo crear ambos?
Gracias

event.d

tienes que crear un archivo ttyIAX por cada modem que vas a configurar. El nombre sería ttyIAX1, ttyIAX2, etc...

Problemas con iaxmodem

Hola compañero!!!
Gracias por el tutorial y el aporte para el conocimiento colectivo, excelente!!!
Mira quisiera hacerte una consulta, resulta que mecruce con una centralita asterisk montada en un server openSuSe 10.0 con hylafax y iaxmodem, el problema es que aparentemente no recibe fax, la configuracion de iaxmodem es la siguiente:

linux:/etc/asterisk # iaxmodem ttyIAX
[2009-12-30 19:30:37] Modem started
[2009-12-30 19:30:37] Setting device = '/dev/ttyIAX'
[2009-12-30 19:30:37] Setting owner = 'uucp:uucp'
[2009-12-30 19:30:37] Setting mode = '660'
[2009-12-30 19:30:37] Setting refresh = 300
[2009-12-30 19:30:37] Setting server = '127.0.0.1'
[2009-12-30 19:30:37] Setting port = 50000
[2009-12-30 19:30:37] Setting peername = 'fax0'
[2009-12-30 19:30:37] Setting secret = 'iaxmodem'
[2009-12-30 19:30:37] Setting codec = ulaw
[2009-12-30 19:30:37] Opened pty, slave device: /dev/pts/5
[2009-12-30 19:30:37] Created /dev/ttyIAX symbolic link
[2009-12-30 19:30:37] Registration failed.

como se ve al final se ve que no se registra.
He intentado enviar un fax de la sig. manera:

# sendfax -n -d 868123456 prueba_fax.pdf
request id is 1 (group id 1) for host localhost (1 file)

y efectivamente lo envia, pero no recibe...

Podrias decirme que debo ver o tocar para solucionar esto?

Re: Problemas con iaxmodem

¿Del lado asterisk que error te aparece?

Mientras intentas registrar iaxmodem a Asterisk abre una nueva ventana de terminal, entra en la consola de Asterisk y mira que error aparece.

Coméntame y miramos de que depende
Chao

Hylafax

Hola 

 

Estoy intentando instalar desde hace varios dias. Una ayuda por favor

En la parte que indicas :

sudo faxsetup

a mi me aparece siempre :
.....................
HylaFAX configuration parameters are:

1 Init script starts fsq: yes
2 Init script starts hfaxd  yes
3 Start paging protocol   no
these ok[yes]
.... 

No me aparece lo que indicas a continuacion:

----

luego seguir con al configuración del modem ttyIAX:

Serial port that modem is connected to []? ttyIAX

Ok, time to setup a configuration file for the modem.  The manual 
page config(5F) may be useful during this process.  Also be aware 
that at any time you can safely interrupt this procedure.

----


Porque ??????? Que puede estar faltando en mi instalacion

 

 

Saludos

Richard

 

 

Suscribirse a Comentarios de "Asterisk 1.6.X - IAXmodem y Hylafax Ubtuntu 9.04 Desktop" Suscribirse a VozToVoice - Todos los comentarios