Post by Daniel - AsteriskHello everyone,
I'm trying to send a received fax with mutt, when I try it from the
Linux shel it works, but when trying with Asterisk's System command it
doesn't.
I'm using Asterisk 1.8.19.0 on Debian 6.0.6, Asterisk was installed by root.
Any hint will be appreciated.
Elder D. Arohuanca
Lima - Peru
--
Reading the responses to this thread I suspect the issue is that the
Muttrc file cannot be found, I am assuming the user:group Asterisk is
running as does not have a shell associated with it nor a home directory.
I am using OpenBSD and the above is true for my environment.
I have in my Asterisk Spool directory the folder structure
/var/spool/asterisk/fax/received. This folder is read-write for the
account Asterisk runs as.
On my system I set it up to use macros, one to receive the fax and
another to send the e-mail if one was received. The calling of the macro
to send the e-mail is performed in the Hangup extension.
I use extensions.ael on my system so here are the macros I set up;
macro fax-receive( fax-number, header-info, sender, recipient ) {
/*
${ARG1} is Receiving Station Fax Number
${ARG2} is Fax Header Information
${ARG3} is Fax Sender E-mail Address
${ARG4} is Fax Recipient E-mail Address
*/
NoOp(**** FAX RECEIVE ****);
Set(FAXOPT(localstationid)=${LOCAL(fax-number)});
Set(FAXOPT(headerinfo)=${LOCAL(header-info)});
Set(FROMADDR=${LOCAL(sender)});
Set(TOADDR=${LOCAL(recipient)});
NoOp(**** SETTING FAXOPT ****);
NoOp(FAXOPT(ecm) : ${FAXOPT(ecm)});
NoOp(FAXOPT(headerinfo) : ${FAXOPT(headerinfo)});
NoOp(FAXOPT(localstationid) : ${FAXOPT(localstationid)});
Set(RXSTART=${EPOCH});
Set(FAXRXPATH=/var/spool/asterisk/fax/received);
Set(FAXRXFILE=fax-${CALLERID(number)}-${UNIQUEID});
NoOp(**** RECEIVING FAX : ${FAXRXFILE} ****);
ReceiveFAX(${FAXRXPATH}/${FAXRXFILE}.tif,fd);
NoOp(**** Subroutine Return ****);
return;
};
macro email_rxfax() {
Set(CALLDURATION=$[(${EPOCH}-${RXSTART})]);
System(FAXRXFILE=${FAXRXFILE} FAXRXPATH=${FAXRXPATH}
FAXRXSTATUS="${FAXOPT(status)}" FAXERROR="${FAXOPT(statusstr)}"
FROMADDR="${FROMADDR}" TOADDR="${TOADDR}"
LOCALSTATIONID="${FAXOPT(localstationid)}"
REMOTESTATIONID="${REMOTESTATIONID}" FAX
PAGES=${FAXOPT(pages)} FAXBITRATE=${FAXOPT(rate)}
FAXRESOLUTION=${FAXOPT(resolution)} CIDNUMBER="${CALLERID(number)}" CIDNAME
="${CALLERID(name)}" CALLDURATION=${CALLDURATION}
/usr/local/sbin/afax2email);
NoOp(**** STATUS : ${SYSTEMSTATUS} ****);
NoOp(**** Subroutine Return ****);
return;
};
Note, the System() line in email_rxfax() is one long line before the NoOp().
Here is an example entry in extensions.ael;
context fax-pstn1 {
fax => {
NoOp(Fax Received ${STRFTIME(,,%F %T %z)});
&fax-receive(+61 8 9XXXXXXX,Your Business
Name,FaxMaster@<your.domain.name>,lmoore@<your.domain.name>);
};
h => {
if ( "X${FAXRXFILE}" != "X" )
{
&email_rxfax();
}
NoOp(Call/Fax Ended ${STRFTIME(,,%F %T %z)});
};
};
Here is a sample extensions.ael entry for an incioming fax.
context fax-pstn1 {
fax => {
NoOp(Fax Received ${STRFTIME(,,%F %T %z)});
&fax-receive(+61 8 9XXXXXXX,Your Business
Name,FaxMaster@<your.domain.name>,lmoore@<your.domain.name>);
};
h => {
if ( "X${FAXRXFILE}" != "X" )
{
&email_rxfax();
}
NoOp(Call/Fax Ended ${STRFTIME(,,%F %T %z)});
};
};
I created a Muttrc file in /etc/asterisk, I use msmtp for the mail
progam, sendmail works but I didn't like the Envelope-