Software for Astribank 2 Document Version: 1.12

The new Astribank models, known as „Astribank 2‟, require an advanced version of DAHDI/Zaptel. When appropriate packages are installed, it is possible to use combinations of the old (Astribank) and the new (Astribank 2) devices connected to the same Asterisk server.

Contents How to Check the Astribank Model ...... 2 Versions ...... 2 Elastix 1.5 ...... 2 Elastix 1.3 ...... 3 Elastix <1.3 ...... 6 trixbox CE Versions ...... 7 CE 2.8.0 ...... 7 trixbox CE 2.6.2.3 ...... 7 trixbox CE 2.6.2.2 ...... 7 trixbox CE < 2.6.2.2 ...... 8 Building from Sources ...... 9 Building DAHDI from the Sources ...... 9 Building Zaptel 1.4.x from the Sources ...... 9 Building Zaptel 1.2.x from the Sources ...... 10 BRIStuff ...... 10 DAHDI Notes ...... 10 How to Reset the Astribank 2 Device When DAHDI is Used ...... 10 How to Configure the DAHDI Channels ...... 11 Zaptel Notes...... 14 How to Reset the Astribank 2 Device When Zaptel is Used ...... 14 How to Configure the Zaptel Channels ...... 15

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 2 of 19

How to Check the Astribank Model Following are indications of the new Astribank hardware models: a) For all new Astribank devices and XR1000/2000/3000 servers, the serial number starts from {X,U}1036300. b) The 1U Astribank models now have two USB sockets on the rear panel (instead of one). c) The Astribank USB Product ID is 116n. USB Product IDs of the old Astribank models are 113n, 114n and 115n. For example, output of the lsusb utility on a computer with the new Astribank connected would be as follows: # lsusb Bus 003 Device 001: ID 0000:0000 Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 Bus 001 Device 002: ID e4e4:1162 Bus 004 Device 001: ID 0000:0000

Elastix Versions

Elastix 1.5 The latest Elastix DAHDI packages (dahdi-2.2.0.2-4 and later) already contain the updated Astribank drivers. It is possible to check the currently installed DAHDI packages version by using the following command: rpm –qa | grep dahdi

If the standard, “plain vanilla” Elastix 1.5 is installed, then it is necessary to upgrade the DAHDI RPM packages in order to provide support for Asterisk 2 devices.

For Non-Astribank BRI Implementations With Non-Xorcom Servers If you don‟t use Astribank BRI and you don‟t use a Xorcom Asterisk server (XR1000/2000/3000):

1. Upgrade your Elastix to the latest packages

yum update

2. Reset the Astribank devices as described in the “How to Reset Astribank 2 Device When DAHDI is Used” section below.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 3 of 19

3. If necessary, configure the DAHDI channels as described in the “How to Configure DAHDI Channels” section below.

For Astribank BRI and/or Xorcom Server Implementations If you use Astribank BRI and/or use a Xorcom Asterisk appliance server (XR1000/2000/3000): 1. In the /etc/yum.repos.d/elastix.repo file define parameter 'exclude' for [elastix-base] and [elastix-updates] repositories, as follows: exclude=elastix-mysqldbdata *dahdi *dahdi-devel asterisk-devel asterisk-sounds* libpri*

2. Download and install the Xorcom repository encryption public key: cd /tmp wget http://updates.xorcom.com/astribank/elastix/repo/RPM-GPG- KEY-xorcom rpm --import RPM-GPG-KEY-xorcom

3. Download the Xorcom repository configuration file: cd /etc/yum.repos.d wget http://updates.xorcom.com/astribank/elastix/xorcom.repo

4. Update the software: yum update *dahdi*

5. Reset the Astribank devices as described in the “How to Reset Astribank 2 Device When DAHDI is Used” section below.

6. If necessary, configure the DAHDI channels as described in the “How to Configure DAHDI Channels” section below.

Elastix 1.3 There are two ways to provide Astribank 2 support for users of Elastix 1.3: a) Upgrade the Zaptel packages as follows: cd /tmp wget http://updates.xorcom.com/astribank/elastix/repo/zaptel- 1.4.12.9.svn.4651-2.i686.rpm wget http://updates.xorcom.com/astribank/elastix/repo/zaptel-devel- 1.4.12.9.svn.4651-2.i686.rpm

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 4 of 19

