commit 43e0f5b59edeefa2db4bd3de24881059d06c6f78 Author: Dave Lane Date: Wed Mar 16 13:43:31 2016 +1300 initial commit of a *whole bunch* of old Egressive shell scripts, used to make many people redundant. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a69cd49 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +obsolete/* diff --git a/ebu/conf/daily.conf b/ebu/conf/daily.conf new file mode 100644 index 0000000..3c560db --- /dev/null +++ b/ebu/conf/daily.conf @@ -0,0 +1,20 @@ +# +# configuration file for /etc/ebu/ebu, a simple script for doing +# tar-based backups. +# +# base filename for the backups... +BU_FROOT="daily" +CURRENT_LINK="Current" +# +# directory in which to save the backups... +BU_DIR=/extra/apu +# +# directories to back up +FILES="/home /etc /var/www /var/spool/mail" +# +# directories/files to exclude +EXCLUDE=" home/sites/subversion home/vmware home/server *.log *Cache* *cache* *~ */tmp *nobackup*" +# +# removal all but the $BU_TO_KEEP most recent +# backups. +BU_TO_KEEP=2 diff --git a/ebu/conf/weekly.conf b/ebu/conf/weekly.conf new file mode 100644 index 0000000..3423044 --- /dev/null +++ b/ebu/conf/weekly.conf @@ -0,0 +1,20 @@ +# +# configuration file for /etc/ebu/ebu, a simple script for doing +# tar-based backups. +# +# base filename for the backups... +BU_FROOT="weekly" +CURRENT_LINK="Current" +# +# directory in which to save the backups... +BU_DIR=/extra/apu +# +# directories to back up +FILES="/home /etc /var/www /var/spool/mail" +# +# directories/files to exclude +EXCLUDE=" home/sites/subversion home/vmware home/server *.log *Cache* *cache* *~ */tmp *nobackup*" +# +# removal all but the $BU_TO_KEEP most recent +# backups. +BU_TO_KEEP=2 diff --git a/ebu/ebu b/ebu/ebu new file mode 100755 index 0000000..12abe3b --- /dev/null +++ b/ebu/ebu @@ -0,0 +1,349 @@ +#!/bin/bash +# +# Simple script to do a comprehensive regular tar backup of build.egressive.com +# Copyright 1999-2003, David Lane for Egressive Limited, www.egressive.com +# +# +VERSION=0.7.0 +NAME=ebu +# +# Defaults +# +# default email address to which to send backup reports +DEF_EMAIL=root@localhost +# +# default email subject +DEF_EMAIL_SUBJ="Default Backup report" +# +# default configuration file +DEF_BU_CONF=/etc/egscripts/ebu/ebu.conf +# +# default log file +DEF_LOG=/var/log/ebu.log +# +# default filename root +DEF_BU_FROOT="defaultname" +# +# +DEF_STAT_DIR=/var/log/stats +# +# for pruning old backups +# +# build list of possible pruning candidates +BU_SUFFIX="tgz" +LIST_SUFFIX="list" +# +# pattern for "ls" command to build list of +# pruneable backup files... +# -1t = 1 column, ordered by time of last mod +PRUNEABLES_CMD="ls -1t" +# +# Commands +# +# tar command +TAR=/bin/tar +# tar command options +FLAGS=" cvfz " +# grep command +GREP=/bin/grep +# wc (word count) command +WC=/usr/bin/wc +# awk command +AWK=/bin/awk +# don't worry, this is just used to determine if the +# disk is installed - it's not going to change the partition table! +FDISK=/sbin/fdisk +# determine today's date +DATE=`date '+%Y-%m-%d-%a'` +# determine today's date +TIME=`date '+%H-%M-%S'` +# email program +MAIL=/bin/mail +# +# temporary holding point for email +TMP_EMAIL=/tmp/tmp_email.$DATE_$TIME +# +# function to direct a message... +message() { + # + # a timestamp for logging purposes + TIMESTAMP=`date '+%Y-%m-%d %H:%M.%S'` + echo "$0: $TIMESTAMP $@" >> $LOG + if test -f $TMP_EMAIL ; then + echo "$0: $TIMESTAMP $@" >> $TMP_EMAIL + fi + verbose "$TIMESTAMP $@" +} +# +# create the temporary email file +create_tmp_email() { + touch $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "created temporary email file: $TMP_EMAIL" + else + message "failed to create temporary email file: $TMP_EMAIL" + fi +} +# +# send the contents of the temporary file to the +# designated report recipient +send_email_report() { + if test -f $TMP_EMAIL ; then + message "sending email report to $EMAIL" + $MAIL -s "$EMAIL_SUBJ" $EMAIL < $TMP_EMAIL + rm $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "failed to remove temporary email file: $TMP_EMAIL" + else + message "successfully removed temporary email file: $TMP_EMAIL" + fi + message "email report successfully sent" + fi +} +# +# insert a blank line into the log and on the console +insert_blank() { + echo "" >> $LOG + verbose "" +} +# +# function to direct a message... +verbose() { + if test $VERBOSE = 1 ; then + echo "$@" + fi +} +# +# build excludes list +build_excludes() { + message "building excludes" + for PAT in $EXCLUDE + do + EXCLUDES="$EXCLUDES --exclude $PAT" + done +} +# +# function to initiate backup +backup() { + build_excludes + EBU_NAME=`basename $0` + BU_CONF_NAME=`basename $BU_CONF` + echo "CURRENT_LINK = $CURRENT_LINK" + if test ! $CURRENT_LINK = "none" ; then + message "removing link: $BU_DIR/$CURRENT_LINK" + # first remove any existing link + rm $BU_DIR/$CURRENT_LINK.$BU_SUFFIX + fi + BU_CMD="$TAR $FLAGS $BU_DIR/$BU_FILE $FILES $EXCLUDES" + message "Executing backup command: $BU_CMD" + $BU_CMD > $BU_DIR/$BU_LIST + if test "$?" -ne "0" ; then + MSGCONF=`basename $BU_CONF` + message "-------Backup ended with error, error: $? ----------" + echo "error: $?" > $STAT_DIR/$NAME-$MSGCONF + else + message "+++++++Backup $BU_FILE successfully finished++++++++" + NUM_FILES=`$WC $BU_DIR/$BU_LIST | $AWK '{print $1}'` + message "Backed up $NUM_FILES files..." + message "Backup size: `ls -l $BU_DIR/$BU_FILE | $AWK '{print $5;}'` bytes" + echo "success: $NUM_FILES backed up (`ls -l $BU_DIR/$BU_FILE | $AWK '{print $5;}'` bytes)" > $STAT_DIR/$NAME-$MSGCONF + # if the variable $CURRENT_LINK is defined in the .conf file, make + # a link to it. + if test ! $CURRENT_LINK = "none" ; then + message "Linking $BU_DIR/$CURRENT_LINK to $BU_DIR/$BU_FILE..." + # create a new link to the current archive + ln -f $BU_DIR/$BU_FILE $BU_DIR/$CURRENT_LINK.$BU_SUFFIX + fi + if [ -e "$BU_DIR/$BU_LIST.gz" ]; then + rm $BU_DIR/$BU_LIST.gz + fi + gzip $BU_DIR/$BU_LIST + fi +} +# +# delete old backups +delete_old() { + # + if test -n $BU_FROOT && test -n $BU_TO_KEEP ; then + # pattern to search for to build the list... + PATTERN="$BU_DIR/$BU_FROOT.*" + # build the list, with the suffix... + PRUNEABLES=`$PRUNEABLES_CMD $PATTERN.$BU_SUFFIX` + if test "$?" -eq "0" ; then + message "pruning older files based on $PATTERN.$BU_SUFFIX" + message "keeping last $BU_TO_KEEP backups" + # + # set counter + NUM=0 + # go through the list of files and remove those we don't want + for PRUNEABLE in $PRUNEABLES + do + NUM=$(($NUM + 1)) + if test $NUM -gt $BU_TO_KEEP ; then + message "deleting $PRUNEABLE and associated list files" + BASE=`basename $PRUNEABLE .$BU_SUFFIX` + rm $BU_DIR/$BASE.$BU_SUFFIX 2>&1 > /dev/null + rm $BU_DIR/$BASE.$LIST_SUFFIX 2>&1 > /dev/null + rm $BU_DIR/$BASE.$LIST_SUFFIX.gz 2>&1 > /dev/null + else + message "keeping $PRUNEABLE" + fi + done + fi + else + message "keeping older backups, missing backup_root_filename..." + fi +} +# +# control loop, using external arguments +# +# process command line arguments +# +# set some default values, so that we can test if they've +# been set in the configuration file... +VERBOSE=0 +BU_CONF=0 +CURRENT_LINK="none" +LOG="" +TMP_EMAIL=/dev/null +# +# set the default mode in case somebody figures out how to get +# past the options below... +MODE=help +# +# cycle through the commandline options +while test $# -ne 0 ; do # while there are arguments + case $1 in + --fileroot|-r) + shift + verbose "setting file root to $1" + BU_FROOT=$1 + ;; + --config|-c) + shift # shift from the flag to the value + verbose "setting configuration file to $1" + BU_CONF=$1 # record the value + ;; + --email|-e) + shift # shift from the flag to the value + verbose "setting temporary email file to $1" + TMP_EMAIL=$1 # record the value + ;; + --log|-l) + shift # shift from the flag to the value + verbose "setting log file to $1" + LOG=$1 # record the value + ;; + --verbose|-v) + VERBOSE=1 + verbose "setting verbosity to true" + ;; + --backup|-b) + MODE=backup + verbose "setting mode to $MODE" + ;; + --delete_old|-d) + MODE=delete_old + verbose "setting mode to $MODE" + ;; + --help|-?|?|-h) + MODE=help + verbose "setting mode to $MODE" + ;; + esac + shift +done +# +# read in config info, from the config +# file provided, or, if none is provided +# from the default file... +if test -f $BU_CONF ; then + . $BU_CONF + verbose "reading config file: $BU_CONF" +elif test -f "$DEF_BU_CONF" ; then + verbose "reading default config file: $DEF_BU_CONF" + . "$DEF_BU_CONF" +else + verbose "config file $DEF_BU_CONF does not exist!" + exit 1 +fi +# +# set the email address to mail results to +# +if test -z $EMAIL ; then + EMAIL=$DEF_EMAIL +fi +# +# set the email subject for results +# +if test -z "$EMAIL_SUBJ" ; then + EMAIL_SUBJ="$DEF_EMAIL_SUBJ" +fi +# +# whack the date on there +EMAIL_SUBJ="$EMAIL_SUBJ for $DATE" +# +# set the log file appropriately +# +if test -z $LOG ; then + LOG=$DEF_LOG +fi +# +# set the log file appropriately +# +if test -z $STAT_DIR ; then + STAT_DIR=$DEF_STAT_DIR +fi +# +# if a file root form wasn't specified use +# a default +if test -z $BU_FROOT ; then + BU_FROOT=$DEF_BU_FROOT + verbose "using default file rootname: $BU_FROOT" +fi +# +# use it to build a filename list for the backup +BU_FILE="$BU_FROOT.$DATE.$TIME.$BU_SUFFIX" +BU_LIST="$BU_FROOT.$DATE.$TIME.$LIST_SUFFIX" +message "backup files: $BU_FILE, $BU_LIST" +# +# Now actually try to do the job we've been asked to do... +# +case $MODE in + backup) +# create_tmp_email + delete_old + backup +# send_email_report + insert_blank + ;; + delete_old) + delete_old + insert_blank + ;; + help) + echo "" + echo "$0 version $VERSION, copyright 1999-2001 Egressive Limited, www.egressive.com" + echo "" + echo "Use tar to backup up a series of paths (excluding some files if desired) onto" + echo "a filesystem (optionally removable), recording the list of files " + echo "in a gzipped file alongside the tar archive" + echo "" + echo "Usage: $0 {-b|-d} [tarfile_root]" + echo "-b or --backup - initiates tar of" + echo " files listed in $DEF_BU_CONF - optionally takes" + echo " a backup file rootname, e.g. weekly-backup" + echo "-d or --delete_old - removes backups older than cutoffs" + echo " specified in $DEF_BU_CONF" + echo "-v or --verbose - give extra feedback on progress to stdout" + echo "-c or --config config_filename - use an alternate configuration file" + echo "-e or --email - filename of the temporary email file to pump backup into into" + echo "-l or --log log_filename - use an alternate log file" + echo "-r or --fileroot tarfile_root - optional parameter specifies the" + echo " root filename for the tar and log files" + echo "-? or --help - display this help information" + echo "" + exit 1 + ;; +esac +exit 0 diff --git a/ebu/ebu.cron b/ebu/ebu.cron new file mode 100755 index 0000000..7831faf --- /dev/null +++ b/ebu/ebu.cron @@ -0,0 +1,15 @@ +# +# run system backups +# +# daily - at 2:30 am, mon-sat +30 2 * * mon,tue,wed,thu,fri,sat root /etc/egscripts/ebu/run_daily +# +# weekly - at 2:30 am, sun +#30 2 * * sun root /etc/egscripts/ebu/run_weekly +# +# monthly - at 3:30 am, on the first of the last of the month +#30 3 1 * * root /etc/egscripts/ebu/run_monthly +# +# yearly - at 1:30 am, on the last day of the year +#30 1 1 1 * root /etc/egscripts/ebu/run_yearly + diff --git a/ebu/run_daily b/ebu/run_daily new file mode 100755 index 0000000..9155a61 --- /dev/null +++ b/ebu/run_daily @@ -0,0 +1,100 @@ +#!/bin/bash +# +# this script runs a series of daily backup files, one after another +# +#------------- +#-- EGAlert -- +EGALERT=/etc/egalert/egalert +EGALERT_DAYSTAMP=`date '+%Y-%m-%d'` +$EGALERT run "$EGALERT_DAYSTAMP-ebu" +#-- EGAlert -- +#------------- + +# These should be the only parameters requiring alteration +# the root filename for the appropriate configuration files +# in $EBU_CONF_DIR +CONF_ROOT="daily" +# the email subject for report emails - to have date added +EMAIL_SUBJ="Warhol Daily Backup Report" +# the email address (or addresses with comma separation) to send it to +EMAIL=dlane@egressive.com +# +# directories... +EBU_DIR=/etc/ebu +EBU_CMD=$EBU_DIR/ebu +EBU_CONF_DIR=$EBU_DIR/conf +LOGS=/var/log +LOG=$LOGS/ebu.log +# determine today's date +DATE=`date '+%Y-%m-%d-%a'` +# determine today's date +TIME=`date '+%H-%M-%S'` +# email program +MAIL=/bin/mail +# a timestamp for logging purposes +TIMESTAMP=`date '+%Y-%m-%d %H:%M.%S'` +# temporary holding point for email +TMP_EMAIL=/tmp/tmp_email_$DATE.$TIME +# build list of backup configuration files +CONFS=`ls -1 $EBU_CONF_DIR/$CONF_ROOT*.conf` +# +# function to direct a message... +message() { + echo "$0: $TIMESTAMP $@" >> $LOG + if test -f $TMP_EMAIL ; then + echo "$0: $TIMESTAMP $@" >> $TMP_EMAIL + fi +} +# +# create the temporary email file +create_tmp_email() { + touch $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "created temporary email $TMP_EMAIL" + else + message "failed to create temporary email $TMP_EMAIL" + fi +} +# +# send the contents of the temporary file to the +# designated report recipient +send_email_report() { + if test -f $TMP_EMAIL ; then + message "sending email report to $EMAIL" + $MAIL -s "$EMAIL_SUBJ" $EMAIL < $TMP_EMAIL + rm $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "failed to remove temporary email $TMP_EMAIL" + else + message "successfully removed temporary email $TMP_EMAIL" + fi + message "email report successfully sent" + fi +} +# +# insert a blank line into the log and on the console +insert_blank() { + echo "" >> $TMP_EMAIL +} +# +# The Functional Part of the Script +# +# build the email for the report +create_tmp_email +# run backup for each file +for CONF in $CONFS +do + $EBU_CMD -b -c $CONF -e $TMP_EMAIL +# $EBU_CMD -d -c $CONF -e $TMP_EMAIL + # put a space in the email to separate tasks + insert_blank +done +# +# send the resulting email +send_email_report + +#------------- +#-- EGAlert -- +$EGALERT success "$EGALERT_DAYSTAMP-ebu" +#-- EGAlert -- +#------------- diff --git a/ebu/run_monthly b/ebu/run_monthly new file mode 100755 index 0000000..5cd3f36 --- /dev/null +++ b/ebu/run_monthly @@ -0,0 +1,86 @@ +#!/bin/bash +# +# this script runs a series of daily backup files, one after another +# +# These should be the only parameters requiring alteration +# the root filename for the appropriate configuration files +# in $EBU_CONF_DIR +CONF_ROOT="monthly" +# the email subject for report emails - to have date added +EMAIL_SUBJ="Avatar Monthly Backup Report" +# the email address (or addresses with comma separation) to send it to +EMAIL=dlane@egressive.com +# +# directories... +EBU_DIR=/etc/ebu +EBU_CMD=$EBU_DIR/ebu +EBU_CONF_DIR=$EBU_DIR/conf +LOGS=/var/log +LOG=$LOGS/ebu.log +# determine today's date +DATE=`date '+%Y-%m-%d-%a'` +# determine today's date +TIME=`date '+%H-%M-%S'` +# email program +MAIL=/bin/mail +# a timestamp for logging purposes +TIMESTAMP=`date '+%Y-%m-%d %H:%M.%S'` +# temporary holding point for email +TMP_EMAIL=/tmp/tmp_email_$DATE.$TIME +# build list of backup configuration files +CONFS=`ls -1 $EBU_CONF_DIR/$CONF_ROOT*.conf` +# +# function to direct a message... +message() { + echo "$0: $TIMESTAMP $@" >> $LOG + if test -f $TMP_EMAIL ; then + echo "$0: $TIMESTAMP $@" >> $TMP_EMAIL + fi +} +# +# create the temporary email file +create_tmp_email() { + touch $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "created temporary email $TMP_EMAIL" + else + message "failed to create temporary email $TMP_EMAIL" + fi +} +# +# send the contents of the temporary file to the +# designated report recipient +send_email_report() { + if test -f $TMP_EMAIL ; then + message "sending email report to $EMAIL" + $MAIL -s "$EMAIL_SUBJ" $EMAIL < $TMP_EMAIL + rm $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "failed to remove temporary email $TMP_EMAIL" + else + message "successfully removed temporary email $TMP_EMAIL" + fi + message "email report successfully sent" + fi +} +# +# insert a blank line into the log and on the console +insert_blank() { + echo "" >> $TMP_EMAIL +} +# +# The Functional Part of the Script +# +# build the email for the report +create_tmp_email +# run backup for each file +for CONF in $CONFS +do + $EBU_CMD -b -c $CONF -e $TMP_EMAIL + # put a space in the email to separate tasks + insert_blank +done +# +# send the resulting email +send_email_report + diff --git a/ebu/run_weekly b/ebu/run_weekly new file mode 100755 index 0000000..14e7a0c --- /dev/null +++ b/ebu/run_weekly @@ -0,0 +1,86 @@ +#!/bin/bash +# +# this script runs a series of daily backup files, one after another +# +# These should be the only parameters requiring alteration +# the root filename for the appropriate configuration files +# in $EBU_CONF_DIR +CONF_ROOT="weekly" +# the email subject for report emails - to have date added +EMAIL_SUBJ="Avatar Weekly Backup Report" +# the email address (or addresses with comma separation) to send it to +EMAIL=dlane@egressive.com +# +# directories... +EBU_DIR=/etc/ebu +EBU_CMD=$EBU_DIR/ebu +EBU_CONF_DIR=$EBU_DIR/conf +LOGS=/var/log +LOG=$LOGS/ebu.log +# determine today's date +DATE=`date '+%Y-%m-%d-%a'` +# determine today's date +TIME=`date '+%H-%M-%S'` +# email program +MAIL=/bin/mail +# a timestamp for logging purposes +TIMESTAMP=`date '+%Y-%m-%d %H:%M.%S'` +# temporary holding point for email +TMP_EMAIL=/tmp/tmp_email_$DATE.$TIME +# build list of backup configuration files +CONFS=`ls -1 $EBU_CONF_DIR/$CONF_ROOT*.conf` +# +# function to direct a message... +message() { + echo "$0: $TIMESTAMP $@" >> $LOG + if test -f $TMP_EMAIL ; then + echo "$0: $TIMESTAMP $@" >> $TMP_EMAIL + fi +} +# +# create the temporary email file +create_tmp_email() { + touch $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "created temporary email $TMP_EMAIL" + else + message "failed to create temporary email $TMP_EMAIL" + fi +} +# +# send the contents of the temporary file to the +# designated report recipient +send_email_report() { + if test -f $TMP_EMAIL ; then + message "sending email report to $EMAIL" + $MAIL -s "$EMAIL_SUBJ" $EMAIL < $TMP_EMAIL + rm $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "failed to remove temporary email $TMP_EMAIL" + else + message "successfully removed temporary email $TMP_EMAIL" + fi + message "email report successfully sent" + fi +} +# +# insert a blank line into the log and on the console +insert_blank() { + echo "" >> $TMP_EMAIL +} +# +# The Functional Part of the Script +# +# build the email for the report +create_tmp_email +# run backup for each file +for CONF in $CONFS +do + $EBU_CMD -b -c $CONF -e $TMP_EMAIL + # put a space in the email to separate tasks + insert_blank +done +# +# send the resulting email +send_email_report + diff --git a/ebu/run_yearly b/ebu/run_yearly new file mode 100755 index 0000000..f895c8e --- /dev/null +++ b/ebu/run_yearly @@ -0,0 +1,86 @@ +#!/bin/bash +# +# this script runs a series of daily backup files, one after another +# +# These should be the only parameters requiring alteration +# the root filename for the appropriate configuration files +# in $EBU_CONF_DIR +CONF_ROOT="yearly" +# the email subject for report emails - to have date added +EMAIL_SUBJ="Avatar Yearly Backup Report" +# the email address (or addresses with comma separation) to send it to +EMAIL=dlane@egressive.com +# +# directories... +EBU_DIR=/etc/ebu +EBU_CMD=$EBU_DIR/ebu +EBU_CONF_DIR=$EBU_DIR/conf +LOGS=/var/log +LOG=$LOGS/ebu.log +# determine today's date +DATE=`date '+%Y-%m-%d-%a'` +# determine today's date +TIME=`date '+%H-%M-%S'` +# email program +MAIL=/bin/mail +# a timestamp for logging purposes +TIMESTAMP=`date '+%Y-%m-%d %H:%M.%S'` +# temporary holding point for email +TMP_EMAIL=/tmp/tmp_email_$DATE.$TIME +# build list of backup configuration files +CONFS=`ls -1 $EBU_CONF_DIR/$CONF_ROOT*.conf` +# +# function to direct a message... +message() { + echo "$0: $TIMESTAMP $@" >> $LOG + if test -f $TMP_EMAIL ; then + echo "$0: $TIMESTAMP $@" >> $TMP_EMAIL + fi +} +# +# create the temporary email file +create_tmp_email() { + touch $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "created temporary email $TMP_EMAIL" + else + message "failed to create temporary email $TMP_EMAIL" + fi +} +# +# send the contents of the temporary file to the +# designated report recipient +send_email_report() { + if test -f $TMP_EMAIL ; then + message "sending email report to $EMAIL" + $MAIL -s "$EMAIL_SUBJ" $EMAIL < $TMP_EMAIL + rm $TMP_EMAIL + if test -f $TMP_EMAIL ; then + message "failed to remove temporary email $TMP_EMAIL" + else + message "successfully removed temporary email $TMP_EMAIL" + fi + message "email report successfully sent" + fi +} +# +# insert a blank line into the log and on the console +insert_blank() { + echo "" >> $TMP_EMAIL +} +# +# The Functional Part of the Script +# +# build the email for the report +create_tmp_email +# run backup for each file +for CONF in $CONFS +do + $EBU_CMD -b -c $CONF -e $TMP_EMAIL + # put a space in the email to separate tasks + insert_blank +done +# +# send the resulting email +send_email_report + diff --git a/egalert/egalert b/egalert/egalert new file mode 100755 index 0000000..b8baa8a --- /dev/null +++ b/egalert/egalert @@ -0,0 +1,159 @@ +#!/bin/bash +# +# File: egalert +# +# egalert - script's checking & alerting tool +# Handles all alert checking for all egressive scripts + +# Usage: egalert FUNCTION DAYSTAMP-SCRIPT_NAME + +# Author: Marek Kuziel (marek@egressive.com) + +# Variables +#---------- +# Directory settings +EGALERT_DIR=/etc/egscripts/egalert +EGALERT_BIN_DIR=`dirname $0` +EGALERT_LOG_DIR=/var/log/egalert +EGALERT_STATUS_DIR=$EGALERT_LOG_DIR/status + +# Mail related stuff +MAINTAINER="dave@egressive.com" +MAIL_CMD=/bin/mail +MAIL_TO="" +MAIL_CC="" +MAIL_BCC="$MAINTAINER" +MAIL_SUBJECT="EGAlert" +MAIL_CONTENT=$EGALERT_BIN_DIR/tmp.txt + +# *stamp +DAYSTAMP=`date '+%Y-%m-%d'` +TIMESTAMP=`date '+%Y-%m-%d %H:%M'` +TIMESTAMP_FULL=`date '+%Y-%m-%d %H:%M:%S'` + +#Debug +EGALERT_DEBUG=1 # To switch on egalert script log for debugging set this to 1 +EGALERT_DEBUG_LOG=$EGALERT_LOG_DIR/$DAYSTAMP.log # DAYSTAMP is more usefull for debugging 'cos creates just one file +EGALERT_DAILY_LOG=$EGALERT_LOG_DIR/egalert-daily-$DAYSTAMP.log + +if [ 1 == $EGALERT_DEBUG ] +then + exec 10>> $EGALERT_DEBUG_LOG + exec 2>&10 + exec 1>&10 +else + exec 10>> /dev/null + exec 2>&10 + exec 1>&10 +fi + +# Functions +#---------- +# Check if log dirs exist +dirs_exist() +{ + if [ ! -d "$EGALERT_LOG_DIR" ] + then + # Log dir doesn't exist. We make it now. + mkdir $EGALERT_LOG_DIR + else + if [ ! -d "$EGALERT_STATUS_DIR" ] + then + mkdir $EGALERT_STATUS_DIR + fi + fi +} + +# Creates egalert log file +egalert_log() +{ + # Create log file if it doesn't exist yet + if [ ! -f "$EGALERT_DAILY_LOG" ] + then + touch $EGALERT_DAILY_LOG + fi + + echo "$TIMESTAMP_FULL $@" >> $EGALERT_DAILY_LOG +} + +# Sends email. Content of email is in first parameter of this function +send_email() +{ + $MAIL_CMD -s "$MAIL_SUBJECT" -c "$MAIL_CC" -b "$MAIL_BCC" "$MAIL_TO" < $MAIL_CONTENT + rm $MAIL_CONTENT +} + +send_log() +{ + egalert_log "INFO: sendlog" + cat $EGALERT_DAILY_LOG > $MAIL_CONTENT + MAIL_SUBJECT="$MAIL_SUBJECT: Infolog" + send_email +} + +# EGAlert +#-------- +dirs_exist + +cd $EGALERT_BIN_DIR + +case "$1" in + # EG:script ran. Touch run file for selected script. + run) + egalert_log "INFO: run ($2)" + touch $EGALERT_STATUS_DIR/$2 + echo "Started at: $TIMESTAMP_FULL" >> $EGALERT_STATUS_DIR/$2 + exit 0 + ;; + # EG:script ran with success. Create success status for selected script. + success) + egalert_log "INFO: success ($2)" + if [ -f $EGALERT_STATUS_DIR/$2 ] + then + echo "Finished with success at: $TIMESTAMP_FULL" >> $EGALERT_STATUS_DIR/$2 + else + egalert_log "EXCEPTION: Script $2 run successfully but status file hasn't been created!" + echo "EXCEPTION: Script $2 run successfully but status file hasn't been created!" > $MAIL_CONTENT + MAIL_SUBJECT="$MAIL_SUBJECT: Exception!" + send_email + fi + exit 0 + ;; + # Send daily log to desired users + sendlog) + send_log + exit 0 + ;; + # Check status of all scripts they should've ran daily for current day + checkdaily) + egalert_log "INFO: checkdaily" + for file in $(ls $EGALERT_STATUS_DIR | grep $DAYSTAMP) + do + if [ 1 != `cat $EGALERT_STATUS_DIR/$file | grep success | wc -l` ] + then + egalert_log "ERROR: Script $file failed!!!" + echo "ERROR: Script $file failed!!!" > $MAIL_CONTENT + MAIL_SUBJECT="$MAIL_SUBJECT: ERROR!!!" + send_email + fi + done + # Check itself. If log file exists (debugging switched on) + # and if size of log is greater than zero. If so inform us. + # If file is zero remove it. + if [ -f $EGALERT_LOG_DIR/$DAYSTAMP.log ] + then + if [ -s $EGALERT_LOG_DIR/$DAYSTAMP.log ] + then + egalert_log "WARNING: EGAlert produced errors!!!" + echo "WARNING: EGAlert produced errors!!!" > $MAIL_CONTENT + MAIL_SUBJECT="$MAIL_SUBJECT: WARNING!" + send_email + else + rm $EGALERT_LOG_DIR/$DAYSTAMP.log + fi + fi + # Send daily log + send_log + exit 0 + ;; +esac diff --git a/egapachewatch/egapachewatch-cron b/egapachewatch/egapachewatch-cron new file mode 100755 index 0000000..e85ac22 --- /dev/null +++ b/egapachewatch/egapachewatch-cron @@ -0,0 +1,8 @@ +# +# egapachewatch, copyright 2007 egressive limited, www.egressive.com +# +# run system backups +# +# every 5 minutes +*/5 * * * * root /etc/egscripts/egapachewatch/egapachewatch.sh + diff --git a/egapachewatch/egapachewatch.sh b/egapachewatch/egapachewatch.sh new file mode 100755 index 0000000..48b5b6c --- /dev/null +++ b/egapachewatch/egapachewatch.sh @@ -0,0 +1,139 @@ +#!/bin/bash +# +# count how many apache processes are running and warn us if it's getting high.. +SCRIPT=egapachewatch.sh +VERSION=0.1 +# +LOG=/var/log/egapachewatch.log +TMP_DIR=/tmp +DATE=`which date` +MAIL=`which mail` +RM=`which rm` +NUMWARN=40 +# +TODAY=`$DATE '+%Y-%m-%d-%a'` +# determine today's date +NOW=`$DATE '+%H-%M-%S'` +# a timestamp for logging purposes +# +# function to direct a message... +message() { + # + # a timestamp for logging purposes + timestamp + if test -w $LOG ; then + echo "$SCRIPT: $TIMESTAMP $@" >> $LOG + fi + if test -w $TMP_EMAIL ; then + echo "$SCRIPT: $TIMESTAMP $@" >> $TMP_EMAIL + fi + verbose "$TIMESTAMP $@" +} +# +# function to direct a message... +verbose() { + if test $VERBOSE ; then + echo "$@" + fi +} +# +# insert a blank line into the log and on the console +insert_blank() { + echo "" >> $TMP_EMAIL + verbose "" +} +# +# update date and time info.. +today() { + # determine today's date + TODAY=`$DATE '+%Y-%m-%d-%a'` +} +now() { + # determine today's date + NOW=`$DATE '+%H-%M-%S'` +} +timestamp() { + # a timestamp for logging purposes + TIMESTAMP=`$DATE '+%Y-%m-%d %H:%M.%S'` +} +# +# create the temporary email file +create_tmp_email() { + if test -d $TMP_DIR ; then + if test -w $TMP_DIR ; then + touch $TMP_EMAIL 2>&1 + else + error "Email tmp directory $TMP_DIR is not writable" + fi + else + error "Email tmp directory $TMP_DIR does not exist" + fi + + if test -w $TMP_EMAIL ; then + message "created temporary email $TMP_EMAIL" + else + error "Failed to create temporary email $TMP_EMAIL" + fi +} +# +# send the contents of the temporary file to the +# designated report recipient +send_email_report() { + if test -f $TMP_EMAIL ; then + message "sending email report to $EMAIL_TO" + for EMAIL_ADD in $EMAIL_TO + do + RES=`$MAIL -s "$EMAIL_SUBJ" $EMAIL_ADD < $TMP_EMAIL` + if test -z $RES ; then + if test $ERROR_STATUS == 1 ; then + message "Error email report successfully sent to $EMAIL_ADD" + else + message "Email report successfully sent to $EMAIL_ADD" + fi + fi + done + if test -w $TMP_EMAIL ; then + $RM $TMP_EMAIL 2>&1 + fi + fi +} + +# modified dave@egressive.com 20071029 +max_clients() { + NUMAVAIL=`grep -A 8 "IfModule prefork.c" /etc/apache2/apache2.conf | grep "^MaxClients" | awk '{print $2;}'` + # An email will be sent if the number of processes running is greater than ($NUMAVAIL - $NUMWARN) + # As of 20071025, MaxClients was set to 150 this may be outrageously high for the amount + # of memory on the server, so NUMWARN is set high too . . . +} + +TMP_EMAIL=$TMP_DIR/$SCRIPT"_tmp_email_"$TODAY.$NOW +EMAIL_TO="support@egressive.com" +NUMPROC=`ps auxwww | grep -c "apache2"` +max_clients +NUMWARNLEVEL=$[$NUMAVAIL - $NUMWARN] +MACHINE_NAME="geprod" +ERROR_STATUS=0 + +# +# set up alert +if ! test -f $TMP_EMAIL ; then + touch $TMP_EMAIL +fi +if ! test -f $LOG ; then + touch $LOG +fi + +message " " # blank line +message "running $NOW" +#NUMAVAIL=1 +message "current number of processes $NUMPROC out of $NUMAVAIL" +if [ $NUMPROC -ge $NUMWARNLEVEL ] ; then + message "sending email alert!" + EMAIL_SUBJ="ALERT - $MACHINE_NAME - exceeding num apache processes!" + send_email_report +fi +now +message "completed run" + +exit 0 + diff --git a/egasterisk/adsi.conf b/egasterisk/adsi.conf new file mode 100644 index 0000000..0f36f80 --- /dev/null +++ b/egasterisk/adsi.conf @@ -0,0 +1,8 @@ +; +; Sample ADSI Configuration file +; +[intro] +alignment = center +greeting => Welcome to the +greeting => Asterisk +greeting => Open Source PBX diff --git a/egasterisk/adtranvofr.conf b/egasterisk/adtranvofr.conf new file mode 100644 index 0000000..dc7bcfc --- /dev/null +++ b/egasterisk/adtranvofr.conf @@ -0,0 +1,39 @@ +; +; Voice over Frame Relay (Adtran style) +; +; Configuration file + +[interfaces] +; +; Default language +; +;language=en +; +; Lines for which we are the user termination. They accept incoming +; and outgoing calls. We use the default context on the first 8 lines +; used by internal phones. +; +context=default +;user => voice00 +;user => voice01 +;user => voice02 +;user => voice03 +;user => voice04 +;user => voice05 +;user => voice06 +;user => voice07 +; Calls on 16 and 17 come from the outside world, so they get +; a little bit special treatment +context=remote +;user => voice16 +;user => voice17 +; +; Next we have lines which we only accept calls on, and typically +; do not send outgoing calls on (i.e. these are where we are the +; network termination) +; +;network => voice08 +;network => voice09 +;network => voice10 +;network => voice11 +;network => voice12 diff --git a/egasterisk/agents.conf b/egasterisk/agents.conf new file mode 100644 index 0000000..eb0383f --- /dev/null +++ b/egasterisk/agents.conf @@ -0,0 +1,105 @@ +; +; Agent configuration +; + +[general] +; +; Define whether callbacklogins should be stored in astdb for +; persistence. Persistent logins will be reloaded after +; Asterisk restarts. +; +persistentagents=yes + +; Enable or disable a single extension from logging in as multiple agents. +; The default value is "yes". +;multiplelogin=yes + +[agents] +; +; Define maxlogintries to allow agent to try max logins before +; failed. +; default to 3 +; +;maxlogintries=5 +; +; +; Define autologoff times if appropriate. This is how long +; the phone has to ring with no answer before the agent is +; automatically logged off (in seconds) +; +;autologoff=15 +; +; Define autologoffunavail to have agents automatically logged +; out when the extension that they are at returns a CHANUNAVAIL +; status when a call is attempted to be sent there. +; Default is "no". +; +;autologoffunavail=yes +; +; Define ackcall to require an acknowledgement by '#' when +; an agent logs in using agentcallbacklogin. Default is "no". +; +;ackcall=no +; +; Define endcall to allow an agent to hangup a call by '*'. +; Default is "yes". Set this to "no" to ignore '*'. +; +;endcall=yes +; +; Define wrapuptime. This is the minimum amount of time when +; after disconnecting before the caller can receive a new call +; note this is in milliseconds. +; +;wrapuptime=5000 +; +; Define the default musiconhold for agents +; musiconhold => music_class +; +;musiconhold => default +; +; Define the default good bye sound file for agents +; default to vm-goodbye +; +;agentgoodbye => goodbye_file +; +; Define updatecdr. This is whether or not to change the source +; channel in the CDR record for this call to agent/agent_id so +; that we know which agent generates the call +; +;updatecdr=no +; +; Group memberships for agents (may change in mid-file) +; +;group=3 +;group=1,2 +;group= +; +; -------------------------------------------------- +; This section is devoted to recording agent's calls +; The keywords are global to the chan_agent channel driver +; +; Enable recording calls addressed to agents. It's turned off by default. +;recordagentcalls=yes +; +; The format to be used to record the calls: wav, gsm, wav49. +; By default its "wav". +;recordformat=gsm +; +; The text to be added to the name of the recording. Allows forming a url link. +;urlprefix=http://localhost/calls/ +; +; The optional directory to save the conversations in. The default is +; /var/spool/asterisk/monitor +;savecallsin=/var/calls +; +; An optional custom beep sound file to play to always-connected agents. +;custom_beep=beep +; +; -------------------------------------------------- +; +; This section contains the agent definitions, in the form: +; +; agent => agentid,agentpassword,name +; +;agent => 1001,4321,Mark Spencer +;agent => 1002,4321,Will Meadows diff --git a/egasterisk/alarmreceiver.conf b/egasterisk/alarmreceiver.conf new file mode 100644 index 0000000..bf767de --- /dev/null +++ b/egasterisk/alarmreceiver.conf @@ -0,0 +1,80 @@ +; +; alarmreceiver.conf +; +; Sample configuration file for the Asterisk alarm receiver application. +; + + +[general] + +; +; Specify a timestamp format for the metadata section of the event files +; Default is %a %b %d, %Y @ %H:%M:%S %Z + +timestampformat = %a %b %d, %Y @ %H:%M:%S %Z + +; +; Specify a command to execute when the caller hangs up +; +; Default is none +; + +;eventcmd = yourprogram -yourargs ... + +; +; Specify a spool directory for the event files. This setting is required +; if you want the app to be useful. Event files written to the spool +; directory will be of the template event-XXXXXX, where XXXXXX is a random +; and unique alphanumeric string. +; +; Default is none, and the events will be dropped on the floor. +; + +eventspooldir = /tmp + +; +; The alarmreceiver app can either log the events one-at-a-time to individual +; files in the spool directory, or it can store them until the caller +; disconnects and write them all to one file. +; +; The default setting for logindividualevents is no. +; + +logindividualevents = no + +; +; The timeout for receiving the first DTMF digit is adjustable from 1000 msec. +; to 10000 msec. The default is 2000 msec. Note: if you wish to test the +; receiver by entering digits manually, set this to a reasonable time out +; like 10000 milliseconds. + +fdtimeout = 2000 + +; +; The timeout for receiving subsequent DTMF digits is adjustable from +; 110 msec. to 4000 msec. The default is 200 msec. Note: if you wish to test +; the receiver by entering digits manually, set this to a reasonable time out +; like 4000 milliseconds. +; + +sdtimeout = 200 + +; +; The loudness of the ACK and Kissoff tones is adjustable from 100 to 8192. +; The default is 8192. This shouldn't need to be messed with, but is included +; just in case there are problems with signal levels. +; + +loudness = 8192 + +; +; The db-family setting allows the user to capture statistics on the number of +; calls, and the errors the alarm receiver sees. The default is for no +; db-family name to be defined and the database logging to be turned off. +; + +;db-family = yourfamily: + +; +; End of alarmreceiver.conf +; diff --git a/egasterisk/alsa.conf b/egasterisk/alsa.conf new file mode 100644 index 0000000..f550306 --- /dev/null +++ b/egasterisk/alsa.conf @@ -0,0 +1,62 @@ +; +; Open Sound System Console Driver Configuration File +; +[general] +; +; Automatically answer incoming calls on the console? Choose yes if +; for example you want to use this as an intercom. +; +autoanswer=yes +; +; Default context (is overridden with @context syntax) +; +context=local +; +; Default extension to call +; +extension=s +; +; Default language +; +;language=en +; +; Default Music on Hold class to use when this channel is placed on hold in +; the case that the music class is not set on the channel with +; Set(CHANNEL(musicclass)=whatever) in the dialplan and the peer channel +; putting this one on hold did not suggest a class to use. +; +;mohinterpret=default +; +; Silence suppression can be enabled when sound is over a certain threshold. +; The value for the threshold should probably be between 500 and 2000 or so, +; but your mileage may vary. Use the echo test to evaluate the best setting. +;silencesuppression = yes +;silencethreshold = 1000 +; +; To set which ALSA device to use, change this parameter +;input_device=hw:0,0 +;output_device=hw:0,0 + +;------------------------------ JITTER BUFFER CONFIGURATION -------------------------- +; jbenable = yes ; Enables the use of a jitterbuffer on the receiving side of an + ; ALSA channel. Defaults to "no". An enabled jitterbuffer will + ; be used only if the sending side can create and the receiving + ; side can not accept jitter. The ALSA channel can't accept jitter, + ; thus an enabled jitterbuffer on the receive ALSA side will always + ; be used if the sending side can create jitter. + +; jbmaxsize = 200 ; Max length of the jitterbuffer in milliseconds. + +; jbresyncthreshold = 1000 ; Jump in the frame timestamps over which the jitterbuffer is + ; resynchronized. Useful to improve the quality of the voice, with + ; big jumps in/broken timestamps, usually sent from exotic devices + ; and programs. Defaults to 1000. + +; jbimpl = fixed ; Jitterbuffer implementation, used on the receiving side of a SIP + ; channel. Two implementations are currently available - "fixed" + ; (with size always equals to jbmax-size) and "adaptive" (with + ; variable size, actually the new jb of IAX2). Defaults to fixed. + +; jblog = no ; Enables jitterbuffer frame logging. Defaults to "no". +;----------------------------------------------------------------------------------- + diff --git a/egasterisk/amd.conf b/egasterisk/amd.conf new file mode 100644 index 0000000..ce4808a --- /dev/null +++ b/egasterisk/amd.conf @@ -0,0 +1,18 @@ +; +; Answering Machine Detection Configuration +; + +[general] +initial_silence = 2500 ; Maximum silence duration before the greeting. + ; If exceeded then MACHINE. +greeting = 1500 ; Maximum length of a greeting. If exceeded then MACHINE. +after_greeting_silence = 800 ; Silence after detecting a greeting. + ; If exceeded then HUMAN +total_analysis_time = 5000 ; Maximum time allowed for the algorithm to decide + ; on a HUMAN or MACHINE +min_word_length = 100 ; Minimum duration of Voice to considered as a word +between_words_silence = 50 ; Minimum duration of silence after a word to consider + ; the audio what follows as a new word +maximum_number_of_words = 3 ; Maximum number of words in the greeting. + ; If exceeded then MACHINE +silence_threshold = 256 diff --git a/egasterisk/applymisdn.conf b/egasterisk/applymisdn.conf new file mode 100644 index 0000000..e69de29 diff --git a/egasterisk/applyzap.conf b/egasterisk/applyzap.conf new file mode 100644 index 0000000..a10b7b3 --- /dev/null +++ b/egasterisk/applyzap.conf @@ -0,0 +1,12 @@ +;! +;! Automatically generated configuration file +;! Filename: applyzap.conf (/etc/asterisk/applyzap.conf) +;! Generator: Manager +;! Creation Date: Wed Jul 23 18:50:55 2008 +;! + +[general] +fxsks = 2,3 +fxoks = 1 +loadzone = nz +defaultzone = nz diff --git a/egasterisk/asterisk.adsi b/egasterisk/asterisk.adsi new file mode 100644 index 0000000..a275502 --- /dev/null +++ b/egasterisk/asterisk.adsi @@ -0,0 +1,159 @@ +; +; Asterisk default ADSI script +; +; +; Begin with the preamble requirements +; +DESCRIPTION "Asterisk PBX" ; Name of vendor +VERSION 0x00 ; Version of stuff +;SECURITY "_AST" ; Security code +SECURITY 0X9BDBF7AC ; Security code +FDN 0x0000000F ; Descriptor number + +; +; Flags +; +FLAG "nocallwaiting" + +; +; Predefined strings +; +DISPLAY "titles" IS "** Asterisk PBX **" +DISPLAY "talkingto" IS "Call active." JUSTIFY LEFT +DISPLAY "callname" IS "$Call1p" JUSTIFY LEFT +DISPLAY "callnum" IS "$Call1s" JUSTIFY LEFT +DISPLAY "incoming" IS "Incoming call!" JUSTIFY LEFT +DISPLAY "ringing" IS "Calling... " JUSTIFY LEFT +DISPLAY "callended" IS "Call ended." JUSTIFY LEFT +DISPLAY "missedcall" IS "Missed call." JUSTIFY LEFT +DISPLAY "busy" IS "Busy." JUSTIFY LEFT +DISPLAY "reorder" IS "Reorder." JUSTIFY LEFT +DISPLAY "cwdisabled" IS "Callwait disabled" +DISPLAY "empty" IS "asdf" + +; +; Begin soft key definitions +; +KEY "callfwd" IS "CallFwd" OR "Call Forward" + OFFHOOK + VOICEMODE + WAITDIALTONE + SENDDTMF "*60" + GOTO "offHook" +ENDKEY + +KEY "vmail_OH" IS "VMail" OR "Voicemail" + OFFHOOK + VOICEMODE + WAITDIALTONE + SENDDTMF "8500" +ENDKEY + +KEY "vmail" IS "VMail" OR "Voicemail" + SENDDTMF "8500" +ENDKEY + +KEY "backspace" IS "BackSpc" OR "Backspace" + BACKSPACE +ENDKEY + +KEY "cwdisable" IS "CWDsble" OR "Disable Call Wait" + SENDDTMF "*70" + SETFLAG "nocallwaiting" + SHOWDISPLAY "cwdisabled" AT 4 + TIMERCLEAR + TIMERSTART 1 +ENDKEY + +KEY "cidblock" IS "CIDBlk" OR "Block Callerid" + SENDDTMF "*67" + SETFLAG "nocallwaiting" +ENDKEY + +; +; Begin main subroutine +; + +SUB "main" IS + IFEVENT NEARANSWER THEN + CLEAR + SHOWDISPLAY "titles" AT 1 NOUPDATE + SHOWDISPLAY "talkingto" AT 2 NOUPDATE + SHOWDISPLAY "callname" AT 3 + SHOWDISPLAY "callnum" AT 4 + GOTO "stableCall" + ENDIF + IFEVENT OFFHOOK THEN + CLEAR + CLEARFLAG "nocallwaiting" + CLEARDISPLAY + SHOWDISPLAY "titles" AT 1 + SHOWKEYS "vmail" + SHOWKEYS "cidblock" + SHOWKEYS "cwdisable" UNLESS "nocallwaiting" + GOTO "offHook" + ENDIF + IFEVENT IDLE THEN + CLEAR + SHOWDISPLAY "titles" AT 1 + SHOWKEYS "vmail_OH" + ENDIF + IFEVENT CALLERID THEN + CLEAR +; SHOWDISPLAY "titles" AT 1 NOUPDATE +; SHOWDISPLAY "incoming" AT 2 NOUPDATE + SHOWDISPLAY "callname" AT 3 NOUPDATE + SHOWDISPLAY "callnum" AT 4 + ENDIF + IFEVENT RING THEN + CLEAR + SHOWDISPLAY "titles" AT 1 NOUPDATE + SHOWDISPLAY "incoming" AT 2 + ENDIF + IFEVENT ENDOFRING THEN + SHOWDISPLAY "missedcall" AT 2 + CLEAR + SHOWDISPLAY "titles" AT 1 + SHOWKEYS "vmail_OH" + ENDIF + IFEVENT TIMER THEN + CLEAR + SHOWDISPLAY "empty" AT 4 + ENDIF +ENDSUB + +SUB "offHook" IS + IFEVENT FARRING THEN + CLEAR + SHOWDISPLAY "titles" AT 1 NOUPDATE + SHOWDISPLAY "ringing" AT 2 NOUPDATE + SHOWDISPLAY "callname" at 3 NOUPDATE + SHOWDISPLAY "callnum" at 4 + ENDIF + IFEVENT FARANSWER THEN + CLEAR + SHOWDISPLAY "talkingto" AT 2 + GOTO "stableCall" + ENDIF + IFEVENT BUSY THEN + CLEAR + SHOWDISPLAY "titles" AT 1 NOUPDATE + SHOWDISPLAY "busy" AT 2 NOUPDATE + SHOWDISPLAY "callname" at 3 NOUPDATE + SHOWDISPLAY "callnum" at 4 + ENDIF + IFEVENT REORDER THEN + CLEAR + SHOWDISPLAY "titles" AT 1 NOUPDATE + SHOWDISPLAY "reorder" AT 2 NOUPDATE + SHOWDISPLAY "callname" at 3 NOUPDATE + SHOWDISPLAY "callnum" at 4 + ENDIF +ENDSUB + +SUB "stableCall" IS + IFEVENT REORDER THEN + SHOWDISPLAY "callended" AT 2 + ENDIF +ENDSUB + diff --git a/egasterisk/asterisk.conf b/egasterisk/asterisk.conf new file mode 100644 index 0000000..2ac7b3d --- /dev/null +++ b/egasterisk/asterisk.conf @@ -0,0 +1,43 @@ +[directories] +astetcdir => /etc/asterisk +astmoddir => /usr/lib/asterisk/modules +astvarlibdir => /var/lib/asterisk +astdatadir => /var/lib/asterisk +astagidir => /var/lib/asterisk/agi-bin +astspooldir => /var/spool/asterisk +astrundir => /var/run +astlogdir => /var/log/asterisk + +;[options] +;verbose = 3 +;debug = 3 +;alwaysfork = yes ; same as -F at startup +;nofork = yes ; same as -f at startup +;quiet = yes ; same as -q at startup +;timestamp = yes ; same as -T at startup +;execincludes = yes ; support #exec in config files +;console = yes ; Run as console (same as -c at startup) +;highpriority = yes ; Run realtime priority (same as -p at startup) +;initcrypto = yes ; Initialize crypto keys (same as -i at startup) +;nocolor = yes ; Disable console colors +;dontwarn = yes ; Disable some warnings +;dumpcore = yes ; Dump core on crash (same as -g at startup) +;languageprefix = yes ; Use the new sound prefix path syntax +;internal_timing = yes +;systemname = my_system_name ; prefix uniqueid with a system name for global uniqueness issues +;maxcalls = 10 ; Maximum amount of calls allowed +;maxload = 0.9 ; Asterisk stops accepting new calls if the load average exceed this limit +;cache_record_files = yes ; Cache recorded sound files to another directory during recording +;record_cache_dir = /tmp ; Specify cache directory (used in cnjunction with cache_record_files) +;transmit_silence_during_record = yes ; Transmit SLINEAR silence while a channel is being recorded +;transmit_silence = yes ; Transmit SLINEAR silence while a channel is being recorded or DTMF is being generated +;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of directly +;runuser = asterisk ; The user to run as +;rungroup = asterisk ; The group to run as + +; Changing the following lines may compromise your security. +;[files] +;astctlpermissions = 0660 +;astctlowner = root +;astctlgroup = apache +;astctl = asterisk.ctl diff --git a/egasterisk/cdr.conf b/egasterisk/cdr.conf new file mode 100644 index 0000000..693b280 --- /dev/null +++ b/egasterisk/cdr.conf @@ -0,0 +1,148 @@ +; +; Asterisk Call Detail Record engine configuration +; +; CDR is Call Detail Record, which provides logging services via a variety of +; pluggable backend modules. Detailed call information can be recorded to +; databases, files, etc. Useful for billing, fraud prevention, compliance with +; Sarbanes-Oxley aka The Enron Act, QOS evaluations, and more. +; + +[general] + +; Define whether or not to use CDR logging. Setting this to "no" will override +; any loading of backend CDR modules. Default is "yes". +;enable=yes + +; Define whether or not to log unanswered calls. Setting this to "yes" will +; report every attempt to ring a phone in dialing attempts, when it was not +; answered. For example, if you try to dial 3 extensions, and this option is "yes", +; you will get 3 CDR's, one for each phone that was rung. Default is "no". Some +; find this information horribly useless. Others find it very valuable. Note, in "yes" +; mode, you will see one CDR, with one of the call targets on one side, and the originating +; channel on the other, and then one CDR for each channel attempted. This may seem +; redundant, but cannot be helped. +;unanswered = no + +; Define the CDR batch mode, where instead of posting the CDR at the end of +; every call, the data will be stored in a buffer to help alleviate load on the +; asterisk server. Default is "no". +; +; WARNING WARNING WARNING +; Use of batch mode may result in data loss after unsafe asterisk termination +; ie. software crash, power failure, kill -9, etc. +; WARNING WARNING WARNING +; +;batch=no + +; Define the maximum number of CDRs to accumulate in the buffer before posting +; them to the backend engines. 'batch' must be set to 'yes'. Default is 100. +;size=100 + +; Define the maximum time to accumulate CDRs in the buffer before posting them +; to the backend engines. If this time limit is reached, then it will post the +; records, regardless of the value defined for 'size'. 'batch' must be set to +; 'yes'. Note that time is in seconds. Default is 300 (5 minutes). +;time=300 + +; The CDR engine uses the internal asterisk scheduler to determine when to post +; records. Posting can either occur inside the scheduler thread, or a new +; thread can be spawned for the submission of every batch. For small batches, +; it might be acceptable to just use the scheduler thread, so set this to "yes". +; For large batches, say anything over size=10, a new thread is recommended, so +; set this to "no". Default is "no". +;scheduleronly=no + +; When shutting down asterisk, you can block until the CDRs are submitted. If +; you don't, then data will likely be lost. You can always check the size of +; the CDR batch buffer with the CLI "cdr status" command. To enable blocking on +; submission of CDR data during asterisk shutdown, set this to "yes". Default +; is "yes". +;safeshutdown=yes + +; Normally, CDR's are not closed out until after all extensions are finished +; executing. By enabling this option, the CDR will be ended before executing +; the "h" extension so that CDR values such as "end" and "billsec" may be +; retrieved inside of of this extension. +;endbeforehexten=no + +; +; +; CHOOSING A CDR "BACKEND" (what kind of output to generate) +; +; To choose a backend, you have to make sure either the right category is +; defined in this file, or that the appropriate config file exists, and has the +; proper definitions in it. If there are any problems, usually, the entry will +; silently ignored, and you get no output. +; +; Also, please note that you can generate CDR records in as many formats as you +; wish. If you configure 5 different CDR formats, then each event will be logged +; in 5 different places! In the example config files, all formats are commented +; out except for the cdr-csv format. +; +; Here are all the possible back ends: +; +; csv, custom, manager, odbc, pgsql, radius, sqlite, tds +; (also, mysql is available via the asterisk-addons, due to licensing +; requirements) +; (please note, also, that other backends can be created, by creating +; a new backend module in the source cdr/ directory!) +; +; Some of the modules required to provide these backends will not build or install +; unless some dependency requirements are met. Examples of this are pgsql, odbc, +; etc. If you are not getting output as you would expect, the first thing to do +; is to run the command "make menuselect", and check what modules are available, +; by looking in the "2. Call Detail Recording" option in the main menu. If your +; backend is marked with XXX, you know that the "configure" command could not find +; the required libraries for that option. +; +; To get CDRs to be logged to the plain-jane /var/log/asterisk/cdr-csv/Master.csv +; file, define the [csv] category in this file. No database necessary. The example +; config files are set up to provide this kind of output by default. +; +; To get custom csv CDR records, make sure the cdr_custom.conf file +; is present, and contains the proper [mappings] section. The advantage to +; using this backend, is that you can define which fields to output, and in +; what order. By default, the example configs are set up to mimic the cdr-csv +; output. If you don't make any changes to the mappings, you are basically generating +; the same thing as cdr-csv, but expending more CPU cycles to do so! +; +; To get manager events generated, make sure the cdr_manager.conf file exists, +; and the [general] section is defined, with the single variable 'enabled = yes'. +; +; For odbc, make sure all the proper libs are installed, that "make menuselect" +; shows that the modules are available, and the cdr_odbc.conf file exists, and +; has a [global] section with the proper variables defined. +; +; For pgsql, make sure all the proper libs are installed, that "make menuselect" +; shows that the modules are available, and the cdr_pgsql.conf file exists, and +; has a [global] section with the proper variables defined. +; +; For logging to radius databases, make sure all the proper libs are installed, that +; "make menuselect" shows that the modules are available, and the [radius] +; category is defined in this file, and in that section, make sure the 'radiuscfg' +; variable is properly pointing to an existing radiusclient.conf file. +; +; For logging to sqlite databases, make sure the 'cdr.db' file exists in the log directory, +; which is usually /var/log/asterisk. Of course, the proper libraries should be available +; during the 'configure' operation. +; +; For tds logging, make sure the proper libraries are available during the 'configure' +; phase, and that cdr_tds.conf exists and is properly set up with a [global] category. +; +; Also, remember, that if you wish to log CDR info to a database, you will have to define +; a specific table in that databse to make things work! See the doc directory for more details +; on how to create this table in each database. +; + +[csv] +usegmtime=yes ; log date/time in GMT. Default is "no" +loguniqueid=yes ; log uniqueid. Default is "no" +loguserfield=yes ; log user field. Default is "no" + +;[radius] +;usegmtime=yes ; log date/time in GMT +;loguniqueid=yes ; log uniqueid +;loguserfield=yes ; log user field +; Set this to the location of the radiusclient-ng configuration file +; The default is /etc/radiusclient-ng/radiusclient.conf +;radiuscfg => /usr/local/etc/radiusclient-ng/radiusclient.conf diff --git a/egasterisk/cdr_custom.conf b/egasterisk/cdr_custom.conf new file mode 100644 index 0000000..8bc2cb3 --- /dev/null +++ b/egasterisk/cdr_custom.conf @@ -0,0 +1,10 @@ +; +; Mappings for custom config file +; +; to get your csv output in a format tailored to your liking, uncomment the following +; and look for the output in the cdr-custom/Master.csv file (usually in /var/log/asterisk). +; +; +;[mappings] +;Master.csv => "${CDR(clid)}","${CDR(src)}","${CDR(dst)}","${CDR(dcontext)}","${CDR(channel)}","${CDR(dstchannel)}","${CDR(lastapp)}","${CDR(lastdata)}","${CDR(start)}","${CDR(answer)}","${CDR(end)}","${CDR(duration)}","${CDR(billsec)}","${CDR(disposition)}","${CDR(amaflags)}","${CDR(accountcode)}","${CDR(uniqueid)}","${CDR(userfield)}" + diff --git a/egasterisk/cdr_manager.conf b/egasterisk/cdr_manager.conf new file mode 100644 index 0000000..1d7984b --- /dev/null +++ b/egasterisk/cdr_manager.conf @@ -0,0 +1,6 @@ +; +; Asterisk Call Management CDR +; +[general] +enabled = no + diff --git a/egasterisk/cdr_odbc.conf b/egasterisk/cdr_odbc.conf new file mode 100644 index 0000000..6245e37 --- /dev/null +++ b/egasterisk/cdr_odbc.conf @@ -0,0 +1,12 @@ +; +; cdr_odbc.conf +; + +;[global] +;dsn=MySQL-test +;username=username +;password=password +;loguniqueid=yes +;dispositionstring=yes +;table=cdr ;"cdr" is default table name +;usegmtime=no ; set to "yes" to log in GMT diff --git a/egasterisk/cdr_pgsql.conf b/egasterisk/cdr_pgsql.conf new file mode 100644 index 0000000..0784c7b --- /dev/null +++ b/egasterisk/cdr_pgsql.conf @@ -0,0 +1,9 @@ +; Sample Asterisk config file for CDR logging to PostgresSQL + +[global] +;hostname=localhost +;port=5432 +;dbname=asterisk +;password=password +;user=postgres +;table=cdr ;SQL table where CDRs will be inserted diff --git a/egasterisk/cdr_tds.conf b/egasterisk/cdr_tds.conf new file mode 100644 index 0000000..d8c7d07 --- /dev/null +++ b/egasterisk/cdr_tds.conf @@ -0,0 +1,11 @@ +; Sample Asterisk config file for CDR logging to FreeTDS + +;[global] +;hostname=fs.malico.loc +;port=1433 +;dbname=MalicoHN +;user=mangUsr +;password= +;charset=BIG5 +;table=cdr + diff --git a/egasterisk/codecs.conf b/egasterisk/codecs.conf new file mode 100644 index 0000000..c8caeab --- /dev/null +++ b/egasterisk/codecs.conf @@ -0,0 +1,65 @@ +[speex] +; CBR encoding quality [0..10] +; used only when vbr = false +quality => 3 + +; codec complexity [0..10] +; tradeoff between cpu/quality +complexity => 2 + +; perceptual enhancement [true / false] +; improves clarity of decoded speech +enhancement => true + +; voice activity detection [true / false] +; reduces bitrate when no voice detected, used only for CBR +; (implicit in VBR/ABR) +vad => true + +; variable bit rate [true / false] +; uses bit rate proportionate to voice complexity +vbr => true + +; available bit rate [bps, 0 = off] +; encoding quality modulated to match this target bit rate +; not recommended with dtx or pp_vad - may cause bandwidth spikes +abr => 0 + +; VBR encoding quality [0-10] +; floating-point values allowed +vbr_quality => 4 + +; discontinuous transmission [true / false] +; stops transmitting completely when silence is detected +; pp_vad is far more effective but more CPU intensive +dtx => false + +; preprocessor configuration +; these options only affect Speex v1.1.8 or newer + +; enable preprocessor [true / false] +; allows dsp functionality below but incurs CPU overhead +preprocess => false + +; preproc voice activity detection [true / false] +; more advanced equivalent of DTX, based on voice frequencies +pp_vad => false + +; preproc automatic gain control [true / false] +pp_agc => false +pp_agc_level => 8000 + +; preproc denoiser [true / false] +pp_denoise => false + +; preproc dereverb [true / false] +pp_dereverb => false +pp_dereverb_decay => 0.4 +pp_dereverb_level => 0.3 + + +[plc] +; for all codecs which do not support native PLC +; this determines whether to perform generic PLC +; there is a minor performance penalty for this +genericplc => true diff --git a/egasterisk/dnsmgr.conf b/egasterisk/dnsmgr.conf new file mode 100644 index 0000000..e34dbcf --- /dev/null +++ b/egasterisk/dnsmgr.conf @@ -0,0 +1,5 @@ +[general] +;enable=yes ; enable creation of managed DNS lookups + ; default is 'no' +;refreshinterval=1200 ; refresh managed DNS lookups every seconds + ; default is 300 (5 minutes) \ No newline at end of file diff --git a/egasterisk/dundi.conf b/egasterisk/dundi.conf new file mode 100644 index 0000000..a1e9997 --- /dev/null +++ b/egasterisk/dundi.conf @@ -0,0 +1,239 @@ +; +; DUNDi configuration file +; +; For more information about DUNDi, see http://www.dundi.com +; +; +[general] +; +; The "general" section contains general parameters relating +; to the operation of the dundi client and server. +; +; The first part should be your complete contact information +; should someone else in your peer group need to contact you. +; +;department=Your Department +;organization=Your Company, Inc. +;locality=Your City +;stateprov=ST +;country=US +;email=your@email.com +;phone=+12565551212 +; +; +; Specify bind address and port number. Default is +; 4520 +; +;bindaddr=0.0.0.0 +;port=4520 +; +; Our entity identifier (Should generally be the MAC address of the +; machine it's running on. Defaults to the first eth address, but you +; can override it here, as long as you set it to the MAC of *something* +; you own!) +; +;entityid=00:07:E9:3B:76:60 +; +; Peers shall cache our query responses for the specified time, +; given in seconds. Default is 3600. +; +;cachetime=3600 +; +; This defines the max depth in which to search the DUNDi system. +; Note that the maximum time that we will wait for a response is +; (2000 + 200 * ttl) ms. +; +ttl=32 +; +; If we don't get ACK to our DPDISCOVER within 2000ms, and autokill is set +; to yes, then we cancel the whole thing (that's enough time for one +; retransmission only). This is used to keep things from stalling for a long +; time for a host that is not available, but would be ill advised for bad +; connections. In addition to 'yes' or 'no' you can also specify a number +; of milliseconds. See 'qualify' for individual peers to turn on for just +; a specific peer. +; +autokill=yes +; +; pbx_dundi creates a rotating key called "secret", under the family +; 'secretpath'. The default family is dundi (resulting in +; the key being held at dundi/secret). +; +;secretpath=dundi +; +; The 'storehistory' option (also changeable at runtime with +; 'dundi store history' and 'dundi no store history') will +; cause the DUNDi engine to keep track of the last several +; queries and the amount of time each query took to execute +; for the purpose of tracking slow nodes. This option is +; off by default due to performance impacts. +; +;storehistory=yes + +[mappings] +; +; The "mappings" section maps DUNDi contexts +; to contexts on the local asterisk system. Remember +; that numbers that are made available under the e164 +; DUNDi context are regulated by the DUNDi General Peering +; Agreement (GPA) if you are a member of the DUNDi E.164 +; Peering System. +; +; dundi_context => local_context,weight,tech,dest[,options]] +; +; 'dundi_context' is the name of the context being requested +; within the DUNDi request +; +; 'local_context' is the name of the context on the local system +; in which numbers can be looked up for which responses shall be given. +; +; 'weight' is the weight to use for the responses provided from this +; mapping. The number must be >= 0 and < 60000. Since it is totally +; valid to receive multiple responses to a query, responses received +; with a lower weight are tried first. Note that the weight has a +; special meaning in the e164 context - see the GPA for more details. +; +; 'tech' is the technology to use (IAX, SIP, H323) +; +; 'dest' is the destination to supply for reaching that number. The +; following variables can be used in the destination string and will +; be automatically substituted: +; ${NUMBER}: The number being requested +; ${IPADDR}: The IP address to connect to +; ${SECRET}: The current rotating secret key to be used +; +; Further options may include: +; +; nounsolicited: No unsolicited calls of any type permitted via this +; route +; nocomunsolicit: No commercial unsolicited calls permitted via +; this route +; residential: This number is known to be a residence +; commercial: This number is known to be a business +; mobile: This number is known to be a mobile phone +; nocomunsolicit: No commercial unsolicited calls permitted via +; this route +; nopartial: Do not search for partial matches +; +; There *must* exist an entry in mappings for DUNDi to respond +; to any request, although it may be empty. +; +;e164 => dundi-e164-canonical,0,IAX2,dundi:${SECRET}@${IPADDR}/${NUMBER},nounsolicited,nocomunsolicit,nopartial +;e164 => dundi-e164-customers,100,IAX2,dundi:${SECRET}@${IPADDR}/${NUMBER},nounsolicited,nocomunsolicit,nopartial +;e164 => dundi-e164-via-pstn,400,IAX2,dundi:${SECRET}@${IPADDR}/${NUMBER},nounsolicited,nocomunsolicit,nopartial + +;digexten => default,0,IAX2,guest@lappy/${NUMBER} +;asdf => + + +; +; +; The remaining sections represent the peers +; that we fundamentally trust. The section name +; represents the name and optionally at a specific +; DUNDi context if you want the trust to be established +; for only a specific DUNDi context. +; +; inkey - What key they will be authenticating to us with +; +; outkey - What key we use to authenticate to them +; +; host - What their host is +; +; order - What search order to use. May be 'primary', 'secondary', +; 'tertiary' or 'quartiary'. In large systems, it is beneficial +; to only query one up-stream host in order to maximize caching +; value. Adding one with primary and one with secondary gives you +; redundancy without sacrificing performance. +; +; include - Includes this peer when searching a particular context +; for lookup (set "all" to perform all lookups with that +; host. This is also the context in which peers are permitted +; to precache. +; +; noinclude - Disincludes this peer when searching a particular context +; for lookup (set "all" to perform no lookups with that +; host. +; +; permit - Permits this peer to search a given DUNDi context on +; the local system. Set "all" to permit this host to +; lookup all contexts. This is also a context for which +; we will create/forward PRECACHE commands. +; +; deny - Denies this peer to search a given DUNDi context on +; the local system. Set "all" to deny this host to +; lookup all contexts. +; +; model - inbound, outbound, or symmetric for whether we receive +; requests only, transmit requests only, or do both. +; +; precache - Utilize/Permit precaching with this peer (to pre +; cache means to provide an answer when no request +; was made and is used so that machines with few +; routes can push those routes up a to a higher level). +; outgoing means we send precache routes to this peer, +; incoming means we permit this peer to send us +; precache routes. symmetric means we do both. +; +; Note: You cannot mix symmetric/outbound model with symmetric/inbound +; precache, nor can you mix symmetric/inbound model with symmetric/outbound +; precache. +; +; +; The '*' peer is special and matches an unspecified entity +; + +; +; Sample Primary e164 DUNDi peer +; +;[00:50:8B:F3:75:BB] +;model = symmetric +;host = 64.215.96.114 +;inkey = digium +;outkey = misery +;include = e164 +;permit = e164 +;qualify = yes + +; +; Sample Secondary e164 DUNDi peer +; +;[00:A0:C9:96:92:84] +;model = symmetric +;host = misery.digium.com +;inkey = misery +;outkey = ourkey +;include = e164 +;permit = e164 +;qualify = yes +;order = secondary + +; +; Sample "push mode" downstream host +; +;[00:0C:76:96:75:28] +;model = inbound +;host = dynamic +;precache = inbound +;inkey = littleguy +;outkey = ourkey +;include = e164 ; In this case used only for precaching +;permit = e164 +;qualify = yes + +; +; Sample "push mode" upstream host +; +;[00:07:E9:3B:76:60] +;model = outbound +;precache = outbound +;host = 216.207.245.34 +;register = yes +;inkey = dhcp34 +;permit = all ; In this case used only for precaching +;include = all +;qualify = yes +;outkey=foo + +;[*] +; diff --git a/egasterisk/enum.conf b/egasterisk/enum.conf new file mode 100644 index 0000000..39c7231 --- /dev/null +++ b/egasterisk/enum.conf @@ -0,0 +1,22 @@ +; +; ENUM Configuration for resolving phone numbers over DNS +; +; Sample config for Asterisk +; This file is reloaded at "module reload enum" in the CLI +; +[general] +; +; The search list for domains may be customized. Domains are searched +; in the order they are listed here. +; +search => e164.arpa +; +; If you'd like to use the E.164.org public ENUM registry in addition +; to the official e164.arpa one, uncomment the following line +; +;search => e164.org +; +; As there are more H323 drivers available you have to select to which +; drive a H323 URI will map. Default is "H323". +; +h323driver => H323 diff --git a/egasterisk/extconfig.conf b/egasterisk/extconfig.conf new file mode 100644 index 0000000..d2c5fbb --- /dev/null +++ b/egasterisk/extconfig.conf @@ -0,0 +1,58 @@ +; +; Static and realtime external configuration +; engine configuration +; +; Please read doc/extconfig.txt for basic table +; formatting information. +; +[settings] +; +; Static configuration files: +; +; file.conf => driver,database[,table] +; +; maps a particular configuration file to the given +; database driver, database and table (or uses the +; name of the file as the table if not specified) +; +;uncomment to load queues.conf via the odbc engine. +; +;queues.conf => odbc,asterisk,ast_config +; +; The following files CANNOT be loaded from Realtime storage: +; asterisk.conf +; extconfig.conf (this file) +; logger.conf +; +; Additionally, the following files cannot be loaded from +; Realtime storage unless the storage driver is loaded +; early using 'preload' statements in modules.conf: +; manager.conf +; cdr.conf +; rtp.conf +; +; +; Realtime configuration engine +; +; maps a particular family of realtime +; configuration to a given database driver, +; database and table (or uses the name of +; the family if the table is not specified +; +;example => odbc,asterisk,alttable +; +; "odbc" is shown in the examples below, but is not the only valid realtime +; engine. There is: +; odbc ... res_config_odbc +; pgsql ... res_config_pgsql +; mysql ... res_config_mysql (available from asterisk-addons) +; +;iaxusers => odbc,asterisk +;iaxpeers => odbc,asterisk +;sipusers => odbc,asterisk +;sippeers => odbc,asterisk +;voicemail => odbc,asterisk +;extensions => odbc,asterisk +;queues => odbc,asterisk +;queue_members => odbc,asterisk + diff --git a/egasterisk/extensions.ael b/egasterisk/extensions.ael new file mode 100644 index 0000000..89436dc --- /dev/null +++ b/egasterisk/extensions.ael @@ -0,0 +1,448 @@ +// +// Example AEL config file +// +// +// Static extension configuration file, used by +// the pbx_ael module. This is where you configure all your +// inbound and outbound calls in Asterisk. +// +// This configuration file is reloaded +// - With the "ael reload" command in the CLI +// - With the "reload" command (that reloads everything) in the CLI + +// The "Globals" category contains global variables that can be referenced +// in the dialplan by using the GLOBAL dialplan function: +// ${GLOBAL(VARIABLE)} +// ${${GLOBAL(VARIABLE)}} or ${text${GLOBAL(VARIABLE)}} or any hybrid +// Unix/Linux environmental variables are reached with the ENV dialplan +// function: ${ENV(VARIABLE)} +// + +globals { + CONSOLE="Console/dsp"; // Console interface for demo + //CONSOLE=Zap/1 + //CONSOLE=Phone/phone0 + IAXINFO=guest; // IAXtel username/password + //IAXINFO="myuser:mypass"; + TRUNK="Zap/g2"; // Trunk interface + // + // Note the 'g2' in the TRUNK variable above. It specifies which group (defined + // in zapata.conf) to dial, i.e. group 2, and how to choose a channel to use in + // the specified group. The four possible options are: + // + // g: select the lowest-numbered non-busy Zap channel + // (aka. ascending sequential hunt group). + // G: select the highest-numbered non-busy Zap channel + // (aka. descending sequential hunt group). + // r: use a round-robin search, starting at the next highest channel than last + // time (aka. ascending rotary hunt group). + // R: use a round-robin search, starting at the next lowest channel than last + // time (aka. descending rotary hunt group). + // + TRUNKMSD=1; // MSD digits to strip (usually 1 or 0) + //TRUNK=IAX2/user:pass@provider +}; + +// +// Any category other than "General" and "Globals" represent +// extension contexts, which are collections of extensions. +// +// Extension names may be numbers, letters, or combinations +// thereof. If an extension name is prefixed by a '_' +// character, it is interpreted as a pattern rather than a +// literal. In patterns, some characters have special meanings: +// +// X - any digit from 0-9 +// Z - any digit from 1-9 +// N - any digit from 2-9 +// [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) +// . - wildcard, matches anything remaining (e.g. _9011. matches +// anything starting with 9011 excluding 9011 itself) +// ! - wildcard, causes the matching process to complete as soon as +// it can unambiguously determine that no other matches are possible +// +// For example the extension _NXXXXXX would match normal 7 digit dialings, +// while _1NXXNXXXXXX would represent an area code plus phone number +// preceded by a one. +// +// Each step of an extension is ordered by priority, which must +// always start with 1 to be considered a valid extension. The priority +// "next" or "n" means the previous priority plus one, regardless of whether +// the previous priority was associated with the current extension or not. +// The priority "same" or "s" means the same as the previously specified +// priority, again regardless of whether the previous entry was for the +// same extension. Priorities may be immediately followed by a plus sign +// and another integer to add that amount (most useful with 's' or 'n'). +// Priorities may then also have an alias, or label, in +// parenthesis after their name which can be used in goto situations +// +// Contexts contain several lines, one for each step of each +// extension, which can take one of two forms as listed below, +// with the first form being preferred. One may include another +// context in the current one as well, optionally with a +// date and time. Included contexts are included in the order +// they are listed. +// +//context name { +// exten-name => { +// application(arg1,arg2,...); +// +// Timing list for includes is +// +//