Receiving Fax & Voice Calls on Single Zap Channel

Hi,

We have an analog line which is setup as our fax number, currently with a fax machine on. However, we’re going to use this as our failover line in the event of a SIP trunk failure. We rarely use the fax machine, maybe once every few months, if setting up a credit account with a supplier, so its not worth getting 2 separate lines to do this.

I have installed an X100P card, in our Asterisk box, and and can make and receive calls on the analong line. I’ve also used the steps in ‘HylaFAX / AvantFax for PIAF! - Parts 1-4’ (pbxinaflash.com/forum/showthread.php?t=3645), I can now send faxes, and the quality is pretty good.
However, when I receive faxes, they come through to the phone extensions, not the AvantFax inbox. I have setup the inbound route in FreePBX to detect faxes, using zaptel, and send to custom destination: fax (hylafax). However, it still seems to go through to the phone extensions. If I set both the default destination for the inbound route, as well as the fax detect destination, to the custom destination: Fax (Hylafax), it works, and the fax is received by the AvantFax inbox, but this means normal phone calls also end up getting answered by the fax!

My config files are as follows:
Zaptel.conf

Span 1: WCFXO/0 “Wildcard X100P Board 1” (MASTER)

fxsls=1

Global data

loadzone=uk
defaultzone=uk

Zapata.conf

[channels]
language=en
context=from-fax
signalling=fxs_ls
rxwink=300
;usedistinctiveringdetection=yes
channel=1
usecallerid=yes
hidecallerid=no
callwaiting=yes
usecallingpres=yes
callwaitingcallerid=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
callreturn=yes
echocancel=yes
echocancelwhenbridged=no
echotraining=800
rxgain=0.0
txgain=0.0
group=1
callgroup=1
pickupgroup=1
immediate=no

;faxdetect=both
faxdetect=incoming
;faxdetect=outgoing
;faxdetect=no

iax_custom.conf ([iax-fax0], [iax-fax1], [iax-fax2], & [iax-fax3] are all the same, so I’ve only shown the first below)

[iax-fax0]
type=friend
host=127.0.0.1
port=4570
context=from-fax
disallow=all
allow=ulaw
jitterbuffer=no
qualify=yes
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0

extensions_custom.conf (only the very bottom 2 sections)

[custom-fax-iaxmodem]
exten => s,1,Dial(IAX2/iax-fax0/${EXTEN})
exten => s,n,Dial(IAX2/iax-fax1/${EXTEN})
exten => s,n,Dial(IAX2/iax-fax2/${EXTEN})
exten => s,n,Dial(IAX2/iax-fax3/${EXTEN})
exten => s,n,Busy
exten => s,n,Hangup

[from-fax]
exten => _x.,1,Dial(ZAP/1/${EXTEN})
exten => _x.,n,Hangup()

I’ve setup the ‘Zap channel DIDs’ modeul in the FreePBX console, so I have:
Channel: 1
Description: Zap Channel
DID:

The Asterisk CLI shows the following when a fax is incoming:

-- Starting simple switch on 'Zap/1-1'
-- Executing [s@from-zaptel:1] NoOp("Zap/1-1", "Entering from-zaptel with DID == ") in new stack
-- Executing [s@from-zaptel:2] Ringing("Zap/1-1", "") in new stack
-- Executing [s@from-zaptel:3] Set("Zap/1-1", "DID=s") in new stack
-- Executing [s@from-zaptel:4] NoOp("Zap/1-1", "DID is now s") in new stack
-- Executing [s@from-zaptel:5] GotoIf("Zap/1-1", "1?zapok:notzap") in new stack
-- Goto (from-zaptel,s,8)
-- Executing [s@from-zaptel:8] NoOp("Zap/1-1", "Is a Zaptel Channel") in new stack
-- Executing [s@from-zaptel:9] Set("Zap/1-1", "CHAN=1-1") in new stack
-- Executing [s@from-zaptel:10] Set("Zap/1-1", "CHAN=1") in new stack
-- Executing [s@from-zaptel:11] Macro("Zap/1-1", "from-zaptel-1|s|1") in new stack
-- Executing [s@macro-from-zaptel-1:1] NoOp("Zap/1-1", "Entering macro-from-zaptel-1 with DID = s and setting to: 0123456789") in new stac                         k
-- Executing [s@macro-from-zaptel-1:2] Set("Zap/1-1", "__FROM_DID=0123456789") in new stack
-- Executing [s@macro-from-zaptel-1:3] Goto("Zap/1-1", "from-trunk|0123456789|1") in new stack
-- Goto (from-trunk,0123456789,1)