wget http://updates.xorcom.com/astribank/elastix/repo/kernel-module- zaptel-1.4.12.9.svn.4651-2_2.6.18_53.1.19.el5.i686.rpm

rpm -Uvh zaptel-1.4.12.9.svn.4651-2.i686.rpm \ zaptel-devel-1.4.12.9.svn.4651-2.i686.rpm \ kernel-module-zaptel-1.4.12.9.svn.4651-2_2.6.18_53.1.19.el5.i686.rpm

Reset the Astribank devices as described in the “How to Reset the Astribank 2 Device when Zaptel is Used” section below.

If necessary, configure the Zaptel channels as described in the “How to Configure Zaptel Channels” section below. b) Upgrade to Elastix 1.5 and the latest DAHDI & Asterisk packages using files from the Xorcom repository.

Upgrading to Elastix 1.5 Follow the steps below to upgrade from Elastix 1.3 to Elastix 1.5. It is strongly recommended that you backup your current server using the Xorcom Rapid Recovery tool (http://www.xorcom.com/optional-extras/rapid-recovery.html). Also, please be aware that you will need to configure DAHDI channels after performing the upgrade. Unfortunately, no configuration porting tools exist.

1. In the /etc/yum.repos.d/elastix.repo file define parameter 'exclude' for [elastix] and [elastix-updates] repositories as follows: exclude=elastix-mysqldbdata *dahdi *dahdi-devel asterisk asterisk- devel asterisk-sounds* libpri*

2. Download and install the Xorcom repository encryption public key: cd /tmp wget http://updates.xorcom.com/astribank/elastix/repo/RPM-GPG-KEY- xorcom rpm --import RPM-GPG-KEY-xorcom

3. Download the Xorcom repository configuration file: cd /etc/yum.repos.d wget http://updates.xorcom.com/astribank/elastix/xorcom.repo

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 5 of 19

4. Update the software: yum update

5. After the kernel update, the XEN kernel version will be set as the default option. In order to fix the problem, edit file /boot/grub/menu.lst and define the parameter 'default' in such a way that it will point to the 'title CentOS (2.6.18-92.1.22.el5)'. Please note that the kernels are numbered starting from 0. For example: default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz #hiddenmenu title CentOS (2.6.18-92.1.22.el5) root (hd0,0) kernel /vmlinuz-2.6.18-92.1.22.el5 ro root=LABEL=/ initrd /initrd-2.6.18-92.1.22.el5.img title CentOS (2.6.18-92.1.22.el5xen) root (hd0,0) kernel /xen.gz-2.6.18-92.1.22.el5 module /vmlinuz-2.6.18-92.1.22.el5xen ro root=LABEL=/ module /initrd-2.6.18-92.1.22.el5xen.img title Elastix (2.6.18-53.1.19.el5xen) root (hd0,0) kernel /xen.gz-2.6.18-53.1.19.el5 module /vmlinuz-2.6.18-53.1.19.el5xen ro root=LABEL=/ module /initrd-2.6.18-53.1.19.el5xen.img title Elastix-base (2.6.18-53.1.19.el5) root (hd0,0) kernel /vmlinuz-2.6.18-53.1.19.el5 ro root=LABEL=/ initrd /initrd-2.6.18-53.1.19.el5.img As you can see, the 'default=0' points to the correct kernel.

6. Reboot the server.

7. Reset the Astribank devices as described in the “How to Reset Astribank 2 Device When DAHDI is Used” section below.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 6 of 19

8. Configure the DAHDI channels. Please note, that the old Zaptel and Asterisk Zapata channels configuration is automatically ported to the DAHDI and Asterisk DAHDI channels configuration. You will only need to add the echo canceller settings to the /etc/dahdi/system.conf file. For example, if you have 8 DAHDI channels then you can add the line below to the system.conf file: echocanceller=oslec,1-8

Alternatively you can re-configure the DAHDI channels as described in the “How to Configure DAHDI Channels” section below.

Elastix <1.3 You can download the Zaptel source RPM package and build the binary packages as follows: 1. Install some pre-requisites: yum install rpm-build libusb-devel

2. Download the source RPM package: cd /tmp wget http://updates.xorcom.com/astribank/elastix/repo/zaptel- 1.4.12.9.svn.4651-2.src.rpm

3. Build the Zaptel packages: rpmbuild --rebuild --target i686 zaptel-1.4.12.9.svn.4651- 2.src.rpm

4. Install the binary RPM packages: cd /usr/src/redhat/RPMS/i686 rpm -Uvh zaptel-1.4.12.9.svn.4651-2.i686.rpm \ zaptel-devel-1.4.12.9.svn.4651-2.i686.rpm \ kernel-module-zaptel-1.4.12.9.svn.4651- 2_2.6.18_53.1.19.el5.i686.rpm

5. Reset the Astribank devices as described in the “How to Reset the Astribank 2 Device When Zaptel is Used” section below.

6. If necessary, configure the Zaptel channels as described in the “How to Configure Zaptel Channels” section below.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 7 of 19 trixbox CE Versions trixbox CE 2.8.0 This version fully supports Astribank 2 devices. There is no need to upgrade DAHDI packages. If necessary, configure the DAHDI channels as described in the “How to Configure DAHDI Channels” section below. trixbox CE 2.6.2.3 This version fully supports Astribank 2 devices. There is no need to upgrade Zaptel packages. If necessary, configure the Zaptel channels as described in the “How to Configure Zaptel Channels” section below.

Please note that the detect_zap script described in that section puts FXO and PRI channels to the /etc/asterisk/zapata-channels.conf. Please make sure that that file is referred from the /etc/asterisk/zapata.conf file by using the 'include' instruction. trixbox CE 2.6.2.2 There are two ways to provide Astribank 2 support for users of trixbox CE 2.6.2.2 a) You can upgrade your trixbox CE to version 2.6.2.3. After upgrade, you will need to reset the Astribank devices as described in the “How to Reset the Astribank 2 Device when Zaptel is Used” section below. b) Download and install Zaptel packages provided by Xorcom. The binary packages and source RPM are available for downloading from http://updates.xorcom.com/astribank/trixbox/astribank2. You can install the binary packages as follows: cd /tmp wget http://updates.xorcom.com/astribank/trixbox/astribank2/ zaptel- 1.4.12.9.svn.r4649-1.i686.rpm wget http://updates.xorcom.com/astribank/trixbox/astribank2/ zaptel- modules-1.4.12.9.svn.r4649-1.2.6.18_92.1.18.el5.i686.rpm wget http://updates.xorcom.com/astribank/trixbox/astribank2/ zaptel- devel-1.4.12.9.svn.r4649-1.i686.rpm rpm -Uvh zaptel-1.4.12.9.svn.r4649-1.i686.rpm \ zaptel-modules-1.4.12.9.svn.r4649-1.2.6.18_92.1.18.el5.i686.rpm\ zaptel-devel-1.4.12.9.svn.r4649-1.i686.rpm

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 8 of 19

