[asterisk-users] FAX 2 mail configuration
Tiago Geada
tiago.geada at gmail.com
Mon Apr 5 06:55:19 CDT 2010
Hi João.
We made up a script that sends received faxes trough a smtp server as an
attachment.
the FAX.ael
context FAX
{
s => {
Answer();
Set(TIMEOUT(absolute)=600); // 10 min
Wait(3);
if("${CALLERID(num)}"="") { //
Set(Number=withhold); // If number
is private
} //
else {
Set(Number=${CALLERID(num)}); // If number
is NOT private
}
Set(recordFile=${UNIQUEID}_${Number}.tiff);
// Record file to RAM first,
Set(recordPath=/var/log/asterisk/fax/${CALLERID(dnid)}/${STRFTIME(${EPOCH},GMT+0,%F)});
// then run /usr/local/bin/mailfax $1 $2
ReceiveFax(/ramdrive/${recordFile});
Wait(5);
Hangup();
};
h => {
System(/usr/local/bin/faxmail "${recordPath}"
"${recordFile}");
};
}
and the script @ /usr/local/bin/faxmail has got something like:
#!/bin/sh
PATH=/usr/sbin:/sbin:/bin:/usr/bin:/usr/local/bin
if [ -d "$1" ]; then
mv "/ramdrive/$2" "$1";
chmod a+rx "$1/$2";
else
mkdir -p "$1";
mv "/ramdrive/$2" "$1";
chmod a+rx "$1/$2";
fi
#chmod a+rx "/ramdrive/$2";
{
(
sleep 1
echo "ehlo tretas.eu"
sleep 1
echo "AUTH LOGIN"
sleep 0
echo -n "asterisk at tretas.eu"|base64
sleep 0
echo -n "tretas"|base64
echo "MAIL FROM: <asterisk at tretas.eu>"
sleep 0
echo "RCPT TO: <tiago.geada at gmail.com>"
echo "RCPT TO: <fax at tretas.eu>"
sleep 1
echo "data"
echo "Subject: FAX $2"
echo "FROM: <asterisk at tretas.eu>"
echo "TO: <fax at tretas.eu>"
sleep 1
echo 'Content-Type: multipart/mixed; boundary=Y3VzY28udHJldGFzLmV1'
echo ""
echo "--Y3VzY28udHJldGFzLmV1"
echo 'Content-Type: multipart/alternative;
boundary="Y3VzY28udHJldGFzLmV2"'
echo ""
echo "--Y3VzY28udHJldGFzLmV2"
echo 'Content-Type: text/plain; charset="ISO-8859-1"'
echo ""
echo "Fax em $(date)"
echo "$1/$2"
echo ""
echo "--Y3VzY28udHJldGFzLmV2"
echo 'Content-Type: text/html; charset="ISO-8859-1"'
echo ""
echo "Fax em $(date)<br>$1/$2"
echo ""
echo "--Y3VzY28udHJldGFzLmV2--"
echo "--Y3VzY28udHJldGFzLmV1"
echo 'Content-Type: image/tiff; name="fax.tiff"'
echo 'Content-Disposition: attachment; filename="fax.tiff"'
echo "Content-Transfer-Encoding: base64"
echo "X-Attachment-Id: 0.1"
echo ""
sleep 1;
cat "$1/$2"|base64
sleep 1;
echo "--Y3VzY28udHJldGFzLmV1--"
echo "."
# echo "quit"
) | telnet smtp.tretas.eu 25
}
Boa sorte!
On 30 March 2010 16:29, Joao Gomes Pereira <gomespereira at startel.pt> wrote:
> Hello
> Im trying to configure Fax2Mail in my Asterisk 1.4.23.1 server, wich
> receievs the Faxes through a SIP trunk.
> I found a lot of solutions in voip-info.org
> So, I would like to know what's the best free Fax2Mail solution and if I
> really need to install Dahdi or Zaptel.
> Thanks
> Regards
> Joao Pereira
>
> --
> StarTel - A Rede Livre
> Joao Gomes Pereira
> www.startel.pt
> +351 304500650
> sip: gomespereira at startel.pt
>
>
> --
> _____________________________________________________________________
> -- 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100405/f3aa3374/attachment.htm
More information about the asterisk-users
mailing list