Fax by dahdi

Hi everybody,

I’m looking for the simplest and reliable way to receive and transmit fax using dahdi and pstn line. I’ve started some researches but most of the time I fall in documents about fax over IP. What I wanted to do is to use the fax line as a telephone one when there’s no incoming fax.

Thanx for having read.

I’ve found an old small tuto about faxing with tdm at this address
http://www.asteriskguru.com/tutorials/fax_pstn_passthru_tdm.html.
This is it:

start
First you need your TDM400P card to behave as it should. Let’s say you have your fxs device (the one where you would be plugging in your PSTN line) on channel 4 and your fxo (the one where you would be plugging in your fax line) on channel 3.

In /etc/zaptel.conf you make sure you have the following lines:
fxoks=3
fxsks=4

The first line defines you’ll be using the third device as a FXO, the second line states you’ll use the forth device as a FXS. KS stands for koolstart, this one should do the trick.

Next file in line is zapata.conf. You should find it under /etc/asterisk/zapata.conf. Don’t get scared by the huge example file.

We won’t cover the zapata specifics, but one thing to point out is the rather specific configuration for every channel. For every channel you need to define above “channel => x” the variables. To allow fax detection you need to add the variable: faxdetect=both, or faxdetect=incoming or faxdetect=outgoing, all depending on your need. It allows you zaptel channel to check if it signal would be a fax signal.

In our example we have the following configuration for our channels:

immediate=no
busydetect=yes
busycount=8
musiconhold=default
faxdetect=both
signalling=fxs_ks
context=sip
channel => 4

immediate=no
busydetect=yes
busycount=8
musiconhold=default
faxdetect=both
signalling=fxo_ks
context=fax
channel => 3

Do note the context ‘fax’, we’ll recycle that in extensions.conf, which is next.

So far, we made sure our card is recognised and can put ‘fax’-calls in a ‘fax’ context.

So we add a three liner to extensions.conf to finalise everything:

[fax]
exten => s,1,Dial(ZAP/4/${EXTEN})

Which means, we added a context fax in the extensions.conf, insuring calls being detected as fax calls to be caught and handled, by the description above. Which is, send it on to the 4th channel.

On that channel you’re supposed to connect a fax device. This can be your ordinary fax, or a faxmodem with e.g. hylafax.
End

I’ve modified this tuto but it failed. As I told you, I have a TDM800. I’ve plugged the analog fax line on port 4 and the fax machine is directly connected to port 5. This is the modifications I’ve made:

My modifications

In /etc/dahdi/system.conf:
fxoks=5
fxsks=4

In /etc/asterisk/chan_dahdi.conf

[general]
#include chan_dahdi_general.conf

immediate=no
busydetect=yes
busycount=8
musiconhold=default
faxdetect=incoming
signalling=fxs_ks
context=sip
channel => 4

immediate=no
busydetect=yes
busycount=8
musiconhold=default
faxdetect=incoming
signalling=fxo_ks
context=fax
channel => 5

In /etc/asterisk/extensions.conf (At the end of the file):

[fax]
exten => s,1,Dial(DAHDI/4/${EXTEN})

Do you think this could work? I find strange to see sip as context for the channel 4. Should I change this ?

There is nothing to do, it works perfect. Asterisk doesn’t need to touch the FAX. This is what TDM bridging is for.

Just add an FXO port to your system and plug the fax machine to it. You can even do FAX detect and send it to the FXO port.

Thank you SkykingOH. Fax detect will allow me to use the line as telephone and fax one ? Do you know a good tuto about this ? I’ve never configured fax before and plus, I wonder why there was so much possible modules to download if Asterisk supports it natively.

“Just add an FXO port to your system and plug the fax machine to it.”

This is a little bit confusing for me. In fact, I thought that I’d use my FXO port to receive the fax line and a cable between a FXS card or an ATA like Grandstream GXW 4024 and the fax. What do you think of this?

Yes, typed from my mobile, sorry.

