Skip to main content

Openzap.sangoma.libpri

Click here to expand Table of Contents

Disclaimer

This page is a work-in-progress and I reserve the right to be totally wrong.

Introduction

This brief note documents the steps required to download, install, and configure the various drivers, modules and configuration required to support PRI with Sangoma A10x cards and libpri. The steps are based the Centos 5.3 i386 OS, may not be exactly the same for other operating systems and versions.

Installation

Sangoma Wanpipe Driver and Utilities

1. Download the driver software from the Sangoma site. The latest version of the driver software which seems to work well is 3.4.1.
2. Untar the driver code, make, and install (if not already done, install flex, bison, libtermcap-devel, kernel-devel, autoconf, automake, subversion, and libtool first)

cd /usr/local/src
tar -xzvf wanpipe-3.4.1.tgz
cd wanpipe-3.4.1
make all_src
make install
cd api/libsangoma
./configure --prefix=/usr
make
make install
cd ../..

3. Configure your wanrouter using the Setup utility.

# ./Setup install

4. Configure your PRI spans using the wancfg_fs utility.

# wancfg_fs

Configure all your channels. (In case of EuroISDN (dialect=Q931), set HW HDLC channel to 16).

5. Install the init.d script and links using the Setup utility.

# ./Setup install_init
 
----------------------------------------------------------
WANPIPE v3.4.1 Installation Script
Copyright (c) 1995-2009, Sangoma Technologies Inc.
----------------------------------------------------------


WANPIPE BOOTSTRAP CONFIGURATION
Your system uses System V -style initialization scripts. You have an option
to add router start-up script to those scripts so that the router will start
automatically when system enters multi-user mode and shut down when it enters
single-user mode or when it is halted.


i.e. By selecting this option WANPIPE will startup on system bootup and
stop on system shutdown.


Would you like to install WANPIPE start-up scripts? (y/n) y


########################################################################
# Sangoma Wanpipe #
# Dahdi/Zaptel/SMG/TDMAPI/BOOT Configuration Script #
# v2.32 #
# Sangoma Technologies Inc. #
# Copyright(c) 2009. #
########################################################################


Current boot level is 3


Wanrouter boot scripts configuration...


Removing existing wanrouter boot scripts...OK
Verifying boot scripts...
Enabling wanrouter boot scripts ...(level:8)
Enabling wanrouter shutdown scripts ...(level:91)
/etc/rc.d/rc4.d/S08wanrouter
/etc/rc.d/rc0.d/K91wanrouter
/etc/rc.d/rc6.d/K91wanrouter
/etc/rc.d/rc5.d/S08wanrouter
/etc/rc.d/rc3.d/S08wanrouter
/etc/rc.d/init.d/wanrouter
/etc/rc.d/rc2.d/S08wanrouter
/etc/rc.d/rc1.d/K91wanrouter

libpri ISDN Library

  1. Download the library software from the Digium site. Version 1.14.10 seems to work well.
  2. Untar the driver code, make, and install.
cd /usr/local/src
tar -xzvf libpri-1.4.10.tar.gz
cd libpri-1.4.10
make
make install

The libpri software is made available under the GPL license, which is not distribution compatible with the MPL license used by FreeSWITCH. Because of this, libpri may not be included in any FreeSWITCH distribution, but can be added to FreeSWITCH by the end-user (you) for their own use.

FreeSWITCH

modules.conf

Uncomment the line for mod_openzap in modules.conf.

#endpoints/mod_skypiax
../../libs/openzap/mod_openzap
#event_handlers/mod_event_multicast

 ####
Build

Run configure with the --with-libpri option, then build and install FreeSWITCH.

./configure --with-libpri
make
make install

 ## Configuration

Sangoma T1/E1 Cards

The Sangoma hardware must be installed to continue.

Hardware Probe

  1. Run the hwprobe utility to discover and report on Sangoma hardware installed in the platform.
  2. Make note of the SLOT and BUS of the T1/E1 device -- this will be required in the next step.
# wanrouter hwprobe


-------------------------------
| Wanpipe Hardware Probe Info |
-------------------------------
1 . AFT-A101-SH : SLOT=4 : BUS=3 : IRQ=5 : CPU=A : PORT=1 : HWEC=32 : V=34


Card Cnt: A101-2=1


wanpipen.conf

