[Asterisk-Users] Looking for comments on robustness of SpanDSP / app-rxfax / mime-construct

Boris Bakchiev boris at jildent.com.au
Tue Apr 12 17:12:03 MST 2005


Hi,

SpanDSP works great for me, even over SIP.
I did change the fax macro a bit to make it work better.
The macro records total number of faxes and pages received by the
extension.

Here is the example of 7644 fax extension.

1. Have this in your dialplan
	exten => _7644,1,Macro(faxreceive)

2. Here is my macro-faxreceive
[macro-faxreceive]
exten => s,1,SetVar(SavedDATETIME=${DATETIME:4:4}-${DATETIME:2:2})
exten =>
s,n,DBGet(ReceivedFaxes=Features/${EXTEN}/${SavedDATETIME}/Faxes)
exten => s,n,SetVar(SavedCALLERID=${CALLERIDNUM})
exten => s,n,DBGet(TotalPages=Features/${EXTEN}/${SavedDATETIME}/Pages)
exten => s,n,SetVar(FAXFILE=/var/spool/asterisk/fax/in/${UNIQUEID}.tif)
exten => s,n,DBGet(EMAILADDR=Features/${EXTEN}/Email)
exten => s,n,NoOp
exten => s,n,DBGet(LOCALSTATIONID=Features/${EXTEN}/CSID)
exten => s,n,rxfax(${FAXFILE})
exten => s,n,SetVar(SavedREMOTESTATIONID=${REMOTESTATIONID})
exten => s,n,GotoIf($["${FAXPAGES}" >= "1"]?12:17)
exten => s,n,Math(ReceivedFaxes,${ReceivedFaxes}+1)
exten => s,n,Math(TotalPages,${TotalPages}+${FAXPAGES})
exten =>
s,n,DBput(Features/${EXTEN}/${SavedDATETIME}/Faxes=${ReceivedFaxes})
exten =>
s,n,DBput(Features/${EXTEN}/${SavedDATETIME}/Pages=${TotalPages})
exten => s,n,system(/etc/asterisk/batch/sendfax "${FAXFILE}"
"${EMAILADDR}" "${EXTEN}" "${FAXPAGES}" "${SavedCALLERID}"
exten => s,n,NoOp
exten => s,103,SetVar(ReceivedFaxes=0)
exten => s,104,Goto(3)
exten => s,105,SetVar(TotalPages=0)
exten => s,106,Goto(5)
exten => s,107,SetVar(EMAILADDR=boris at jildent.com.au)
exten => s,108,Goto(8)
exten => s,109,SetVar(LOCALSTATIONID=${EXTEN})
exten => s,110,Goto(9)

3. Here is my sendfax script
#!/bin/sh
FAXFILE=$1
EMAILADDRESS=$2
RECIPIENT=$3
PAGES=$4
SENDER=$5
CSID=$6
DATES=`date '+%A, %e %B, %Y, %H:%M:%S'`
DATEF=`date +%d%m%Y-%H%M`

[ -z "$FAXFILE" ] || [ -z "$EMAILADDRESS" ] || [ -z "$RECIPIENT" ] &&
exit 0
[ -z "$SENDER" ] && [ -z "$CSID" ] && SENDER=Unknown
[ -z "$SENDER" ] && SENDER="$CSID"
[ -f "$FAXFILE" ] || exit 0

mkdir -p "/var/spool/asterisk/fax/in/$RECIPIENT"

tiff2pdf -z -p A4 -f -c "Virtual Fax" -t "Fax from \"$SENDER\" on
$DATES" -s "Fax from \"$SENDER\" on $DATES" -k "\"$
/etc/asterisk/batch/mime-construct --to "$EMAILADDRESS" --subject "Fax
received on $DATES"  --string "You have received $PAGE
mv $FAXFILE "/var/spool/asterisk/fax/in/$RECIPIENT/$DATEF.tif"


This might not be efficent asterisk programming, but it works well.
I did modify mime-construct to send attachments propertly to Outlook.

If Asterisk guru's could improve it, please do so.

regards

 
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
> bounces at lists.digium.com] On Behalf Of Colin Anderson
> Sent: Wednesday, 13 April 2005 05:57
> To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
> Subject: [Asterisk-Users] Looking for comments on robustness of
SpanDSP /
> app-rxfax / mime-construct
> 
> I've been testing spandsp with mime-construct on 1.0 - stable with the
> inbound fax number being routed as a DID on a PRI. While I have it
> working,
> and it emails me a PDF fine most of the time, I've noticed some issues
on
> receive:
> 
> 1. It's a little bitchy on long faxes from analog machines; it just
seems
> to
> rx and rx and rx forever and never finish. Using a Class 1 USR
faxmodem
> with
> our fax software (Zetafax) it works 100%; only sometimes is it a
problem
> with a "plain old fax" that's long. Not using a Canon fax, it's a
Ricoh G4
> 33.6.
> 
> 2. Sometimes I watch it spool the inbound file then hang up the Zap
> channel
> and mime-construct doesn't kick in, like it's bailing out of the
dialplan.
> So, the fax comes in ok, but mime-construct never gets around to doing
> it's
> thing. This was really a problem when I had the Asterisk server
pointing
> to
> a slow DNS server since I'm relaying the PDF's to an outside SMTP
server.
> Changing the DNS server to a local DNS server help greatly, but still,
> sometimes the PDF never gets mailed.
> 
> I am using the ext-fax context provided in the latest AMP. I haven't
> changed
> anything in that context from the stock install.
> 
> My questions:
> 
> 1. Any comments on faxrecieve macro robustness in general?
> 2. Are there any recommended ways to set this up on a PRI beyond what
I've
> done?
> 3. Problem (2) I have above seems to be a timing problem in the
dialplan -
> would a Wait() or two help any?
> 
> tia
> _______________________________________________
> Asterisk-Users mailing list
> Asterisk-Users at lists.digium.com
> http://lists.digium.com/mailman/listinfo/asterisk-users
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users


This message (and any associated files) is intended only for the use of the individual or entity to which it is addressed and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the intended recipient you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Messages sent to and from us may be monitored... 

Internet communications cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. Therefore, we do not accept responsibility for any errors or omissions that are present in this message, or any attachment, that have arisen as a result of e-mail transmission. If verification is required, please request a hard-copy version. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.





More information about the asterisk-users mailing list