Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-21 Thread khalid touati
@ Bryant: thanks so much for the interesting figure of use.


> Why do so may people think their problems are unique. Many people use FFA
> and spandsp. They all come across this. The issue is widely known, well
> understood, and not at all strange once you think about it.
>
> Steve
>
>
 @ Steve: don't get that mad dude, my impression is only My impression and
it only affects me, so nothing to worry about, i'd rather discuss asterisk
issues instead of discussing my impression, but thanks for your help.

--
__**__**_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
 http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
 
http://lists.digium.com/**mailman/listinfo/asterisk-**users



-- 
Abdullah
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-21 Thread Steve Underwood

On 06/21/2011 09:12 PM, khalid touati wrote:
Ok, for the variables, I can retrieve some of them like the caller 
number and so on (I would assume that all the variables that last for 
duration of call are there), but I still think that I sould not use 
the h extension to continue after ReceiveFAX use, it's like not a lot 
of people use FFA, moreover very few came accross such an issue which 
is fine.
Why do so may people think their problems are unique. Many people use 
FFA and spandsp. They all come across this. The issue is widely known, 
well understood, and not at all strange once you think about it.


Steve

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-21 Thread Bryant Zimmerman



 From: "khalid touati" 
Sent: Tuesday, June 21, 2011 9:12 AM
To: "Asterisk Users Mailing List - Non-Commercial Discussion" 

Subject: Re: [asterisk-users] Problem with ReceiveFAX app from FFA

Ok, for the variables, I can retrieve some of them like the caller number 
and so on (I would assume that all the variables that last for duration of 
call are there), but I still think that I sould not use the h extension to 
continue after ReceiveFAX use, it's like not a lot of people use FFA, 
moreover very few came accross such an issue which is fine.

 


Here is a receivefax example. Note this is not a complete example just a 
snip. You have to use the "h" extension if you really want to make it all 
work. Don't fight it just do it. This is a standard process very similar to 
how you need to handle returns from "Dial" comands.  

