summaryrefslogtreecommitdiff
path: root/kernel/xpp/utils/genzaptelconf.8
blob: c3f6f73c5410ed78478d35b26ae170231e19b87c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
.TH GENZAPTELCONF 8 "July 18th, 2005" "Xorcom Rapid Asterisk" "Linux Programmer's Manual"
.SH "NAME" 
.B genzaptelconf 
-- generates zaptel configuration (TDM adaptors)
.SH SYNOPSIS
.PP 
.B genzaptelconf 
[-sRdvzF] [-c <country_code>] [-e <base_exten>]

.B genzaptelconf 
[-sRdv] -l -- only list to standard output
   
.B genzaptelconf 
-su -- only unload zaptel modules

.B genzaptelconf 
-h -- Help screen
    
.SH DESCRIPTION
.B genzaptelconf 
is a script to detect zaptel devices (currently mostly TDM cards are 
supported). It generates both 
.I /etc/zaptel.conf
and 
.I /etc/asterisk/zapata-channels.conf

.I PRI
and 
.I BRI
(with ZapBRI) cards are basically identified as well. However the span
configiration is a default that I only hope is sane. Looking for feedback

.SH OPTIONS
.B -c
.I country_code
.RS
A two-letter country code. Sets the country-code for the zonezone 
entries in 
.I zaptel.conf
, The default is the value of
.I lc_country
from 
.I /etc/default/zaptel
and failing that, "us".
.RE

.B -d
.RS
Also try to detect modules. Unloads all zaptel modules and loads them
one by one. Considers a module useful if it loaded successfully and if 
loading it has generated at least one zapata channel.

The list of detected modules is written as the value of 
.I ZAPTEL_MODS
in 
.I /etc/default/zaptel
.RE

.B -e
.I base_exten_num
.RS
Configure channel 
.I i 
as extension 
.I exten_num
+
.I i 
 . This is mostly for the caller-id values. Crude, but may be good enough. 
See also
.I -r
.RE

.B -F
.RS
Disable writing FXS extensions in zapata.conf
.RE

.B -l
.RS
Only list deceted channels and their signalling. Don't write 
configuration files. Note, however that 
.I -ld
will still rewrite the modules line in 
.I /etc/default/zaptel
(see 
.I -d
above).
.RE

.B -M
.RS
Update
.I /etc/modules
with a list of our modules, thereby
triggers their loading via modprobe on the next boot.

This triggers the
.I -d
option as well.
.RE

.B -R
.RS
Don't restart asterisk even if it was stopped using
.I -s
 .
.RE

.B -s
.RS
Stop asterisk for the duration of the test. The detection will only
work if nobody uses the zaptel channels: 

* To allow unloading of modules

* to allow reading configuration files.

This option tells the script to stop asterisk (if it was running) and to 
try to start it after the end of the test.
.RE

.B -v
.RS
Be verbose. lists the detected modules if 
.I -d
is used. Lists detected channls. In the end tries to connect to asterisk
to get a list of configured zaptel channels.
.RE

.B -z
.RS
emulate the operation of zapscan.bin: generate 
.I /etc/asterisk/zapscan.conf
with the results of the scan.
.RE

.SH CONFIGURATION
Look at the beginning of the script for a number of variables that can 
be overriden through the configuraion file. Some variables can also be 
overriden through the environment. The configuration file is sourced by
bash but for compatibility expected to have only 'var=VALUE' lines and
comments or empty lines.

The configuration will first be read from 
.I /etc/default/zaptel
if it exists, and 
.I /etc/sysconfig/zaptel
otherwise (But those file names may be overriden, see 
.I ZAPTEL_BOOT_DEBIAN
and 
.I ZAPTEL_BOOT_FEDORA
below). Variables set in those files will override the default settings
and setting rom the environment.

The following variables may be set from the environment:
ZAPCONF_FILE, ZAPATA_FILE, ZAPTEL_BOOT_DEBIAN, ZAPTEL_BOOT_FEDORA,
DEVZAP_TIMEOUT, ZTCFG