Reset the Astribank devices as described in the “How to Reset the Astribank 2 Device when Zaptel is Used” section below.

If necessary, configure the Zaptel channels as described in the “How to Configure Zaptel Channels” section below.

Please note that the detect_zap script described in that section puts FXO and PRI channels to the /etc/asterisk/zapata-channels.conf. Please make sure that that file is referred from the /etc/asterisk/zapata.conf file by using the 'include' instruction. trixbox CE < 2.6.2.2 You can download the Zaptel source RPM package and build the binary packages as follows: 1. Install some pre-requisites: yum install rpm-build newt-devel ncurses-devel libusb-devel kernel-devel gcc

2. Download the source RPM package: cd /tmp wget http://updates.xorcom.com/astribank/trixbox/astribank2/zaptel- 1.4.12.9.svn.r4649-1.src.rpm

3. Build the Zaptel packages: rpmbuild --rebuild --target i686 \ zaptel-1.4.12.9.svn.r4649-1.src.rpm

4. Install the binary RPM packages: cd /usr/src/redhat/RPMS/i686 rpm -Uvh zaptel-1.4.12.9.svn.r4649-1.i686.rpm \ zaptel-modules-1.4.12.9.svn.r4649-1.2.6.18_92.1.18.el5.i686.rpm\ zaptel-devel-1.4.12.9.svn.r4649-1.i686.rpm

