Asterisk and fax calls
Can I fax over a call with GSM codec compression?
You're not going to get that working because GSM is a lossy codec. It is able to get extreme savings in size, because it optimizes out parts of the sound that most humans don't hear. However, that same bandwidth that humans don't hear is exactly the bandwidth that the fax application uses to transmit valuable portions of the image.
Therefore, the GSM codec is never going to be appropriate for sending faxes. Besides, if you need low bitrates for your IP connection, you're likely to experience delays in the fax negotiation — which will probably result in a failed fax attempt. If you want to be able to send faxes in this way, then negotiate the fax at one end, and email the resulting TIFF
? graphics file to the other end.
Virtual Fax
- Fax over IP - T.38 anyone ?
Receiving Faxes in Asterisk
Asterisk as a fax/voice switch
The answer is simple: Yes, it can. If you Answer() the call before you Dial() an extension, Asterisk will listen for fax beeping. If the call is an fax, it will automatically jump into the fax extension.
Sample code:
[default]
; Answer the line and listen
exten => s,1,Answer
; Dial an extension, let asterisk give a ringtone
exten => s,2,Dial(IAX2/3987,40,r)
; Hangup if nobody picked up within 40 seconds
exten => s,3,Hangup
; Did we get a fax?
exten => fax,1,SetVar(FAXFILE=/var/spool/asterisk-fax/${UNIQUEID}.tif)
exten => fax,2,rxfax(${FAXFILE})
Downside of this solution: The moment that somebody calls you, Asterisk picks up and it will cost him, like with any other fax/voice switch.
Downside of this solution: The moment that somebody calls you, Asterisk picks up and it will cost him, like with any other fax/voice switch.
Zap fax detection
If you're having trouble getting fax detection to work it might be because the faxdetect option in
zapata.conf defaults to off. These are the valid options for faxdetect:
faxdetect=both faxdetect=incoming faxdetect=outgoing faxdetect=no
Sending a fax to a SIP device
You can send faxes to SIP extentions, too. Make sure you are using alaw or ulaw as your codec. Something like this will detect the fax and send it to your SIP device:
exten => s,1,Answer
exten => s,2,Dial(SIP/201&SIP/202)
exten => fax,1,Dial(SIP/203,30)
exten => fax,2,Congestion
exten => fax,102,Congestion
First it answers the line to allow Asterisk to listen for fax tones, then it rings our normal phones. If, however, fax tones were detected, it will go to the "fax" extention which dials our SIP device with the fax machine on it. Finally, if the fax extension is in use or doesn't answer in 30 seconds, play the congestion tone.