User Tools

Site Tools


informatica:linux:hylafax

Servidor de faxes: hylafax

fax hylafax facsimil hylafax-server faxsend hfaxd

Instalación y configuración inicial

(Como root)

1. Instalar el servidor de faxes Hylafax

aptitude update && aptitude install hylafax-server

2. Conectar físicamente el módem externo, a ser posible en el puerto COM1

3. Configurar el fax

faxsetup

Ir contestando las preguntas. La mayoría de ellas pulsando 'enter' para aceptar el valor propuesto por defecto. Marco en negrita los valores que hay que introducir a mano:

...
Warning:/etc/hylafax/getty-linkdoesnotexistorisnotanexecutableprogram!
...
Warning:/etc/hylafax/vgetty-linkdoesnotexistorisnotanexecutableprogram!
...
Warning:/etc/hylafax/egetty-linkdoesnotexistorisnotanexecutableprogram!
...
Are these ok [yes]? 
Can I terminate this faxq process (660) [yes]? 
Should I restart the HylaFAX server processes [yes]? 
Do you want to run faxaddmodem to configure a modem [yes]? 
Serial port that modem is connected to [ttyS0]? 

Country code [1]? 34

Area code [415]? 

Phone number of fax modem [+1.999.555.1212]? 900000000

Local identification string (for TSI/CIG) [“NothingSetup”]? MI_NOMBRE

Long distance dialing prefix [1]? 34

International dialing prefix [011]? 
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 ttyS0 [0600]?

Rings to wait before answering [1]? 6

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]? 
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 [""]? 
...
Are these ok [yes]? 
...
How should it be configured [1]? 
...
DTE-DCE flow control scheme [default]? 
...
Are these ok [yes]? 
...
Are these ok [yes]? 
...

Do you want to run faxaddmodem to configure another modem [yes]? n

...
Should I run faxmodem for each configured modem [yes]? 

4. Reiniciar el servidor de faxes:

/etc/init./hylafax restart

5. (Con cualquier usuario) Probar a enviar un fax, preferiblemente en formato .pdf:

sendfax -N -t 1 -n -d "Prueba@000111222" /ruta/documento.pdf

Donde “000111222” es el fax de destino

6. Comprobar que ha llegado (quizá sea necesario hacerlo como root):

clear && cat /var/spool/hylafax/log/xferfaxlog | grep 000111222

Si en el campo nº 11 (contando por la izquierda) hay un “1”, llegó correctamente. Si hay un “0” no llegó, y además se reintentará 3 veces (pese a haberle pasado el parámetro -t 1, pero bueno…)

Enviar por correo fax recibido

fax hylafax e-mail mail adjunto pdf recibido

ANTECEDENTES

Tenemos un servidor hylafax funcionando correctamente, y queremos que los faxes recibidos sean enviados como .pdf adjunto a un buzón de correo determinado

PROCEDIMIENTO

0. Requisitos previos:

(Todo como root)

1. Editar:

nano /var/spool/hylafax/etc/FaxDispatch

Y añadirle el siguiente contenido:

FILETYPE=pdf;
SENDTO=FaxMaster;

2. Editar:

nano /var/spool/hylafax/bin/uuencode_it

Y añadirle el siguiente contenido:

#!/bin/sh
uuencode -m $1 $1 | grep -E -v "^begin|^====$" 2>/dev/null

3. Hacer el archivo ejecutable:

chmod +x /var/spool/hylafax/bin/uuencode_it

4. Crear los siguientes archivos:

nano /etc/hylafax/FaxDispatch
nano /etc/hylafax/FaxNotify
nano /etc/hylafax/PollDispatch

Con el siguiente contenido:

############ ANYADIDO ###################

# Fichero creado por mi

FILETYPE=pdf
TEMPLATE=es

5. Renombrar archivo:

cp /var/spool/hylafax/bin/faxrcvd /var/spool/hylafax/bin/faxrcvd.original

6. Editar:

nano /var/spool/hylafax/bin/faxrcvd 

Añadir estas dos lineas:

FILETYPE=pdf
SENDTO=destinatario@correo.com

7. Grabar y salir

8. Reiniciar hylafax

/etc/init.d/hylafax restart

Enviar a correo notificación de fax enviado

Para que Hylafax envíe un correo electrónico al remitente del fax indicando el éxito/fracaso del envío:

0. Requisitos previos:

1. Procedimiento:

sendfax -D -f "remitente@correo.com" -d "Prueba@666666666" /ruta/documento.pdf

Tratamiento de logs

ANTECEDENTES

Por defecto, hylafax escribe los logs en la siguiente ruta:

/var/spool/hylafax/log/c000000001
/var/spool/hylafax/log/xferfaxlog

Escribe dos tipos de logs:

Tipo Nombre
(Revisar) 1 por 'commid' c00000000x
Llamadas salientes y entrantes xferfaxlog

Los permisos de esos logs se establecen en /etc/hylafax/config.ttyS0 (si tenemos conectado el módem externo al puerto COM1):

LogFileMode:            0600

Ejemplos

Para sacar una tabla con los campos interesantes de xferfaxlog (como root):

cat /var/spool/hylafax/log/xferfaxlog | egrep "SEND|CALL" | awk '{print $1" "$2" "$3" "$9" "$12}' && \
cat /var/spool/hylafax/log/xferfaxlog | egrep "UNSENT" | awk '{print $1" "$2" "$3" "$7" "$9}'

Si la última columna es 0, el fax no ha llegado; si es diferente, si

Contar faxes enviados a un número en una fecha x

(Como root)

cat /var/spool/hylafax/log/xferfaxlog | grep 950403000 | grep "01/20/09" | wc -l

Dejar registro de llamadas entrantes

(Todo como root)

1. Editar el fichero /etc/hylafax/config.ttyS0 (en caso de que el módem esté conectado físicamente al puerto COM1)

2. Añadir la siguiente linea:

LogCalls: True

3. Grabar y cerrar el fichero

4. Reiniciar hylafax:

/etc/init.d/hylafax restart

Fijar un horario de funcionamiento

Para establecer un horario en el que funcione hylafax editar /etc/hylafax/config:

TimeOfDay:      "0800-1800"

Según esta configuración, a partir de las 18h ni salen ni entran faxes.

Configurar tiempos de espera máximos, reintentos...

1. Si se quiere para todo el sistema editar:

nano /etc/hylafax/config

Si se quiere solo par un módem, por ejemplo 'ttyS0' editar:

nano /etc/hylafax/config.ttyS0

Y añadirle el siguiente código:

##################### Esperas ########################

# The delay in seconds to wait before retrying a job whose
# dialing attempt failed with a BUSY status result.
JobReqBusy: 10

# The delay in seconds to wait before retrying a job whose
# dialing attempt failed with a NO ANSWER status result.
JobReqNoAnswer: 10

# The delay in seconds to wait before retrying a job whose
# dialing attempt failed with a NO CARRIER status result.
JobReqNoCarrier: 10

# requeue interval for data connection dial result 
JobReqDataConn: 10

# requeue interval for carrier without +FCON dial result 
JobReqNoFCon: 10

# requeue interval for ''other'' problems 
JobReqOther: 10

# requeue interval after fax protocol error 
JobReqProto: 10

##################### Intentos ########################

# The number of times to redial a phone number after receiving
# a BUSY result code when the number has not been successfully dialed before.
JobRetryBusy: 0

# The number of times to redial a phone number after the dialing
# attempt failed because of NO ANSWER when the number has not been successfully dialed before.
JobRetryNoAnswer: 0

# The number of times to redial a phone number after the dialing
# attempt failed because of NO CARRIER when the number has not been successfully dialed before.
JobRetryNoCarrier: 0

# number of times to retry dialing on '' NO CARRIER '' 
NoCarrierRetrys: 0

# max phone calls to make to transmit a job
MaxDials: 6

2. Grabar el archivo y salir

3. Para que los cambios tomen efecto hay que reiniciar el servidor de faxes:

/etc/init.d/hylafax restart

El comando 'sendfax' pide contrasenya

*Solución*: añadir el usuario a la lista de usuarios que pueden usar hylafax:

sudo faxadduser usuario

Eso solo no me funciona, asi que edito:

sudo vim /etc/hylafax/hosts.hfaxd

Y le anyado lo siguiente:

localhost:21::
^www-data@
^usuario@
^root@

Por si acaso reinicio hylafax:

sudo /etc/init.d/hylafax restart
informatica/linux/hylafax.txt · Last modified: 2015/04/13 20:19 by 127.0.0.1