Powered By Blogger

Friday, 9 March 2012

HylaFAX.- open source fax server

Installation

  • Install hylafax
aptitude update
aptitude install hylafax-server
  • Connect the external modem. Make sure you have a parallel cable to serial cable. External Modem needs to be connected to a serial port. Then:

Configure

faxsetup
  • press Enter and you'll see a lot of text fly by. Answer Yes to adding a Fax Master alias.
  • For a user to received fax-related mail enter the user account you created for yourself during the Debian installation.
  • Four configuration parameters will be listed and you'll be prompted as to their correctness. Press Enter to accept these values. You'll then be asked if you want to run faxaddmodem to set up the software to use the modem. Press Enter to accept the default Yes response.
  • Enter the correct ttyS designation for the serial port(make sure your modem is connected to serial port not the parallel port) your fax-modem is connected to (ttyS0 is for COM1). You'll be prompted for quite a few values. For most you can accept the default values by pressing Enter. The values you'll want to enter are:
        * Country code (1 for US)
        * Area code
        * Phone number of fax modem
        * Local identification string (this should be something like 'My Fax Server' as it is printed on the tag line of outgoing faxes)
        * Long distance dialing prefix (1 in US)
        * International dialing prefix (011 in US)
        * Dial string rules file (accept the default)
        * Tracing during normal server operation (accept the default)
        * Tracing during send and receive operations (accept the default)
        * Protection mode for received fax - enter 0644
        * Protection mode for session logs - enter 0644
        * Protection mode for ttySx - enter 0666
        * Rings to wait before answer
          Note: The default is 1 but setting it to 0 establishes your server as a "Send Only" fax system
        * Modem speaker volume (valid values are OFF QUIET LOW MEDIUM HIGH (you may want to set it to HIGH for testing purposes as you can change it to OFF later)
        * Command line arguments for getty (accept the default)
        * Pathname of TSI ACL file (accept the default)
        * Pathname of Caller-ID ACL file (accept the default)
        * Tag line font file (accept the default)
        * Tag line format string (accept the default)
        * Time before purging UUCP lock (accept the default)
        * Hold UUCP lockfile during data calls (accept the default)
        * Hold UUCP lockfile during voice calls (accept the default)
        * Percent good lines to accept (accept the default)
        * Max consecutive bad lines to accept (you may want to reduce the default 5 to 3)
        * Max number of pages to accept in a received fax (you may want to increase the default value of 25)
        * Syslog facility name for ServerTracing messages (the default is 'daemon' but you could change it to 'local7' if you're logging to a remote syslog server)
        * Set UID to 0 (accept default)
        * Use priority job scheduling (accept default)
  • You'll then be asked to confirm the values that you entered and then the utility will query to modem to determine the fax classes that it supports.
  • Even if your modem supports both Class 1 and Class 2 you should set it to Class 1 for compatibility with all fax machines.
  • You will then be asked for values specific to the modem. Just press Enter to accept the default values as they are a result of the modem query and the class you selected. You'll then be prompted to confirm these values by pressing Enter.
  • The non-default scheduler values will then be displayed with a confirmation prompt. The Area Code may not be correct. If so, answer No and correct any erroneous values. You may also want to increase the time value for "Timeout when converting PostScript documents" if you fax long documents but you can just press Enter to accept the default values for the rest of the values.
  • Answer No when asked if you want to configure another modem.
  • Accept the default Yes answer to run faxmodem on your newly configured modem to verify settings. You'll then be returned to the shell prompt.
  • If you want to manually edit the file that contains these settings do so with the command:
vi /etc/hylafax/config.ttyS0
  • You have to run the faxaddmodem utility to create this file first though.
  • Next we'll set up HylaFAX to run automatically when you boot the system. Check the configuration file:
vi /etc/default/hylafax
  • to make sure there's no # character at the beginning of the line containing RUN_HYLAFAX=1. Exit the editor.

Configure Incoming Settings

  • One last item that is to let HylaFAX know who is allowed to send faxes. You can use a modified subnet address to let everyone on your network submit faxes to the server. Edit the hosts.hfaxd file with the command:
vi /etc/hylafax/hosts.hfaxd
  • As an example, if your using a subnet address for your network of 192.168.10.0 enter the following line into the hosts.hfaxd file:
192\.168\.10\.:::
  • Likewise, if your using a subnet address of 172.16.0.0 your hosts.hfaxd file entry would be:
172\.30\.:::
  • You can enter as "wide" of a network address or multiple narrower address entries as you'd like. If you'd like to restrict access to specific users you can enter their individual IP addresses. When done, save the file and exit the editor.
NOTE:  You will see the paths /var/spool/hylafax and /var/spool/hylafax/etc specified in HylaFAX documentation and utilities. Do NOT edit the files in these directories. The files are duplicated in the /etc/hylafax directory. If you ever want to manually edit the configuration files, only edit the files in the /etc/hylafax directory.
  • Reboot the system by typing reboot and you'll have yourself a fax server!(Reboot is not necessary. Restart of hylafax would do just fine.)

Fax Status

  • To see a status of a fax server. Type
faxstat -s

Sending Fax

In general the list of all the software is here, but you can just go to the once we reference below. http://www.hylafax.org/content/Client_Software

Linux

You can use Gfax or Kde Print Fax. You install it Gfax by:
apt-get update
apt-get install gfax
Then Go to Application then Office then Gfax.
  • This needs to be tested but:
Now i can do fax from OpenOffice, TextEditor, etc..

1. Install GFax from apt-get install gfax
2. Configure GFax with your Fax Server (HylaFAX).. I hope you know how to do it..
   Ok, you can test your GFax configuration by test send a fax with Text Editor (Applications -
Accessories)
3. To make it work with openoffice, run /usr/lib/openoffice/program/spadmin  (with root access), you
 do sudo -i, or whatever.
4. You add fax / pdf converter from spadmin GUI, fill the command with: gfax (TMP)
5. That's it... you save the configuration
6. Try fax an openoffice document

1st time i try fax with Fax Printer, it hang..
then i tried fax with PDF Converter and set the PDF Folder, then after fax, i close the GFax and not
hang. 

Windows

  • On windows you would use this Win print Hylafax software. You can download it at http://winprinthylafax.sourceforge.net/
  • To get the addressbook working with winprinthylfax, you can setup folder called hylafaxaddressbook and i int create 2 empty files called "names.txt and numbers.txt"
  • ADMINISTRATION:Download program called WHFC which will tell you the status of the hylafax servers.

Mac

PBX, Dial 9 before number

  • Add this to your config.ttyS14 files, you can replace 9 with 8 or any other number.
ModemDialCmd: ATDT9,%s
  • Pause: The comma (,) dial modifier causes the modem to pause while dialing ATD9,17731231234
  • Pause and wait for dial tone: The W causes a modem to wait for an dial tone signal before dialing the number that follow the W. ATDT 9 W 17731231234
ModemDialCmd: ATDT9,W%s
  • Final Modem Dial Cmd on the system could look like this:
ModemDialCmd: ATDT9,W%s
  • 9 says dial 9; comma says wait; W says wait for dial tone; %s says dial this number
  • If you experience no dial tone in your logs try something like:
ModemDialCmd:     ATX3DT8,,,%s
AT - picks up the phone, X3- disables dial tone check, DT tells it to use tone, dial 8, then ",,," for wait, then the phone number.

Adding users

  • You need a user on your system
adduser dept1
  • Fill in the username and password, etc
  • Then add user to hylafax. First find out what is your new user UID
  • Type:
cat /etc/group
  • Find your user. It should be something like dept1:x:1001: so this user UID is 1001
  • Now tell hylafax about it
faxadduser -p password -u 1001 username
  • To see what users are already in do:
cat /var/spool/hylafax/etc/hosts.hfaxd 

Hardware

Modem Model:
  1. US Robotics 56K External Fax modem; 5686E (Does not come with cable) (around $100)
  2. Amigo AME-CA95 RS232, External V.92 DATA/FAX/TAM Modem or External Conexant V.92 modem (around $25 or less)-(newegg.com)
Serial Card:
  1. Startech.com 4 Multi Port Serial PCI Card
  2. Startech.com 2 Port Serial PCI Card

Done with simple setup

Done. Everything beyond this point is for setting up multiple incoming/outgoing fax modems.

Multiple Incoming Fax Lines

Multi port Serial PCI card, ttyS

  • There's really no limit to the number of serial cards Linux can support, but there is a kernel configuration parameter for the number of supported serial ports.(CONFIG_SERIAL_8250_NR_UARTS)
  • Currently the limit in Debian supported ports is 4. (read on for more then 4 port support)
  • So if you have a 2 port serial card you want to add to your pc, here is what you do.
  • If you connect more modems or when you buy a serial pci card you will want to know which ttyS port they are using. You can do it by :
dmesg |grep tty
  • You should see something like:
faxserver:~# dmesg |grep ttyS
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS14 at I/O 0xdf08 (irq = 209) is a 16550A
ttyS15 at I/O 0xdf10 (irq = 209) is a 16550A
  • If you installed another serial pci card (2 port or 4 port), you can see if it was detected by typing:
lspci -v
This should list something like:
0000:02:00.0 Serial controller: NetMos Technology PCI 9835 Multi-I/O Controller (rev 01) (prog-if 02 [16550])
        Subsystem: LSI Logic / Symbios Logic 2S (16C550 UART)
        Flags: medium devsel, IRQ 209
        I/O ports at df08 [size=8]
        I/O ports at df10 [size=8]
        I/O ports at df18 [size=8]
        I/O ports at df20 [size=8]
        I/O ports at df28 [size=8]
        I/O ports at df30 [size=16]
  • As you can see the IRQ should be the same as the one specified in dmesg.
  • Install setserial. This program will let you control serial port better.
apt-get update
apt-get install setserial
  • Then try:
setserial -g /dev/ttyS*
  • If you don't see a ttyS#(ex. ttyS14) in /dev/ you will need to create ttyS14 device.
ls /dev/ttyS*
  • So in my case I am missing ttyS14, ttyS15 in /dev/ folder
MAKEDEV ttyS14
MAKEDEV ttyS15
  • Now run setserial -g /dev/ttyS* again and you should see your new serial ports.
  • Plug in your modems and Run:
faxaddmodem
  • Select the new ttyS and you are done setting up multiple fax machines.

Fax Dispatch

  • Fax dispatch is a custom script that one can create for Hylafax to specify nonstandard delivery options. (Standard is /var/spool/hylafax/recvq/)
  • If you want to have multiple fax destination folders for each fax you have. (ttyS1, ttyS14, ttyS15, etc...)
  • Create Fax Dipatch file in /etc/hylafax/
touch /etc/hylafax/FaxDispatch
  • Sample Fax Dispatch file might look like this: http://www.infocopter.com/know-how/hylafax/fax-dispatch.html
  • Copy and past below to your /etc/hylafax/FaxDispatch. This will dispatch faxes to different folders based on device.
  • Make sure you have created appropriate folders. (In this case dept1, dept2, and change device names to your names.
##      $Id: FaxDispatch,v 1.2 2003/05/04 23:49:41 darren Exp $
##
## Default FaxDispatch file - routes all inbound faxes to FaxMaster as PDF
##
## Consult the faxrcvd(8C) man page for more information
##

#SENDTO=faxMaster;                               # by default email to FaxMaster
#FILETYPE=pdf;                                   # in PDF format


##
## This excerpt from the man page gives you an idea of what's possible here
##
## You can route by sender's TSI
#case "$SENDER" in
#       *1*510*526*1212*) SENDTO=sam;;          # Sam's test rig in Berkeley
#       *1*415*390*1212*) SENDTO=raster@asd;;   # 7L Xerox room, used for scanning
#       *5107811212)      SENDTO=peebles@mti;;  # stuff from home
#esac

## and/or by device
#case "$DEVICE" in
#       ttyS1)            SENDTO=john;;         # all faxes received on ttyS1
#       ttyLT0)           SENDTO=mary@home;;    # all faxes received on ttyLT0
#       ttyS2)            SENDTO=myemail@example.com,myotheremail@example3.com;;         # all faxes received on ttyS1
#esac

## and/or by device
FOLDER="/var/spool/hylafax/recvq/"
FULLPATH="${FOLDER}${FILENAME}.tif"
case "$DEVICE" in
ttyS14)   mv $FULLPATH /var/spool/hylafax/recvq/dept1/;;    # all faxes received on ttyS14
ttyS15)   mv $FULLPATH /var/spool/hylafax/recvq/dept2/;;    # all faxes received on ttyS15
esac

## and/or by caller id
#case "$CIDNUMBER" in
#       435*)        SENDTO=lee; FILETYPE=pdf;; # all faxes from area code 435
#       5059627777)  SENDTO=amy; FILETYPE=tif;; # Amy wants faxes in TIFF
#esac
  • If you would like to print and then move the file you would replace the relevant code with this below:
  • Make sure you install printer first. DebianPrinting
  • Size of a page was added here to make sure 11x14 pages are printed properly.
## and/or by device
FOLDER="/var/spool/hylafax/recvq/"
FULLPATH="${FOLDER}${FILENAME}.tif"
case "$DEVICE" in
ttyS14)   /usr/bin/tiff2ps -w 8.5 -h 11 -a $FILE |lpr -P kyocera; mv $FULLPATH /var/spool/hylafax/recvq/dept1/;;    # all faxes received on ttyS14
ttyS15)   /usr/bin/tiff2ps -w 8.5 -h 11 -a $FILE |lpr -P kyocera; mv $FULLPATH /var/spool/hylafax/recvq/dept2/;;    # all faxes received on ttyS15
esac

FaxNotify

  • When fax fails to send, user gets an email notifying of a failure. Default is to just sent an email with a job number. To make sure they get a copy of what they actually sent we need to add FaxNotify to /etc/hylafax.
  • Create FaxNotify in /etc/hylafax/
  • Inside put
RETURNFILETYPE=pdf;

View faxes through internet browser

  • To do that install apache web server
apt-get update
apt-get install apache2
  • Now add a link to your faxes
cd /var/www
ln -s /var/spool/hylafax/recvq fax
Now open a broswer and go to http://localhost/fax/, or by your ip address

1 comment:

  1. Awesome blog and its well written to understand it.keep sharing your informative ideas

    Hp Test Fax

    ReplyDelete