.RS
.I lc_country
.RS
The default country. Can be also overriden by the option -c
.RE

.I base_exten
.RS
The base number used for automatic numbering
.RE

.I context_manual
.RS
If set to 'yes', no context changes are made in zapata-channels.conf
.RE

.I context_lines
.RS
The context into which calls will go from zaptel trunks.
.RE

.I context_phones
.RS
The context into which calls will go from zaptel phones.
.RE

.I context_manual
.RS
If set to 'yes', no group settings are made in zapata-channels.conf
.RE

.I group_lines
.RS
The group number for zaptel trunks.
.RE

.I group_phones
.RS
The group number for zaptel phones.
.RE

.I ALL_MODULES
.RS
modules list. Used for unloading and modules detection. The order of modules
is the same for both.
.RE

.I ZAPCONF_FILE
.RS
ztcfg's configuration file. The sane default is /etc/zaptel.conf .
.RE

.I ZAPATA_FILE
.RS
The generated partial zapata.conf snippet. Default:
/etc/asterisk/zapata-channels.conf .
.RE

.I ZAPTEL_BOOT_DEBIAN
.RS
The Debian Zaptel defaults file. Normally
.I /etc/default/zaptel
.
.RE


.I ZAPTEL_BOOT_FEDORA
.RS
The Zaptel defaults file on various other distributions. Normally
.I /etc/sysconfig/zaptel
 .
.RE

.I DEVZAP_TIMEOUT
.RS
Maximal number of seconds to wait for /dev/zap to be initializaed by
udev.
.RE

.I ZTCFG
.RS
The full path to the ztcfg tool. Default: 
.I /sbin/ztcfg
genzaptelconf will also explicitly test for
.I /usr/sbin/ztcfg 
as a last resort.
.RE
.RE

.SH FILES
.I /etc/zaptel.conf
.RS
The configuration file used by 
.I ztcfg
to configure zaptel devices. re-written by 
.I genzaptelconf
 . A backup copy is saved to
.I /etc/zaptel.conf.bak
 .
.RE

.I /etc/asterisk/zapata.conf
.RS
The configuration file of Asterisk's 
.I chan_zap.
Not modified directly by 
.I genzaptelconf.
If you want genzaptelconf's setting to take effect, add the following 
line at the end of 
.I zapata.conf:
.RS
#include "zapata-channels.conf"
.RE
.RE

.I /etc/asterisk/zapata-channels.conf
.RS
This is the snippet of 
.I chan_zap
configuration file that 
.I genzaptelconf generates.
 . A backup copy is saved to
.I /etc/asterisk/zapata-channels.conf.bak
 .
.RE

.I /etc/default/zaptel
.RS
This file holds configuration for both 
.I genzaptelconf
and
.I /etc/init.d/zaptel .
It is sourced by both scripts and can thus be used to override settings 
of variables from those scripts.
.RE

.I /etc/modules
.RS
A debian-specific list of kernel modules to be loaded by modprobe at 
boot time. When the option 
.I -d
(detect) is used, genzaptelconf will write in this file zaptel modules
to be loaded. If you want to use a different file, set 
.I MOD_FILELIST
 . If it is rewritten, a backup copy is saved to
.I /etc/modules.bak
 .
.RS
The backup copy of 
.I /etc/modules
.RE

.SH "SEE ALSO" 
ztcfg(8) asterisk(8). 

.SH BUGS
If you override a configuration variable both through the environment 
and through the configuration file, the value from the configuration 
file wins.

.SH "AUTHOR" 
This manual page was written by Tzafrir Cohen <tzafrir.cohen@xorcom.com> 
Permission is granted to copy, distribute and/or modify this document under 
the terms of the GNU General Public License, Version 2 any  
later version published by the Free Software Foundation. 

On Debian systems, the complete text of the GNU General Public 
License can be found in /usr/share/common-licenses/GPL.