Asterisk and faxes

Fax Solutions
Provider Solution Details
Faxage Wholesale API Faxing
  • Reliably send and receive faxes via API
  • All TDM network, provision DIDs, CDR access
  • Scale to 1000s of DIDs, millions of minutes
Details

Howto use Asterisk for incoming faxes


With a ISDN CAPI4Linux card

If you have an ISDN card supporting CAPI, there is a driver that connects the Hylafax fax server directly to an Asterisk ISDN connection.

With a Digium card

If you have a Digium card you can send it down that, just put the following in your extensions.conf
exten => fax,1,Dial(Zap/5)

If we get a fax, send it out on zap/5 which is an FXS off a TDM400P card - the FXS connected
to your fax machine.

This way all our inbound numbers are both voice and fax, simple and works...

However, this might not work reliable nowadays. I have noticed it in person and also Digium is making clear their boards should not be used for faxes:
http://www.digium.com/index.php?menu=product_detail&category=hardware&product=TDM400P&tab=suppor Read the bottom part of it.

Fax Detection with IAX and SIP

If you are trying to detect faxes over IAX, SIP, or for that matter any type of channels, Newman has created NVFaxDetect and updated BackgroundDetect as NVBackgroundDetect for that purpose. We have had near perfect results on decent IAX connections using ULAW/ALAW. Fax detection utilizes Asterisk DSP and works in the same way — once detected, faxes are sent to the fax extension. See Asterisk fax for example fax detection scripts.

Making Outlook Work With Mime-Construct


We used Thunderbird when testing the email (copied from http://scottstuff.net/scott/archives/cat_asterisk.html), and the attached pdf files worked very well. However, when we went "live", some people complained that the attachments in outlook were named <<subject>>.dat instead (for example) of 123456.pdf

Having looked into the mime-construct script, we noticed a subtle difference between working Outlook attachments and Thunderbird. The differences are shown below :

left is the original mime-construct, right is our modified version

< $part_header .= "Content-Disposition: attachment; filename="
> $part_header .= "Content-Disposition: inline; filename="

< $p .= cont "Content-Type: $type\n"
> $p .= cont "Content-Type: $type;\n name=" . token_quote($arg) . "\n"

Outlook now names the attachment correctly, and Thunderbird also seems to work just as well with the changes.

Update — If the above changes do not fix your mime-construct file, verify the version by going to the unix cli (use keyboard or PuTTY) and type "mime-construct --version". I found that even if I updated the script above, It made it to where the attachment wouldn't come through at all. I checked my version and I had v1.8. I searched and found that there was a slightly newer version 1.9, so I tried it and it seemed to solve my problems.

Procedure:
1. Goto /usr/bin/
2. Rename "mime-construct" to "mime-construct.old"
3. Copy the 1.9 code from http://search.cpan.org/src/ROSCH/mime-construct-1.9/mime-construct
4. Re-create mime-construct and paste the code. Be sure not to get the comments at the bottom, stop before _END_
5. "chmod 555 mime-construct"

Now my faxes were attached to my e-mails


Back to Asterisk tips and tricks

Howto use Asterisk for incoming faxes


With a ISDN CAPI4Linux card

If you have an ISDN card supporting CAPI, there is a driver that connects the Hylafax fax server directly to an Asterisk ISDN connection.

With a Digium card

If you have a Digium card you can send it down that, just put the following in your extensions.conf
exten => fax,1,Dial(Zap/5)

If we get a fax, send it out on zap/5 which is an FXS off a TDM400P card - the FXS connected
to your fax machine.

This way all our inbound numbers are both voice and fax, simple and works...

However, this might not work reliable nowadays. I have noticed it in person and also Digium is making clear their boards should not be used for faxes:
http://www.digium.com/index.php?menu=product_detail&category=hardware&product=TDM400P&tab=suppor Read the bottom part of it.

Fax Detection with IAX and SIP

If you are trying to detect faxes over IAX, SIP, or for that matter any type of channels, Newman has created NVFaxDetect and updated BackgroundDetect as NVBackgroundDetect for that purpose. We have had near perfect results on decent IAX connections using ULAW/ALAW. Fax detection utilizes Asterisk DSP and works in the same way — once detected, faxes are sent to the fax extension. See Asterisk fax for example fax detection scripts.

Making Outlook Work With Mime-Construct


We used Thunderbird when testing the email (copied from http://scottstuff.net/scott/archives/cat_asterisk.html), and the attached pdf files worked very well. However, when we went "live", some people complained that the attachments in outlook were named <<subject>>.dat instead (for example) of 123456.pdf

Having looked into the mime-construct script, we noticed a subtle difference between working Outlook attachments and Thunderbird. The differences are shown below :

left is the original mime-construct, right is our modified version

< $part_header .= "Content-Disposition: attachment; filename="
> $part_header .= "Content-Disposition: inline; filename="

< $p .= cont "Content-Type: $type\n"
> $p .= cont "Content-Type: $type;\n name=" . token_quote($arg) . "\n"

Outlook now names the attachment correctly, and Thunderbird also seems to work just as well with the changes.

Update — If the above changes do not fix your mime-construct file, verify the version by going to the unix cli (use keyboard or PuTTY) and type "mime-construct --version". I found that even if I updated the script above, It made it to where the attachment wouldn't come through at all. I checked my version and I had v1.8. I searched and found that there was a slightly newer version 1.9, so I tried it and it seemed to solve my problems.

Procedure:
1. Goto /usr/bin/
2. Rename "mime-construct" to "mime-construct.old"
3. Copy the 1.9 code from http://search.cpan.org/src/ROSCH/mime-construct-1.9/mime-construct
4. Re-create mime-construct and paste the code. Be sure not to get the comments at the bottom, stop before _END_
5. "chmod 555 mime-construct"

Now my faxes were attached to my e-mails


Back to Asterisk tips and tricks
Created by: oej, Last modification: Wed 29 of Aug, 2007 (03:20 UTC) by justin_newman
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+