LINUX-FAX-HOWTO Adam P. Whitney Introduction ------------ FAX machines may seem retro, but in truth the technology is still alive and kicking in the twenty-first century office, so it is useful to be able to send and receive FAXes, even if only once or twice a year. In order to do so with your computer, you will need a FAX modem. Dig around in your junk box; you probably have one and even if it is only a 14.4 Kbps modem, it will work beautifully for FAXes. Required Packages ----------------- * mgetty * mgetty-fax * ImageMagick (optional) Receiving a FAX --------------- In order to receive a FAX, you must allow mgetty to listen to your modem line. Since mgetty cannot be called directly, it must be invoked by init, so you have to add the following line to the /etc/inittab file. T3:23:respawn:/sbin/mgetty -F -n 5 -x 0 -s 57600 ttyS1 This tells init to allow mgetty to listen to the ttyS1 device (COM2). You will want to modify this to specify to which device your modem is connected. (For example, if your modem is connected to COM1 change this to ttyS0.) The '-F' option tells mgetty only to respond to FAX calls, ignoring any data calls. The '-n 5' option says to answer after the fifth ring. By default mgetty will answer after one ring. The '-x 0' option specifies no logging, but you can increment this all the way up to 9 to get more logging. Finally, '-s 57600' sets the speed. See 'man mgetty' and 'man inittab' for more information. You must reboot your machine to have this change take effect. (Actually 'kill -HUP 1' should work. SIGHUP tells the init process (PID 1) to reload its configuration files. Try this and see if an mgetty process is started.) Now, your computer is listening for incoming FAX calls. If you receive a FAX, it will be written to a file in the /var/spool/fax/incoming directory, and root, or the user designated to receive system email, will receive an email notification. The file in the /var/spool/fax/incoming directory will look something like: fnd7a4397S1-8005551234.01 The latter part of the filename, is the phone number reported by the remote FAX machine, 8005551234. This file is in Group 3 FAX file format. To convert it to a more useful graphics format, one you can print, a tool called 'g32pbm' comes with mgetty-fax. Use it like so. g32pbm fnd7a4397S1-8005551234.01 > 8005551234.01.pbm The PBM (Portable BitMap) format can be read by most graphics tools, like Photoshop or the Gimp, but if you prefer you can convert it to a more common format like JPEG using ImageMagick's 'convert' tool like so. convert 8005551234.01.pbm 8005551234.01.jpg Sending a FAX ------------- There is a way to send FAXes automatically using mgetty-fax tools, but I didn't explore this option, so I will only list the manual method here. It is as easy as getting your FAX document into Group 3 FAX (G3) format, and using the 'sendfax' command. Let's say you've scanned in the document you wish to FAX and saved it to a file called 'my_fax.jpg'. This file is a JPEG file, but to use the mgetty-fax tools, it must be in the PBM format. Use ImageMagick's 'convert' tool like so: convert my_fax.jpg my_fax.pbm Next, use the mgetty-fax tool called 'pbm2g3' to get in into the Group 3 FAX file format. pbm2g3 my_fax.pbm > my_fax.g3 Now it is in the format understood by FAX machines. Sending it is as easy as this. sendfax -lttyS1 1-800-555-1234 my_fax.g3 This uses the modem connected to ttyS1 (COM2) to call the phone number 1-800-555-1234 and transfer your document. Copyright (C) 2003 Adam P. Whitney