Wanpipe TDM Voice API Solution
Wanpipe Release -> Download Here
-> TDM API Driver
-> LibSangoma User Library -> user space API.
Wanpipe TDM Voice API is currently supported on all AFT hardware.
Wanpipe Package Installation
Untar LATEST release
tar xvfz wanpipe-<version>.tgz
Change directory into wanpipe source directory
cd wanpipe-<version>/
Compile and install wanpipe driver
make make install
To confirm successful installation run:
wanrouter hwprobe
Wanpipe Package Configuration
Wanpipe drivers can be configured for 3 API modes
TDM SPAN Mode
Run: /usr/sbin/wancfg_span_tdmapi
-> Each board will configure the span for voice only mode or voice + dchan.-> Furthermore, Sangoma TDM SPAN API supports multiple DCHANS so on can configure
channels 1-10 as voice and 11-24 as HDLC DCHANS.TDM CHAN Mode
Run: /usr/sbin/wancfg_tdmapi
-> Each board will configure the span for voice only mode or voice + dchan.
-> Furthermore, Sangoma TDM API supports multiple DCHANS so on can configure
channels 1-10 as voice and 11-24 as HDLC DCHANS.DATA API Mode
Run: /usr/sbin/wancfg_data_api
-> For each card wancfg_data_api will configure the span for voice only mode or voice + dchan.
-> Furthermore, TDM API supports multiple DCHANS so on can configure
channels 1-10 as voice and 11-24 as HDLC DCHANS.
Note: For full description of wanpipe1.conf files please refer to attached samples below.
Wanpipe TDM API Startup & Operation
Once the above wanpipe port configuration is complete using wancfg_tdmapi configuration utility. One has to start all ports.
wanrouter start
->This command will load and configure wanpipe drivers
-> For full wanrouter usage click hereFull driver log and events are located in /var/log/messages
->tail -f /var/log/messages
At this point TDM driver is configured and ready to tx/rx voice & dchan data. One must make sure that ports are in connected state before trying to tx/rx data using the API programs.
-> wanrouter status #check status of all ports
-> wanpipemon -i w1g1 -c Ta #check T1/E1 alarms of each portOnce all ports are connected the ifconfig command can be used to confirm that card running.
-> ifconfig
The rx/tx data packets should be incrementing
The MTU value indicates the hardware chunk size
Any rx or tx errors indicate that something is wrong with the data flow.
-> overruns : indicate dma problems or mis-configured system.
Wanpipe TDMAPI Sample Code
Note: the /etc/wanpipe directory is created after wanpipe package installation.
Sample code for tdm api is installed in /etc/wanpipe/api/tdm_api directory.
cd /etc/wanpipe/api/tdm_api
or
cd /etc/wanpipe/api/libsangoma/examples/Read the README file on how to use sample applications
Wanpipe TDMAPI priserver Sample Code
The priserver sample code combines simple tdm_api sample file with libpri library.
The priserver is located in /etc/wanpipe/api/libsangoma/examples directory.
cd /etc/wanpipe/api/libsangoma/examples
make clean
make
make install
Note: if you get a compilation error with priserver you have not compile libsangoma with the libpri support. Pleaser refer to installing libsangoma with libpri below.
TDM API Sample Code Usage
aft_tdm_hdlc_test
This application is used to tx/rx HDLC data to and from a voice or dchan. It is useful as a CRC data test to confirm that all voice & dchan channels are working free of bit errors.
->./aft_tdm_hdlc_test wanpipe1 <span-chan device> <span-chan device> ....
->eg: ./aft_tdm_hdlc_test wanpipe1 s1c1
Start hdlc tx/rx on span 1 chan 1->eg: ./aft_tdm_hdlc_test wanpipe1 s1c1 s1c2
Start hdlc tx/rx on both span 1 chan 1 and span 1 chan 2With this application one can test the full card by specifying all spans and chans on the command line.
A small script is included in this directory that can simplify the use to this application
-> ./tdm_hdlc_test.sh "span list" "chan list"
-> eg: ./tdm_hdlc_test.sh 1 1 # Start hdlc test on span 1 chan 1
./tdm_hdlc_test.sh "1 2" 1 # Start hdlc test on chan 1 of span 1 & 2
./tdm_hdlc_test.sh 1 # Start hdlc test on all chans for span 1
Wanpipe TDM API in Production - Sangoma Media Gateway SMG
The Sangoma Media Gateway has been built on TDM API. Once can look at the the production code to see how one would use the TDM API to build a full media gateway applicatoins.
The Sangoma Media Gateway is located in every wanpipe release
cd wanpipe-<version>
cd ssmg/sangoma_mgd.trunk
vi sangoma_mgd.c
-> search for all instances of "sangoma_" these are all
libsangoma api functions used in the media gateway.
Wanpipe LibSangoma Installation
Libsangoma is installed automatically during the installation process!
These instructions are here for information sake, in case one wants to recompile libsangoma library.
The LibSangoma is installed in /etc/wanpipe/api/libsangoma
cd /etc/wanpipe/api/libsangoma
./configure
make
make install
Add library path /usr/local/lib into /etc/ld.so.conf
Run ldconfig to accept /etc/ld.so.conf changes.
Wanpipe LibSangoma with LibPRI Installation (Optional must be done manually)
Download libpri from www.asterisk.org and save it into /usr/src directory.
Untar libpri tgz file in /usr/src directory
Change directory into libpri and run: make; make install
cd /etc/wanpipe/api/libsangoma
./configure --with-libpri=/usr/src/<libpri directory>
make
make install
Add library path /usr/local/lib into /etc/ld.so.conf
Run ldconfig to accept /etc/ld.so.conf changes.
Sample API configuration Files
-> Voice API Configuration file:
-> Analog Voice API Config:
-> PRI-mode Voice API Config:
-> PRI-datascope-tap-mode: