OpenZAP
From FreeSWITCH Wiki
OpenZAP is a driver that is capable of interfacing with both analog and PRI cards. The project implements a TDM abstraction library to provide an interface to TDM hardware as well as various signaling for T1/E1 interfaces.
Overview
Status
- Development is finished and testers are currently wanted.
- So far we have analog (only tested in US so far but we are working on UK too) and q.931 PRI signaling but we should be able to add more things like RBS as time progresses.
- The PRI stack is incomplete
License
BSD
History
Zaptel is actually a decendant of the original public domain tormenta driver made by Jim Dixon in 2000.
http://www.zapatatelephony.org/zap.c
http://www.zapatatelephony.org/zap.h
Our goal here is to pick up where this left off and keep the important functionality in the driver and the rest in user space. Eventually we hope to make our own platform-agnostic driver interface.
Design
We only use zaptel as a device via the socket opened on the operating system to access the low level features such as open close read write and the rest of the functionality is implemented in our own user space layer.
For clarification -- we simply speak to the zaptel kernel interface. In fact, we don't even use their header files to build. So if you have a card that requires modified drivers, then you would need to use those, but they should work as long as they maintain the same zaptel interface.
Getting started
Getting the code
mod_openzap is now included with SVN checkout of FreeSWITCH under libs/open_zap. Therefore, you do not have to download the svn.
However, if you have not checked out FreeSWITCH and would like to look at the OpenZAP code, you can browse the OpenZAP source code here or
Download via subversion:
svn co http://svn.openzap.org/svn/openzap/trunk openzap_trunk
Configuration
See Openzap.conf Examples and Openzap.conf.xml Examples. You will also need a zaptel.conf, since it is tied in with ztcfg into the kernel module configs.
NOTE: The installer does not create the necessary subdirectory. After checking out FreeSWITCH (or just OpenZAP) you can do this:
Create openzap directory in /etc
cd into the conf subdirectory of your mod_openzap directory, e.g.:
copy the config files into /etc/openzap
copy the openzap.conf.xml file into your FreeSWITCH conf directory:
You will, of course, need to edit both openzap.conf and openzap.conf.xml. Please see the above links to sample configs.
Openzap Installation
1. Make sure while compiling Freeswitch source, you have included ../../libs/openzap/mod_openzap in modules.conf (just need to uncomment it)
2. Make sure that you have loaded your country-specific tones at /etc/openzap/tones.conf. Check for your country-specific dial-tone/ring-tone/busy-tone etc in tones.conf because you can't make outbound calls on FXO unless you have proper tones configured.For eg, the tones.conf(India) will look like this tones.conf Example
NOTE: By default, tones.conf for USA is avaialable at ${freeswitch_src}/libs/openzap/conf/
Hardware/Driver compatibility
OpenZAP should work with the latest Sangoma TDM API as well as any Zaptel dating back to when there was only Tormenta 2.
The hardware support thus far includes Zaptel and native Sangoma TDM API. The existing codebase includes mod_openzap for FreeSWITCH that is currently functional with analog and Euro or DMS100 PRI.
Zaptel Installation
1. The FXO/FXS card should be installed first to verify the zaptel installation. (Make sure the system has internet connectivity as it downloads some utilities)
2. Download the zaptel-1.4.2.tar.gz from reliable sources. Untar the source tarball, compile and install it.
$tar -zxvf zaptel-1.4.2.tar.gz ....(I had to rely on this older zaptel version that works for me, as the newer ones were troubling me.) $cd zaptel-1.4.2 $./configure $make $make install $make config
3. Make sure you have the proper zaptel.conf in your /etc directory
4. Be cautious while configuring country zone in zaptel.conf at /etc. I didn't understand why we have to swap the channel numbers for FXS and FXO. For eg,
----- @/etc/zaptel.conf ----- loadzone=in defaultzone=in fxsks=4 fxoks=1
5. Add the wctdm and zaptel modules now.
$modprobe wctdm $modprobe zaptel
6. Now verify the installation with the ztcfg command
$ztcfg -vv Zaptel Version: 1.4.2 Echo Canceller: MG2 Configuration ====================== Channel map: Channel 01: FXO Kewlstart (Default) (Slaves: 01) Channel 04: FXS Kewlstart (Default) (Slaves: 04) 2 channels configured.
Setup
1. Once you are done with installing zaptel drivers and fixed the FXS/FXO card on your machine, the green LEDs(Digium TDM400 card in my case) on your card will start glowing. (that's good omen for you :-) )
3. At the time of running Freeswitch from /usr/local/freeswitch/bin/, make sure again that <load module ="mod_openzap"/> is included in /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
4.Make sure you see the Openzap FXS and FXO configuration messages on your console when you run Freeswitch. For example,
2008-05-01 18:10:32 [INFO] zap_zt.c:170 zt_open_range() configuring device /dev/zap/channel channel 1 as OpenZAP device 1:1 fd:33 2008-05-01 18:10:32 [INFO] zap_zt.c:170 zt_open_range() configuring device /dev/zap/channel channel 4 as OpenZAP device 2:1 fd:34 2008-05-01 18:10:32 [INFO] zap_io.c:1978 load_config() Configured 2 channel(s) 2008-05-01 18:10:32 [CONSOLE] switch_loadable_module.c:749 switch_loadable_module_load_file() Successfully Loaded [mod_openzap] 2008-05-01 18:10:32 [NOTICE] switch_loadable_module.c:139 switch_loadable_module_process() Adding Endpoint 'openzap' 2008-05-01 18:10:32 [NOTICE] switch_loadable_module.c:245 switch_loadable_module_process() Adding API Function 'oz'
5. Now you can take a ride on your Ozzzzzzz... zip zap zoom ;)
Dialplan Configuration
1. To bridge an inbound call to your FXS that is configured on channel 1, for an UA registered as 507@proxy.com configure as below
<extension name="incoming-fxs">
<condition field="destination_number" expression="^(507)$">
<action application="bridge" data="openzap/1/1"/>
</condition>
</extension>
2. To bridge an outbound call onto your FXO card that is configured on channel 4, for any 10-digit destination configure as below
<extension name="outgoing-fxo">
<condition field="destination_number" expression="^([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9])$">
<action application="set" data="dialed_ext=$1"/>
<action application="bridge" data="openzap/2/1/${dialed_ext}"/>
</condition>
</extension>
API
Examples
As an example, let's see configuration for OpenZap module with Digium TDM400P 2FXS/2FXO card. Configuration OpenZAP- DigiumTDM400P Example
FAQ
Q: OpenZAP vs. mod_wanpipe
OpenZAP replaces mod_wanpipe
Q: OpenZAP vs. libpri
OpenZAP replaces libpri - We do have some pri support, it is currently limited to some specific dialects, but we are working on expanding those to more. We do/can not support libpri due to the gpl licensing of that library, however we have a different pri stack.
Q: Does OpenZAP support libss7?
Currently we do not have any open source ss7 solutions but commercial options are available.
Q: How do I configure spanmaps?
This can be done in the openzap config file
Q: Do you need a special tor2.c for using Tormenta2?
You should not need anything special, just zaptel loaded with any plugin tor2, whatever. Any variation of the driver should be fine since zaptel is fairly generic. Tormenta2 clones from pbxhardware.com are reported to work well.
Q: For analog cards (XP100), will I need zaptel kernel drivers?
Yes, for analog cards, OpenZAP communicates w/ the zaptel kernel drivers via sockets, which in turn communicates with the hardware card.
Q: If I want sangoma with openzap, do I need wanpipe installed?
Yes
Q: Does openzap support ccs, hdb3 with Digium te420?
If those are configured with the drivers, then yes, we support zaptel. OTOH if those are something in userspace, then no.
Q: Does openzap support euroisdn?
The euro patches are not in yet, but we are about to do a re-work of the pri stack, so it should work after that.
