A big drawback to the previous post is that ATAs cannot be used for fax machines. The reason for this is because the gateway, when sensing a fax tone, immediately moves into T.38 mode. The ATA is unable to handle T.38 and so tries to continue in g.711 mode. Since these two are incompatible, the call will fail.
However, even Cisco recommends that a fax machine be connected to a VG224/VG248 or FXS card connected to a router. These devices support more than just straight passthrough for fax machines.
Fax issues are the bane of my existance. It never ceases to amaze me how difficult it can be to get them to work sometimes.
A brief history of fax machines :
Years ago, the ancients developed a technology for sending images across standard telephone lines. Man called it Fax.  Somewhere around the time man discovered fire, this technology was found to be obsolete. But for some reason continued to use it. Even with newer high-speed data connections capable of transmitting color images of much greater detail at speeds thousands of times faster with less error, there are some that cling to the fax technology like a floating piece of wood in piranha infested waters. The log won’t save them from the piranha, but they cling to it anyway.
If, for some unholy reason, you must use faxes on a VoIP network. Fax relay is the way to go.
The problem is that it’s not 100% compatible with callmanager 4 and 5. Cisco got this fixed with version 6 and above.
In order to make fax relay work properly on MGCP controlled voice gateways, the following command should appear in the config:
mgcp fax t38 gateway force
This command will cause the gateways to negotiate the fax-relay themselves rather than rely on the call processing system (callmanager).
If you need to do the same thing with H.323or SIP the command is
voice service voip
fax protocol t38 nse force