FreePBX is a web-based open source GUI (graphical user interface) that controls and manages Asterisk (PBX), an open source communication server. FreePBX is licensed under the GNU General Public License (GPL), an open source license. FreePBX can be installed manually or as part of the pre-configured FreePBX Distro that includes the system OS, Asterisk, FreePBX GUI and assorted dependencies.


We have included a short configuration guide below to use your T38fax.com account with FreePBX. This guide assumes that you have a working FreePBX installation, and that you have command line access to that system. This guide also assumes that you're using an Analog Telephony Adapter (ATA) to connect your fax machine to FreePBX. We used a Cisco SPA112 in this example, though any of our Certified ATA's should work much the same way. There are several ways to configure FreePBX to use your T38fax.com account, this guide will focus on what we've found is the simplest method to do so. We are always open to improving this documentation, if you've found an easier way, please feel free to open a ticket through our T38fax.com support portal and let us know!


Requirements: FreePBX 12.0.74+ with Asterisk 13.4+


Configuration Guide


Create Your Trunk


Navigate to Connectivity -> Trunks and create a new Chan_SIP trunk.


Important: chan_pjsip in FreePBX is currently experimental and not supported, you must use chan_sip!


Give your trunk a name (in both places!), then input the following under PEER Details:

username=YOUR-USER-NAME
type=peer
secret=YOUR-PASSWORD
qualify=yes
nat=yes
insecure=port,invite
host=sip.t38fax.com
defaultexpiry=600
context=custom-t38

Replace YOUR-USER-NAME and YOUR-PASSWORD with the credentials you received via email. It should look something like the screenshot below:



Trunk-Configuration.png

You should remove all of the content in the USER Details section.


Then, under Register String, add this line (be sure to replace YOUR-USER-NAME and YOUR-PASSWORD with your credentials):

YOUR-USER-NAME:YOUR-PASSWORD@sip.t38fax.com~900


RegisterString.png


Remember to Submit Changes & Apply your configuration!


Create Your Extension


Next,  we're going to create an extension for your ATA so it can register to  Asterisk and receive/make calls on behalf of your fax machine. Navigate  to Applications -> Extensions and click the drop down to create a new, Generic Chan_SIP device. Remember, Chan_PJSIP is experimental in FreePBX and therefore not supported! For now, put your T38fax DID in the "User Extension" field,  give your extension a friendly display name, and Submit Your Changes.  After you submit your changes, you can make any adjustments required to  the extension itself, such as NAT or other requirements of your network.


New-Sip-Extension.png


Be sure to grab the "Secret" as this is the password you'll need to add to the ATA (along with your DID) to register your ATA to this extension.


Create Your Outbound Route


Now, navigate to Connectivity -> Outbound Routes and  create a new Outbound route. Give it a name, and duplicate the dial  patterns found in the screenshot below. make sure to add your t38fax  trunk to the "Trunk Sequence for Matched Routes" section, Submit your changes, and Apply your configuration.


Outbound-Route.png

Adjust Your SIP Settings


Next, you'll need to make a small adjustment to your SIP settings. Navigate to Settings -> Asterisk SIP Settings -> Then Select Chan_SIP Settings from the upper right hand menu. Find the Audio Codecs section, and enable T.38 Pass-Through Support. Submit your changes and Apply your Configuration.


Audio-Codecs.png


Configure extensions_custom.conf & udptl_custom.conf


Next, you'll need to access your FreePBX installation from the command line. Edit the extensions_custom.conf file found in /etc/asterisk with the following code:

[custom-t38]
; The following detects the dialed number.
exten => s,1,Set(DNID=${SIP_HEADER(To)})
exten => s,n,Set(DNID=${CUT(DNID,@,1)})
exten => s,n,Set(DNID=${CUT(DNID,:,2)})
exten => s,n,Goto(${DNID},1)
; The following sends the incoming call to the SIP user.
exten => YOUR_DID,1,Dial(SIP/YOUR_DID)
; If you have more than one DID, you can add additional definitions to route them as well:
exten => YOUR_SECOND_DID,1,Dial(SIP/YOUR_SECOND_DID)

Then, add the following to udptl_custom.conf:
udptlstart=10000
udptlend=10999
udptlchecksums=no
T38FaxUdpEC=t38UDPRedundancy
udptlfecentries=3
udptlfecspan=3
use_even_ports=no

Make sure to save those files, and then run the following command:

amportal restart

You  should now add your extension's credentials to your ATA so it can  successfully register, and now you should be able to successfully fax  using your T38fax.com SIP account! Need to test it out? Send a one-page  fax to: 1-215-825-8792 and we'll send you a fax back that includes a  small picture of your original document, and verify that ECM is enabled  on your device! If you have any trouble with this, please feel free to  open a ticket with our support team and someone can assist you!