OpenZAP OpenR2
From FreeSWITCH Wiki
OpenZAP OpenR2 Installation
If you want to use MFC-R2 signaling with OpenZAP (most likely to use it with FreeSWITCH), follow this steps:
1. You need first to download openr2 svn trunk.
$ svn co http://openr2.googlecode.com/svn/trunk/ openr2
2. Install the library with the usual steps
$ ./configure --prefix=/usr $ make && make install
3. Proceed to install the Wanpipe drivers (use the latest drivers found at http://wiki.sangoma.com/) or if you have a Digium board install DAHDI (see point 5 for clarification)
4. In other directory proceed to checkout and install FreeSWITCH trunk as usual.
$ svn co http://svn.freeswitch.org/svn/freeswitch/trunk $ ./boostrap.sh $ ./configure $ make && make install
5. Configure the openzap.conf spans to use CAS channels in E1 mode. The following samples assume you use span 1. You can use either zaptel/dahdi or wanpipe mode.
Before looking at the configuration, let me explain a bit better what zaptel/dahdi or wanpipe mode means. When I talk about Zaptel, I mean Zaptel or DAHDI, both are supported.
Wanpipe mode is used typically when you have a Sangoma board.
Zaptel mode is used typically when you have a Zaptel compatible board, like Sangoma or Digium boards. However if you have a Sangoma board there is no point in using it in Zaptel mode for FreeSWITCH, Sangoma boards support Zaptel mode just to be able to plug into Asterisk channel driver chan_zap/chan_dahdi, but FreeSWITCH can use Sangoma boards directly in Wanpipe mode.
If you have a Sangoma board, you DON'T need Zaptel/DAHDI drivers, use Wanpipe mode and follow the instructions in the ./Setup script to install the drivers in API mode (The menu says which one for FreeSWITCH). More detailed instructions can be found at the Sangoma wiki: http://wiki.sangoma.com/wanpipe-freeswitch-install
At this date, the latest Sangoma drivers are 3.5.5
If you have a Zaptel compatible board, install the latest Zaptel/DAHDI drivers as usual (instructions can be found on voip-info.org I think)
Once you have installed either the Sangoma Wanpipe drivers or Zaptel/DAHDI drivers, you can proceed to configure /usr/local/freeswitch/conf/autoload_configs/openzap.conf
For Wanpipe mode:
[span wanpipe myspan] name => wp1 number => 1 trunk_type => E1 cas-channel => 1:1-15:1101 cas-channel => 1:16-31:1101
For Zaptel/DAHDI mode:
[span zt myspan] name => zap1 number => 1 trunk_type => E1 cas-channel => 1-15:1101 cas-channel => 17-31:1101
Remember that Zaptel/DAHDI spans channel numbering starts at 1 and keeps incrementing across spans up to infinity, where Wanpipe channel specification always is span based
<span>:<channel-range>:<cas_bits>
That is, regardless of how many spans you have, you will not have any channel higher than 31, where in zaptel/dahdi, for span 2 you would start at channel 32.
6. Configure FreeSWITCH to use R2 spans, edit /usr/loca/freeswitch/conf/autoload_configs/openzap.conf.xml and add the R2 spans:
<r2_spans>
<span id= "myspan">
<!-- ONLY THIS PARAMETERS REQUIRED -->
<param name="variant" value="br"/>
<param name="max_ani" value="20"/>
<param name="max_dnis" value="10"/>
<param name="dialplan" value="XML"/>
<param name="context" value="default"/>
<!-- ONLY USE THE FOLLOWING PARAMETERS TO TWEAK ADVANCED SETTINGS -->
<!--
<param name="category" value="national_subscriber"/>
<param name="allow_collect_calls" value="yes"/>
<param name="immediate_accept" value="yes"/>
<param name="double_answer" value="yes"/>
<param name="skip_category" value="yes"/>
<param name="forced_release" value="yes"/>
<param name="charge_calls" value="yes"/>
<param name="get_ani_first" value="yes"/>
<param name="mfback_timeout" value="7000"/>
<param name="metering_pulse_timeout" value="1000"/>
<param name="advanced_protocol_file" value="/etc/r2proto.conf"/>
-->
<!-- USE THIS FOR DEBUGGING MFC-R2 PROTOCOL -->
<param name="logdir" value="mfcr2"/>
<param name="logging" value="notice,warning,error,mf,cas"/>
<param name="call_files" value="yes"/>
<param name="dial-regex" value=""/>
<param name="fail-dial-regex" value=""/>
</span>
</r2_spans>
OpenZAP OpenR2 Commands
From the FreeSWITCH CLI you can execute:
$ oz r2 status 1
That will show you the status and basic configuration for the span 1, like this:
freeswitch@localhost.localdomain> oz r2 status 1 API CALL [oz(r2 status 1)] output: Variant: MX Max ANI: 10 Max DNIS: 4 ANI First: No Immediate Accept: No Channel Tx CAS Rx CAS 63 IDLE IDLE 64 IDLE IDLE 65 IDLE IDLE 66 IDLE IDLE 67 IDLE IDLE 68 IDLE IDLE 69 IDLE IDLE 70 IDLE IDLE 71 IDLE IDLE 72 IDLE IDLE 73 IDLE IDLE 74 IDLE IDLE 75 IDLE IDLE 76 IDLE IDLE 77 IDLE IDLE 79 IDLE IDLE 80 IDLE IDLE 81 IDLE IDLE 82 IDLE IDLE 83 IDLE IDLE 84 IDLE IDLE 85 IDLE IDLE 86 IDLE IDLE 87 IDLE IDLE 88 IDLE IDLE 89 IDLE IDLE 90 IDLE IDLE 91 IDLE IDLE 92 IDLE IDLE 93 IDLE IDLE +OK.
There is a debugging command used to see if any thread got stuck using an R2 channel.
$ oz r2 threads
That will display the number of running R2 call threads (there should be exactly 1 thread per call).
Other misc commands:
$ oz r2 version
$ oz r2 variants
$ oz r2 kill

