[Asterisk-Users] Preserving received digits during a fax match?

Kris Boutilier Kris.Boutilier at scrd.bc.ca
Thu Jun 3 00:26:41 MST 2004


I have a set of analog DID lines coming into my Asterisk box, via a channel
bank. The numbers in the DID bank route to various places, including voice
lines of various staff. I am using the fax detection engine to intercept
faxes accidentially sent to numbers on the DID bank and reroute them to a
physical fax set up in the office. I would now like to preserve the received
digits and pass them through to a 'faxhandler' section for reuse (ie. in
routing some faxes to email via hylafax, others still to go to the fax
machine). My inital approach was to try:

 exten => fax,1,Goto(outto-faxhandler,${EXTEN},1)       ; If asterisk
detects a fax, deal with it

with

 [outto-faxhandler]
 exten => _.,1,ChanIsAvail(Zap/21)              ; Check if the target
station is free
 exten => _.,2,Dial(Zap/21)                         ; Immediatly route
inbound calls to dedicated station
 exten => _.,102,Playtones(busy)
 exten => _.,103,Busy
 exten => _.,104,Wait(10)
 exten => _.,105,Hangup

But, checking the CDR logs it records 'fax' as the value of ${EXTEN}. I also
tried using:

 exten => s,1,SetVar(DIGITS=${EXTEN})
 ...

with 

 exten => fax,1,Goto(outto-faxhandler,${DIGITS},1)       ; If asterisk
detects a fax, deal with it

and then the faxhandler routine above, but it (correctly) records 's' as the
value of ${EXTEN}.

So, how do I go about getting the digits out of the registers and into a
variable, so I can preserve them across the call? I'm answering the trunks
in immediate mode and using:

 [infrom-did]
 exten => s,1,DigitTimeout,2                     ; Gather keypresses, 2
second pause is 'completed dialing'
 exten => s,2,ResponseTimeout,10                 ; 10 seconds without any
digits at all is a problem...
 exten => fax,1,Goto(outto-faxhandler,s,1)       ; If asterisk detects a
fax, deal with it
 include => outto-norstar-DNs

to gather the digits and handle the contexts. 

Thanks in advance.

Kris Boutilier
Information Systems Coordinator
Sunshine Coast Regional District




More information about the asterisk-users mailing list