Configuration Overview

FreeTDM Configuration

The configuration of FreeTDM spans is the same either for Linux or Windows, only the location of the freetdm.conf file changes.

The following instructions assume the default configuration directory for FreeTDM (in Linux /usr/local/freetdm/conf and for Windows at c:/freetdm/)

  1. Edit freetdm.conf and remove everything there (the initial content is just a sample configuration for FXO/FXS channels). This is a sample configuration for 2 T1's meant to be used with Sangoma PRI stack.

[span wanpipe myPriLink]
trunk_type => T1
group => sangoma1
b-channel => 1:1-23
d-channel => 1:24 

[span wanpipe myPriLink2]
trunk_type => T1
group => sangoma2
b-channel => 2:1-23
d-channel => 2:24 

The syntax for the span header is [span <io type> <span name>], where in this sample the I/O type is "wanpipe" and the span name is any string, in this case "myPriLink" and "myPriLink2".

The following is an explanation of the parameters:

trunk_type => Defines the type of span (channel container) to configure, what follows must be any of these values:  "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM".

group => Sets the current dialing group name to use for any following "xx-channel" declaration that can be used to place calls like "b-channel, fxo-channel, fxs-channel" etc. Multiple "group" parameters may appear within the same [span] context to add channels to a different dialing group. This group name can then be used from a program via the FreeTDM API ftdm_channel_open_by_group() to select the first available channel to dial within a group.

b-channel => Channel range within a physical Wanpipe span. The format for this or any xx-channel configuration is <span>:<channel range begin>-<channel range end>. If no range is needed a single channel can be specified by omitting  the dash: <span>:<chan>.

Valid channel types: fxo-channel, fxs-channel, em-channel, b-channel, d-channel, cas-channel, b-channel.

For more detailed information on FreeTDM configuration see http://wiki.freeswitch.org/wiki/FreeTDM  .

FreeSWITCH Configuration

The configuration of FreeTDM spans inside FreeSWITCH is the same for Linux and Windows. This is a sample configuration for 2 PRI spans using Sangoma PRI stack. The configuration must be placed in config/autoload_configs/freetdm.conf.xml inside FreeSWITCH directory. Important settings are in bold.

<configuration name="freetdm.conf" description="FreeTDM Configuration">
<config_profiles>
<profile name="myCpeProfile">
<param name="interface" value="cpe"/>
<param name="switchtype" value="national"/>
</profile>
</config_profiles>
<sangoma_pri_spans>
<span name="myPriLink" cfgprofile="myCpeProfile">
<param name="dialplan" value="XML" />
<param name="context" value="default" />
</span> 
<span name="myPriLink2" cfgprofile="myCpeProfile">
<param name="dialplan" value="XML" />
<param name="context" value="default" />
</span>
</sangoma_pri_spans>
</configuration>

The span "name" must match the name you specified in freetdm.conf. For more information on valid PRI/BRI configuration paramters, go here: Telephony Cards for FreeSWITCH

 

FreeSWITCH/FreeTDM operation

To start using FreeTDM you can either add the mod_freetdm module to the conf/autoload_configs/modules.conf.xml or load it manually with "load mod_freetdm" inside the FreeSWITCH CLI.

 

FreeTDM API

The FreeTDM API allows you to configure spans and run a given signaling stack on a span. The basic model of work is:

  1. Initialize the library.

  2. Load the configuration.

  3. Configure a span providing the signaling stack to use, the parameters for that signaling (signaling specific parameters) and a function pointer to be used as callback to be notified about events.

  4. Run the span. This will launch one or several background threads (depending on the signaling stack) where all the signaling work will be done for this span.

  5. When you're done, your application must shutdown the stack, which will kill all the spans.

You can refer to libs/freetdm/src/testsangomaboost.c (which has plenty of comments) for a sample Sangoma boost program using the FreeTDM API.  There is also documentation in the main header file libs/freetdm/src/include/freetdm.h

We have also generated documentation with doxygen for the API: http://docs.sangoma.com:8060/doxygen/freetdm/

 

Q.931 to FreeTDM event maps

Q.931

FreeTDM Event

SETUP

FTDM_SIGEVENT_START

PROCEED 

FTDM_SIGEVENT_PROCEED

PROGRESS (without media)

FTDM_SIGEVENT_PROGRESS

PROGRESS (with media)

FTDM_SIGEVENT_PROGRESS_MEDIA

ALERT (without media)

FTDM_SIGEVENT_RINGING

ALERT  (with media)

FTDM_SIGEVENT_RINGING followed by SIGEVENT_PROGRESS_MEDIA

FACILITY

FTDM_SIGEVENT_FACILITY

DISCONNECT

FTDM_SIGEVENT_STOP

RELEASE/RELEASE COMPLETE        

FTDM_SIGEVENT_RELEASE

 

Return to Documentation Home I Return to Sangoma Support