[asterisk-users] FAX Options

Mark Scholten mark at streamservice.nl
Mon Aug 2 18:26:26 CDT 2010



> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Alejandro Imass
> Sent: Monday, August 02, 2010 9:00 PM
> To: Asterisk Users Mailing List - Non-Commercial Discussion
> Subject: [asterisk-users] FAX Options
> 
> Hi,
> 
> Is FAXing with Asterisk a practical option ? Or is it better just to
> use a plain fax connected to an FXS and just switch with Asterisk. I
> specifically wanted to know if there was any experience using just the
> fax scanner to send faxes and receive them via asterisk and the to
> e-mail. My idea was to take my old fax connect it to an FXS port and
> send faxes with the fax machine (using the fax mainly as a scanner),
> but receive them through our existing FXO jack that is connected to
> the PSTN. the scheme would be something like:
> 
> PSTN <------> FXO -----
>                                       |
>                                       |------------Asterisk
>                                       |
> FAX ------> FXS ---------
> 
> I'm using Asterisk 1.4.26.2 on FreeBSD 8.0

Here we have the following setup, could you say if that is acceptable for
you?
Outgoing fax:
Fax -> Linksys pap2t (sip, no t38, for settings see
http://www.provu.co.uk/pdf/sipura/ip_faxing_sipura_linksys.pdf) -> asterisk
-> sip trunk provider (this could also be some sip -> pstn solution I guess)
Incoming fax:
Sip trunk provider -> asterisk -> email

For the incoming fax I use a separate context, below I've listed an example:
exten => 1000,1,Answer
exten =>
1000,2,Set(FAXFILE=/var/spool/asterisk/fax/${CALLERID(num)}_${EPOCH}_client.
tif)
exten => 1000,3,Set(CLID=${CALLERID(num)})
exten => 1000,4,Set(EMAIL=email address)
exten => 1000,5,Set(TRADENAME=tradename (used in the email))
exten => 1000,6,Wait(3)
exten => 1000,7,ReceiveFax(${FAXFILE})
exten => 1000,8,Hangup

exten => h,1,System(/usr/bin/php /etc/scripts/fax2mail.php ${FAXFILE}
${CLID} ${EMAIL} ${TRADENAME})

fax2mail.php (tiff2pdf and phpmailer are required):
<?php
        $faxfile = $_SERVER["argv"][1];
        $callerid = $_SERVER["argv"][2];
        $email = $_SERVER["argv"][3];

        shell_exec("/usr/bin/tiff2pdf
-o/var/spool/asterisk/fax/".$callerid.".pdf ".$faxfile);
        $bijlage = "/var/spool/asterisk/fax/".$callerid.".pdf";
        switch ( $_SERVER["argv"][4]  ) {
                case "trade": $tradename = 'our trademark';  $from =
'fax at domain.tld';    $fromname = $tradename.' - Fax system';  break;
                default:      $tradename = 'our trademark';  $from =
'fax at domain.tld';    $fromname = $tradename.' - Fax system';  break;
        }
        require("/etc/scripts/class.phpmailer.php");

        $mail = new PHPMailer();
        //      $mail->IsMail(); // telling the class to use Mail functie
van PHP
        $mail->IsSMTP();  // telling the class to use SMTP
        $mail->Host     = ""; // SMTP server
        $mail->SMTPAuth = true;     // turn on SMTP authentication
        $mail->Username = "";  // SMTP username
        $mail->Password = ""; // SMTP password

        $mail->From     = $from;
        $mail->AddAddress($email);
        $mail->FromName = $fromname;
        $mail->AddAttachment($bijlage);
        $mail->Subject = "Received fax from ".$callerid;

        $mail->AddReplyTo = $email;

        $mail->IsHTML(false);
        $mail->Body = "email body";

        $mail->Send();

        //shell_exec("/bin/rm /var/spool/asterisk/fax/".$callerid.".pdf
".$faxfile);

?>

I agree that it isn't a beautiful solution, however it works. Sending a fax
directly with asterisk is probably also possible (I didn't test it).

Asterisk version: 1.6.2.6 (yes I know that I should update)

Regards, Mark

> 
> TIA,
> Alejandro Imass
> 
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>                http://www.asterisk.org/hello
> 
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users




More information about the asterisk-users mailing list