summaryrefslogtreecommitdiff
path: root/kernel/xpp/utils/twinstar_hook
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2009-05-27 10:01:24 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2009-05-27 10:01:24 +0000
commit18c6813f2c788b603dab363b9138d65d24252167 (patch)
tree92402484268f2bc1d5e4e55f7321b9204ad47c5f /kernel/xpp/utils/twinstar_hook
parent2a73224819e867eaf56371d6055e2ca4d36396b6 (diff)
Big dump of newer xpp code.
For finer details and separate commits, you are advised to look into the commit log of dahdi-{linux,tools}. xpp.r7150 * 116x Astribanks: - Support for the TwinStar capability and for FXO and (BRI|PRI) on same device. - New control protocol ("MPP"). - astribank_hextool - a low-level firmware loading tool instead of fpga_load . - astribank_tool - Other MPP activities . - Can still reset (but just that) through older protocol. - astribank_hexload is required for loading FPGA firmware for USB_FW.hex rev > 6885. - USB_FW rev. 7071 . - More modular FPGA firmware (1161 only). - FPGA_1161.hex rev. 7131. PIC_TYPE_* rev. 7107. - software-settings of some capabilities with astribank_allow . * XPP: - init_card_* script are less verbose. - Reduced rate of "Is a DAHDI sync master" message. - Replace member bus_id with dev_name() and set_dev_name() for building with 2.6.30. - Conditionally remove 'owner' property of procfs was dropped in 2.6.30. - astribank_hook now enabled by default. - Has an optional hook for TwinStar. * BRI: - hardhdlc support: The bri_dchan patch is no longer needed. - If bri_dchan patch applied: old code is used, and "dchan" is used. - If not: new code and "hardhdlc" is used. - zapconf will generate the right configuration, depending on the new sysfs driver attribute bri_hardhdlc, but default to "dchan" as before if not explicitly told. - Bugfix: explicitly turn off leds on startup. * FXS: - Initialization and calibration fixes. - Notify the user just one about wrong VMWI config * Dahdi-perl: - Fix detection of empty slots in wctdm. - Fix working with ethmf's extra file in /proc/zaptel - Improved detection of Rhino cards. - dahdi_genconf's generated text better explains files are generated. - /etc/xpp_order - allow specifiying an explicit order for Astribanks to register with Zaptel. - Dahdi::Xpp::Mpp - A wrapper around astribank_tool . * dahdi.init: - A separate waitfor_xpds script. May now have a wait-loop in some cases. - xpp_sync needs to only be called after dahdi_cfg . (for the PRI module). git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@4641 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'kernel/xpp/utils/twinstar_hook')
-rwxr-xr-xkernel/xpp/utils/twinstar_hook132
1 files changed, 132 insertions, 0 deletions
diff --git a/kernel/xpp/utils/twinstar_hook b/kernel/xpp/utils/twinstar_hook
new file mode 100755
index 0000000..c934e7e
--- /dev/null
+++ b/kernel/xpp/utils/twinstar_hook
@@ -0,0 +1,132 @@
+#! /bin/sh
+#
+# Written by Oron Peled <oron@actcom.co.il>
+# Copyright (C) 2009, Xorcom
+#
+# All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+
+#
+# This is an experimental script to activate an Astribank TwinStar
+# during failover.
+#
+# The script assume that there is an /etc/xpp_order file
+# specifying the Astribanks' labels according to the required
+# registration order.
+#
+# This file can be easily generated by running:
+# zapconf xpporder
+# after the system is configured and working.
+#
+
+me=`basename $0`
+dir=`dirname $0`
+LOGGER="logger -i -t '$me'"
+
+# Always redirect stderr somewhere, otherwise the shell script will die
+# when it tries to do I/O related stuff on closed file descriptor.
+# Our default is to throw it down the bit-bucket.
+#exec 2> /dev/console
+## If you wish to trace this script:
+#exec 2> "/tmp/${me}_$XBUS_NAME" 1>&2
+
+# Our directory in the beginning, so we can use local lab setup
+PATH="$dir:/usr/sbin:/sbin:/usr/bin:/bin"
+
+set -e
+
+# For lab testing
+liveconf="$dir/liveconf/zaptel"
+
+if [ -d "$liveconf" ]; then
+ zaptel_conf="$liveconf"
+else
+ zaptel_conf="/etc"
+fi
+
+export XPPORDER_CONF="$zaptel_conf/xpp_order"
+if [ ! -r "$XPPORDER_CONF" ]; then
+ echo "Skip($ACTION): No '$XPPORDER_CONF'" | $LOGGER
+ exit 0
+fi
+ZAPTELCONF="$zaptel_conf/zaptel.conf"
+
+TWS_DIR="/var/tmp"
+TWS_PREFIX="$TWS_DIR/twinstar-"
+LABELFILE="/sys/$DEVPATH/label"
+export XBUS_SORT='SORT_LABEL'
+
+echo "starting($ACTION): setup from $XPPORDER_CONF" | $LOGGER
+STAMP="${TWS_PREFIX}${XBUS_NAME}"
+TWS_TOTAL=`sed -e 's/#.*//' -e '/^[ ]*$/d' -e 'y/\t/ /' "$XPPORDER_CONF" | wc -l`
+
+case "$ACTION" in
+online)
+ if [ ! -f "$LABELFILE" ]; then
+ echo "Missing labelfile '$LABELFILE'" | $LOGGER
+ exit 1
+ fi
+ LABEL=`cat $LABELFILE`
+ TWS_LINE=`awk "/^$LABEL/" $XPPORDER_CONF`
+ if [ "$TWS_LINE" = "" ]; then
+ echo "online($XBUS_NAME): '$LABEL' is not in '$XPPORDER_CONF'" | $LOGGER
+ exit 1
+ fi
+ echo "$LABEL" > "$STAMP"
+ HOW_MANY=`ls ${TWS_PREFIX}* | wc -l`
+ echo "online($XBUS_NAME): $LABEL (${HOW_MANY}/${TWS_TOTAL})" | $LOGGER
+ twinstar enable-wd
+ if [ "$HOW_MANY" -eq "$TWS_TOTAL" ]; then
+ echo "online: GOT ALL $TWS_TOTAL" | $LOGGER
+ zt_registration on
+ zt_registration 2>&1 | tr '\t' ' ' | $LOGGER
+ echo "Using '$ZAPTELCONF'" 2>&1 | $LOGGER
+ ztcfg -v -c "$ZAPTELCONF" 2>&1 | $LOGGER
+ sleep 1 # Just for visual effect
+ asterisk -rx 'module load chan_zap.so' 2>&1 | $LOGGER
+ xpp_blink bzzt xpd "$XBUS_NUM"
+ ports=`twinstar ports`
+ if [ "$ports" = 0 ]; then
+ play /usr/share/zaptel/primary-pbx-is-ready.wav || :
+ elif [ "$ports" = 1 ]; then
+ play /usr/share/zaptel/backup-pbx-is-ready.wav || :
+ fi
+ echo "online: READY" | $LOGGER
+ fi
+ ;;
+offline)
+ LABEL=`cat $STAMP`
+ TWS_LINE=`awk "/^$LABEL/" $XPPORDER_CONF`
+ rm -f "$STAMP"
+ if [ "$TWS_LINE" = "" ]; then
+ echo "offline($XBUS_NAME): $LABEL is not in $XPPORDER_CONF" | $LOGGER
+ exit 1
+ fi
+ echo "offline($XBUS_NAME): $LABEL" | $LOGGER
+ twinstar disable-wd
+ # If we want to disconnect everybody
+ twinstar jump
+ asterisk -rx 'module unload chan_zap.so'
+ ;;
+*)
+ echo "$0: Unknown ACTION='$ACTION'" | $LOGGER
+ echo "$0: ARGS='$*'" | $LOGGER
+ echo "$0: ENV:" | $LOGGER
+ env | $LOGGER
+ exit 1
+esac
+