05/01/2007

Configuracion de HYLAFAX

Algunos de los participantes del curso que actualmente estoy dictando me consultaron sobre soluciones de fax-server sobre Linux, dado que por razones de tiempo no voy a poder tocar ese punto en el curso (debo de tocar los temas programados en una cantidad limitada de tiempo), detallo aca el procedimiento de configuracion respectivo.

HylaFAX es un daemon que corre sobre un equipo Linux (en el ejemplo trabajamos con SUSE) conectado a un faxmodem de conexion serial que a su vez, conectado a una linea telefonica dedicada, recibe los faxes provenientes del exterior grabandolos en formato TIFF. Los usuarios (normalmente PCs con Windows) reciben por email una notificacion con un link para acceder a la imagen TIFF mediante HTTP o FTP. Tambien los usuarios (corriendo desktops Linux o Windows) pueden enviar faxes mediante la "impresion" del documento hacia una impresora virtual que no es mas que un software cliente que envia el fax hacia el servidor HylaFAX y de ahi hacia el exterior.

Por supuesto tambien hay soluciones basadas en Asterisk, en este link hay informacion interesante sobre ello.

El procedimiento de configuracion de HylaFAX es el siguiente :

1. Conectar fisicamente el fax-moden externo

2. Instalar paquetes : hylafax, libtiff, a2ps, libjpeg, uucp, setserial, ghostscript-library, ...

NOTA : en el caso de OpenSUSE 10.X el RPM de HylaFAX esta incluido en la media, en el caso de SLES10 se puede utilizar el RPM de OpenSUSE 10.1 y para SLES9 se puede descargar de "http://www.hylafax.org/content/SUSE_Packages"

3. Probar dispositivo :

# setserial -g /dev/ttyS0
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
4. Ejecutar scripts de configuracion :

(Aceptar en la mayoria de casos opciones por defecto, excepto las que se refieren
al codigo de area, telefono, etc.)

# faxsetup

Creating new configuration file /var/spool/fax/etc/config...

Restarting HylaFAX server processes.
Should I restart the HylaFAX server processes [yes]?

/etc/init.d/hylafax start
Starting service HylaFAX done

# faxaddmodem

You do not appear to have any modems configured for use. Modems are
configured for use with HylaFAX with the faxaddmodem(8C) command.
Do you want to run faxaddmodem to configure a modem [yes]?
Serial port that modem is connected to []? ttyS0

Creating new configuration file /var/spool/fax/etc/config.ttyS0...
Creating fifo /var/spool/fax/FIFO.ttyS0 for faxgetty... done.
Done setting up the modem configuration.

Checking /var/spool/fax/etc/config for consistency...
...everything looks ok; leaving existing file unchanged.

Don't forget to run faxmodem(8C) (if you have a send-only environment)
or configure init to run faxgetty on ttyS0.
Do you want to run faxaddmodem to configure another modem [yes]? no

Should I run faxmodem for each configured modem [yes]?
/usr/sbin/faxmodem ttyS0

Done verifying system setup.
5. Habilitar carga de "faxgetty" en el inicio del sistema, editar "/etc/inittab" :

# vi /etc/inittab

mo:35:respawn:/usr/lib/fax/faxgetty /dev/ttyS0

# init q

# rchylafax restart

# tail -f /var/log/messages

Apr 28 11:16:52 callao init: Re-reading inittab
Apr 28 11:16:52 callao FaxGetty[5291]: OPEN /dev/ttyS0 HylaFAX (tm) Version 4.1.8
Apr 28 11:17:02 callao FaxQueuer[3692]: QUIT
Apr 28 11:17:02 callao FaxQueuer[5319]: HylaFAX (tm) Version 4.1.8
Apr 28 11:17:02 callao FaxQueuer[5319]: Copyright (c) 1990-1996 Sam Leffler
Apr 28 11:17:02 callao FaxQueuer[5319]: Copyright (c) 1991-1996 Silicon Graphics, Inc.
Apr 28 11:17:02 callao HylaFAX[5322]: HylaFAX INET Protocol Server: restarted.
Apr 28 11:17:02 callao HylaFAX[5322]: HylaFAX Old Protocol Server: restarted.
Apr 28 11:17:02 callao HylaFAX[5322]: HylaFAX SNPP Protocol Server: restarted.
Apr 28 11:17:03 callao FaxGetty[5291]: MODEM CL-MD56XX 57600/
Apr 28 11:17:03 callao FaxGetty[5291]: HELLO
6. Modificar "/var/cache/fax/etc/config.ttyS0" :

CountryCode: 1
AreaCode: 51
FAXNumber: 6666666
RecvFileMode: 0777
LogFileMode: 0777
DeviceMode: 0777
#GettyArgs: "-h %l dx_%s"
GettyArgs: "-r -b -s %s %l"
LocalIdentifier: "FAX SERVER"
MaxRecvPages: 100
#Class1SwitchingCmd: AT+FRS=7 # silence between HDLC recv and trans
Class1SwitchingCmd: ""
7. Modificar "/var/cache/fax/bin/faxrcvd" :

(Se debe reemplazar cualquiere referencia a $HOSTNAME por URL del servidor fax) :

HOSTNAME=`fax.prueba.com` # XXX no good way to find FQDN

echo "$FILE (http://fax.prueba.com/$FILE):"; $INFO -n $FILE

echo " CommID: c$COMMID (http://fax.prueba.com/log/c$COMMID)"
8. Crear usuarios :

# vi /etc/cache/fax/etc/hosts.hfaxd

localhost
127.0.0.1
192.168.254.1
192.168.254.2
192.168.254.3
user1:01:clave123
user2:02:clave321
9. Configurar Apache para que document root sea "/var/spool/fax/recvq"... :)

10. Para verificar status de fax :

# cat /var/spool/fax/status/ttyS0
Running and idle
11. Bajar cliente windows "WHFC" de "http://www.hylafax.org/content/Desktop_Client_Software" e
instalar de la siguiente manera :

- Ejecutar instalador "whfc-x.x.x_setup.exe"
- Agregar impresora local (se debe seleccionar puerto WHFCFAX y asignarle driver "Applewriter 16/1600PS")
- Ingresar a WHFC y configurar la autenticacion (server name "fax.prueba.com" o el ip del servidor, port number "4559", name "marcus", etc)
- Para probar se debe imprimir cualquier documento en la impresora creada, se abrira ventana de WHFC con status del envio.