A seperate wanpipen.conf file is required for each T1 or E1 span to used by FreeSWITCH. The first file would be named wanpipe1.conf, the second wanpipe2.conf, etc. Create the /etc/wanpipe/wanpipe_n.conf file with using a text editor (recommended). The Sangoma _wancfg_fs utility can also be used to create the /etc/wan/wanpipe1.conf file, but it may need to be modified manually after.

  1. The [devices] section describes device name and the type of hardware. The device name should match the span number. For example, wanpipe1 would be used for span1, wanpipe2 would be used for span2. For Samgoma A101/A102/A104/A108 T1/E1 cards, the hardware is WAN_AFT_TE1.
  2. The [interfaces] section describes interface name, device name, and the interface API for a span. The interface and device names should match the span number. For example, w1g1 would be used for span1, w2g1 would be used for span2. FreeSWITCH requires that the TDM_VOICE_API be configured.
  3. PCISLOT and PCIBUS should be the same as the values reported for SLOT and BUS by the hwprobe utility.
  4. FE_MEDIA should be set to either T1 or E1 -- depending what the TDM interface will be connecting to. The span number is also used in the conf/openzap.conf file.
  5. FE_LCODE defines the zero suppression method to be used on the TDM interface. Valid values are B8ZS and AMI for T1, and HDB3 or AMI for E1 spans.
  6. TE_FRAME defines the framing structure to be used on the TDM interface. Valid values are ESF and D4 for T1 (D4 in this context means Super Frame, ESF means Extended Superframe. By default in NA, ESF is your default value.) , and CRC4 or NCRC4 for E1 spans.
  7. FE_CLOCK specifies which end of the TDM link provides the master clock for synchronization. A value of NORMAL indicates that the other end (typically the PSTN telco) is the master (this is the most common). A value of MASTER indicates that the card is the master (possibly when using a two span card, where one span connects to the PSTN and the other span connects to another PBX or channel bank). (Normal = Derived Clock, master = internal clock)
  8. TDMV_LAW specifies the coding for voice content. Normally MULAW is used for T1, and ALAW is used for E1.
  9. TDMV_SPAN defines the span number. The span number is also used in the conf/openzap.conf file.
  10. TDMV_DCHAN defines the timeslot to be used for D-channel signalling. Timeslot 24 is normally used with T1, and timeslot 16 for E1. The span number is also used in the conf/openzap.conf file. If set to 0, no D-channel will be configured.
  11. TDMV_HW_DTMF specifies if hardware-based DTMF detection should be enabled (this is only available if the card is equipped with a echo cancellation module and TDMV_HWEC is set to YES). This should be set to NO to work-around a open issue).
[devices]
wanpipe1 = WAN_AFT_TE1


[interfaces]
w1g1 = wanpipe1, , TDM_VOICE_API, Comment
[wanpipe1]
CARD_TYPE = AFT
S514CPU = A
CommPort = PRI
AUTO_PCISLOT = NO
PCISLOT = 4
PCIBUS = 3
FE_MEDIA = T1
FE_LCODE = B8ZS
FE_FRAME = ESF
FE_LINE = 1
TE_CLOCK = NORMAL
TE_REF_CLOCK = 0
TE_HIGHIMPEDA = NO
LBO = 0DB
FE_TXTRISTATE = NO
MTU = 1500
UDPPORT = 9000
TTL = 255
IGNORE_FRONT_END = NO
TDMV_LAW = MULAW
TDMV_SPAN = 1
TDMV_DCHAN = 24
TDMV_HW_FAX_DETECT = NO
TDMV_HW_DTMF = NO


[w1g1]
ACTIVE_CH = ALL
TDMV_HWEC = YES
MTU = 80
IDLE_FLAG = 0x7E

wanrouter.rc

The WAN_DEVICES line in the wanrouter.rc file must be updated to include all the wanpipen configurations (do not inclide the .conf file suffix).

WAN_DEVICES="wanpipe1 wanpipe2"

FreeSWITCH Configuration Files

openzap.conf

Modify the conf/openzap.conf file to match your hardware configuration.

  1. Assign a meaningful name for the span following the keyword wanpipe to the in the section header (PRI_1 in the example). This name is also used in the openzap.conf.xml configuration file.
  2. The number parameter must be the same as the value of TDMV_SPAN in the associated wanpipe configuration file.
  3. The trunk_type must be the same as the value of FE_MEDIA in the associated wanpipe configuration file.
  4. The d-channel parameter has two values, separated by a colon (:). The left-hand-side indicates the span where the d-channel is located. This should be the same as the value of TDMV_SPAN in the associated wanpipe configuration file. The right hand-side indicates the timeslot where the d-channel is located. This should be the same as the value of TDMV_DCHAN in the associated wanpipe configuration file.
  5. The b-channel parameter also has two values, separated by a colon (:). The left-hand-side indicates the span where the b-channels are located. This should be the same as the value of TDMV_SPAN in the associated wanpipe configuration file. The right hand-side indicates the timeslots where the b-channel are located. These should be all other timeslots on the span (all except the timeslot being used for the d-channel).
