wanpipe/api/xmtp2api-v1.6/README

225 lines
7.3 KiB
Plaintext

MTP2 API
For Latest Info Visit
http://wiki.sangoma.com/wanpipe-aft-ss7-mtp2-api
Introduction
The Wanpipe MTP2 API provides a custom ss7 developer access to Sangoma's Kernel SS7 MTP2 stack that runs over Sangoma AFT Series T1/E1 cards. The MTP2 API is written as a library in C and works in conjunction with wanpipe mtp2 kernel drivers.
MTP2 API contains the following files:
mtp2api.c -> example main code
libxmtp2.c -> mtp2 api library
libxmtp2.y -> mtp2 api library header
Architecture
mtp2api # custom ss7 application
|
/dev/xmtp20 # kernel device
|
| xmtp2km | # MTP2 Stack / kernel module
|
| wanpipe | # Wanpipe Device Driver - Core
|
| AFT | # Sangoma AFT T1/E1 Hardware
Installation
1. Download latest Wanpipe MTP2 Release From:
-> ftp.sangoma.com/linux/custom/mtp2api
2. Untar wanpipe-<version>.tgz
3. cd wanpipe-<version>
4. ./Setup install
-> proceed with default options until COMPILATION
-> specify compilation mode 4 (SMG/SS7)
-> proceed with default options for rest of installation
5. To confirm successful install
-> wanrouter hwprobe
6. Download MTP2API Library / Sample code from
-> ftp.sangoma.com/linux/custom/mtp2api
Configuration
From the above architectural diagram one needs to configure the following:
1. Wanpipe AFT T1/E1 timeslot configuration per devices per link
Each T1/E1 port/timeslot is configued using /etc/wanpipe/wanpipe#.conf configuration file.
The wanpipe#.conf configuration files are created using wancfg_smg configurator.
The AFT T1/E1 cards be configured for
-> MTP2 API T1/E1 channels Only
-> MTP2 API T1/E1 channels + TDM API Voice Channels
2. MTP2 Stack configuration for each mtp2 link
The MTP2 stack configuration is done via MTP2 API, in custom ss7 application
Configuration Sequence
1. Configure wanpipe device driver + AFT hardware T1/E1 time slots
-> use: wancfg_smg configurator
2. Develop mtp2api custom application that will configure the xmtp2km kernel stack
for each mtp2 link that is associated to the T1/E1 time slot.
Wanpipe AFT T1/E1 time slot configuration
MTP2 API T1/E1 channels only
1. Use: wancfg_smg configurator
-> wancfg_smg
-> For each port specify T1/E1/Clocking
-> Select XMTP2 Only Configuration
-> MTP2 channels for each T1/E1 timeslot
2. Please consult your telco on line configuration.
3. The wanpipe configuration files will be saved in
-> /etc/wanpipe/wanpipe#.conf where # = { 1, 2, 3 .. }
MTP2 API T1/E1 channels + TDM API Voice Channels
1. Run wancfg_smg configurator
-> wancfg_smg
-> For each port specify T1/E1/Clocking
-> Select XMTP2 + Voice Configuration
-> MTP2 channels for each T1/E1 timeslot
2. Please consult your telco on line configuration.
3. The wanpipe configuration files will be saved in
-> /etc/wanpipe/wanpipe#.conf where # = { 1, 2, 3 .. }
Operation
Once the wanpipe devices are configured for MTP2, for each T1/E1 time slot, one must develop the mtp2api application to configure each MTP2 link in the kernel xmtp2km stack.
The mtp2api application MUST be started before starting wanpipe devices! The reason for this is that MTP2 links must be configured before physical devics are started.
1. Edit mtp2api.c file and configure the XMTP2 ports based on above wancfg_smg configuration.
2. Search for: /* MTP2 Configuration based on wancfg_smg configurator */
You will see MTP2 configuration for each link and each wanpipe card device.
/* MTP2 Configuration based on wancfg_smg configuration */
for (i=0;i<16;i++) {
/* Initialize Local MTP2 Device Structure: Likset 0 Link 0 */
mtp2dev = &mtp2_dev_idx[MTP2_DEV_KEY(0,i)];
memset(mtp2dev,0,sizeof(mtp2_dev_t));
mtp2dev->init=1;
mtp2dev->state=LINK_NOT_CONNECTED;
mtp2dev->cfg.card=1; /* Number corresponding to wanpipe config file number: wanpipe1.conf */
mtp2dev->cfg.slot=i; /* T1/E1 timeslot/interface number -> corresponds to interface number
in wanpipe interface name - w1g1 in wanpipe1.conf */
mtp2dev->cfg.clear_ch=1; /* 1=8bit hdlc 0=7bit hdlc */
mtp2dev->cfg.linkset=0; /* LinkSet number */
mtp2dev->cfg.link=i; /* Link in LinkSet */
mtp2dev->cfg.mtu=80*1; /* Block size per timeslot configured */
/* Configure MTP2 Timters */
mtp2dev->cfg.cfg_T1 = MTP2_SEC_MS(13.0);
mtp2dev->cfg.cfg_T2 = MTP2_SEC_MS(11.5);
mtp2dev->cfg.cfg_T3 = MTP2_SEC_MS(11.5);
mtp2dev->cfg.cfg_T4Pe = MTP2_SEC_MS(0.6);
mtp2dev->cfg.cfg_T4Pn = MTP2_SEC_MS(2.30);
mtp2dev->cfg.cfg_T5 = MTP2_SEC_MS(0.12);
mtp2dev->cfg.cfg_T6 = MTP2_SEC_MS(3.0);
mtp2dev->cfg.cfg_T7 = MTP2_SEC_MS(1.0);
mtp2dev->rx_msu=mtp2_rx_msu;
mtp2dev->state_change=mtp2_state_change;
mtp2dev->fd=fd;
/* Stop current MTP2 Link */
err=xmtp2_stop_link (fd, &mtp2dev->cfg);
if (err) {
exit(-1);
}
/* Configure MTP2 Link */
err=xmtp2_conf_link (fd, &mtp2dev->cfg);
if (err) {
exit(-1);
}
/* Power ON MTP2 Link */
err=xmtp2_cmd (fd, mtp2dev->cfg.linkset, mtp2dev->cfg.link, LSC_CAUSE_POWER_ON, MGMT);
if (err) {
exit(-1);
}
/* Start physical T1/E1 channel for the configured MTP2 Link
If the port is already running this command will be skipped,
The /etc/wanpipe/wanpipe#.conf file must be properly configured */
err=xmtp2_start_facility(mtp2dev->cfg.card,mtp2dev->cfg.slot);
if (err) {
exit (-1);
}
mtp2dev=NULL;
}
3. The above configuration must match for each wanpipe#.conf file created
using wancfg_smg.
Based on above configuration mtp2api.c will start each wanpipe channel device
on application start. This done in:
/* Stop wanpipe devices associated with MTP2 Links */
xmtp2_start_facility(card,slot);
section of the code.
Once the mtp2api.c application starts it will
1. Load xmtp2km module
2. Configure each linkset and link in the module
3. Start all wanpipe devices related to linkset and link
4. Once the T1/E1 link comes up
5. The mtp2api will try to bring the links into SERVICE
6. Once Link is in SERVICE mtp2api will start transmitting
MSU of 10 bytes long every 10 seconds on each MTP2 linkset/link.
Based on this application one can develop other SS7 Stacks over the XMTP2 API.
Contact
=======
For more info contact
Nenad Corbic