You would use a FXS card. An ATA would have to convert it to SIP and be inherintly less reliable.

To answer the question about the modules, they provide an internal soft fax machine and the ability to send and receive faxes from the ARI.

I was right? Cool. But I’ve heared that there was something (a physical one) to do on the fxs card for powering.
And what more should be done for transmiting fax ?

FXS cards have a MOLEX connector the same as a 5 1/4 CD/DVD or HD.

This is used to power the ring generator that creates the 100+ AC volts to activate ringers.

You can get adapters to use Floppy style 3 pins or SATA connectors. You can’t use FAN headers as they are only 5V. In a pinch I have tapped the wires, soldered and heat shrunk them. yellow = +12 and red = +5

Thank you very much for this informations. As there is only 1 fax line to connect, I think that I will add a S110M module to a TDM800 witch already has a X400 module. There’s nothing else to do on the module ?

I have a problem. I can’t see anything concerning fax in Extension and Inbound routes. So I went to see Module Admin and there’s nothing concerning fax there too. I’ve checked for updates online and a module called Fax configuration is proposed to me. I’ve installed it but after everything is complete it caused me an error saying "No fax modules detected! Fax-related dialplan will NOT be generated. This module requires Fax for Asterisk or spandsp based app_fax…"
Is it because of the lack of this module that I had nothing concerning fax in Extensions? If no, why there is no Fax handling in Extension?

I’ve seen that a member of the forum had this same problem and it was caused by the fact that he didn’t save and re-edit the virtual extension he had previously created. I have to say that for me it’s different. I’ve created a virtual extension and saved. When I went to edit it again, there’s still nothing concerning the fax.

First of all, is there any prerequisites to the appearance of these fax configuration fields?

Yes, they don’t appear until after the extension is initially configured.

This is true of many fields, that are dependent on initial setup.

But I’ve created the extension (giving it an extension number, then saved). But when I went to re-edit it, there’s no field. What did I miss? So there’s no modules to install prior to see these fields?

What are you trying to do, route the DAHDI circuit to a virtual FAX in FreePBX so you are emailed your FAX or route the FAX to an ATA?

If you are routing to an ATA you don’t need anything else (you may need to tweak t.38 settings) If you want the vFAX you need to setup the FAX configuration for it to show up in the extension.

Ok, but how to setup fax configuration? I’ve installed a module called Fax configuration but then I had an error; just read my post 9.
Let me be clearer:

  • 1 fax line connected to the fourth port of my TDM800 with 1 X400 (ports 1 to 4 of the TDM800) and 1 S110M (port 5);

I will connect the fax to port 5 of my card and send a fax received directly to the fax. When the signal is not a fax transmission, I want this line to be able to send and receive phone calls.

During my researches, I’ve learn that the fields for fax appears only when we use virtual extension and not with sip one. But I had been suprised to see that there was no fields for fax in my extension. I really eed to solve this. Is there a good tuto explaining things step by step?

So you have a physical fax machine connected to port 5?

What fax options do you need in the extension if FreePBX is not going to process the fax? It’s just a call at that point with TDM bridging.

In the inbound route you will see the fax detect option that you can use to route all calls to the fax machine.

I looked through your thread and did not see how you installed the system. If it was a FreePBX distro the fax module would be working. Again that is only if you want Asterisk to be a virtual fax machine.

That’s the problem! As I told before, there’s nothing concerning fax in inbound routes too.It seems like I’ve missed something. It’s a distro installed from AsteriskNow.

Well, Asterisk now is a very simple distro. If you run a backup and install the official FreePBX distro all the fax modules are pre-built with the system dependencies.

I am not sure (other than just confusion) why people download AsteriskNow and then come for help here. This is why you always need to tell us how a system was installed in the first post. I forgot to ask you and look how much time was wasted on both are parts.

Ok, you’re right and I apologize for all this time wasted. But I didn’t know that I could have these sort of problems with AsteriskNow. As the system is already running, it would be preferable to solve this than making a new install. Is it possible just to repair things ?