[span wanpipe PRI_1]
name => OpenZAP
number => 1
trunk_type => t1
b-channel => 1:1-23
d-channel => 1:24

Example for Q931 (Euroisdn) with 2 PRI channels

[span wanpipe PRI_1]
name => OpenZAP
number => 1
trunk_type => e1
b-channel => 1:1-15
d-channel => 1:16
b-channel => 1:17-31
[span wanpipe PRI_2]
name => OpenZAP
number => 2
trunk_type => e1
b-channel => 2:1-15
d-channel => 2:16
b-channel => 2:17-31

openzap.conf.xml

Modify the conf/autoload_configs/openzap.conf.xml to match. Spans using libpri are configured within the <libpri_spans> tags.

  1. The name attribute of the span tag must be set to the name assigned in the openzap.conf configuration file.
  2. The value of the node parameter must be set to either cpe (or user) or net (or network). The value cpe is normally used when the span in connected to a PSTN telco. When connecting to another PBX, the value must be coordinated with the other system. One end must be cpe and the other net.
  3. The value of the switch parameter must be set to either ni1, ni2, dms100, lucent5e, att4ess, or euroisdn. The ISDN variant configured should match the configuration on the connecting switch.
<configuration name="openzap.conf" description="OpenZAP Configuration">
<settings>
<param name="debug" value="1"/>
<!--<param name="hold-music" value="$${moh_uri}"/>-->
</settings>
<libpri_spans>
<span name="PRI_1">
<param name="node" value="cpe"/>
<param name="switch" value="ni2"/>
<param name="dialplan" value="XML"/>
<param name="context" value="public"/>
</span>
</libpri_spans>
</configuration>

modules.conf.xml

Modify the conf/autoload_configs/modules.conf.xml and remove the XML comment tags around the line for mod_openzap.

<!-- <load module="mod_woomera"/> -->
<load module="mod_openzap"/>
<!-- <load module="mod_unicall"/> -->

Operation

Sangoma wanrouter

Start the wanpipe service to load the kernel modules, configure and start the drivers, and bring-up the TDM interfaces. Start the wanrouter

# service wanrouter start


Starting WAN Router...
Loading WAN drivers: wanpipe done.
Starting up device: wanpipe1
--> Loading ec image OCT6116-64S.ima...
Configuring interfaces: w1g1
done.

NOTE: Make sure that you are not running sangoma_prid. Stop sangoma_prid by using smg_ctrl stop.

FreeSWITCH

Start FreeSWITCH and conform that openzap successfully opens and starts all configured channels.

