Fax problem

I had installed freepbx 2.4.1.2 (elastix 1.4), asterisk 1.4.19 and now configured it for incoming fax (hardware Digium T205E). The problem is that when there is an incoming fax the handshake just rejected. But, if I call the fax line from a regular phone proceed and faxstat -s returns receiving!

tail -f /var/log/messages

STATE CHANGE: RUNNING -> LISTENING
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [9:DATE=0903]
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [9:TIME=1133]
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [5:NAME=]
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [15:NMBR=2104177846]
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [11:ANID=]
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [6:NDID=s]
Sep 3 11:33:50 callserver FaxGetty[31008]: --> [4:RING]
Sep 3 11:33:50 callserver FaxGetty[31008]: ANSWER: Call ID 1 "2104177846"
Sep 3 11:33:50 callserver FaxGetty[31008]: ANSWER: Call ID 2 ""
Sep 3 11:33:50 callserver FaxGetty[31008]: ANSWER: Call ID 3 ""
Sep 3 11:33:50 callserver FaxGetty[31008]: ANSWER: Call ID 4 "s"
Sep 3 11:33:50 callserver FaxGetty[31008]: STATE CHANGE: LISTENING -> ANSWERING
Sep 3 11:33:52 callserver FaxGetty[31008]: ANSWER: Ring detected without successful handshake
Sep 3 11:33:52 callserver FaxGetty[31008]: <-- [5:ATH0\r]
Sep 3 11:33:52 callserver FaxGetty[31008]: --> [2:OK]
Sep 3 11:33:52 callserver FaxGetty[31008]: MODEM set DTR OFF
Sep 3 11:33:52 callserver FaxGetty[31008]: MODEM set baud rate: 0 baud (flow control unchanged)
Sep 3 11:33:53 callserver FaxGetty[31008]: MODEM set DTR OFF
Sep 3 11:33:53 callserver FaxGetty[31008]: MODEM set baud rate: 0 baud (flow control unchanged)
Sep 3 11:33:53 callserver FaxGetty[31008]: DELAY 75 ms
Sep 3 11:33:53 callserver FaxGetty[31008]: MODEM set DTR ON
Sep 3 11:33:53 callserver FaxGetty[31008]: DELAY 2600 ms
Sep 3 11:33:57 callserver FaxGetty[31008]: MODEM set baud rate: 19200 baud, input flow XON/XOFF, output flow XON/XOFF
Sep 3 11:33:57 callserver FaxGetty[31008]: DELAY 10 ms
Sep 3 11:33:57 callserver FaxGetty[31008]: MODEM flush i/o
Sep 3 11:33:57 callserver FaxGetty[31008]: <-- [4:ATZ\r]
Sep 3 11:33:57 callserver FaxGetty[31008]: --> [2:OK]
Sep 3 11:33:57 callserver FaxGetty[31008]: DELAY 3000 ms

asterisk
(410 is the freepbx extension: call waiting=disabled. zapata: faxdetect=incoming, inbound route: fax extension=410, fax detection=zaptel, pause after=7, set destination extension = 410)