5. Reset the Astribank devices as described in the “How to Reset the Astribank 2 Device when Zaptel is Used” section below.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 9 of 19

6. If necessary, configure the Zaptel channels as described in the “How to Configure Zaptel Channels” section below. Please note that the detect_zap script described in that section puts FXO and PRI channels to the /etc/asterisk/zapata-channels.conf. Please make sure that that file is referred from the /etc/asterisk/zapata.conf file by using the 'include' instruction.

Building from Sources

Building DAHDI from the Sources Download and compile DAHDI 2.2.0.1 and DAHDI Tools 2.2.0 from the www.asterisk.org Web site. Please refer the included README files for instructions about packages building. Note that the following libraries must be pre-installed for DAHDI Tools building: libusb- dev, newt-dev (for , etc) and libusb-devel, newt-devel (for RedHat, CentOS etc). Also make sure that you have installed fxload utility on your system. This utility is used for downloading the Astribank firmware via USB. You can download deb and rpm fxload packages from the Xorcom Web site: http://updates.xorcom.com/astribank/fxload/

Please refer to the “DAHDI Notes” section below for further instructions about Astribank reset and configuration.

Building Zaptel 1.4.x from the Sources Download and build Zaptel from the source tarball that you can download by using the following link: http://updates.xorcom.com/astribank/zaptel-xpp.tgz

Please refer to the included README files for instructions about package building. Note that the following libraries must be pre-installed for Zaptel building: libusb-dev, newt-dev, ncurses-dev (for Debian, Ubuntu etc) and libusb-devel, newt-devel, ncurses-devel (for RedHat, CentOS etc). Also make sure that you have installed fxload utility on your system. This utility is used for downloading the Astribank firmware via USB. You can download deb and rpm fxload packages from the Xorcom Web site: http://updates.xorcom.com/astribank/fxload/

Please refer to the “Zaptel Notes” section below for further instructions about Astribank reset and configuration.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 10 of 19

Building Zaptel 1.2.x from the Sources At this time, Astribank 2 is not supported in Zaptel 1.2.

BRIStuff The BRIstuff package may be downloaded by using the following link: http://updates.xorcom.com/astribank/bristuff/1.4/bristuff-current.tgz Please refer to the included README file for further instructions about building and installing the BRIstuff on your Asterisk server. Please refer to the “Zaptel Notes” section below for further instructions about Astribank reset and configuration.

DAHDI Notes

How to Reset the Astribank 2 Device When DAHDI is Used 1. Stop Asterisk: amportal stop

Please be aware that the 'amportal' command does not always stop Asterisk. Therefore, you must verify that Asterisk has indeed been stopped. You can use command: ps -A | grep asterisk to check if the asterisk and safe_asterisk processes have been terminated. You also can stop Asterisk by running the Asterisk initialization script: /etc/init.d/asterisk stop

2. Once Asterisk is stopped you can stop DAHDI: /etc/init.d/dahdi stop

3. Now you can reset the Astribank firmware. The simplest way is just to switch off/on the Astribank devices. If you are not able to do this, then run /usr/share/dahdi/xpp_fxloader reset. Wait 10-20 seconds and then make sure that the devices are initialized. You should see it as e4e4:1162 in output of lsusb. For example: Bus 003 Device 001: ID 0000:0000

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 11 of 19

Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000 Bus 001 Device 002: ID e4e4:1162 Bus 004 Device 001: ID 0000:0000 4. Start DAHDI and Asterisk: /etc/init.d/dahdi start amportal start

How to Configure the DAHDI Channels You can configure the DAHDI channels either manually or by using the detect_zap script that is provided by the -module-zapauto package. The minimum version number of freepbx-module-zapauto package is 0.7.3-1.

1. Define the desired order of the DAHDI channels to be registered. By default, the channels related to the installed DAHDI equipment will be registered in the DAHDI framework in the following order: a) all non-Astribank related channels (e.g., Digium PCI boards, etc.) b) all Astribank related channels. All of the connected Astribank devices will be sorted alphabetically, based on the USB connector strings.

