WELCOME [ Log In · Register ]        SITE [ Search · Page Index · Recent Changes ]    RSS

Wanpipe API FreeTDM

FreeTDM is a signaling and board API abstraction used mainly by the FreeSWITCH project to place calls in TDM and analog telephony circuits. The library was previously named "OpenZAP". Sangoma has worked along with the FreeSWITCH developers in this library so Sangoma's customers can also use it to do custom development. The library is still under heavy development but the overall API does not change often. The intention of the library is to present a consistent API for different telephony signaling stacks.

 


-- Linux Installation. --


== Installation Pre-requisites ==

- Recommended Linux distribution is CentOS, but is not strictly required.
- GNU autotools: libtool, autoconf, automake, configure, gmake etc.
- Wanpipe Linux drivers (and libsangoma, which is included in the drivers package).

== Installation ==

1. Check out the code. The svn tree is at http://svn.openzap.org:81/svn/openzap/branches/sangoma_boost/

# svn co http://svn.openzap.org:81/svn/openzap/branches/sangoma_boost/

2. Configure the build environment (You will need the GNU autotools: libtool, autoconf, automake etc).

# cd sangoma_boost/
# ./boostrap
# ./configure

3. Compile.

# make
# make install

The FreeTDM library, headers and configuration will be installed by default at /usr/loca/freetdm (you can change that by specifying a different directory using the --prefix option to the configure script).

4. Install sangoma_prid and its libraries.

# cd src/ftmod/ftmod_sangoma_boost/bin/
# tar -xzf linux32.tar.gz
#  cd linux32/
# ./install.sh /usr/local/freeswitch

The installation directory must exists and contain a mod/ and lib/ sub directories. 

 


-- Windows Installation Instructions --


== Installation Pre-requisites ==

- Visual Studio 2008.
- Wanpipe Windows drivers which can be found at http://wiki.sangoma.com/wanpipe-windows-drivers. Below is the list of commands to run to install the drivers and libsangoma; insure the commands are ran in the order listed.This will create a "Program Files\Sangoma\" directory if this is not created remove driver and try again.

- setup.exe install_devel_files
- setup.exe install

- Once drivers are installed please copy the files inside of "Program Files\Sangoma\api\lib\(You're architecture)\" to "Program Files\Sangoma\lib\".

NOTE: This step will not be required in future releases

 

== Installation ==

1. Check out the code. The svn tree is at http://svn.openzap.org:81/svn/openzap/branches/sangoma_boost/, you can use TortoiseSVN client to get the code: http://tortoisesvn.net/
    I will refer to the directory you just checked out as $freetdm-svn.
2. Open the Visual Studio 2008 solution file $freetdm-svn/freetdm.2008.sln (there are other solution files for 2005 but those do not work for FreeTDM yet).
3. Build the solution. The generated DLL and LIB files should be at $freetdm-svn/Debug
4. Place the following DLLs where can be found by your application:

    freetdm.dll - This is the main DLL containing the FreeTDM API.
    ftdm_wanpipe.dll - I/O FreeTDM interface for Sangoma boards.
    ftdm_sangoma_boost.dll - Sangoma signaling abstraction for BRI, PRI and SS7 (SS7 not available on Windows yet).

5. In addition to the generated DLLs, there is also several DLL's that are part of the Sangoma PRI stack. These DLL's are distributed without source code and can be found at $freetdm-svn/src/ftmod_sangoma_boost/bin/win32.zip, just unzip the file and place all the DLL's in a place where can be found by your application.
6. Link your application to freetdm.lib to use the FreeTDM I/O and Signaling API.
7. Create the directory "C:/freetdm/", this directory will be used to place configuration files. If you want to change the path, it must be done using the macro FTDM_CONFIG_DIR during the build of FreeTDM.
8. Copy all the files within $freetdm-svn/conf/ to "C://freetdm/".

 


-- Configuration --


The following instructions assume the default configuration directory for FreeTDM (in Linux /usr/local/freetdm/conf and for Windows 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 a single T1 span.

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

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.

-- API Usage for E1/T1 boards --

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 $freetdm-svn/src/testsangomaboost.c (which has plenty of comments) for a sample Sangoma boost program using the FreeTDM API.