== Channel ‘Zap/1-1’ jumping out of macro ‘from-zaptel-1’
– Executing [0123456789@from-trunk:1] NoOp(“Zap/1-1”, “Catch-All DID Match - Found 0123456789 - You probably want a DID for this.”) in n ew stack
– Executing [0123456789@from-trunk:2] Goto(“Zap/1-1”, “ext-did|s|1”) in new stack
– Goto (ext-did,s,1)
– Executing [s@ext-did:1] Set(“Zap/1-1”, “__FROM_DID=s”) in new stack
– Executing [s@ext-did:2] ExecIf(“Zap/1-1”, “1 |Set|CALLERID(name)=”) in new stack
– Executing [s@ext-did:3] Set(“Zap/1-1”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [s@ext-did:4] SetCallerPres(“Zap/1-1”, “allowed_not_screened”) in new stack
– Executing [s@ext-did:5] Goto(“Zap/1-1”, “custom-fax-iaxmodem|s|1”) in new stack
– Goto (custom-fax-iaxmodem,s,1)
– Executing [s@custom-fax-iaxmodem:1] Dial(“Zap/1-1”, “IAX2/iax-fax0/s”) in new stack
– Called iax-fax0/s
– Call accepted by 127.0.0.1 (format ulaw)
– Format for call is ulaw
– IAX2/iax-fax0-8184 is ringing
– IAX2/iax-fax0-8184 answered Zap/1-1
– Hungup ‘IAX2/iax-fax0-8184’
== Spawn extension (custom-fax-iaxmodem, s, 1) exited non-zero on ‘Zap/1-1’
– Hungup ‘Zap/1-1’
– Executing [*97@from-internal:1] Answer(“SIP/101-08ddbf00”, “”) in new stack
– Executing [*97@from-internal:2] Wait(“SIP/101-08ddbf00”, “1”) in new stack
– Executing [*97@from-internal:3] Macro(“SIP/101-08ddbf00”, “user-callerid|”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/101-08ddbf00”, “AMPUSER=101”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/101-08ddbf00”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/101-08ddbf00”, “1|Set|REALCALLERIDNUM=101”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/101-08ddbf00”, “AMPUSER=101”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/101-08ddbf00”, “AMPUSERCIDNAME=Test”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/101-08ddbf00”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/101-08ddbf00”, “AMPUSERCID=101”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/101-08ddbf00”, “CALLERID(all)=“Test” <101>”) in new stack
– Executing [s@macro-user-callerid:9] GotoIf(“SIP/101-08ddbf00”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:10] Set(“SIP/101-08ddbf00”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:11] GotoIf(“SIP/101-08ddbf00”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,18)
– Executing [s@macro-user-callerid:18] NoOp(“SIP/101-08ddbf00”, “Using CallerID “Test” <101>”) in new stack
– Executing [*97@from-internal:4] Macro(“SIP/101-08ddbf00”, “get-vmcontext|101”) in new stack
– Executing [s@macro-get-vmcontext:1] Set(“SIP/101-08ddbf00”, “VMCONTEXT=default”) in new stack
– Executing [s@macro-get-vmcontext:2] GotoIf(“SIP/101-08ddbf00”, “0?200:300”) in new stack
– Goto (macro-get-vmcontext,s,300)
– Executing [s@macro-get-vmcontext:300] NoOp(“SIP/101-08ddbf00”, “”) in new stack
– Executing [*97@from-internal:5] MailboxExists(“SIP/101-08ddbf00”, “101@default”) in new stack
– Executing [*97@from-internal:6] GotoIf(“SIP/101-08ddbf00”, “1?mbexist”) in new stack
– Goto (from-internal,*97,106)
– Executing [*97@from-internal:106] VoiceMailMain(“SIP/101-08ddbf00”, “101@default”) in new stack
– <SIP/101-08ddbf00> Playing ‘vm-password’ (language ‘en’)
– <SIP/101-08ddbf00> Playing ‘vm-youhave’ (language ‘en’)
– <SIP/101-08ddbf00> Playing ‘digits/1’ (language ‘en’)
– <SIP/101-08ddbf00> Playing ‘vm-first’ (language ‘en’)
– <SIP/101-08ddbf00> Playing ‘vm-message’ (language ‘en’)
== Parsing ‘/var/spool/asterisk/voicemail/default/101/INBOX/msg0000.txt’: Found
– <SIP/101-08ddbf00> Playing ‘/var/spool/asterisk/voicemail/default/101/INBOX/msg0000’ (language ‘en’)
– <SIP/101-08ddbf00> Playing ‘vm-deleted’ (language ‘en’)
– <SIP/101-08ddbf00> Playing ‘vm-nomore’ (language ‘en’)
== Spawn extension (from-internal, *97, 106) exited non-zero on ‘SIP/101-08ddbf00’
– Executing [h@from-internal:1] Macro(“SIP/101-08ddbf00”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/101-08ddbf00”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] GotoIf(“SIP/101-08ddbf00”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] GotoIf(“SIP/101-08ddbf00”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] Hangup(“SIP/101-08ddbf00”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/101-08ddbf00’ in macro ‘hangupcall’
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/101-08ddbf00’

Does anyone know how to configure Asterisk to detect fax calls, and voice calls, and route them correctly?

Thanks

Ben

voip-info.org/wiki/view/Asterisk+fax

From the looks of things, you have to explicitly answer the call, before dialing the voice number, and you need and extension called fax in the same context.

Hi,

Thanks for the reply.

Having read the link you provided, and this link: hylafax.org/archive/2004-07/msg00096.html am I correct in thinking that I need to add the following to the extensions_custom.conf file:

[from-fax]
exten => s,1,Answer
exten => _x.,1,Dial(ZAP/1/${EXTEN})
exten => _x.,n,Hangup()

Ben

P.S. When you say you need an extension for fax, which sort of extension should be created - Zap, Other or None (virtual)?

Asterisk extensions don’t have Zap / other / none characteristics. That may be an artefact of some GUI that you are using. Extensions are directory numbers, they are not devices.

Even if I knew which GUI you were using, I would not be familiar with it. I’ve also not used faxdetect in anger.

However, as I read the article, enabling faxdetect causes an implicit:

GoTo(fax,1)

application invocation (using Asterisk 1.6 syntax).