Skip to end of metadata
Go to start of metadata

Full T.38 Capabilities

Initial support for handling of T.38 sessions was merged into the Asterisk 1.4 codebase. Inside of Asterisk 1.4, it is possible to perform what is referred to as T.38 passthrough. T.38 Passthrough allows Asterisk to carry T.38 UDPTL from one T.38-speaking endpoint to another T.38-speaking endpoint. Asterisk does not modify the media. Asterisk 1.6, in addition to its T.38 passthrough capabilities, introduced T.38 termination support, such that T.38 fax sessions could be initiated from locally stored TIFF files (SendFax) or that T.38 fax sessions could be terminated into locally stored TIFF files (ReceiveFax). The basic faxing capabilities of Asterisk 1.8 remained the same as 1.6.

The limitation of these versions of Asterisk is that while 1.6 - 1.8 are fully capable of passing through or terminating T.38 sessions, there is no capability for T.38 gateway. Older versions of Asterisk cannot directly pass a fax from the PSTN or a non-T.38 endpoint to a T.38 endpoint. Instead, older versions of Asterisk require that two separate calls be established - e.g. one to receive the Fax into a TIFF file (ReceiveFax), and an entirely separate call to send the Fax from a TIFF file to a fax machine (SendFax), or vice versa.

Asterisk 10 overcomes this limitation and provides full T.38 Fax Gateway support. T.38 Gateway provides a number of advantages over the older, two-step store-and-forward method (generally referred to as T.37). Advantages include: end-to-end confirmation of receipt (with two separate calls the callee doesn't necessarily know the caller was trying to send them a fax), reduced time to fax (not receiving and then sending separately cuts the time in half), and increased reliability (no concerns about the reliability of local file storage or the TIFF interpreters).

Enabling T.38 Gateway mode

In order to affect this new T.38 Gateway capability, an additional option, gateway, has been added to the FAXOPT Dialplan Function. Enabling this option can be done like:

exten => 1,1,NoOp()
exten => 1,n,Set(FAXOPT(gateway)=yes)
exten => 1,n,Dial(SIP/mypeer,20)

Here, we use the gateway option in combination with the Dial application:

Using T.38 Gateway mode

T.38 Gateway mode should be used when one leg of a call is not capable of T.38 mode. In the event that both legs are capable and Gateway mode is configured, then the Gateway will step out of the way, allowing transparent T.38 passthrough.

The T.38 Gateway code uses an audiohook to monitor the line for the presence of fax. The monitoring checks for both V.21 preamble and T.38 Re-INVITE from the remote party. If neither is detected within a 10 second window, the Gateway shuts down, removing the audiohook from the channel, and allows the call to complete transparently.

T.38 Gateway with Local Termination Fallback

It is also possible to use Gateway mode in combination with local Termination mode for calls received by Asterisk - if, for example the second call leg to a peer or number is not possible. In order to accomplish this, Gateway mode must be disabled on the current channel, or the ReceiveFax application will not be run. This can be accomplished like:

exten => 1,1,NoOp()
exten => 1,n,Set(FAXOPT(gateway)=yes)
exten => 1,n,Dial(SIP/mypeer,20)
exten => 1,n,Verbose(Failed to dial 'SIP/mypeer': ${DIALSTATUS})
exten => 1,n,Set(FAXOPT(gateway)=no)
exten => 1,n,ReceiveFax(myreceivedfile.tiff,d)
Icon

It is possible to set a channel variable for a SIP peer such that gateway mode is always enabled. This can be accomplished for a SIP peer in sip.conf like:

[mypeer]
type=peer
host=dynamic
secret=chooseabetterpassword
context=default
setvar=FAXOPT(gateway)=yes

T.38 Gateway Fax Activity Timeout

By default, gateway mode will remain enabled throughout the life of a channel. An optional timeout can be enabled to automatically disable gateway mode if there is no fax activity a given time after two channels are bridged. Enabling a timeout also has the side effect of reserving fax resources for a channel. The timeout can be enabled by passing second parameter (a timeout in seconds) when setting FAXOPT(gateway).

exten => 1,1,NoOp()
exten => 1,n,Set(FAXOPT(gateway)=yes,10) ; disable gateway if there is no fax activity in 10 seconds
exten => 1,n,Dial(SIP/mypeer,20)
  • No labels