f/F option is a special patch written by Kevin @ digium and will not be in 
the distro unitl 10.x
FAX-MASTER_CHK-FAILED(${CALLERID(number)) FAX-MASTER_DO-FAILED()  are 
database storage macro that stores and get's failed fax attempts so I can 
force a roll back. Store the fax vars in a database on success and fail. 
This lets me notify the user for either case.  

[fax_inbound_efax]
exten => PFax,1,Set(SIP_CODEC=ulaw)
exten => PFax,n,Set(l_faxoptions=f)
exten => 
PFax,n,Set(l_faxhasfailed=${FAX-MASTER_CHK-FAILED(${CALLERID(number)},${p_Ca
llSrcTrunk})})
exten => PFax,n,GotoIf($[${l_faxhasfailed}>0]?audioonly:tryt38)
exten => PFax,n(audioonly),Set(l_faxoptions=F)
exten => PFax,n(tryt38),Answer()
exten => PFax,n,Wait(2)
exten => PFax,n,Set(l_faxFile_Base=${STRFTIME(,,%Y%m%d-%H%M)}_${RAND(1)})
exten => PFax,n,Set(l_faxFile_Path=/var/spool/fax_in/)
exten => PFax,n,Set(l_faxFile_FullName=fax_${l_faxFile_Base}.tiff)
exten => PFax,n,Set(l_faxFile=${l_faxFile_Path}${l_faxFile_FullName})
exten => PFax,n,ReceiveFAX(${l_faxFile},${l_faxoptions}) 

exten => h,1,NoOp(Do Fax Hangup)
exten => h,n,Goto(Do-${FAXOPT(status)},1) 

exten => Do-SUCCESS,1,NoOp(Fax Success)
exten => Do-SUCCESS,n,Goto(Do-Store,1)
exten => Do-SUCCESS,n,NoOp(Return from System) 

exten => Do-FAILED,1,NoOp(Fax Failed)
exten => 
Do-FAILED,n,GotoIf($[${l_faxoptions}=f]?DoLogFallback:DoNoFallback)
exten => 
Do-FAILED,n(DoLogFallback),Set(FAX-MASTER_DO-FAILED()=${CALLERID(number)},${
p_CallSrcTrunk})
exten => Do-FAILED,n(DoNoFallback),Goto(Do-Store,1) 

exten => Do-Store,1,NoOp(Store Fax Data)
exten => Do-Store,n,GotoIf($["${FAXOPT(rate)}"=""]?DoRate0:DoRate)
exten => Do-Store,n(DoRate0),Set(l_storeRate=0)
exten => Do-Store,n,Goto(DoDisplay)
exten => Do-Store,n(DoRate),Set(l_storeRate=${FAXOPT(rate)})
exten => Do-Store,n(DoDisplay),NoOp(DT = ${STRFTIME(,,%Y-%m-%d %H:%M:%S)})
exten => Do-Store,n,NoOp(Fax Base = ${l_faxFile_Base})
exten => Do-Store,n,NoOp(Switch ID = ${gbl_switchid})
exten => Do-Store,n,NoOp(Account Code = ${gbl_actnumber})
exten => Do-Store,n,NoOp(Line Code  = ${gbl_actlineid})
exten => Do-Store,n,NoOp(Caller ID Num = ${CALLERID(number)})
exten => Do-Store,n,NoOp(Caller ID Name = ${CALLERID(name)})
exten => Do-Store,n,NoOp(File Path = ${l_faxFile_Path})
exten => Do-Store,n,NoOp(File Name = ${l_faxFile_FullName})
exten => Do-Store,n,NoOp(opt emc = ${FAXOPT(ecm)})
exten => Do-Store,n,NoOp(opt filename = ${FAXOPT(filename)})
exten => Do-Store,n,NoOp(opt localstationid = ${FAXOPT(localstationid)})
exten => Do-Store,n,NoOp(opt headerinfo = ${FAXOPT(headerinfo)})
exten => Do-Store,n,NoOp(opt remotestationid = ${FAXOPT(remotestationid)})
exten => Do-Store,n,NoOp(opt maxrate = ${FAXOPT(maxrate)})
exten => Do-Store,n,NoOp(opt minrate = ${FAXOPT(minrate)})
exten => Do-Store,n,NoOp(opt rate = ${l_storeRate})
exten => Do-Store,n,NoOp(opt pages = ${FAXOPT(pages)})
exten => Do-Store,n,NoOp(opt resolution = ${FAXOPT(resolution)})
exten => Do-Store,n,NoOp(opt error = ${FAXOPT(error)})
exten => Do-Store,n,NoOp(opt status = ${FAXOPT(status)})
exten => Do-Store,n,NoOp(opt statusstr = ${FAXOPT(statusstr)})
exten => Do-Store,n,"Run some kind of macro or storage/email script here" 
Good luck

Bryant
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-21 Thread khalid touati
Ok, for the variables, I can retrieve some of them like the caller number
and so on (I would assume that all the variables that last for duration of
call are there), but I still think that I sould not use the h extension to
continue after ReceiveFAX use, it's like not a lot of people use FFA,
moreover very few came accross such an issue which is fine.
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-20 Thread Warren Selby
On Mon, Jun 20, 2011 at 2:43 PM, Bryant Zimmerman wrote:

> I concur we use the "h" extension to log inbound faxes to a database and
> then we process them outside the asterisk platform.  Our biggest issue with
> ReceiveFAX is about a 20% t.38 negotiation fail ratio. We then force fall
> back to t.30 for the next call from that number. We would like to see better
> success with t.38. Today our primary server has had 910 faxes of which 707
> negotiated t.38, 44 have failed darn robo dialers, The rest failed the first
> attempt and came in T.30 on the second call
>

I'm not sure how much of this is the fault of FFA versus the fault of shoddy
t.38 implementations out in the wild.  I've had a ton of headaches trying to
get t.38 solutions implemented with various ITSP's and FFA.  I've heard that
the free SpanDSP version has better negotiation rates, however, I have not
personally tested them.  In the end, for mission critical fax applications
(yes, these still exist, especially in the financial sector), I tend to go
with a dedicated line and DID used in conjunction with an FXO device or T1
device, an IAXModem connection over a local, low-latency LAN, and setup a
dialplan pass-through to a hylafax server.

-- 
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com 
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-20 Thread Bryant Zimmerman
 

 From: "Warren Selby" 
Sent: Monday, June 20, 2011 3:00 PM
To: "Asterisk Users Mailing List - Non-Commercial Discussion" 

Subject: Re: [asterisk-users] Problem with ReceiveFAX app from FFA

On Mon, Jun 20, 2011 at 7:44 AM, Larry Moore  
wrote:
 
 I personally have considered this behaviour to possibly be a bug.

Once a fax is sent, the sending fax machine typically hangs up the call - 
sending the call to the "h" extension.  It's the same as if you are on an 
actual call that was connected using the Dial() application, and the other 
end hangs up - the next step is the 'h' extension, not to continue in the 
current dialplan.  I don't see how this is a bug, unless you think the 
entire call-flow paradigm that currently exists in asterisk is a bug.

Now, if you're not getting certain variables to pass into the 'h' 
extension, that you feel should indeed be passed into the 'h' extension, 
that may be considered a bug...but you would need to show us CLI output and 
existing dialplan for followup.

-- 
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com



Waren

I concur we use the "h" extension to log inbound faxes to a database and 
then we process them outside the asterisk platform.  Our biggest issue with 
ReceiveFAX is about a 20% t.38 negotiation fail ratio. We then force fall 
back to t.30 for the next call from that number. We would like to see 
better success with t.38. Today our primary server has had 910 faxes of 
which 707 negotiated t.38, 44 have failed darn robo dialers, The rest 
failed the first attempt and came in T.30 on the second call.

Thanks
Bryant
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-20 Thread Warren Selby
On Mon, Jun 20, 2011 at 7:44 AM, Larry Moore  wrote:


> I personally have considered this behaviour to possibly be a bug.
>

Once a fax is sent, the sending fax machine typically hangs up the call -
sending the call to the "h" extension.  It's the same as if you are on an
actual call that was connected using the Dial() application, and the other
end hangs up - the next step is the 'h' extension, not to continue in the
current dialplan.  I don't see how this is a bug, unless you think the
entire call-flow paradigm that currently exists in asterisk is a bug.

Now, if you're not getting certain variables to pass into the 'h' extension,
that you feel should indeed be passed into the 'h' extension, that may be
considered a bug...but you would need to show us CLI output and existing
dialplan for followup.


-- 
Thanks,
--Warren Selby, dCAP
http://www.SelbyTech.com 
--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
   http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-20 Thread Larry Moore

On 20/06/2011 8:18 AM, Steve Underwood wrote:

On 06/20/2011 03:38 AM, khalid touati wrote:

Hi Guys,
I solved temporarely my issue by kind of tricking Asterisk, I used 
the following line instead of the old:

exten => h,n,System('/usr/local/
bin/fax2mail -p -f "${FAXFILENOEXT}" --cid-number ${CALLERID(num)} 
--cid-name "${CALLERID(name)}" --dest-name "Sir/Madam"')
now when it hang up I receive my fax through email, and let me tell 
you (first time using Free Fax from Asterisk) ReceiveFAX catch well 
faxes, just a couple tries but got them all, let's see with more 
faxes what will happen.


Why do you consider this a temporary fix? The far end machine will 
normally hang up at the end of the FAX, so the hangup option in the 
dialplan is exactly where you should expect to be.


I don't know the specifics of how an Asterisk application should exit 
however WRT ReceiveFAX() using SPANDSP Technology I would expect the 
call to descend to any functions below ReceiveFAX() whether or not the 
facsimile was received successfully, the status codes from ReceiveFAX() 
can be used by whatever is called next, e.g. a script to e-mail the 
received facsimile or a report advising errors were encountered.


I am using a macro to receive faxes, I have placed my System() call back 
to were the macro returns after execution due to the function not being 
called after ReceiveFAX() under certain conditions.


This however does not guarantee getting an e-mail of what has been 
received if the sender decides to abort the transmission.


I can reproduce this using HylaFAX to send a fax to an extension which 
Asterisk ReceiveFAX(,f) will accept, granted it will fall back 
to G.711 mode when receiving, when I abort the transmission using WHFC 
client, it is as though ReceiveFAX() goes of somewhere else or simply 
decides to forget where it came from as it does not appear to return 
hence the System() call is never made.


I should point out I am using extensions.ael for my dialplan.

I personally have considered this behaviour to possibly be a bug.

Cheers,

Larry.

--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-19 Thread Steve Underwood

On 06/20/2011 03:38 AM, khalid touati wrote:

Hi Guys,
I solved temporarely my issue by kind of tricking Asterisk, I used the 
following line instead of the old:

exten => h,n,System('/usr/local/
bin/fax2mail -p -f "${FAXFILENOEXT}" --cid-number ${CALLERID(num)} 
--cid-name "${CALLERID(name)}" --dest-name "Sir/Madam"')
now when it hang up I receive my fax through email, and let me tell 
you (first time using Free Fax from Asterisk) ReceiveFAX catch well 
faxes, just a couple tries but got them all, let's see with more faxes 
what will happen.


Why do you consider this a temporary fix? The far end machine will 
normally hang up at the end of the FAX, so the hangup option in the 
dialplan is exactly where you should expect to be.


If you need a couple of tries for some of your FAXes, it doesn't sound 
like FFA is working very well for you. Check the timing of your 
telephony channel. If you get more than 1% failures when sending FAXes 
to and from your own equipment you should be looking into the cause.


Steve


--
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
  http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-users


Re: [asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-19 Thread khalid touati
Hi Guys,
I solved temporarely my issue by kind of tricking Asterisk, I used the
following line instead of the old:
exten => h,n,System('/usr/local/
bin/fax2mail -p -f "${FAXFILENOEXT}" --cid-number ${CALLERID(num)}
--cid-name "${CALLERID(name)}" --dest-name "Sir/Madam"')
now when it hang up I receive my fax through email, and let me tell you
(first time using Free Fax from Asterisk) ReceiveFAX catch well faxes, just
a couple tries but got them all, let's see with more faxes what will happen.


On Sun, Jun 19, 2011 at 12:24 PM, khalid touati wrote:

>
> Hi all,
> I am running to the following problem, when using the below dialplan to
> receive fax, everything works perfect till this line
> exten => receive,n,ReceiveFAX(${FAXFILE}):
> and then the following line cannot be executed, it's like asterisk can't go
> back to dialplan and continue, the good news is when i check what is
> received in my fax folder i find that the file is a valid one (not corrupted
> or empty), also when I use another way to execute fax2mail, it's working
> perfect and sent right to my email (test was done with the same file
> received by ReceiveFAX), so I belive the problem is just when transiting
> from the line that call ReceiveFAX and the line that call fax2mail (but both
> work not in order or separately), the debugging of PRI channel is below
> dialplan (maybe i will need to turn on debugging in receiveFAX app as well),
> please advise!
>
> I am using asterisk 1.6.2.11, FAX For Asterisk Components:
> Applications: 1.6.2.0_1.2.1
> Digium FAX Driver: 1.6.2.0_1.2.1 (optimized for barcelona_64)
>
> [fax-rx]
> exten => receive,1,NoOp( FAX RECEIVE )
> exten => receive,n,Set(GLOBAL(FAXCOUNT)=$[ ${GLOBAL(FAXCOUNT)} + 1 ])
> exten => receive,n,Set(FAXCOUNT=${GLOBAL(FAXCOUNT)})
> exten =>
> receive,n,Set(FAXFILE=/var/spool/asterisk/fax/${STRFTIME(,,%F_%T_${CALLERID(num)})}.tif)
> exten =>
> receive,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(,,%F_%T_${CALLERID(num)})})
> exten => receive,n,Set(GLOBAL(LASTFAXCALLERNUM)=${CALLERID(num)})
> exten => receive,n,Set(GLOBAL(LASTFAXCALLERNAME)=${CALLERID(name)})
> exten => receive,n,NoOp( SETTING FAXOPT )
> exten => receive,n,Set(FAXOPT(ecm)=yes)
> exten => receive,n,Set(FAXOPT(headerinfo)=MY FAXBACK RX)
> exten => receive,n,Set(FAXOPT(localstationid)=15184893772)
> 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,System('/usr/local/bin/fax2mail -p -f "${FAXFILENOEXT}"
> --cid-number ${CALLERID(num)} --cid-name "${CALLERID(name)}" --dest-name
> "Sir/Madam"')
>
> *debug:*
>
> pbx3*CLI>
> -- Executing [receive@fax-rx:20] ReceiveFAX("DAHDI/1-1",
> "/var/spool/asterisk/fax/2011-06-18_12:52:44_8009806858.tif") in new stack
> q931.c:5088 q931_connect: Call 14288 enters state 8 (Connect Request).
> Hold state: Idle
> pbx3*CLI>
> pbx3*CLI>
> > DL-DATA request
> pbx3*CLI>
> > Protocol Discriminator: Q.931 (8)  len=14
> pbx3*CLI>
> > TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent to originator)
> pbx3*CLI>
> > Message Type: CONNECT (7)
> TEI=0 Transmitting N(S)=1, window is open V(A)=0 K=7
> pbx3*CLI>
> pbx3*CLI>
> > Protocol Discriminator: Q.931 (8)  len=14
> pbx3*CLI>
> > TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent to originator)
> > Message Type: CONNECT (7)
> pbx3*CLI>
> > [18 03 a9 83 81]
> > Channel ID (len= 5) [ Ext: 1  IntID: Implicit  Other(PRI)  Spare: 0
> Exclusive  Dchan: 0
>
> pbx3*CLI>
> >   ChanSel: As indicated in following octets
> >   Ext: 1  Coding: 0  Number Specified  Channel Type:
> 3
> pbx3*CLI>
> >   Ext: 1  Channel: 1 Type: CPE]
> > [1e 02 81 82]
> pbx3*CLI>
> > Progress Indicator (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0)
> 0: 0  Location: Private network serving the local user (1)
> pbx3*CLI>
> >   Ext: 1  Progress Description: Called
> equipment is non-ISDN. (2) ]
> pbx3*CLI>
> -- Channel 'DAHDI/1-1' receiving FAX
> '/var/spool/asterisk/fax/2011-06-18_12:52:44_8009806858.tif'
> pbx3*CLI>
> -- Channel 'DAHDI/1-1' FAX session '7' started
> pbx3*CLI>  < Protocol Discriminator: Q.931 (8)  len=5
> < TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent from originator)
> < Message Type: CONNECT ACKNOWLEDGE (15)
> pbx3*CLI>
> Received message for call 0x2aaac80812d0 on link 0x2aaac8035bb8 TEI/SAPI
> 0/0
> q931.c:7785 post_handle_q931_message: Call 14288 enters state 10 (Active).
> Hold state: Idle
> pbx3*CLI>
> -- FAX h

