LibSangoma Installation
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:
Â
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.
Â
->This command will load and configure wanpipe drivers
-> For full wanrouter usage click here ÂFull driver log and events are located in /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 port ÂOnce 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 2 ÂWith 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: