[incoming]
exten => fax,1,NoOp(-------------------Call from ${CALLERID(number)} to ${EXTEN}------------------)
exten => fax,n,Goto(fax-rx,receive,1)
[fax-rx]
exten => receive,1,NoOP(------------------- FAX from ${CALLERID(number)} ------------------)
exten => receive,n,Answer()
exten => receive,n,Set(FILENAME=fax-${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CALLERID(number)})
exten => receive,n,Set(FAXFILE=/var/spool/asterisk/fax/receive/${FILENAME}.tif)
exten => receive,n,Set(FAXOPT(headerinfo)=Received by ${CALLERID(number)} ${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M)})
exten => receive,n,Set(FAXOPT(localstationid)=OFFICE)
exten => receive,n,Set(FAXOPT(maxrate)=14400)
exten => receive,n,Set(FAXOPT(minrate)=2400)
exten => receive,n,NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)})
exten => receive,n,NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)})
exten => receive,n,NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)})
exten => receive,n,NoOp(FAXOPT(maxrate) : ${FAXOPT(maxrate)})
exten => receive,n,NoOp(FAXOPT(minrate) : ${FAXOPT(minrate)})
exten => receive,n,NoOp(**** RECEIVING FAX : ${FAXFILE} ****)
exten => receive,n,ReceiveFAX(${FAXFILE})
exten => receive,n,Hangup()
exten => h,1,NoOP(------------------- FAX from ${CALLERID(number)} ------------------)
exten => h,n,NoOP(------------------- STATUS ${FAXSTATUS} ${FAXERROR} ------------------)
exten => h,n,system(/var/lib/asterisk/agi-bin/fax/fax-process.pl --to
fax@asterisk.org --from
asterisk@asterisk.org --subject "Fax prineat s ${URIENCODE(${CALLERID(number)})} ${URIENCODE(${CALLERID(name)})}" --attachment ${FILENAME}.pdf --type application/pdf --file ${FAXFILE});
<a href="
http://asterisk-system.ru/wp-content/up ... pl">Скрипт для конвертации полученного факса и отправки на почту</a>
После отправки факса запускается перловый скрипт “sendfax_success.pl”, который отправляет на почту информацию о статусе отправки, и перемещает отправленные файлы в другую директорию. В принципе сам скрипт как пример(выставляю по просьбе трудящихся), можете переделать под ваши задачи.
#!/usr/bin/perl
#
#
#
# Developed by 2012 Mihail Belobrov
#
# Скрипт подтверждения успешной отправки факса
#
use strict;
use warnings;
use Net::SMTP;
my $response = $ARGV[0];
my $done_dir = "/var/spool/asterisk/fax/send/done";
my $queue_dir = "/var/spool/asterisk/fax/send/queue";
my $from_mail;
#парсим нужные данные
chomp($response);
my $filename = $1 if ($response =~ /\/var\/spool\/asterisk\/fax.+(sendto.+\.tif)/);
my $phone = $1 if ($response =~ /\/var\/spool\/asterisk\/fax.+sendto_(\d+)_.+\.tif/);
my $faxname = $1 if ($response =~ /\/var\/spool\/asterisk\/fax.+sendto_\d+_(.+\.tif)/);
my $file_without = $1 if ($response =~ /\/var\/spool\/asterisk\/fax.+(sendto_\d+_.+)\.tif/);
sleep(3);
#Перемещаем успешно, переданные факсы в папку done
system("/bin/mv $response $done_dir");
#Выбираем дополнительные данные
my $mail_user_to = 'fax1\@yourdomain.com';
my $mail_user_from = 'asterisk\@yuordomain.com';
my $mail_server = 'mail.yourdomain.com';
my $mail_user = 'fax1\@yourdomain.com';
my $subj = 'Fax otrpavlen';
my $Body='Факс '.$faxname.' на номер '.$phone.' отправлен успешно!';
my $smtp = Net::SMTP->new($mail_server);
$smtp->mail($ENV{USER});
$smtp->to($mail_user);
$smtp->data();
$smtp->datasend("To: $mail_user_to\n");
$smtp->datasend("From: $mail_user_from\n");
$smtp->datasend("Subject: $subj\n");
$smtp->datasend("\n");
$smtp->datasend("$Body\n");
$smtp->dataend();
$smtp->quit;
=============================================================