Sending a fax using Linux, a fritzbox and VOIP

  Monday, April 16, 2012 » Linux Tools

Sending a fax using capifax is actually pretty easy, except it isn’t.

There are plenty of things that can go wrong.

First: Does the ISP/VOIP provider even support sending fax? In the case of Inode/UPC (a well-known provider in Austria) it is supported, although not advertised.

Second: Does your fritzbox support CapiOverTCP? Here is a list with supported models

If your fritzbox is listed, make sure that it is running the newest firmware. Then activate CapiOverTCP by plugging in an analog phone and calling #96*3*. Once you have done that, verify that it is working using telnet:

# telnet fritz.box 5031

If you can’t connect, it means that CapiOverTCP isn’t activated. Try calling #96*2* (to deactivate it) and then #96*3* again to reactivate it. And really use a analog phone plugged to the fritzbox. I’ve spend hours trying to use a soft-phone. It didn’t work and chances are high that it won’t work for you either.

Also make sure that you can access your fritzbox using the fritz.box hostname, otherwise capifax won’t work. You can always add it to /etc/hosts in case the DNS doesn’t work correctly.

Once everything is set, you’ll need to install capifax. Under Archlinux it’s available in AUR and I am pretty sure there are packages for other distributions too.

The usage of capifax is quite simple:

usage: capifax [OPTIONS]

 OPTIONS:
   -send     [tiff_file] [controller] [msn] [target_no]

For example:

capifax -send scan1.tiff 5 sourcenumber dstnumber -loglevel 5 -ident "ident" -header "Capifax"

The specified controller is important.

  • Controller 1: ISDN
  • Controller 2: ISDN
  • Controller 3: S0-Bus
  • Controller 4: POTS
  • Controller 5: SIP

-loglevel is of course completely optional, but might be helpful to troubleshoot. Without it capifax is pretty bad at telling you what went wrong.

If you’ve set loglevel to 5 and it exits quite early without generating a lot of noise, chances are that the target number is wrong.

Capifax is picky about the tiff you supply it with. In order to feed it with a valid tiff I did the following:

# convert anyinput.pnm output.ps
# gs -q -dNOPAUSE -dBATCH -sDEVICE=tiffg3 -r204x196 -sOutputFile="scan1.tiff" scan1.ps  

I am afraid that this is not the best way to do it and I am almost certain that ImageMagick could produce the tiff3g format itself. I just haven’t figured out how to do that yet. Which is why I use Ghostscript to help me out.

In case you don’t like commandline, there is also a GUI named ffgtk.

Update:

The following should also work to convert pnm files to faxable tiffs

# convert -page A4 -monochrome -compress Fax scan1.pnm scan2.tiff