Shamus,

I guess 1.8 works a little different then 1.4 in the way it handles a
disconnected channel.

I haven't messed with fax detection yet since I just have a dedicated DID
pointed to the receivefax application.

I do know that ReceiveFax and SendFax are currently available for 1.4,
since that's what I'm using. I think they replaced the prior applications
and standardized them across all version trees. I read something about how
you can set something in the faxing config file to support the prior
applications if necessary.

Good point about the possible CID security tisk - I didn't think about
that. I actually provide some sanity checking already, but I should
probably tweak it to look for possible attacks. All incoming calls go
through a private/restricted/unknown/invalid/etc. check. If it comes up as
anything other then a seemingly legit number, it sends it to a call
screening application. This part:
exten = s,n,GotoIf($[${REGEX("^[+]?[0-9]{3\,}$" ${CALLERID(num)})} !=
1]?unknown)
would catch a lot (anything that doesn't start with at least a three digit
number), but I guess someone could possibly get around it if they knew what
they were doing.

-James

On Fri, Feb 17, 2012 at 9:37 AM, Shamus Rask <[email protected]> wrote:

> James,
>
> I'm running Asterisk 1.8.x. When I was running Asterisk 1.4, I used
> NVFaxDetect() in my incoming context as this was the only way I could get
> it to detect a fax on a SIP trunk. Then, I passed it to a separate server
> running Ubuntu with the following:
>
>> exten => fax,1,Dial(IAX2/iaxmodem)
>> exten => fax,1,Hangup
>
>
> I'm not sure if ReceiveFax works in 1.4?
>
>
> Separately, I've made one additional change to my dialplan based on a
> potential security flaw that Lonnie kindly pointed out. Since I am calling
> System() and was echoing the callerID, there was a potential for "mischief"
> if someone changed their CID to something nasty. By using the Filter()
> command, I'm limiting what characters will be echoed.
>
> exten => fax,1,Verbose(3,Incoming fax)
>>   same => n,Set(FAXDEST=/tmp)
>>   same => n,Set(tempfax=${STRFTIME(,,%C%y%m%d%H%M)})
>>   same => n,ReceiveFax(${FAXDEST}/${tempfax}.tif)
>>   same => n,Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
>>   same =>
>> n,Set(fromfax=${FILTER(0-9a-zA-Z\x20\x2c\x2d,${CALLERID(all)})})  ; only
>> allow alpha-numeric characters and space, comma, hyphen -- reduces security
>> risk
>>
>>   same => n,System(tiff2pdf -j -o ${FAXDEST}/${tempfax}.pdf
>> ${FAXDEST}/${tempfax}.tif)
>>   same => n,System(echo -e "To: [email protected]\nSubject: FAX from
>> ${fromfax}" | mime-pack "new fax" "${FAXDEST}/${tempfax}.pdf"
>> "application/pdf" | sendmail -t)
>>
>>   same => n,system(rm ${FAXDEST}/${tempfax}.*)
>>   same => n,Hangup
>>
>
> cheers,
>   Shamus
>
>
>
> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Fri, 17 Feb 2012 00:39:52 -0500
>> From: James Babiak <[email protected]>
>>
>> Subject: Re: [Astlinux-users] fax - command to e-mail attachment
>> To: [email protected]
>> Message-ID: <[email protected]>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> I decided to play around with faxing (since we can use the digium
>> binaries now), and was surprised at how well it's working. I'm using
>> Asterisk 1.4 too.
>>
>> Everything worked great except for one thing.
>>
>> I tried your example for fax to email, but it doesn't seem to work as
>> written for me. It would never get past the ReceiveFax application in
>> the dialplan since the call was disconnected at this point, and it
>> immediately killed the channel. The only way I was able to get it to
>> continue with the dialplan was to use the "h" extension for everything
>> from the Verbose line on. IE:
>> /
>> [fax-in]
>> exten => s,1,Verbose(3,Incoming fax)
>> exten => s,n,Set(FAXDEST=/tftpboot/faxes)
>> exten => s,n,Set(tempfax=${STRFTIME(,,%C%y%m%d%H%M)})
>> exten => s,n,Set(FAXOPT(ecm)=yes)
>> exten => s,n,Set(FAXOPT(headerinfo)=ASTERISK)
>> exten => s,n,Set(FAXOPT(maxrate=14400)
>> exten => s,n,Set(FAXOPT(minrate=2400)
>> exten => s,n,ReceiveFax(${FAXDEST}/${tempfax}.tif,d)
>>
>> exten => h,1,Verbose(3,- Fax receipt completed with status: ${FAXSTATUS})
>> exten => h,n,System(tiff2pdf -j -o ${FAXDEST}/${tempfax}.pdf
>> ${FAXDEST}/${tempfax}.tif)
>> exten => h,n,System(echo -e "To: [email protected]\nSubject: FAX from
>> ${CALLERID(all)}" | mime-pack "new fax" "${FAXDEST}/${tempfax}.pdf"
>> "application/pdf" | sendmail -t)
>> exten => h,n,System(rm ${FAXDEST}/${tempfax}.tif)
>> exten => h,n,Return()/
>>
>>
>> The above worked, but nothing else would.
>>
>> I'm curious how you were able to get it to continue with the dialplan
>> after the channel was hung up while staying in the same extension. Am I
>> missing something?
>>
>> This is actually the first I've really messed with Asterisk and
>> sending/receiving faxes directly through it. Pretty neat. I just put
>> together a 'faxback' script to receive a fax and then automatically fax
>> it back to the originating caller-id. Useful for testing purposes.
>> Apparently 1.4 doesn't support the "Originate" dialplan application, so
>> I had to have it write out a call file which would be passed back in for
>> the outbound leg.
>>
>> -James
>>
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Astlinux-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/astlinux-users
>
> Donations to support AstLinux are graciously accepted via PayPal to
> [email protected].
>
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Astlinux-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to 
[email protected].

Reply via email to