[asterisk-users] Problem with ReceiveFAX app from FFA

2011-06-19 Thread khalid touati
Hi all,
I am running to the following problem, when using the below dialplan to
receive fax, everything works perfect till this line
exten => receive,n,ReceiveFAX(${FAXFILE}):
and then the following line cannot be executed, it's like asterisk can't go
back to dialplan and continue, the good news is when i check what is
received in my fax folder i find that the file is a valid one (not corrupted
or empty), also when I use another way to execute fax2mail, it's working
perfect and sent right to my email (test was done with the same file
received by ReceiveFAX), so I belive the problem is just when transiting
from the line that call ReceiveFAX and the line that call fax2mail (but both
work not in order or separately), the debugging of PRI channel is below
dialplan (maybe i will need to turn on debugging in receiveFAX app as well),
please advise!

I am using asterisk 1.6.2.11, FAX For Asterisk Components:
Applications: 1.6.2.0_1.2.1
Digium FAX Driver: 1.6.2.0_1.2.1 (optimized for barcelona_64)

[fax-rx]
exten => receive,1,NoOp( FAX RECEIVE )
exten => receive,n,Set(GLOBAL(FAXCOUNT)=$[ ${GLOBAL(FAXCOUNT)} + 1 ])
exten => receive,n,Set(FAXCOUNT=${GLOBAL(FAXCOUNT)})
exten =>
receive,n,Set(FAXFILE=/var/spool/asterisk/fax/${STRFTIME(,,%F_%T_${CALLERID(num)})}.tif)
exten =>
receive,n,Set(FAXFILENOEXT=/var/spool/asterisk/fax/${STRFTIME(,,%F_%T_${CALLERID(num)})})
exten => receive,n,Set(GLOBAL(LASTFAXCALLERNUM)=${CALLERID(num)})
exten => receive,n,Set(GLOBAL(LASTFAXCALLERNAME)=${CALLERID(name)})
exten => receive,n,NoOp( SETTING FAXOPT )
exten => receive,n,Set(FAXOPT(ecm)=yes)
exten => receive,n,Set(FAXOPT(headerinfo)=MY FAXBACK RX)
exten => receive,n,Set(FAXOPT(localstationid)=15184893772)
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,System('/usr/local/bin/fax2mail -p -f "${FAXFILENOEXT}"
--cid-number ${CALLERID(num)} --cid-name "${CALLERID(name)}" --dest-name
"Sir/Madam"')

*debug:*

pbx3*CLI>
-- Executing [receive@fax-rx:20] ReceiveFAX("DAHDI/1-1",
"/var/spool/asterisk/fax/2011-06-18_12:52:44_8009806858.tif") in new stack
q931.c:5088 q931_connect: Call 14288 enters state 8 (Connect Request).  Hold
state: Idle
pbx3*CLI>
pbx3*CLI>
> DL-DATA request
pbx3*CLI>
> Protocol Discriminator: Q.931 (8)  len=14
pbx3*CLI>
> TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent to originator)
pbx3*CLI>
> Message Type: CONNECT (7)
TEI=0 Transmitting N(S)=1, window is open V(A)=0 K=7
pbx3*CLI>
pbx3*CLI>
> Protocol Discriminator: Q.931 (8)  len=14
pbx3*CLI>
> TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent to originator)
> Message Type: CONNECT (7)
pbx3*CLI>
> [18 03 a9 83 81]
> Channel ID (len= 5) [ Ext: 1  IntID: Implicit  Other(PRI)  Spare: 0
Exclusive  Dchan: 0

pbx3*CLI>
>   ChanSel: As indicated in following octets
>   Ext: 1  Coding: 0  Number Specified  Channel Type: 3
pbx3*CLI>
>   Ext: 1  Channel: 1 Type: CPE]
> [1e 02 81 82]
pbx3*CLI>
> Progress Indicator (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0)  0:
0  Location: Private network serving the local user (1)
pbx3*CLI>
>   Ext: 1  Progress Description: Called
equipment is non-ISDN. (2) ]
pbx3*CLI>
-- Channel 'DAHDI/1-1' receiving FAX
'/var/spool/asterisk/fax/2011-06-18_12:52:44_8009806858.tif'
pbx3*CLI>
-- Channel 'DAHDI/1-1' FAX session '7' started
pbx3*CLI>  < Protocol Discriminator: Q.931 (8)  len=5
< TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent from originator)
< Message Type: CONNECT ACKNOWLEDGE (15)
pbx3*CLI>
Received message for call 0x2aaac80812d0 on link 0x2aaac8035bb8 TEI/SAPI 0/0
q931.c:7785 post_handle_q931_message: Call 14288 enters state 10 (Active).
Hold state: Idle
pbx3*CLI>
-- FAX handle 0: [ 104.899463 ], entering CLOSING state
-- FAX handle 0: [ 104.899528 ], entering CLOSING state
pbx3*CLI>  < Protocol Discriminator: Q.931 (8)  len=9
< TEI=0 Call Ref: len= 2 (reference 14288/0x37D0) (Sent from originator)
< Message Type: DISCONNECT (69)
< [08 02 82 90]
pbx3*CLI>
< Cause (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0)  Spare: 0
Location: Public network serving the local user (2)
<  Ext: 1  Cause: Normal Clearing (16), class = Normal Event
(1) ]
Received message for call 0x2aaac80812d0 on link 0x2aaac8035bb8 TEI/SAPI 0/0
-- Processing IE 8 (cs0, Cause)
pbx3*CLI>
-- Found active call: 0x2aaac80812d0 cref:14288
q931.c:7994 post_handle_q931_message: Call 14288 enters state 12 (Disconnect
Indication).