---
name: "genzaptelconf"
section: "8"
platform: "linux"
package: "zaptel"
version: "1:1.4.11~dfsg-3"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/genzaptelconf"
---

# genzaptelconf(8)

## NAME

**genzaptelconf** -- generates zaptel configuration (TDM adaptors)

## SYNOPSIS

**genzaptelconf** \[-sRdvzF\] \[-c \<country\_code\>\] \[-e \<base\_exten\>\]

**genzaptelconf** \[-sRdv\] -l -- only list to standard output

**genzaptelconf** -su -- only unload zaptel modules

**genzaptelconf** -h -- Help screen

## DESCRIPTION

**genzaptelconf** is a script to detect zaptel devices (currently mostly TDM cards are  supported). It generates both  */etc/zaptel.conf* and  */etc/asterisk/zapata-channels.conf*

*PRI* and  *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

## OPTIONS

- **-c** *country\_code*

  A two-letter country code. Sets the country-code for the zonezone  entries in  *zaptel.conf* , The default is the value of *lc\_country* from  */etc/default/zaptel* and failing that, "us".

- **-d**

  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  *ZAPTEL\_MODS* in  */etc/default/zaptel*

- **-e** *base\_exten\_num*

  Configure channel  *i* as extension  *exten\_num* + *i*\
    . This is mostly for the caller-id values. Crude, but may be good enough.  See also *-r*

- **-F**

  Disable writing FXS extensions in zapata.conf

- **-l**

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

- **-M**

  Update */etc/modules* with a list of our modules, thereby triggers their loading via modprobe on the next boot.

  This triggers the *-d* option as well.

- **-R**

  Don't restart asterisk even if it was stopped using *-s*\
    .

- **-s**

  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.

- **-v**

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

- **-z**

  emulate the operation of zapscan.bin: generate  */etc/asterisk/zapscan.conf* with the results of the scan.

## 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  */etc/default/zaptel* if it exists, and  */etc/sysconfig/zaptel* otherwise (But those file names may be overriden, see  *ZAPTEL\_BOOT\_DEBIAN* and  *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

*lc\_country*

The default country. Can be also overriden by the option -c

*base\_exten*

The base number used for automatic numbering

*context\_manual*

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

*context\_lines*

The context into which calls will go from zaptel trunks.

*context\_phones*

The context into which calls will go from zaptel phones.

*context\_manual*

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

*group\_lines*

The group number for zaptel trunks.

*group\_phones*

The group number for zaptel phones.

*ALL\_MODULES*

modules list. Used for unloading and modules detection. The order of modules is the same for both.

*ZAPCONF\_FILE*

ztcfg's configuration file. The sane default is /etc/zaptel.conf .

*ZAPATA\_FILE*

The generated partial zapata.conf snippet. Default: /etc/asterisk/zapata-channels.conf .

*ZAPTEL\_BOOT\_DEBIAN*

The Debian Zaptel defaults file. Normally */etc/default/zaptel*

*ZAPTEL\_BOOT\_FEDORA*

The Zaptel defaults file on various other distributions. Normally */etc/sysconfig/zaptel*\
  .

*DEVZAP\_TIMEOUT*

Maximal number of seconds to wait for /dev/zap to be initializaed by udev.

*ZTCFG*

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

## FILES

*/etc/zaptel.conf*

The configuration file used by  *ztcfg* to configure zaptel devices. re-written by  *genzaptelconf*\
  . A backup copy is saved to */etc/zaptel.conf.bak*\
  .

*/etc/asterisk/zapata.conf*

The configuration file of Asterisk's  *chan\_zap.* Not modified directly by  *genzaptelconf.* If you want genzaptelconf's setting to take effect, add the following  line at the end of  *zapata.conf:*

\#include "zapata-channels.conf"

*/etc/asterisk/zapata-channels.conf*

This is the snippet of  *chan\_zap* configuration file that  *genzaptelconf generates.*\
  . A backup copy is saved to */etc/asterisk/zapata-channels.conf.bak*\
  .

*/etc/default/zaptel*

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

*/etc/modules*

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

The backup copy of  */etc/modules*

## SEE ALSO

[ztcfg(8)](/ztcfg/8.md) [asterisk(8)](/asterisk/8.md).

## BUGS

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

## 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.