So, if you swap Astribank devices or add a new device, then the order of the channels will get mixed up. In order to avoid this problem and put the DAHDI channels registration under control, you can list the device labels or/and USB connector strings in the desired order in the /etc/dahdi/xpp_order file. You can see the Astribank labels and USB connectors in the output of the dahdi_hardware -v command. For example:

#dahdi_hardware -v usb:001/007 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware LABEL=[usb:000169] CONNECTOR=usb-0000:00:03.3-5 XBUS-01/XPD-00: FXS Span 5 XBUS-01/XPD-10: FXS Span 6 XBUS-01/XPD-20: FXS Span 7 XBUS-01/XPD-30: FXS Span 8 usb:001/008 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware LABEL=[usb:0000149] CONNECTOR=usb-0000:00:03.3-4 XBUS-02/XPD-00: E1_TE Span 1 DAHDI-SYNC XBUS-02/XPD-10: FXS Span 2

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 12 of 19

XBUS-02/XPD-20: FXS Span 3 XBUS-02/XPD-30: FXS Span 4

The simplest way to create the /etc/dahdi/xpp_order file is to run dahdi_genconf xpporder and then to edit the file manually. Following is an example of the file content:

# Autogenerated by /usr/sbin/dahdi_genconf on Sun Apr 26 09:13:25 2009 # If you edit this file and execute /usr/sbin/dahdi_genconf again, # your manual changes will be LOST. # # This is an optional configuration file for ordering # Dahdi registration. # # It is read from /etc/dahdi/xpp_order. This location # may be overwritten via the environment variable XPPORDER_CONF # # Lines may contain: # - The Astribank label (verbatim) # - The Astribank connector string (prefixed with @) # Ordering number of each listed Astribank is determined # by its position in this file. # Astribanks not listed in this file, get an ordering # number of 999 (last). # # Astribanks with same ordering number are sorted by their # connectors (to preserve legacy behavior). # # Examples: # usb:TWS-08 # @usb-0000:06:02.2-2 usb:000169 # @usb-0000:00:03.3-5 usb:0000149 # @usb-0000:00:03.3-4 Please note that channels of the Astribank devices that are not listed in the file will be registered following the Astribanks listed in the xpp_order file, based on the order of their USB connector strings.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 13 of 19

2. Install the freepbx-module-zapauto If the xorcom.repo repository is configured on the server then you can install the package as follows: yum install freepbx-module-zapauto Alternatively, you can download the latest freepbx-module-zapauto package from http://updates.xorcom.com/astribank/elastix/repo.

3. Now you can perform the hardware detection. Be aware that the command below will remove all DAHDI related settings from the server. Please read the explanation below before you run the following detect_zap script: /var/lib/asterisk/bin/detect_zap

The detect_zap performs the following actions: a) removes all of current DAHDI-related configuration settings b) performs DAHDI hardware detection c) puts all trunk channels (FXO, PRI, BRI) in /etc/asterisk/chan_dahdi.conf d) creates FreePBX extensions for DAHDI channels (FXS). By default, detect_zap will assign consecutive extension numbers starting with 401 to each DAHDI extension it detects. If those numbers are already in use by non DAHDI extensions, detect_zap will fail to work properly. You can define a new starting extension number in variable ZAP_FIRST_CHANNEL in the /etc/amportal.conf file. For example, if you want detect_zap to create extensions with numbers starting with 1001 then you must define: ZAP_FIRST_CHANNEL=1001 e) causes the FreePBX to re-build the configuration including chan_dahdi_additional.conf (where DAHDI extensions are configured) f) rebuilds /var/lib/asterisk/bin/astdb g) assigns all trunk channels (FXO, PRI) to group 0, and creates a trunk in FreePBX h) creates an outbound rule in the FreePBX configuration with dial pattern '9|.'

