How to Reset the Astribank 2 Device when DAHDI is Used
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 the 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
Once Asterisk is stopped you can stop DAHDI:
/etc/init.d/dahdi stop
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:
/usr/share/doc/astribank_upgrade /usr/share/dahdi/ Please note, that the astribank_upgrade script is needed only for this particular version upgrade. Consequently, we have decided to put this script in such an unusual place. For future upgrades the /usr/share/dahdi/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/dahdi/waitfor_xpds
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 freepbx-module-zapauto package. The minimum version number of freepbx-module-zapauto package is 0.7.3-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:
all non-Astribank related channels (e.g., Digium PCI boards, etc.)
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
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.
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.
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:
removes all of current DAHDI-related configuration settings
performs DAHDI hardware detection
puts all trunk channels (FXO, PRI, BRI) in /etc/asterisk/chan_dahdi.conf
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
causes the FreePBX to re-build the configuration including chan_dahdi_additional.conf (where DAHDI extensions are configured)
rebuilds /var/lib/asterisk/bin/astdb
assigns all trunk channels (FXO, PRI) to group 0, and creates a trunk in FreePBX
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
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: