FreeSWITCH

  • Updated

The World's First Cross-Platform Scalable Free Multi-Protocol Softswitch

FreeSWITCH is a scalable open source cross-platform telephony platform designed to route and interconnect popular communication protocols using audio, video, text or any other form of media. It was created in 2006 to fill the void left by proprietary commercial solutions. FreeSWITCH also provides a stable telephony platform on which many applications can be developed using a wide range of free tools.

This version supports both T.38 pass-through and T.38 termination.

  • 1. Sign up for a Free Trial account here: Free Trial Signup

    2. You'll need to create the following XML file to register your FreeSWITCH installation to T38Fax.com. Create the following file: /etc/freeswitch/sip_profiles/external/t38fax.xml

    <include>
    <gateway name="t38fax.com">
    <param name="username" value="SIP_USERNAME" />
    <param name="password" value="SIP_PASSWORD" />
    <param name="realm" value="sip.t38fax.com" />
    <param name="from-domain" value="sip.t38fax.com" />
    <param name="proxy" value="sip.t38fax.com:5080" />
    <param name="expire-seconds" value="300" />
    <param name="register" value="true" />
    <param name="retry-seconds" value="30" />
    <param name="caller-id-in-from" value="true" />
    <param name="ping" value="25" />
    <param name="context" value="T38FAX-inbound" />
    </gateway>
    </include>
    T38Fax Gateway Configuration: /etc/freeswitch/sip_profiles/external/t38fax.xml

    Please ensure that you've replaced the following "generic" values with the associated account information from your T38Fax.com account:

    SIP_USERNAME

    SIP_PASSWORD

    3. Create an Inbound Route for each DID you'd like to route from T38Fax.com to your FreeSWITCH installation. We'll also define the context here to make adding additional routes easier. Create the following file: /etc/freeswitch/dialplan/T38FAX-inbound.xml

    <!--
    NOTICE:
    This context is accessed by inbound calls from T38FAX.com.
    -->
    
    <!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
    <include>
    <context name="T38FAX-inbound">
    
    <extension name="unloop">
    <condition field="${unroll_loops}" expression="^true$"/>
    <condition field="${sip_looped_call}" expression="^true$">
    <action application="deflect" data="${destination_number}"/>
    </condition>
    </extension>
    
    <!--
    Tag anything pass-through here as an outside_call so you can make sure not
    to create any routing loops based on the conditions that it came from 
    the outside of the switch.  
    -->
    
    <extension name="outside_call" continue="true">
    <condition>
    <action application="set" data="outside_call=true"/>
    <action application="export" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/>
    </condition>
    </extension>
    
    <extension name="call_debug" continue="true">
    <condition field="${call_debug}" expression="^true$" break="never">
    <action application="info"/>
    </condition>
    </extension>
    
    <!--
    You can place files in the T38FAX-inbound directory to get included.
    -->
    <X-PRE-PROCESS cmd="include" data="T38FAX-inbound/*.xml"/>
    </context>
    </include>
    T38Fax Inbound Route Configuration: /etc/freeswitch/dialplan/T38FAX-inbound.xml

    For each DID you wish to configure, add an XML definition in the T38FAX-inbound directory, where DIDX is replaced with the number you wish to route: /etc/freeswitch/dialplan/T38FAX-inbound/DIDX.xml

    <include>
    <extension name="DIDX">
    <condition field="destination_number" expression="^DIDX$">
    <action application="transfer" data="EXT_NUMBER XML faxext"/>
    </condition>
    </extension>
    </include>
    T38Fax Inbound Route: /etc/freeswitch/dialplan/T38FAX-inbound/DIDX.xml

    Please ensure that you've replaced the following "generic" values with the associated account information from your T38Fax.com account:

    DIDX

    EXT_NUMBER

    4. Next, we'll define the "faxext" context. Create the following file: /etc/freeswitch/dialplan/faxext.xml

    <!--
    NOTICE:
    This context is for fax extensions.
    Fax extensions need to have the user_context variable set to "faxext".
    -->
    <!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
    <include>
    <context name="faxext">
    
    <extension name="unloop">
    <condition field="${unroll_loops}" expression="^true$"/>
    <condition field="${sip_looped_call}" expression="^true$">
    <action application="deflect" data="${destination_number}"/>
    </condition>
    </extension>
    
    <extension name="global" continue="true">
    <condition field="${call_debug}" expression="^true$" break="never">
    <action application="info"/>
    </condition>
    </extension>
    
    <extension name="t38fax-setup" continue="true">
    <condition break="never">
    <action application="export" data="fax_enable_t38=true" />
    <action application="export" data="fax_enable_t38_request=true" />
    <action application="export" data="t38_passthru=true" />
    <action application="export" data="fax_use_ecm=true" />
    <action application="export" data="absolute_codec_string=PCMU" />
    </condition>
    </extension>
    
    <!--
    You can place files in the faxext directory to get included.
    -->
    <X-PRE-PROCESS cmd="include" data="faxext/*.xml"/>
    </context>
    </include>
    T38Fax "faxext" context configuration: /etc/freeswitch/dialplan/faxext.xml

    Then define your pass-through extensions within the "faxext" directory:

    <include>
    <extension name="EXT_NUMBER">
    <condition field="destination_number" expression="^(EXT_NUMBER)$">
    <!--
    You could use the following bridge line instead of the one below this comment if
    you need the "To:" SIP header to contain the extension number instead of the
    contact value registered by the endpoint.
    
    <action application="bridge" data="${sofia_contact(user/$1@${domain_name})}^$1"/>
    -->
    <action application="bridge" data="user/$1@${domain_name}"/>
    </condition>
    </extension>
    </include>
    T38Fax pass-through Extension: /etc/freeswitch/dialplan/faxext/EXT_NUMBER.xml

    Please ensure that you've replaced the following "generic" values with the associated account information from your T38Fax.com account:

    EXT_NUMBER

    5. Create Outbound Routes that will allow you to dial 10 or 11 digits when using our SIP trunks. Create the following file: /etc/freeswitch/dialplan/faxext/t38fax.com.xml

    <extension name="t38fax.com" >
    <condition field="${toll_allow}" expression="domestic"/>
    <condition field="destination_number" expression="^(?:[+]?1)?([2-9]\d{9})$">
    <action application="set" data="hangup_after_bridge=true"/>
    <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
    <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
    <action application="set" data="inherit_codec=true"/>
    <action application="set" data="ignore_display_updates=true"/>
    <action application="set" data="callee_id_number=1$1" />
    <action application="set" data="continue_on_fail=false"/>
    <action application="export" data="fax_enable_t38=true"/>
    <action application="export" data="fax_enable_t38_request=false"/>
    <action application="export" data="t38_passthru=true"/>
    <action application="export" data="fax_use_ecm=true"/>
    <action application="export" data="absolute_codec_string=PCMU"/>
    <action application="bridge" data="sofia/gateway/t38fax.com/1$1"/>
    </condition>
    </extension>
    T38Fax Outbound Route Configuration: /etc/freeswitch/dialplan/faxext/t38fax.com.xml

    6. Create an extension to register your ATA to FreeSWITCH. A general example is included below. Create the following file where EXT_NUMBER is your desired extension number: /etc/freeswitch/directory/default/EXT_NUMBER.xml

    <include>
    <user id="EXT_NUMBER">
    <params>
    <param name="password" value="ATA_PASSWORD"/>
    </params>
    <variables>
    <variable name="toll_allow" value="domestic,international,local"/>
    <variable name="accountcode" value="EXT_NUMBER"/>
    <variable name="user_context" value="faxext"/>
    <variable name="effective_caller_id_name" value="Extension EXT_NUMBER"/>
    <variable name="effective_caller_id_number" value="EXT_NUMBER"/>
    <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
    <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
    <variable name="callgroup" value="faxext"/>
    </variables>
    </user>
    </include>
    T38Fax Extension Configuration: /etc/freeswitch/directory/default/EXT_NUMBER.xml

    Please ensure that you've replaced the following "generic" values with the associated account information from your T38Fax.com account:

    EXT_NUMBER

    ATA_PASSWORD

    At this time, you should be able to successfully send a fax using T.38 pass-through to your ATA. Feel free to test by sending a single page fax to: 215-825-8792, and the system will fax your transmission back to you once it's successfully received it.

  • 1. Sign up for a Free Trial account here: Free Trial Signup

    2. You'll need to create the following XML file to register your FreeSWITCH installation to T38Fax.com. Create the following file: /etc/freeswitch/sip_profiles/external/t38fax.xml

    <include>
    <gateway name="t38fax.com">
    <param name="username" value="SIP_USERNAME" />
    <param name="password" value="SIP_PASSWORD" />
    <param name="realm" value="sip.t38fax.com" />
    <param name="from-domain" value="sip.t38fax.com" />
    <param name="proxy" value="sip.t38fax.com:5080" />
    <param name="expire-seconds" value="300" />
    <param name="register" value="true" />
    <param name="retry-seconds" value="30" />
    <param name="caller-id-in-from" value="true" />
    <param name="ping" value="25" />
    <param name="context" value="T38FAX-inbound" />
    </gateway>
    </include>
    T38Fax Gateway Configuration: /etc/freeswitch/sip_profiles/external/t38fax.xml

    Please ensure that you've replaced the following "generic" values with the associated account information from your T38Fax.com account:

    SIP_USERNAME

    SIP_PASSWORD

    3. Create an Inbound Route for each DID you'd like to route from T38Fax.com to your FreeSWITCH installation. We'll also define the context here to make adding additional routes easier. Create the following file: /etc/freeswitch/dialplan/T38FAX-inbound.xml

    <!--
    NOTICE:
    This context is accessed by inbound calls from T38FAX.com.
    -->
    
    <!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
    <include>
    <context name="T38FAX-inbound">
    
    <extension name="unloop">
    <condition field="${unroll_loops}" expression="^true$"/>
    <condition field="${sip_looped_call}" expression="^true$">
    <action application="deflect" data="${destination_number}"/>
    </condition>
    </extension>
    
    <!--
    Tag anything pass thru here as an outside_call so you can make sure not
    to create any routing loops based on the conditions that it came from 
    the outside of the switch.  
    -->
    
    <extension name="outside_call" continue="true">
    <condition>
    <action application="set" data="outside_call=true"/>
    <action application="export" data="RFC2822_DATE=${strftime(%a, %d %b %Y %T %z)}"/>
    </condition>
    </extension>
    
    <extension name="call_debug" continue="true">
    <condition field="${call_debug}" expression="^true$" break="never">
    <action application="info"/>
    </condition>
    </extension>
    
    <!--
    You can place files in the T38FAX-inbound directory to get included.
    -->
    <X-PRE-PROCESS cmd="include" data="T38FAX-inbound/*.xml"/>
    </context>
    </include>
    T38Fax Inbound Route Configuration: /etc/freeswitch/dialplan/T38FAX-inbound.xml

    For each DID you wish to configure, add an XML definition in the T38FAX-inbound directory, where DIDX is replaced with the number you wish to route: /etc/freeswitch/dialplan/T38FAX-inbound/DIDX.xml

    <include>
    <extension name="DIDX">
    <condition field="destination_number" expression="^DIDX$">
    <action application="transfer" data="EXT_NUMBER XML faxext"/>
    </condition>
    </extension>
    </include>
    T38Fax Inbound Route: /etc/freeswitch/dialplan/T38FAX-inbound/DIDX.xml

    Please ensure that you've replaced the following "generic" values with the associated account information from your T38Fax.com account:

    DIDX

    EXT_NUMBER

    4. Next, we'll define the "faxext" context. Create the following file: /etc/freeswitch/dialplan/faxext.xml

    <!--
    NOTICE:
    This context is for fax extensions.
    Fax extensions need to have the user_context variable set to "faxext".
    -->
    <!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
    <include>
    <context name="faxext">
    
    <extension name="unloop">
    <condition field="${unroll_loops}" expression="^true$"/>
    <condition field="${sip_looped_call}" expression="^true$">
    <action application="deflect" data="${destination_number}"/>
    </condition>
    </extension>
    
    <extension name="global" continue="true">
    <condition field="${call_debug}" expression="^true$" break="never">
    <action application="info"/>
    </condition>
    </extension>
    
    <extension name="t38fax-setup" continue="true">
    <condition break="never">
    <action application="export" data="fax_enable_t38=true" />
    <action application="export" data="fax_enable_t38_request=true" />
    <action application="export" data="t38_passthru=true" />
    <action application="export" data="fax_use_ecm=true" />
    <action application="export" data="absolute_codec_string=PCMU" />
    </condition>
    </extension>
    
    <!--
    You can place files in the faxext directory to get included.
    -->
    <X-PRE-PROCESS cmd="include" data="faxext/*.xml"/>
    </context>
    </include>
    T38Fax "faxext" context configuration: /etc/freeswitch/dialplan/faxext.xml

    Then create the "faxext" directory:

    T38Fax termination extension folder: /etc/freeswitch/dialplan/faxext/

    5. Finally, define an extension to receive the fax via FreeSWITCH. Please note that this will simply create the associated .tif file, and that these instructions do not include emailing or otherwise manipulating the fax file once received:

    <include>
    <extension name="EXT_NUMBER">
    <condition field="destination_number" expression="^(EXT_NUMBER)$">
    <action application="answer"/>
    <action application="playback" data="silence_stream://2000"/>
    <action application="rxfax" data="/tmp/FAX-${uuid}.tif"/>
    <action application="hangup"/>
    </condition>
    </extension>
    </include>
    T38Fax FreeSWITCH Termination Extension: /etc/freeswitch/dialplan/faxext/EXT_NUMBER.xml

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Didn't find what you were looking for?

Submit a request