FOOD FOR THOUGHT Would like to implement email to fax

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
772
Reaction score
124
My PBX:

PIAF Installed Version = 2.0.6.5 under *HARDWARE* │
│ FreePBX Version = 2.11.0.38 │
│ Running Asterisk Version = 11.10.0 │
│ Asterisk Source Version = 11.10.0 │
│ Dahdi Source Version = 2.9.0 │
│ Libpri Source Version = 1.4.14 │
│ IP Address = 192.168.40.29 on eth0 │
│ Operating System = CentOS release 6.5 (Final) │
│ Kernel Version = 2.6.32-431.1.2.0.1.el6.x86_64 - 64 Bit │
│ Incredible Version = 11.10

I'd like to be able to email a pdf or group of pdf files (pdf ONLY) to an account and have them faxed out. I'd like the subject line to have the pertinent info (ie something like TO:"AndyB"; AT:"888123456") and sent to one of the accounts within my domains - like new account '[email protected]'.

The PBX should look for new email (it currently sends out its email to a gmail account, but I could easily use one of my domains now that they are 'free' since I host my own remove VPS driven mail server).

So, there are two (or more) issues - 1) mail server is remote and the PBX presently doesn't ever 'check for mail' and 2) I can't find anything in all my searching.

Is this possible? Has it been done?

Would love to get this working - I have a friend who always needs me to fax for him - now he would just send an email and owe me half a penny for the flowroute charges <g>.

Andrew
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,534
Reaction score
727
I have done this for a few complex systems. For the single mailbox, relatively simple scenario you are talking about you can probably do this with some shell scripts and linux tools like fetchmail (get the mail from your mail server to PBX) and munpack (decode and save attachments). You can write a little custom dialplan in extensions_custom.conf and then trigger the fax send with a .call file.

Would love to get this working - I have a friend who always needs me to fax for him - now he would just send an email and owe me half a penny for the flowroute charges <g>.

Does he really fax that much? You can send five three-page faxes per day using faxzero.com.
 

DoctorJ

Member
Joined
Jul 14, 2015
Messages
80
Reaction score
18
I second the request, and I admit that I do not have the technical know-how. This could be a massive time saver for my office.

My plan would be to have multiple google drive folders where PDF's get saved. Using Zapier (or maybe IFTTT), these folders would be routinely parsed, and the PDF's emailed (and thus "faxed") to certain numbers based on the google drive folder in which they were placed. How would this improve things? Well, I can set up a google form, enter a few key pieces of information, generate a PDF from that information, save to a specified folder, and then have that form automatically faxed. The only thing I would have to do is enter the information into the form. Everything else would then happen automagically. Much easier than me printing / finding a form, filling it out, then giving it to my staff to fax when they have time, and then having them file the form after...

Just a thought...

Was going to set this up with a commercial fax service, such as efax, myfax, etc. But if I could use my already perfectly working avantfax instance, well, all the better...
 

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
772
Reaction score
124
It's not the only use, and his faxes tend to be support docs that run 15-20 pages.
While I can fax while away from home by connecting via OpenVPN, I can't use the print driver to print to fax either (the driver/server seems to use random and varying ports for communication).

This isn't life or death, but seems like it should be reasonably easy to do since sendmail is already installed and I know that one can send a fax via the command line using 'sendfax ....'Un

Conceptually, the script would

1. Look at emails received, 1 by 1 since some point (10 minutes before last check time)
2. Look at Subject Line to see if it starts with !FAX!
3. If it does, parse the subject line and fill in a text string for the coverpage/fax using the sendfax parameters
4. Send the Fax or Faxes (not sure if sendfax allows multiple files in one shot)
5 Send email to deleted folder/kill
6 Rinse and repeat until all emails are accounted for in period

Unfortunately, I can't script worth a d*mn <g>, so the 5 step loop above is outside of my pay grade.

Since this is personal use, the script doesn't really need to be industrial grade (ie test for email confirmation prior to deleting the email)



Andrew
 

AndyInNYC

Active Member
Joined
May 23, 2013
Messages
772
Reaction score
124
DoctorJ,

You know that you can print directly from Windows to a 'print driver' which will ask for a fax number and send the fax out, don't you?

If you have the file already within your world, just open it and click 'Print'.

Or else I have Friday-itis and missed part of your issue.

Andrew
 

DoctorJ

Member
Joined
Jul 14, 2015
Messages
80
Reaction score
18
Andy,

Thanks for the reply. Well, we're completely Mac-based, but that is really neither here nor there. The idea is to completely remove the human component of having to open a document and then print / fax it. The office staff is already very adept at simply using the avantfax web interface. I'm trying to automate as much as possible. Basically, anything that has a simple set of instructions (and thus a computer can carry out), I don't want my staff doing. Cuts down on staff and overhead, and allows my staff to do more productive / interesting work.

Any thoughts on how I can get IncrediblePBX to see my patients and write my notes? That would truly be incredible! Ward?
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
If you have Hylafax(+) presumable Intellifax inmcluded, you should read

http://hylafax.sourceforge.net/howto/faxing.php

In there is a script (mail2sendfax) that uses an email 'alias' to pipe the inbound email to a filter that strips out the 'important bits' and the mime content which is tiffified and send to snedfax. Go the postfix valias route and you are sweet, and it's hard to believe that a few dozen lines of bash manipulkating an email are not 'prior art'