...
2009-06-16 17:25:32.623714 [NOTICE] zap_io.c:2609 Modules configured: 1
2009-06-16 17:25:32.624071 [INFO] zap_io.c:2430 Loading IO from /usr/local/freeswitch/mod/ozmod_wanpipe.so [wanpipe]
2009-06-16 17:25:32.624130 [INFO] zap_io.c:2230 auto-loaded 'wanpipe'
2009-06-16 17:25:32.624250 [INFO] ozmod_wanpipe.c:261 configuring device s1c1 as OpenZAP device 1:1 fd:38 DTMF: software
2009-06-16 17:25:32.624286 [INFO] ozmod_wanpipe.c:261 configuring device s1c2 as OpenZAP device 1:2 fd:39 DTMF: software
2009-06-16 17:25:32.624309 [INFO] ozmod_wanpipe.c:261 configuring device s1c3 as OpenZAP device 1:3 fd:40 DTMF: software
2009-06-16 17:25:32.624347 [INFO] ozmod_wanpipe.c:261 configuring device s1c4 as OpenZAP device 1:4 fd:41 DTMF: software
2009-06-16 17:25:32.624381 [INFO] ozmod_wanpipe.c:261 configuring device s1c5 as OpenZAP device 1:5 fd:42 DTMF: software
2009-06-16 17:25:32.624412 [INFO] ozmod_wanpipe.c:261 configuring device s1c6 as OpenZAP device 1:6 fd:43 DTMF: software
2009-06-16 17:25:32.624434 [INFO] ozmod_wanpipe.c:261 configuring device s1c7 as OpenZAP device 1:7 fd:44 DTMF: software
2009-06-16 17:25:32.624461 [INFO] ozmod_wanpipe.c:261 configuring device s1c8 as OpenZAP device 1:8 fd:45 DTMF: software
2009-06-16 17:25:32.624493 [INFO] ozmod_wanpipe.c:261 configuring device s1c9 as OpenZAP device 1:9 fd:46 DTMF: software
2009-06-16 17:25:32.624529 [INFO] ozmod_wanpipe.c:261 configuring device s1c10 as OpenZAP device 1:10 fd:47 DTMF: software
2009-06-16 17:25:32.624563 [INFO] ozmod_wanpipe.c:261 configuring device s1c11 as OpenZAP device 1:11 fd:48 DTMF: software
2009-06-16 17:25:32.624599 [INFO] ozmod_wanpipe.c:261 configuring device s1c12 as OpenZAP device 1:12 fd:49 DTMF: software
2009-06-16 17:25:32.624632 [INFO] ozmod_wanpipe.c:261 configuring device s1c13 as OpenZAP device 1:13 fd:50 DTMF: software
2009-06-16 17:25:32.624671 [INFO] ozmod_wanpipe.c:261 configuring device s1c14 as OpenZAP device 1:14 fd:51 DTMF: software
2009-06-16 17:25:32.624712 [INFO] ozmod_wanpipe.c:261 configuring device s1c15 as OpenZAP device 1:15 fd:52 DTMF: software
2009-06-16 17:25:32.624797 [INFO] ozmod_wanpipe.c:261 configuring device s1c16 as OpenZAP device 1:16 fd:53 DTMF: software
2009-06-16 17:25:32.624845 [INFO] ozmod_wanpipe.c:261 configuring device s1c17 as OpenZAP device 1:17 fd:54 DTMF: software
2009-06-16 17:25:32.624891 [INFO] ozmod_wanpipe.c:261 configuring device s1c18 as OpenZAP device 1:18 fd:55 DTMF: software
2009-06-16 17:25:32.624955 [INFO] ozmod_wanpipe.c:261 configuring device s1c19 as OpenZAP device 1:19 fd:56 DTMF: software
2009-06-16 17:25:32.624990 [INFO] ozmod_wanpipe.c:261 configuring device s1c20 as OpenZAP device 1:20 fd:57 DTMF: software
2009-06-16 17:25:32.625030 [INFO] ozmod_wanpipe.c:261 configuring device s1c21 as OpenZAP device 1:21 fd:58 DTMF: software
2009-06-16 17:25:32.625068 [INFO] ozmod_wanpipe.c:261 configuring device s1c22 as OpenZAP device 1:22 fd:59 DTMF: software
2009-06-16 17:25:32.625105 [INFO] ozmod_wanpipe.c:261 configuring device s1c23 as OpenZAP device 1:23 fd:60 DTMF: software
2009-06-16 17:25:32.625134 [INFO] ozmod_wanpipe.c:261 configuring device s1c24 as OpenZAP device 1:24 fd:61 DTMF: none
2009-06-16 17:25:32.625153 [INFO] zap_io.c:2353 Configured 24 channel(s)
2009-06-16 17:25:32.625451 [INFO] zap_io.c:2430 Loading IO from /usr/local/freeswitch/mod/ozmod_libpri.so [libpri]
2009-06-16 17:25:32.625478 [INFO] zap_io.c:2447 Loading SIG from /usr/local/freeswitch/mod/ozmod_libpri.so
2009-06-16 17:25:32.625489 [INFO] zap_io.c:2563 auto-loaded 'libpri'
...
2009-06-16 17:25:32.625526 [CONSOLE] switch_loadable_module.c:889 Successfully Loaded [mod_openzap]
2009-06-16 17:25:32.625539 [NOTICE] switch_loadable_module.c:142 Adding Endpoint 'openzap'
2009-06-16 17:25:32.625580 [NOTICE] switch_loadable_module.c:248 Adding Application 'disable_ec'
2009-06-16 17:25:32.625734 [NOTICE] switch_loadable_module.c:270 Adding API Function 'oz'
...
2009-06-16 17:25:37.154938 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:2
2009-06-16 17:25:37.655850 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:3
2009-06-16 17:25:38.151764 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:4
2009-06-16 17:25:38.645679 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:5
2009-06-16 17:25:39.152589 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:6
2009-06-16 17:25:39.647504 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:7
2009-06-16 17:25:40.153416 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:8
2009-06-16 17:25:40.648329 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:9
2009-06-16 17:25:41.153243 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:10
2009-06-16 17:25:41.651155 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:11
2009-06-16 17:25:42.151068 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:12
2009-06-16 17:25:42.654980 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:13
2009-06-16 17:25:43.155895 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:14
2009-06-16 17:25:43.655806 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:15
2009-06-16 17:25:44.151720 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:16
2009-06-16 17:25:44.647633 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:17
2009-06-16 17:25:45.155545 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:18
2009-06-16 17:25:45.654458 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:19
2009-06-16 17:25:46.149373 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:20
2009-06-16 17:25:46.656284 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:21
2009-06-16 17:25:47.151198 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:22
2009-06-16 17:25:47.655110 [NOTICE] ozmod_libpri.c:920 -- Restarting 1:23
...