Other Astribank Configuration Parameters For a detailed explanation of other Astribank configuration parameters, please refer to the README.Astribank file, found in the sources of DAHDI Tools (http://svn.digium.com/svn/dahdi/tools/trunk/xpp/README.Astribank). We have chosen to describe the most important parameters here:

File /etc/dahdi/xpp.conf

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 14 of 19

Information from this file is used by the Astribank drivers during their initialization. If you are using Astribank E1/T1 and you want to configure it for the T1 mode, then define parameter: pri_protocol T1

If you need to define the country specific settings for the FXO ports then define the 'opermode' paramater. For example: opermode FRANCE

File /etc/dahdi/genconf_parameters Information from this file is used by dahdi_genconf utility. This is standard DAHDI utility used for the hardware detection and automatic configuration building. This utility is called by detect_zap. The most important parameters that may be defined in this file are as follows: pri_termtype – defines the function group for a particular PRI port (TE or NT). If the parameter is not defined, then dahdi_genconf utility will consider all ports as TE and define 'signalling = pri_cpe' in the /etc/asterisk/chan_dahdi.conf file.

For example, if you want to define one PRI port as TE and another as NT then you can define the pri_termtype parameter for the NT port as follows: pri_termtype SPAN/3 NT

Obviously, you will have to define a corresponding Span number. If you want all PRI ports to be defined as NT then you can define: pri_termtype SPAN/* NT

Zaptel Notes

How to Reset the Astribank 2 Device When Zaptel is Used 1. Stop Asterisk: amportal stop

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 15 of 19

Please be aware that the 'amportal' command does not always stop Asterisk. Therefore, you must verify that Asterisk has indeed been stopped. You can use command: ps -A | grep asterisk to check if the asterisk and safe_asterisk processes have been terminated. You also can stop Asterisk by running the Asterisk initialization script: /etc/init.d/asterisk stop

2. Once Asterisk is stopped you can stop Zaptel: /etc/init.d/zaptel stop

3. Now you can reset the Astribank firmware. The simplest way is just to switch off/on the Astribank devices. If you are not able to do this, then:

cd /tmp wget http://svn.digium.com/svn/dahdi/tools/trunk/xpp/astribank_upgrade chmod +x astribank_upgrade ./astribank_upgrade /usr/share/zaptel

Please note, that the astribank_upgrade script is needed only for this particular version upgrade. For future upgrades the /usr/share/zaptel/xpp_fxloader utility will be used, as it was in the past. Wait 10-20 seconds and then make sure that the devices are initialized: /usr/share/zaptel/waitfor_xpds

4. Start Zaptel and Asterisk: /etc/init.d/zaptel start amportal start

How to Configure the Zaptel Channels You can configure the Zaptel channels either manually or by using the detect_zap script that is provided by the freepbx-module-zapauto package. The minimum version number of freepbx-module-zapauto package is 0.7.3-1.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 16 of 19

1. Define the desired order of the Zaptel channels to be registered. By default, the channels related to the installed Zaptel equipment will be registered in the Zaptel framework in the following order: a) all non-Astribank related channels (e.g., Digium PCI boards, etc.) b) all Astribank related channels. All of the connected Astribank devices will be sorted alphabetically, based on the USB connector strings.

So, if you swap Astribank devices or add a new device, then the order of the channels will get mixed up. In order to avoid this problem and put the Zaptel channels registration under control, you can list the device labels or/and USB connector strings in the desired order in the /etc/xpp_order file. You can see the Astribank labels and USB connectors in the output of the zaptel_hardware -v command. For example:

#zaptel_hardware -v usb:001/007 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware LABEL=[usb:000169] CONNECTOR=usb-0000:00:03.3-5 XBUS-01/XPD-00: FXS Span 5 XBUS-01/XPD-10: FXS Span 6 XBUS-01/XPD-20: FXS Span 7 XBUS-01/XPD-30: FXS Span 8 usb:001/008 xpp_usb+ e4e4:1152 Astribank-multi FPGA-firmware LABEL=[usb:0000149] CONNECTOR=usb-0000:00:03.3-4 XBUS-02/XPD-00: E1_TE Span 1 DAHDI-SYNC XBUS-02/XPD-10: FXS Span 2 XBUS-02/XPD-20: FXS Span 3 XBUS-02/XPD-30: FXS Span 4

The simplest way to create the /etc/xpp_order file is to run: zapconf xpporder and then to edit the file manually. Following is an example of the file content: # Autogenerated by /usr/sbin/zapconf on Sun May 3 08:38:15 2009 # If you edit this file and execute /usr/sbin/zapconf again, # your manual changes will be LOST. # # This is an optional configuration file for ordering # Zaptel registration.

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 17 of 19

# # It is read from /etc/xpp_order. This location # may be overwritten via the environment variable XPPORDER_CONF # # Lines may contain: # - The Astribank label (verbatim) # - The Astribank connector string (prefixed with @) # Ordering number of each listed Astribank is determined # by its position in this file. # Astribanks not listed in this file, get an ordering # number of 999 (last). # # Astribanks with same ordering number are sorted by their # connectors (to preserve legacy behavior). # # Examples: # usb:TWS-08 # @usb-0000:06:02.2-2usb:000169 # @usb-0000:00:03.3-5usb:0000149 # @usb-0000:00:03.3-4

Please note that channels of the Astribank devices that are not listed in the file will be registered following the Astribanks listed in the xpp_order file, based on the order of their USB connector strings.

2. Install the freepbx-module-zapauto If the xorcom.repo repository is configured on the server then you can install the package as follows: yum install freepbx-module-zapauto Alternatively, you can download the latest freepbx-module-zapauto package from http://updates.xorcom.com/astribank/elastix/repo.

3. Now you can perform the hardware detection. Be aware that the command below will remove all Zaptel related settings from the server. Please read the explanation below before you run the following detect_zap script: /var/lib/asterisk/bin/detect_zap

The detect_zap performs the following actions:

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 18 of 19 a) removes all of current Zaptel-related configuration settings b) performs Zaptel hardware detection c) puts all trunk channels (FXO, PRI, BRI) in /etc/asterisk/zapata-channels.conf d) creates FreePBX extensions for Zaptel channels (FXS). By default, detect_zap will assign consecutive extension numbers starting with 401 to each Zaptel extension it detects. If those numbers are already in use by non Zaptel extensions, detect_zap will fail to work properly. You can define a new starting extension number in variable ZAP_FIRST_CHANNEL in the /etc/amportal.conf file. For example, if you want detect_zap to create extensions with numbers starting with 1001 then you must define:

ZAP_FIRST_CHANNEL=1001 e) causes the FreePBX to re-build the configuration including zapata_additional.conf (where Zaptel extensions are configured) f) rebuilds /var/lib/asterisk/bin/astdb g) assigns all trunk channels (FXO, PRI) to group 0, and creates a trunk in FreePBX h) creates an outbound rule in the FreePBX configuration with dial pattern '9|.'

Other Astribank Configuration Parameters For a detailed explanation of other Astribank configuration parameters, please refer to the README.Astribank file, found in the sources of Zaptel (http://svn.digium.com/svn/zaptel/branches/1.4/kernel/xpp/README.Astribank). We have chosen to describe the most important parameters here:

File /etc/xpp.conf Information from this file is used by the Astribank drivers during their initialization. If you are using Astribank E1/T1 and you want to configure it for the T1 mode, then define parameter: pri_protocol T1

If you need to define the country specific settings for the FXO ports then define the 'opermode' parameter. For example: opermode FRANCE

File /etc/genconf_parameters

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]

Software For Astribank 2 Page 19 of 19

Information from this file is used by zapconf utility. This is standard Zaptel utility used for the hardware detection and automatic configuration building. This utility is called by detect_zap. The most important parameters that may be defined in this file are as follows: pri_termtype – defines the function group for a particular PRI port (TE or NT). If the parameter is not defined, then zapconf utility will consider all ports as TE and define 'signalling = pri_cpe' in the /etc/asterisk/zapata-channels.conf file.

For example, if you want to define one PRI port as TE and another as NT then you can define the pri_termtype parameter for the NT port as follows: pri_termtype SPAN/3 NT

Obviously, you will have to define a corresponding Span number. If you want all PRI ports to be defined as NT then you can define: pri_termtype SPAN/* NT

Xorcom USA Xorcom Ltd. 23309 North 17th Drive, Suite #100 Misgav Industrial Park, POB 60 Phoenix, AZ 85027 USA D.N. Misgav 20179, Israel Tel: 866-XORCOM1/866-967-2661 Tel: +972-4-9951999 [email protected] www.xorcom.com [email protected]