Automatic printing of faxes

Discussion in 'General' started by vtofa, Mar 18, 2009.

  1. vtofa

    Joined:
    Oct 21, 2008
    Messages:
    67
    Likes Received:
    0
    We need to automatically print incoming faxes, in addition to getting them via email. How would we accomplish that?
    Thanks
     
  2. dicko

    Joined:
    Oct 24, 2008
    Messages:
    4,099
    Likes Received:
    0
    This is often done with hylafax in /var/spool/hylafax/bin/notify

    Avantfax (search these boards) makes it easier by associating each modem with a "printer"
     
  3. vtofa

    Joined:
    Oct 21, 2008
    Messages:
    67
    Likes Received:
    0
    For the record, I added a line to /var/spool/hylafax/bin/faxrcvd right after line 48 (this is elastix 1.3):

    Code:
    48 exec("sudo chmod -R 755 $faxes_path");
    49 exec("/usr/bin/lpr -o fitplot < $pdffile");
    
    In "normal" HylaFax the PRINTER is assigned in etc/FaxDispatch but I noticed the Elastix provided bin/faxrcvd does not source the FaxDispatch file. Hopefully this will be resolved in future versions of Elastix.
     
  4. tolengo

    Joined:
    Oct 31, 2008
    Messages:
    117
    Likes Received:
    0
    I am interested too !! :) i was thinking about this long time ago but never i realized it.

    fax to printer fantastic!!

    thank for your suggestions

    Johnny
     
  5. jaminmc

    Joined:
    Nov 24, 2010
    Messages:
    3
    Likes Received:
    0
    Woohoo!!! Still works in Elastix 2.2!!!!!

    This:
    Code:
    48 exec("sudo chmod -R 755 $faxes_path");
    49 exec("/usr/bin/lpr -o fitplot < $pdffile");
     
  6. logdog

    Joined:
    Apr 10, 2009
    Messages:
    21
    Likes Received:
    0
    I'm sorry, I can not understand the lines between I want to paste the code:

    right?:

    Code:
    FATAL ERROR: $SPOOL/etc/setup.cache is missing!
    
    The file $SPOOL/etc/setup.cache is not present.  This
    probably means the machine has not been setup using the faxsetup(8C)
    command.  Read the documentation on setting up HylaFAX before you
    startup a server system.
    
    exec("sudo chmod -R 755 $faxes_path");
    exec("/usr/bin/lpr -o fitplot < $pdffile");
    
    EOF
        exit 1
    }
    
    
     
  7. fencepost

    Joined:
    Sep 7, 2012
    Messages:
    1
    Likes Received:
    0
    Since I just spent some time fiddling with this, here's basically what you need to do. Note: everything in this message refers to the files under /var/spool/hylafax/

    First, keep in mind that Elastix Is Not Regular Hylafax. If you look for information on doing this with Hylafax you'll find references to modifying the files 'bin/faxrcvd' or 'etc/FaxDispatch'. Neither of those files is used in Elastix (though FaxDispatch is still auto-updated when you add fax destinations), it instead uses 'bin/faxrcvd.php' to launch 'bin/faxrcvd-elastix.php', which queries the email address (previously obtained from FaxDispatch) from the database using the function obtener_mail_destiny.

    In doing this I modified 'bin/faxrcvd-elastix.php'. I've had problems in the past with this file being replaced with a "clean" copy when the server is updated, so SAVE YOUR WORK ELSEWHERE SO YOU CAN RESTORE IT AFTER UPGRADES. I've had to go through the process of re-creating, and while it's simpler the second time around, it's still annoying and possibly important things may be offline until you get things restored. Save yourself problems, document, and keep a couple of copies elsewhere.

    Now that I've given you the warnings, most things that you're going to want to do for working with the received fax files are going to go into 'bin/faxrcvd-elastix.php' right before section 3, "ENVIO EMAIL". At that point you have access to the TIFF file ($tiff_file, generally 'recvq/fax000000000.tif' with the numbers changing), the PDF file ($pdffile, note that the actual filename is always 'fax.pdf' - it's only the path to that file that changes), and the assorted inbound variables if you need to build your own filename that includes phone numbers, date/time stamps, etc.

    For printing, I'm simply taking the received .tif file, converting it to Postscript, and sending it to a printer via lpr (the printer is already installed with CUPS). The command I added right before the Email section is
    Code:
    exec("/usr/bin/tiff2ps -a $tiff_file | lpr -P MyPrintQueue");
    If you don't have a Postscript-capable printer, you'll need to do something else to generate your printable output. Here's (http://www.wizards-toolkit.org/discours ... =3&t=17361) a discussion of using ImageMagick to convert to PCL and some things to be aware of (probably now fixed), but details will depend on your needs.

    I have also used this location for a script that sends received faxes via FTP to another server, but if you do that you should carefully consider what will happen if the destination server is down or unreachable - unless you build some sort of queueing, FTP transfers will simply fail and not be retried, while printing hands off to a subsystem that will queue jobs for immediate or later delivery.
     
  8. Tola

    Joined:
    Jul 16, 2010
    Messages:
    77
    Likes Received:
    0
    This works in elastix 2.0 thx fencepost

    i dont have a PS printer so i used this command instead

    exec("/usr/bin/tiff2pdf -a $tiff_file | lpr -P CanonMF469");

    and it works

    Thank you
     

Share This Page