Configurazione File /etc/zaptel.conf
il file zaptel.conf è richiesto dai prodotti Digium nel caso tu debba configurare un interfaccia TDM. It is read by the /sbin/ztcfg program. Both /etc/zaptel.conf and /sbin/ztcfg are installed by the zaptel package: see Zaptel Installation
. There are two configuration files with similar names, but they are different files:
- /etc/zaptel.conf: Configuration of your hardware interfaces
- /etc/asterisk/zapata.conf: Asterisk configuration to use your hardware interfaces
The configuration settings established in zaptel.conf are:
If elements 1 and 2 listed above are not configured in zaptel.conf, the interface card missing the configuration information will not work in Asterisk.
- An identification number for a TDM-related card that will be used in extensions.conf (also known as the "dialplan") to refer to a specific interface card. Each TDM-related card must be assigned a unique number.
- What type of signalling is to be used for each TDM-related interface card.
- What tone language is to be used in association with a TDM card (e.g. English, French, German). By specifying this parameter, channels used by British users can be configured to give familiar UK tones, while a French user could be attached on another interface and hear French tones. Note: at present, only a few tone sets are supported; see the file zonedata.c in the Zaptel source. If your nation or telco uses different tones, please help by providing updated zone data.
Edit your zaptel.conf file
We assume you are starting with the default /etc/zaptel.conf file that was installed by 'make install', which contains only two lines that are not commented out:
- loadzone=us: means your interface card(s) will be loaded with US indication tones. You can load more than one set of tones into an interface to allow you to generate tones from different zones by giving a comma-separated list of two letter country codes. Available zones are: us, au, fr, nl, uk, fi, es, jp, no, at, nz, it, us-old, gr, tw, cl. Tone zones are defined in the Zaptel source file zonedata.c.
- defaultzone=us: means use the tones for this zone by default (when no other zone is specified).
The remaining settings in your zaptel.conf file depend on which Digium interface card(s) you have installed.
FXO/FXS interface cards
- The Wildcard X100P is an FXO device which will use fxs signalling with Asterisk.
- The Wildcard S100U is an FXS device which will use fxo signalling with Asterisk.
- The Wildcard TDM400P may have a combination of FXO and FXS modules installed in its four slots. Note that the Wildcard TDM400P may be referred to by different names according to how many modules and what kind of modules are installed on it. If it has one FXS module on it then it is called TDM10B. If it has two FXS modules then it is TDM20B and so on. TDM400P is sometimes used to refer to just the board with no modules on it.
Configuration for the Wildcard X100P:
- fxsks=1: if you have one Wildcard X100P installed
- fxsks=1-2: if you have two Wildcard X100P cards installed
- fxsks=1-3: if you have three Wildcard X100P cards installed, and so on.
Configuration for the Wildcard S100U:
- fxoks=1: for one card
- fxoks=1-2: for two cards
- fxoks=1-3: for three cards, and so on.
Configuration for the Wildcard TDM400P:
- If your card is a TDM10B (one FXS module), put: fxoks=1
- If your card is a TDM20B (two FXS modules), put: fxoks=1-2
- If your card is a TDM30B (three FXS modules), put: fxoks=1-3
- If your card is a TDM04B (four FXO modules), put: fxsks=1-4
- If your card has modules FXO, FXO, FXS, FXS (in that order), put:
- If your card has modules FXS, FXO, FXO, FXS (in that order), put:
- If your card has modules FXS, (empty), FXO, FXS (in that order), put:
- If you have one Wildcard TDM40B and one Wildcard TDM22B installed, put:
- fxoks=1-4 (for the TDM40B)
- fxsks=5,8 (for the two FXO modules on your TDM22B)
- fxoks=6,7 (for the two FXS modules on your TDM22B)
Then run /sbin/ztcfg. If it exits silently, your configuration is correct. If you get a message like: ZT_CHANCONFIG failed on channel 1: Invalid argument (22) Did you forget that FXS interfaces are configured with FXO signalling and that FXO interfaces use FXS signalling?
then your configuration is incorrect. It may also be helpful to check your /var/log/messages logfile to see what messages the zaptel, wcfxs and/or wcfxo kernel modules generated when they were loaded.
T1/E1 interface cards
Now it is time to cover the T1/E1 cards. Once you know the basics for one card it will pretty much be the same for all of them. I will start with the Wildcard T100P.
Configuration for T100P using a PRI
In /etc/zaptel.conf: span=1,1,0,esf,b8zs bchan=1-23 dchan=24
In /etc/asterisk/zapata.conf: switchtype=national context=blah signalling=pri_cpe group=1 channel => 1-23
As you see, we using esf framing and b8zs coding. Change it according to how your PRI is setup. Also you may need to change the switchtype. The signalling should be set for slave which is what pri_cpe is. In the /etc/asterisk/zapata.conf, you define only the B channels.
When using a channel bank, you define the fxo/fxs channels instead of B and D channels. Now it is setup just like the fxo/fxs cards. This is for an all fxs channel bank. If you have fxo then change the signalling. If you have fxs and fxo channel bank, you need to split the channels according to how the channel bank is set up.
Configuration for T100P using a channel bank.
In /etc/zaptel.conf: span=1,0,0,esf,b8zs fxoks=1-24
In /etc/asterisk/zapata.conf: signalling=fxo_ks context=blah group=1 channel => 1-24
If you have an E100P/E400P card then you would change the framing, coding, and switchtype. Of course your channels will be different since E1's have 31 channels. The TE410P card allows you to use T1 and E1 circuits.
Example zaptel.conf file
Let's say that you have two cards installed in your computer:
- a Wildcard X100P (providing a single FXO interface)
- a Wildcard TDM400P configured with 4 modules
- module 0: an FXO module
- module 1: an FXO module
- module 2: an FXS module
- module 3: an FXS module
Then your zaptel.conf file might look like this: loadzone=us defaultzone=us ; Use Kewlstart FXS signalling for the Wildcard X100P fxsks=1 ; Use Kewlstart FXS signalling for modules 0 and 1 of the Wildcard TDM400P fxsks=2-3 ; Use Kewlstart FXO signalling for modules 2 and 3 of the Wildcard TDM400P fxoks=4-5
What do these parameters mean?
- fxsks=1: is actually 3 parameters specified in one chunk. Let's break the chunk down first, to make the parts easier to understand. The fist part in this chunk is "fxs", which means use FXS signalling for this interface card so it can communicate with the public telephone network. The next part in this chunk is "ks", which means use kewlstart signalling to determine whether a channel is open or closed (analogous to a telephone handset being off-hook or on-hood, respectively). The next part in this chunk is "=1" which means this interface card will be identified as channel 1 in other configuration files; especially in extensions.conf (also known as the "Dialplan"). For example, this card will be referenced as Zap/1 in extensions.conf.
- fxsks=2-3: means modules 0 and 1 of the Wildcard TDM400P also use FXS signalling with Kewlstart signalling. They will be identified by Asterisk as Zap/2 and Zap/3.
- fxoks=4-5: means modules 2 and 3 of the Wildcard TDM400P will use FXO signalling so they can communicate with devices that function as telephone handsets (like desk phones or soft-phones such as Gnophone, KPhone, or X-Lite), use Kewlstart signalling to determine whether a channel is open or closed, and identify these interfaces as channels 4 and 5 (Asterisk will refer to them as Zap/4 and Zap/5).
Use the right signalling!
One area of confusion is the right signalling to use on FXO and FXS ports. Remember that on these ports, Asterisk is connecting to the opposite type of device (an FXO port connects to a device that expects to be signalled by an FXS, FXS ports attach to devices that expect FXO signalling). What you specify in the zaptel.conf
file is the type of signalling Asterisk must generate for the attached device. Fortunately, ztcfg
gives you a helpful hint if you get it wrong: ZT_CHANCONFIG failed on channel 1: Invalid argument (22) Did you forget that FXS interfaces are configured with FXO signalling and that FXO interfaces use FXS signalling?
Loopstart, Groundstart, Kewlstart
See Digium's FAQ
about the differences between loopstart, groundstart and kewlstart. The summary is: you probably need to use kewlstart both for your FXO telephone lines (to your local telephone exchange) and also for your FXS handset lines (connecting your standard telephone handsets), regardless of where in the world you are.
Identification of Zaptel channels
Why, in the example above, does the Wildcard X100P PSTN card get identified as interface 1 (Zap/1) and the WildCard TDM400P get identified as interfaces 2 through 5 (Zap/2 to Zap/5)? The answer lies in the order in which the Zaptel modules are loaded into the kernel.
The Wildcard X100P needs the wcfxo
kernel module driver. The Wildcard TDM400P needs the wcfxs
kernel module driver. All cards also need the zaptel
kernel module driver.
If you had just the Wildcard X100P installed in your computer, you would be first loading the zaptel
module, then the wcfxo
module (and then running the ztcfg
program). Your Wildcard X100P would show up as Zap/1. If you bought and installed a Wildcard TDM400P with modules FXO,FXO,FXS,FXS plugged into it, you would also need to load the wcfxo
kernel module driver for this card (somewhat confusingly, it handles both the FXO and the FXS modules installed on the Wildcard TDM400P). If you load your kernel modules in the order zaptel
, then your Wiildcard X100P interface will be Zap/1, and your Wildcard TDM400P interfaces will be Zap/2 through to Zap/5. If, on the other hand, you load your kernel modules in the order zaptel
, then your Wildcard TDM400P interfaces will be Zap/1 through to Zap/4, and your Wildcard X100P interface will be Zap/5, and you would need to change your dialplan (extensions.conf) accordingly.