( been doing it for years with both t3bmodem and iaxmodem either through asterisk configured as a pass-through or bypassing Asterisk in both directions. Unless you have the patience of Job, don't try the t38modem bit on RH based OS's , a good VSP can do T30 (iaxmodem) better than 95% though, and hylafax picks up the broken/partial faxes with great aplomb)
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Intel's old Net SatisFAXtion boards used this technology more than 25 years ago so I'm having a hard time believing there is a patent issue with the process. We used it in the federal courts long before today's Internet and email solutions existed.
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Also worth noting that Xerox developed much more sophisticated products using glyph technology in the early 1990's that we used extensively to circulate judicial opinions in house. It allowed us to scan a glyph image (fancy QRcodes) into a Xerox copier which would then retrieve a stored document and send it via fax or a proprietary protocol to another fax device or Xerox copier. The patent is long since expired for that technology, too.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
So it's a lazy Sunday afternoon , so maybe we are not Faced with a big problem (that's for the old farts) but the quoted patent states quite definitely

ABSTRACT
A facsimile/email communication system and method providing a user the ability to send emails from any standalone facsimile machine and providing a user the ability to logon to a centralized web server and send facsimiles to any standalone fax machine.

I would have to ask WTF does that have to do with sending an email to an email address that delivers the content of that email (text, mime or whaever) to a virtual or physical FAX machine anywhere in the world. there is no centralized web anything here to worry about. Email is hardly "Centralized"
 
Last edited:

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,534
Reaction score
727
Just curious what you all are using for sending faxes from Asterisk right now. I put together a script for fetchmail-to-fax that uses Asterisk's built-in SendFax (app_fax with spandsp). If you're using Hylafax or something else then let me know how it works (preferably from a dialplan / command line perspective).
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,534
Reaction score
727
Just curious what you all are using for sending faxes from Asterisk right now. I put together a script for fetchmail-to-fax that uses Asterisk's built-in SendFax (app_fax with spandsp). If you're using Hylafax or something else then let me know how it works (preferably from a dialplan / command line perspective).

I read up on Hylafax including the link posted by dicko. Looks like I can pipe my script to the hylafax CLI.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
Briefly It only takes a few mods, I have

virtual_alias_maps = regexp:/etc/postfix/valias

in /etc/postfix/main.cf

/^(\+1|1)?[2-9][0-9]{2}[2-9][0-9]{2}[0-9]{4}@your.domain.com$/ mail2fax@localhost

in /etc/postfix/valias

and

mail2fax: |/usr/bin/mail2fax.sh

in /etc/aliases

(postmap the valias file and newaliases after these changes ;-) )

and mail2fax is somewhat modified mail2fax.sh

the regex will accept only NANP numbers formatted as
NXXNXXXXXX
1NXXNXXXXXX
+1NXXNXXXXXX
this for my/your protection against faxpammers but can be easily changed for other locales.

If you use avantfax then a sprinkling of mysql queries into the avantfax database inside the mail2fax script will add some 'singing and dancing' if you want it to.
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,534
Reaction score
727
Does the mail2fax convert attachments or just fax the mail body? I wasn’t sure.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
No the script extracts ALL mime content as seperate entities, Hylafax can handle by default text, pdf, ps and tiff but you can use headless openoffice(libreoffice) with your modified typerules file to handle most m$stuff that aren't too complicated docx/doc usually work, complicated spreadsheets get a little mangled.

I find it best to convert to ps and let hylafax/ghostscript do the tiff thing

I would definitely

man faxmail
man sendfax
man typerules

to "get it"
 
Last edited:

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,534
Reaction score
727
@AndyInNYC if you are using Hylafax then follow dicko's suggestion... looks like the built in scripts do all the heavy lifting for you.

The script I wrote is really most useful when interfacing directly with Asterisk fax. It gets the mail, parses out the attachments, finds PDFs and converts them to fax-appropriate TIFF. In other words I spent too much time reinventing the Hylafax wheel and I don't even really use fax. :)
 

billsimon

Well-Known Member
Joined
Jan 2, 2011
Messages
1,534
Reaction score
727
Puzzles me why Avantfax only works with Hylafax and doesn't do direct integration with Asterisk's own fax modules. Hylafax is spandsp... res_fax_spandsp is spandsp (obviously)... seems like a place to cut out some moving parts and simplify.
 

dicko

Still learning but earning
Joined
Oct 30, 2015
Messages
1,607
Reaction score
826
That would be because the engine behind Avantfax is hylafax and hylafax talks to "modems" i.e. /dev/tty(something), both iaxmodem and t38modem look like tty devices to hylafax but iax2/sip extensions to Astersk, both use spandsp, not so much res_fax_spandsp which provides only an interface to the asterisk dialplan but not to tty.

Actually, I find to "cut out some moving parts" I would use t38modems and cut out FreePBX and Asterisk and have t38modem intermediate between the internet for your fax DID's inbpound and outbound traffic and the localnet (can't be done with iaxmodem) , you could then route inbound or outbound calls as appropriate to your t38 aware Asterisk endpoints with the t38modem routing rules.
 

Members online

No members online now.

Forum statistics

Threads
25,781
Messages
167,507
Members
19,201
Latest member
troutpocket
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top