-- Accepting call from '2104177846' to '410' on channel 0/6, span 1
-- Executing [410@from-pstn:1] Macro("Zap/6-1", "exten-vm|novm|410") in new stack
-- Executing [s@macro-exten-vm:1] Macro("Zap/6-1", "user-callerid") in new stack
-- Executing [s@macro-user-callerid:1] NoOp("Zap/6-1", "user-callerid:  2104177846") in new stack
-- Executing [s@macro-user-callerid:2] Set("Zap/6-1", "AMPUSER=2104177846") in new stack
-- Executing [s@macro-user-callerid:3] GotoIf("Zap/6-1", "0?report") in new stack
-- Executing [s@macro-user-callerid:4] ExecIf("Zap/6-1", "1|Set|REALCALLERIDNUM=2104177846") in new stack
-- Executing [s@macro-user-callerid:5] NoOp("Zap/6-1", "REALCALLERIDNUM is 2104177846") in new stack
-- Executing [s@macro-user-callerid:6] Set("Zap/6-1", "AMPUSER=") in new stack
-- Executing [s@macro-user-callerid:7] Set("Zap/6-1", "AMPUSERCIDNAME=") in new stack
-- Executing [s@macro-user-callerid:8] GotoIf("Zap/6-1", "1?report") in new stack
-- Goto (macro-user-callerid,s,13)
-- Executing [s@macro-user-callerid:13] NoOp("Zap/6-1", "TTL:  ARG1: novm") in new stack
-- Executing [s@macro-user-callerid:14] GotoIf("Zap/6-1", "0?continue") in new stack
-- Executing [s@macro-user-callerid:15] Set("Zap/6-1", "__TTL=64") in new stack
-- Executing [s@macro-user-callerid:16] GotoIf("Zap/6-1", "1?continue") in new stack
-- Goto (macro-user-callerid,s,23)
-- Executing [s@macro-user-callerid:23] NoOp("Zap/6-1", "Using CallerID "" <2104177846>") in new stack
-- Executing [s@macro-exten-vm:2] Set("Zap/6-1", "RingGroupMethod=none") in new stack
-- Executing [s@macro-exten-vm:3] Set("Zap/6-1", "VMBOX=novm") in new stack
-- Executing [s@macro-exten-vm:4] Set("Zap/6-1", "EXTTOCALL=410") in new stack
-- Executing [s@macro-exten-vm:5] Set("Zap/6-1", "CFUEXT=") in new stack
-- Executing [s@macro-exten-vm:6] Set("Zap/6-1", "CFBEXT=") in new stack
-- Executing [s@macro-exten-vm:7] Set("Zap/6-1", "RT=""") in new stack
-- Executing [s@macro-exten-vm:8] Macro("Zap/6-1", "record-enable|410|IN") in new stack
-- Executing [s@macro-record-enable:1] GotoIf("Zap/6-1", "0?2:4") in new stack
-- Goto (macro-record-enable,s,4)
-- Executing [s@macro-record-enable:4] AGI("Zap/6-1", "recordingcheck|20090903-113724|1251967044.1082") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck

recordingcheck|20090903-113724|1251967044.1082: Inbound recording not enabled
– AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:5] NoOp(“Zap/6-1”, “No recording needed”) in new stack
– Executing [s@macro-exten-vm:9] Macro(“Zap/6-1”, “dial||tr|410”) in new stack
– Executing [s@macro-dial:1] GotoIf(“Zap/6-1”, “1?dial”) in new stack
– Goto (macro-dial,s,3)
– Executing [s@macro-dial:3] AGI(“Zap/6-1”, “dialparties.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Starting New Dialparties.agi
== Parsing ‘/etc/asterisk/manager.conf’: Found
== Parsing ‘/etc/asterisk/manager_additional.conf’: Found
== Parsing ‘/etc/asterisk/manager_custom.conf’: Found
== Manager ‘admin’ logged on from 127.0.0.1
dialparties.agi: Caller ID name is ‘unknown’ number is '2104177846’
dialparties.agi: USE_CONFIRMATION: 'FALSE’
dialparties.agi: RINGGROUP_INDEX: ''
dialparties.agi: Methodology of ring is ‘none’
– dialparties.agi: Added extension 410 to extension map
– dialparties.agi: Extension 410 cf is disabled
– dialparties.agi: Extension 410 do not disturb is disabled
> dialparties.agi: extnum 410 has: cw: 0; hascfb: 0 [] hascfu: 0 []
> dialparties.agi: ExtensionState: 0
dialparties.agi: Extension 410 has ExtensionState: 0
– dialparties.agi: Checking CW and CFB status for extension 410
– dialparties.agi: dbset CALLTRACE/410 to 2104177846
– dialparties.agi: Filtered ARG3: 410
== Manager ‘admin’ logged off from 127.0.0.1
– AGI Script dialparties.agi completed, returning 0
– Executing [s@macro-dial:7] Dial(“Zap/6-1”, “IAX2/410||tr”) in new stack
– Called 410
– Call accepted by 127.0.0.1 (format alaw)
– Format for call is alaw
– IAX2/410-5 is ringing
– IAX2/410-5 answered Zap/6-1
– Redirecting Zap/6-1 to fax extension
– Hungup ‘IAX2/410-5’
== Spawn extension (from-pstn, fax, 0) exited non-zero on ‘Zap/6-1’ in macro ‘dial’
== Spawn extension (from-pstn, fax, 0) exited non-zero on ‘Zap/6-1’ in macro ‘exten-vm’
== Spawn extension (from-pstn, fax, 0) exited non-zero on ‘Zap/6-1’
– Executing [fax@from-pstn:1] Goto(“Zap/6-1”, “ext-fax|in_fax|1”) in new stack
– Goto (ext-fax,in_fax,1)
– Executing [in_fax@ext-fax:1] StopPlayTones(“Zap/6-1”, “”) in new stack
– Executing [in_fax@ext-fax:2] GotoIf(“Zap/6-1”, “0?3:analog_fax|1”) in new stack
– Goto (ext-fax,analog_fax,1)
– Executing [analog_fax@ext-fax:1] GotoIf(“Zap/6-1”, “1?4:2”) in new stack
– Goto (ext-fax,analog_fax,4)
– Executing [analog_fax@ext-fax:4] Hangup(“Zap/6-1”, “”) in new stack
== Spawn extension (ext-fax, analog_fax, 4) exited non-zero on ‘Zap/6-1’
– Executing [h@ext-fax:1] System(“Zap/6-1”, "/var/lib/asterisk/bin/fax-process.pl --to --from [email protected] --subject "Fax from 2104177846 " --attachment fax_2104177846.pdf --type application/pdf --file ") in new stack
– Executing [h@ext-fax:2] Hangup(“Zap/6-1”, “”) in new stack
== Spawn extension (ext-fax, h, 2) exited non-zero on ‘Zap/6-1’
– Hungup ‘Zap/6-1’

iaxmodem version 0.1.14 - /etc/iaxmodem/iaxmodem-cfg.ttyIAX1

device /dev/ttyIAX1
owner uucp:uucp
mode 660
port 4570
refresh 300
server 127.0.0.1
peername 410
secret 410
cidname
cidnumber
codec slinear

hylafax verison 4.3.3 - /var/spool/hylafax/etc/config.ttyIAX1

CountryCode: 0030
AreaCode: 210
FAXNumber:
LongDistancePrefix: 1
InternationalPrefix: 011
DialStringRules: etc/dialrules
ServerTracing: 0xFFF
SessionTracing: 0xFFF
RecvFileMode: 0600
LogFileMode: 0600
DeviceMode: 0600
RingsBeforeAnswer: 1
SpeakerVolume: off
GettyArgs: "-h %l dx_%s"
LocalIdentifier: ""
TagLineFont: etc/lutRS18.pcf
TagLineFormat: "From %%l|%c|Page %%P of %%T"
MaxRecvPages: 200

Modem-related stuff: should reflect modem command interface

and hardware connection/cabling (e.g. flow control).

ModemType: Class1 # use this to supply a hint

Enabling this will use the hfaxd-protocol to set Caller*ID

#ModemSetOriginCmd: AT+VSID="%s","%d"

If “glare” during initialization becomes a problem then take

the modem off-hook during initialization, and then place it

back on-hook when done.

#ModemResetCmds: “ATH1\nAT+VCID=1” # enables CallID display
#ModemReadyCmds: ATH0
Class1AdaptRecvCmd: AT+FAR=1
Class1TMConnectDelay: 400 # counteract quick CONNECT response

Class1RMQueryCmd: “!24,48,72,96” # enable this to disable V.17

You’ll likely want Caller*ID display (also displays DID) enabled.

ModemResetCmds: AT+VCID=1 # enables CallID display

If you are “missing” Caller*ID data on some calls (but not all)

and if you do not have adequate glare protection you may want to

not answer based on RINGs, but rather enable the CallIDAnswerLength

for NDID, disable AT+VCID=1 and do this:

#RingsBeforeAnswer: 0
#ModemRingResponse: AT+VRID=1

CallIDPattern: "NMBR="
CallIDPattern: "NAME="
CallIDPattern: "ANID="
CallIDPattern: “NDID=”
#CallIDAnswerLength: 4

Uncomment these if you really want them, but you probably don’t.

#CallIDPattern: “DATE=”
#CallIDPattern: “TIME=”

I had something of the same problem. Unless I specified the codec as ulaw in the FreePBX gui and on the ttyIAX modem config, then the connection would either drop or I would get a message stating that there was congestion on the line.

ttyIAX Config file:
owner uucp:uucp
mode 660
port 4571
refresh 300
server 127.0.0.1
peername 101
secret faxmodem101
cidname xxxxxxxxx
cidnumber xxxxxxxxx
codec ulaw

FreePbx Extension Configuration:
device options-
disallow all
allow ulaw