wanpipe-freeswitch-configTo configure your system, you will need the following 3 steps:
- Configure Wanpipe
- Configure OpenZAP
- Configure FreeSwitch / mod_openzap
- Some Dialplan examples
Configure Wanpipe
To configure the channels on your Card use the following command:
#> /usr/sbin/wancfg_tdmapi
Remeber to set the right signaling at the "Select signalling mode for port 1 on XXXX" Menu position. For euroisdn this would be CCS.
Configure OpenZap
To configure OpenZap, we need to create the openzap.conf file in the right place.
#> mkdir /etc/openzap
#> cd /etc/openzap
#> vi openzap.conf
For an E1 PRI interface, the file should look like this:
[span wanpipe] name => OpenZAP number => 1 trunk_type => E1 b-channel => 1:1-15 d-channel => 1:16 b-channel => 1:17-31
for a T1 it will look like:
[span wanpipe] trunk_type => t1 b-channel => 1:1-23 d-channel=> 1:24
For a A200/400 Analog Card with port 1 & 2 in FXO mode and port 3 & 4 in FXS Mode it would look like:
[span wanpipe] name => OpenZAP number => 3001 fxo-channel => 1:1 number => 3002 fxo-channel => 1:2 [span wanpipe] name => OpenZAP number => 4165551111 fxs-channel => 1:3 number => 4165552222 fxs-channel => 1:4
IMPORTANT FOR USERS OF ANALOG CARDS: 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) would look like:
[in] generate-dial => v=-7;%(1000,0,375,425) detect-dial => 375,425 generate-ring => v=-7;%(2000,4000,440,480) detect-ring => 440,480 generate-busy => v=-7;%(500,500,480,620) detect-busy => 480,620 generate-attn => v=0;%(100,100,1400,2060,2450,2600) detect-attn => 1400,2060,2450,2600 generate-callwaiting-sas => v=0;%(300,0,440) detect-callwaiting-sas => 440 generate-callwaiting-cas => v=0;%(80,0,2750,2130) detect-callwaiting-cas => 2750,2130 detect-fail1 => 913.8 detect-fail2 => 1370.6 detect-fail3 => 776.7
NOTE: By default, tones.conf for USA is avaialable at ${freeswitch_src}/libs/openzap/conf/
Copy the wanpipe.conf file from the libs/openzap/conf directory to /etc/openzap as well
Configure FreeSwitch
To make use of OpenZap in FreeSwitch we need to enable it in modules.conf.xml and than configure it in its own configuration file called openzap.conf.xml.
So first edit the file conf/autoload_configs/modules.conf.xml and change the line:
<!-- <load module="mod_openzap"/> -->
to look like this:
<load module="mod_openzap"/>
So, now that we told freeswitch that he should load the module on the next start, we need to set the configuration file called
conf/autoload_configs/openzap.conf.xml.
Here some examples how it should look like:
For a E1 PRI:
<configuration name="openzap.conf" description="OpenZAP Configuration">
<settings>
<param name="debug" value="0"/>
</settings> <pri_spans>
<span id="1">
<param name="mode" value="user"/> <param name="dialect" value="euro"/> <param name="dialplan" value="XML"/> <param name="context" value="default"/>
</span>
</pri_spans>
</configuration>
For a A200/400 with 2 FXO and 2 FXS:
<configuration name="openzap.conf" description="OpenZAP Configuration"> <settings> <param name="debug" value="9"/> </settings> <analog_spans> <span id="1"> <param name="tonegroup" value="us"/> <param name="digit-timeout" value="2000"/> <param name="max-digits" value="11"/> <param name="dialplan" value="XML"/> <param name="context" value="default"/> <param name="enable-analog-option" value="3-way"/> <param name="moh" value="$${base_dir}/sounds/Dardedisco.wav"/> </span> <span id="2"> <param name="tonegroup" value="us"/> <param name="digit-timeout" value="2000"/> <param name="max-digits" value="11"/> <param name="dialplan" value="XML"/> <param name="context" value="default"/> <param name="enable-analog-option" value="3-way"/> <param name="moh" value="$${base_dir}/sounds/Dardedisco.wav"/> </span> <span id="3"> <param name="tonegroup" value="us"/> <param name="digit-timeout" value="2000"/> <param name="max-digits" value="11"/> <param name="dialplan" value="XML"/> <param name="context" value="default"/> </span> <span id="4"> <param name="tonegroup" value="us"/> <param name="digit-timeout" value="2000"/> <param name="max-digits" value="11"/> <param name="dialplan" value="XML"/> <param name="context" value="default"/> </span> </analog_spans> </configuration>
Now that we have setup all the components, lets move to setting an example dialplan for the just configured devices.
Some Dialplan Examples
Your channels are accessible in the dialplan as:
OpenZAP/<SPAN>/<CHANNEL>/<DESTINATION_NUMBER>
<SPAN> - the index number of the SPAN you want to use to dial out through. If that value is missing, use any span.
<CHANNEL> - The channel you want to send the call out via. If left empty it will use any channel.
<DESTINATION_NUMBER> - The destinatiuon number.
Examples:
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>
|