Skip to main content

[Script Sharing] Filename option when receiving faxes per tenant

Posted by tsicinc on Fri, 06/23/2017

Hello Guys,

We have been testing Thirdlane for a few weeks now, the product is good. I was working this week on our fax solution, wanting to integrate everything in Thirdlane / Asterisk, we found our way out, since most of the needed modules / scripts were included in their latests release (we used SpanDSP).

We were missing one option when receiving faxes : Renaming the fax file per customer.

For us the proper format was TenantRequestedFileName-CurrentDate.pdf, to create that option,we did the following steps :

1 - Cloned tl-stdexten-fax script
2 - Added Second argument : name : File Name, type : text, required Yes
3 - Added PBX Command after the first line : exten => s,n,Set(FILENAME=${ARG2})
3 - We modified /etc/asterisk/special_features.include as following :

From : (4th line after [tl-faxreceive])
exten => s,n(setfile),Set(FAXFILE=${UNIQUEID})
exten => s,n(setfile),Set(FAXFILE=${FILENAME}_${STRFTIME(${EPOCH},,%d%m%Y_%H-%M-%S)})

That allowed us to have an option for filename under each tenant and offer them a custom filename + timestamp for each fax received.

Hope you guys can make good use of it, or even integrate it into the next release !

Submitted by thirdlane on Fri, 06/23/2017 Permalink

Great job, and thanks for the post! This is a perfect example of how we'd like our products to be understood, and extended.

We'll be happy to add this to the next release. I wonder if anyone relies on the filename to be in the"old" format so that we would have to make the extra argument optional for backward compatibility? I doubt that - but if anyone does, please let me know.

Submitted by eeman on Wed, 06/28/2017 Permalink

I hope you meant you modified tl-stdexten-fax-forasterisk and not stdexten-fax. The latter is a WAAAY OLD script that does not properly handle res_fax, t38, and other newer features.

Alex: nobody gave a shit about the filename because it gets deleted the moment the fax gets converted to email :-) UNIQUEID was simply much easier to shell-script around because we all know what spaces and special characters do to interpreted scripts.